version 1.81, 2003/02/13 23:02:42
|
version 1.109, 2003/07/17 18:10:53
|
Line 79 use strict;
|
Line 79 use strict;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use GDBM_File; |
use GDBM_File; |
use POSIX qw(strftime mktime); |
use POSIX qw(strftime mktime); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common :http :methods); |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
|
use Apache::lonmenu(); |
my $readit; |
my $readit; |
|
|
=pod |
=pod |
Line 150 BEGIN {
|
Line 151 BEGIN {
|
while (<$fh>) { |
while (<$fh>) { |
next if /^\#/; |
next if /^\#/; |
chomp; |
chomp; |
my ($key,$val)=(split(/\s+/,$_,2)); |
my ($key,$two,$country,$three,$enc,$val)=(split(/\t/,$_)); |
$language{$key}=$val; |
$language{$key}=$val.' - '.$enc; |
} |
} |
} |
} |
} |
} |
Line 328 sub studentbrowser_javascript {
|
Line 329 sub studentbrowser_javascript {
|
} |
} |
url += 'form=' + formname + '&unameelement='+uname+ |
url += 'form=' + formname + '&unameelement='+uname+ |
'&udomelement='+udom; |
'&udomelement='+udom; |
var title = 'Student Browser'; |
var title = 'Student_Browser'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
options += ',width=700,height=600'; |
options += ',width=700,height=600'; |
stdeditbrowser = open(url,title,options,'1'); |
stdeditbrowser = open(url,title,options,'1'); |
Line 345 sub selectstudent_link {
|
Line 346 sub selectstudent_link {
|
return ''; |
return ''; |
} |
} |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
'","'.$udomele.'");'."'>Select</a>"; |
'","'.$udomele.'");'."'>Select User</a>"; |
|
} |
|
|
|
sub coursebrowser_javascript { |
|
return (<<'ENDSTDBRW'); |
|
<script type="text/javascript" language="Javascript" > |
|
var stdeditbrowser; |
|
function opencrsbrowser(formname,uname,udom) { |
|
var url = '/adm/pickcourse?'; |
|
var filter; |
|
if (filter != null) { |
|
if (filter != '') { |
|
url += 'filter='+filter+'&'; |
|
} |
|
} |
|
url += 'form=' + formname + '&cnumelement='+uname+ |
|
'&cdomelement='+udom; |
|
var title = 'Course_Browser'; |
|
var options = 'scrollbars=1,resizable=1,menubar=0'; |
|
options += ',width=700,height=600'; |
|
stdeditbrowser = open(url,title,options,'1'); |
|
stdeditbrowser.focus(); |
|
} |
|
</script> |
|
ENDSTDBRW |
|
} |
|
|
|
sub selectcourse_link { |
|
my ($form,$unameele,$udomele)=@_; |
|
return "<a href='".'javascript:opencrsbrowser("'.$form.'","'.$unameele. |
|
'","'.$udomele.'");'."'>Select Course</a>"; |
} |
} |
|
|
############################################################### |
############################################################### |
Line 518 sub help_open_topic {
|
Line 549 sub help_open_topic {
|
my ($topic, $text, $stayOnPage, $width, $height) = @_; |
my ($topic, $text, $stayOnPage, $width, $height) = @_; |
$text = "" if (not defined $text); |
$text = "" if (not defined $text); |
$stayOnPage = 0 if (not defined $stayOnPage); |
$stayOnPage = 0 if (not defined $stayOnPage); |
if ($ENV{'browser.interface'} eq 'textual') { |
if ($ENV{'browser.interface'} eq 'textual' || |
|
$ENV{'environment.remote'} eq 'off' ) { |
$stayOnPage=1; |
$stayOnPage=1; |
} |
} |
$width = 350 if (not defined $width); |
$width = 350 if (not defined $width); |
Line 555 ENDTEMPLATE
|
Line 587 ENDTEMPLATE
|
|
|
} |
} |
|
|
|
# This is a quicky function for Latex cheatsheet editing, since it |
|
# appears in at least four places |
|
sub helpLatexCheatsheet { |
|
my $other = shift; |
|
my $addOther = ''; |
|
if ($other) { |
|
$addOther = Apache::loncommon::help_open_topic($other, shift, |
|
undef, undef, 600) . |
|
'</td><td>'; |
|
} |
|
return '<table><tr><td>'. |
|
$addOther . |
|
&Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols', |
|
undef,undef,600) |
|
.'</td><td>'. |
|
&Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols', |
|
undef,undef,600) |
|
.'</td></tr></table>'; |
|
} |
|
|
=pod |
=pod |
|
|
=item csv_translate($text) |
=item csv_translate($text) |
Line 600 sub get_domains {
|
Line 652 sub get_domains {
|
|
|
=pod |
=pod |
|
|
=item select_dom_form($defdom,$name) |
=item select_form($defdom,$name,%hash) |
|
|
|
Returns a string containing a <select name='$name' size='1'> form to |
|
allow a user to select options from a hash option_name => displayed text. |
|
See lonrights.pm for an example invocation and use. |
|
|
|
=cut |
|
|
|
#------------------------------------------- |
|
sub select_form { |
|
my ($def,$name,%hash) = @_; |
|
my $selectform = "<select name=\"$name\" size=\"1\">\n"; |
|
foreach (sort keys %hash) { |
|
$selectform.="<option value=\"$_\" ". |
|
($_ eq $def ? 'selected' : ''). |
|
">".$hash{$_}."</option>\n"; |
|
} |
|
$selectform.="</select>"; |
|
return $selectform; |
|
} |
|
|
|
|
|
#------------------------------------------- |
|
|
|
=pod |
|
|
|
=item select_dom_form($defdom,$name,$includeempty) |
|
|
Returns a string containing a <select name='$name' size='1'> form to |
Returns a string containing a <select name='$name' size='1'> form to |
allow a user to select the domain to preform an operation in. |
allow a user to select the domain to preform an operation in. |
See loncreateuser.pm for an example invocation and use. |
See loncreateuser.pm for an example invocation and use. |
|
|
|
If the $includeempty flag is set, it also includes an empty choice ("no domain |
|
selected"); |
|
|
=cut |
=cut |
|
|
#------------------------------------------- |
#------------------------------------------- |
sub select_dom_form { |
sub select_dom_form { |
my ($defdom,$name) = @_; |
my ($defdom,$name,$includeempty) = @_; |
my @domains = get_domains(); |
my @domains = get_domains(); |
|
if ($includeempty) { @domains=('',@domains); } |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
foreach (@domains) { |
foreach (@domains) { |
$selectdomain.="<option value=\"$_\" ". |
$selectdomain.="<option value=\"$_\" ". |
Line 673 sub home_server_option_list {
|
Line 755 sub home_server_option_list {
|
############################################################### |
############################################################### |
|
|
############################################################### |
############################################################### |
|
############################################################### |
|
|
|
=pod |
|
|
|
=item &decode_user_agent() |
|
|
|
Inputs: $r |
|
|
|
Outputs: |
|
|
|
=over 4 |
|
|
|
=item $httpbrowser |
|
|
|
=item $clientbrowser |
|
|
|
=item $clientversion |
|
|
|
=item $clientmathml |
|
|
|
=item $clientunicode |
|
|
|
=item $clientos |
|
|
|
=back |
|
|
|
=cut |
|
|
|
############################################################### |
|
############################################################### |
|
sub decode_user_agent { |
|
my @browsertype=split(/\&/,$Apache::lonnet::perlvar{"lonBrowsDet"}); |
|
my %mathcap=split(/\&/,$$Apache::lonnet::perlvar{"lonMathML"}); |
|
my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; |
|
my $clientbrowser='unknown'; |
|
my $clientversion='0'; |
|
my $clientmathml=''; |
|
my $clientunicode='0'; |
|
for (my $i=0;$i<=$#browsertype;$i++) { |
|
my ($bname,$match,$notmatch,$vreg,$minv,$univ)=split(/\:/,$browsertype[$i]); |
|
if (($httpbrowser=~/$match/i) && ($httpbrowser!~/$notmatch/i)) { |
|
$clientbrowser=$bname; |
|
$httpbrowser=~/$vreg/i; |
|
$clientversion=$1; |
|
$clientmathml=($clientversion>=$minv); |
|
$clientunicode=($clientversion>=$univ); |
|
} |
|
} |
|
my $clientos='unknown'; |
|
if (($httpbrowser=~/linux/i) || |
|
($httpbrowser=~/unix/i) || |
|
($httpbrowser=~/ux/i) || |
|
($httpbrowser=~/solaris/i)) { $clientos='unix'; } |
|
if (($httpbrowser=~/vax/i) || |
|
($httpbrowser=~/vms/i)) { $clientos='vms'; } |
|
if ($httpbrowser=~/next/i) { $clientos='next'; } |
|
if (($httpbrowser=~/mac/i) || |
|
($httpbrowser=~/powerpc/i)) { $clientos='mac'; } |
|
if ($httpbrowser=~/win/i) { $clientos='win'; } |
|
if ($httpbrowser=~/embed/i) { $clientos='pda'; } |
|
return ($httpbrowser,$clientbrowser,$clientversion,$clientmathml, |
|
$clientunicode,$clientos,); |
|
} |
|
|
|
############################################################### |
|
############################################################### |
|
|
|
|
|
############################################################### |
## Authentication changing form generation subroutines ## |
## Authentication changing form generation subroutines ## |
############################################################### |
############################################################### |
## |
## |
Line 1202 sub aboutmewrapper {
|
Line 1353 sub aboutmewrapper {
|
|
|
|
|
sub syllabuswrapper { |
sub syllabuswrapper { |
my ($link,$un,$do,$tf)=@_; |
my ($linktext,$coursedir,$domain,$fontcolor)=@_; |
if ($tf) { $link='<font color="'.$tf.'">'.$link.'</font>'; } |
if ($fontcolor) { |
return "<a href='/public/$do/$un/syllabus'>$link</a>"; |
$linktext='<font color="'.$fontcolor.'">'.$linktext.'</font>'; |
|
} |
|
return "<a href='/public/$domain/$coursedir/syllabus'>$linktext</a>"; |
} |
} |
|
|
# ---------------------------------------------------------------- Language IDs |
# ---------------------------------------------------------------- Language IDs |
Line 1217 sub languagedescription {
|
Line 1370 sub languagedescription {
|
return $language{shift(@_)}; |
return $language{shift(@_)}; |
} |
} |
|
|
|
# ----------------------------------------------------------- Display Languages |
|
# returns a hash with all desired display languages |
|
# |
|
|
|
sub display_languages { |
|
my %languages=(); |
|
if ($ENV{'environment.languages'}) { |
|
foreach (split(/\s*(\,|\;|\:)\s*/,$ENV{'environment.languages'})) { |
|
$languages{$_}=1; |
|
} |
|
} |
|
if ($ENV{'course.'.$ENV{'request.course.id'}.'.languages'}) { |
|
foreach (split(/\s*(\,|\;|\:)\s*/, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.languages'})) { |
|
$languages{$_}=1; |
|
} |
|
} |
|
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); |
|
if ($ENV{'form.displaylanguage'}) { |
|
foreach (split(/\s*(\,|\;|\:)\s*/,$ENV{'form.displaylanguage'})) { |
|
$languages{$_}=1; |
|
} |
|
} |
|
return %languages; |
|
} |
|
|
# --------------------------------------------------------------- Copyright IDs |
# --------------------------------------------------------------- Copyright IDs |
sub copyrightids { |
sub copyrightids { |
return sort(keys(%cprtag)); |
return sort(keys(%cprtag)); |
Line 1335 sub get_previous_attempt {
|
Line 1514 sub get_previous_attempt {
|
} |
} |
} |
} |
|
|
|
sub relative_to_absolute { |
|
my ($url,$output)=@_; |
|
my $parser=HTML::TokeParser->new(\$output); |
|
my $token; |
|
my $thisdir=$url; |
|
my @rlinks=(); |
|
while ($token=$parser->get_token) { |
|
if ($token->[0] eq 'S') { |
|
if ($token->[1] eq 'a') { |
|
if ($token->[2]->{'href'}) { |
|
$rlinks[$#rlinks+1]=$token->[2]->{'href'}; |
|
} |
|
} elsif ($token->[1] eq 'img' || $token->[1] eq 'embed' ) { |
|
$rlinks[$#rlinks+1]=$token->[2]->{'src'}; |
|
} elsif ($token->[1] eq 'base') { |
|
$thisdir=$token->[2]->{'href'}; |
|
} |
|
} |
|
} |
|
$thisdir=~s-/[^/]*$--; |
|
foreach (@rlinks) { |
|
unless (($_=~/^http:\/\//i) || |
|
($_=~/^\//) || |
|
($_=~/^javascript:/i) || |
|
($_=~/^mailto:/i) || |
|
($_=~/^\#/)) { |
|
my $newlocation=&Apache::lonnet::hreflocation($thisdir,$_); |
|
$output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/; |
|
} |
|
} |
|
# -------------------------------------------------- Deal with Applet codebases |
|
$output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei; |
|
return $output; |
|
} |
|
|
sub get_student_view { |
sub get_student_view { |
my ($symb,$username,$domain,$courseid,$target) = @_; |
my ($symb,$username,$domain,$courseid,$target) = @_; |
my ($map,$id,$feedurl) = split(/___/,$symb); |
my ($map,$id,$feedurl) = split(/___/,$symb); |
Line 1346 sub get_student_view {
|
Line 1560 sub get_student_view {
|
} |
} |
if ($target eq 'tex') {$moreenv{'form.grade_target'} = 'tex';} |
if ($target eq 'tex') {$moreenv{'form.grade_target'} = 'tex';} |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
my $userview=&Apache::lonnet::ssi('/res/'.$feedurl); |
$feedurl=&Apache::lonnet::clutter($feedurl); |
|
my $userview=&Apache::lonnet::ssi_body($feedurl); |
&Apache::lonnet::delenv('form.grade_'); |
&Apache::lonnet::delenv('form.grade_'); |
foreach my $element (@elements) { |
foreach my $element (@elements) { |
$ENV{'form.grade_'.$element}=$old{$element}; |
$ENV{'form.grade_'.$element}=$old{$element}; |
Line 1358 sub get_student_view {
|
Line 1573 sub get_student_view {
|
$userview=~s/\<head\>//gi; |
$userview=~s/\<head\>//gi; |
$userview=~s/\<\/head\>//gi; |
$userview=~s/\<\/head\>//gi; |
$userview=~s/action\s*\=/would_be_action\=/gi; |
$userview=~s/action\s*\=/would_be_action\=/gi; |
|
$userview=&relative_to_absolute($feedurl,$userview); |
return $userview; |
return $userview; |
} |
} |
|
|
sub get_student_answers { |
sub get_student_answers { |
my ($symb,$username,$domain,$courseid) = @_; |
my ($symb,$username,$domain,$courseid,%form) = @_; |
my ($map,$id,$feedurl) = split(/___/,$symb); |
my ($map,$id,$feedurl) = split(/___/,$symb); |
my (%old,%moreenv); |
my (%old,%moreenv); |
my @elements=('symb','courseid','domain','username'); |
my @elements=('symb','courseid','domain','username'); |
Line 1372 sub get_student_answers {
|
Line 1588 sub get_student_answers {
|
} |
} |
$moreenv{'form.grade_target'}='answer'; |
$moreenv{'form.grade_target'}='answer'; |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
my $userview=&Apache::lonnet::ssi('/res/'.$feedurl); |
my $userview=&Apache::lonnet::ssi('/res/'.$feedurl,%form); |
&Apache::lonnet::delenv('form.grade_'); |
&Apache::lonnet::delenv('form.grade_'); |
foreach my $element (@elements) { |
foreach my $element (@elements) { |
$ENV{'form.grade_'.$element}=$old{$element}; |
$ENV{'form.grade_'.$element}=$old{$element}; |
Line 1481 sub domainlogo {
|
Line 1697 sub domainlogo {
|
my $domain = &determinedomain(shift); |
my $domain = &determinedomain(shift); |
# See if there is a logo |
# See if there is a logo |
if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') { |
if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') { |
return '<img src="http://'.$ENV{'HTTP_HOST'}.':8080/adm/lonDomLogos/'. |
my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
$domain.'.gif" />'; |
if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } |
|
return '<img src="http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort. |
|
'/adm/lonDomLogos/'.$domain.'.gif" />'; |
} elsif(exists($Apache::lonnet::domaindescription{$domain})) { |
} elsif(exists($Apache::lonnet::domaindescription{$domain})) { |
return $Apache::lonnet::domaindescription{$domain}; |
return $Apache::lonnet::domaindescription{$domain}; |
} else { |
} else { |
Line 1503 Returns: value of designparamter $which
|
Line 1721 Returns: value of designparamter $which
|
############################################## |
############################################## |
sub designparm { |
sub designparm { |
my ($which,$domain)=@_; |
my ($which,$domain)=@_; |
|
if ($ENV{'environment.color.'.$which}) { |
|
return $ENV{'environment.color.'.$which}; |
|
} |
$domain=&determinedomain($domain); |
$domain=&determinedomain($domain); |
if ($designhash{$domain.'.'.$which}) { |
if ($designhash{$domain.'.'.$which}) { |
return $designhash{$domain.'.'.$which}; |
return $designhash{$domain.'.'.$which}; |
Line 1527 Inputs:
|
Line 1748 Inputs:
|
$addentries, extra parameters for the <body> tag. |
$addentries, extra parameters for the <body> tag. |
$bodyonly, if defined, only return the <body> tag. |
$bodyonly, if defined, only return the <body> tag. |
$domain, if defined, force a given domain. |
$domain, if defined, force a given domain. |
|
$forcereg, if page should register as content page (relevant for |
|
text interface only) |
|
|
Returns: A uniform header for LON-CAPA web pages. |
Returns: A uniform header for LON-CAPA web pages. |
If $bodyonly is nonzero, a string containing a <body> tag will be returned. |
If $bodyonly is nonzero, a string containing a <body> tag will be returned. |
Line 1540 other decorations will be returned.
|
Line 1763 other decorations will be returned.
|
|
|
############################################### |
############################################### |
sub bodytag { |
sub bodytag { |
my ($title,$function,$addentries,$bodyonly,$domain)=@_; |
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg)=@_; |
unless ($function) { |
unless ($function) { |
$function='student'; |
$function='student'; |
if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { |
if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { |
Line 1574 sub bodytag {
|
Line 1797 sub bodytag {
|
unless ($realm) { $realm=' '; } |
unless ($realm) { $realm=' '; } |
# Set messages |
# Set messages |
my $messages=&domainlogo($domain); |
my $messages=&domainlogo($domain); |
# Output |
# Port for miniserver |
|
my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
|
if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } |
|
# construct main body tag |
my $bodytag = <<END; |
my $bodytag = <<END; |
<body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link" |
<body bgcolor="$pgbg" text="$font" alink="$alink" vlink="$vlink" link="$link" |
$addentries> |
$addentries> |
END |
END |
|
my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'. |
|
$lonhttpdPort.$img.'" />'; |
if ($bodyonly) { |
if ($bodyonly) { |
return $bodytag; |
return $bodytag; |
} elsif ($ENV{'browser.interface'} eq 'textual') { |
} elsif ($ENV{'browser.interface'} eq 'textual') { |
return $bodytag.'<h1>LON-CAPA: '.$title. |
# Accessibility |
'</h1><a href="/adm/menu">Main Menu</a><hr />'; |
return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web', |
} else { |
$forcereg). |
return(<<ENDBODY); |
'<h1>LON-CAPA: '.$title.'</h1>'; |
|
} elsif ($ENV{'environment.remote'} eq 'off') { |
|
# No Remote |
|
return $bodytag.&Apache::lonmenu::menubuttons($forcereg,'web', |
|
$forcereg). |
|
'<table bgcolor="'.$pgbg.'" width="100%" border="0" cellspacing="3" cellpadding="3"><tr><td bgcolor="'.$tabbg.'"><font size="+3" color="'.$font.'"><b>'.$title. |
|
'</b></font></td></tr></table>'; |
|
} |
|
|
|
# |
|
# Top frame rendering, Remote is up |
|
# |
|
return(<<ENDBODY); |
$bodytag |
$bodytag |
<table width="100%" cellspacing="0" border="0" cellpadding="0"> |
<table width="100%" cellspacing="0" border="0" cellpadding="0"> |
<tr><td bgcolor="$font"> |
<tr><td bgcolor="$sidebg"> |
<img src="http://$ENV{'HTTP_HOST'}:8080/$img" /></td> |
$upperleft</td> |
<td bgcolor="$font"><font color='$sidebg'>$messages</font></td> |
<td bgcolor="$sidebg" align="right">$messages </td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td rowspan="3" bgcolor="$tabbg"> |
<td rowspan="3" bgcolor="$tabbg"> |
Line 1611 $bodytag
|
Line 1851 $bodytag
|
<td bgcolor="$tabbg" align="right"><font size="2">$realm</font> </td></tr> |
<td bgcolor="$tabbg" align="right"><font size="2">$realm</font> </td></tr> |
</table><br> |
</table><br> |
ENDBODY |
ENDBODY |
|
} |
|
|
|
############################################### |
|
|
|
sub get_posted_cgi { |
|
my $r=shift; |
|
|
|
my $buffer; |
|
|
|
$r->read($buffer,$r->header_in('Content-length'),0); |
|
unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) { |
|
my @pairs=split(/&/,$buffer); |
|
my $pair; |
|
foreach $pair (@pairs) { |
|
my ($name,$value) = split(/=/,$pair); |
|
$value =~ tr/+/ /; |
|
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
$name =~ tr/+/ /; |
|
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
&add_to_env("form.$name",$value); |
|
} |
|
} else { |
|
my $contentsep=$1; |
|
my @lines = split (/\n/,$buffer); |
|
my $name=''; |
|
my $value=''; |
|
my $fname=''; |
|
my $fmime=''; |
|
my $i; |
|
for ($i=0;$i<=$#lines;$i++) { |
|
if ($lines[$i]=~/^$contentsep/) { |
|
if ($name) { |
|
chomp($value); |
|
if ($fname) { |
|
$ENV{"form.$name.filename"}=$fname; |
|
$ENV{"form.$name.mimetype"}=$fmime; |
|
} else { |
|
$value=~s/\s+$//s; |
|
} |
|
&add_to_env("form.$name",$value); |
|
} |
|
if ($i<$#lines) { |
|
$i++; |
|
$lines[$i]=~ |
|
/Content\-Disposition\:\s*form\-data\;\s*name\=\"([^\"]+)\"/i; |
|
$name=$1; |
|
$value=''; |
|
if ($lines[$i]=~/filename\=\"([^\"]+)\"/i) { |
|
$fname=$1; |
|
if |
|
($lines[$i+1]=~/Content\-Type\:\s*([\w\-\/]+)/i) { |
|
$fmime=$1; |
|
$i++; |
|
} else { |
|
$fmime=''; |
|
} |
|
} else { |
|
$fname=''; |
|
$fmime=''; |
|
} |
|
$i++; |
|
} |
|
} else { |
|
$value.=$lines[$i]."\n"; |
|
} |
|
} |
} |
} |
|
$ENV{'request.method'}=$ENV{'REQUEST_METHOD'}; |
|
$r->method_number(M_GET); |
|
$r->method('GET'); |
|
$r->headers_in->unset('Content-length'); |
} |
} |
|
|
############################################### |
############################################### |
|
|
sub get_unprocessed_cgi { |
sub get_unprocessed_cgi { |
Line 1915 sub csv_samples_select_table {
|
Line 2226 sub csv_samples_select_table {
|
$i--; |
$i--; |
return($i); |
return($i); |
} |
} |
|
|
|
=pod |
|
|
|
=item check_if_partid_hidden($id,$symb,$udom,$uname) |
|
|
|
Returns either 1 or undef |
|
|
|
1 if the part is to be hidden, undef if it is to be shown |
|
|
|
Arguments are: |
|
|
|
$id the id of the part to be checked |
|
$symb, optional the symb of the resource to check |
|
$udom, optional the domain of the user to check for |
|
$uname, optional the username of the user to check for |
|
|
|
=cut |
|
|
|
sub check_if_partid_hidden { |
|
my ($id,$symb,$udom,$uname) = @_; |
|
my $hiddenparts=&Apache::lonnet::EXT('resource.0.parameter_hiddenparts', |
|
$symb,$udom,$uname); |
|
my @hiddenlist=split(/,/,$hiddenparts); |
|
foreach my $checkid (@hiddenlist) { |
|
if ($checkid =~ /^\s*\Q$id\E\s*$/) { return 1; } |
|
} |
|
return undef; |
|
} |
|
|
|
|
|
|
1; |
1; |
__END__; |
__END__; |
|
|