version 1.209, 2005/06/05 01:37:26
|
version 1.215, 2005/06/06 19:51:05
|
Line 403 sub valout {
|
Line 403 sub valout {
|
$result.=$sec.' secs '; |
$result.=$sec.' secs '; |
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif ($type=~/^date/) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value); |
$result = localtime($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
Line 434 sub plink {
|
Line 434 sub plink {
|
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my $winvalue=$value; |
my $winvalue=$value; |
unless ($winvalue) { |
unless ($winvalue) { |
if ($type=~/^date/) { |
if (&isdateparm($type)) { |
$winvalue=$env{'form.recent_'.$type}; |
$winvalue=$env{'form.recent_'.$type}; |
} else { |
} else { |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
Line 667 sub extractResourceInformation {
|
Line 667 sub extractResourceInformation {
|
my $symbp = shift; |
my $symbp = shift; |
my $maptitles=shift; |
my $maptitles=shift; |
my $uris=shift; |
my $uris=shift; |
|
my $keyorder=shift; |
|
my $defkeytype=shift; |
|
|
|
my $keyordercnt=100; |
|
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
Line 697 sub extractResourceInformation {
|
Line 700 sub extractResourceInformation {
|
my $parmdis = $display; |
my $parmdis = $display; |
$parmdis =~ s/\[Part.*$//g; |
$parmdis =~ s/\[Part.*$//g; |
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
|
$$defkeytype{$name}=&Apache::lonnet::metadata($srcf,$key.'.type'); |
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
Line 709 sub extractResourceInformation {
|
Line 713 sub extractResourceInformation {
|
} else { |
} else { |
$$keyp{$id}=$key; |
$$keyp{$id}=$key; |
} |
} |
|
# |
|
# Put in order |
|
# |
|
unless ($$keyorder{$key}) { |
|
$$keyorder{$key}=$keyordercnt; |
|
$keyordercnt++; |
|
} |
|
|
} |
} |
} |
} |
$$mapp{$id}= |
$$mapp{$id}= |
Line 730 sub extractResourceInformation {
|
Line 742 sub extractResourceInformation {
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
|
sub isdateparm { |
|
my $type=shift; |
|
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
|
} |
|
|
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 743 sub parmmenu {
|
Line 760 sub parmmenu {
|
} |
} |
} |
} |
} |
} |
|
|
|
function checkthis(thisvalue, checkName) { |
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
|
ele = document.forms.parmform.elements[i]; |
|
if (ele.name == checkName) { |
|
if (ele.value == thisvalue) { |
|
document.forms.parmform.elements[i].checked=true; |
|
} |
|
} |
|
} |
|
} |
|
|
|
function checkdates() { |
|
checkthis('duedate','pscat'); |
|
checkthis('opendate','pscat'); |
|
checkthis('answerdate','pscat'); |
|
checkthis('interval','pscat'); |
|
} |
|
|
|
function checkvisi() { |
|
checkthis('hiddenresource','pscat'); |
|
checkthis('encrypturl','pscat'); |
|
checkthis('problemstatus','pscat'); |
|
checkthis('contentopen','pscat'); |
|
checkthis('opendate','pscat'); |
|
} |
|
|
|
function checkparts() { |
|
checkthis('hiddenparts','pscat'); |
|
checkthis('display','pscat'); |
|
checkthis('ordered','pscat'); |
|
} |
|
|
|
function checkstandard() { |
|
checkall(false,'pscat'); |
|
checkdates(); |
|
checkthis('weight','pscat'); |
|
checkthis('maxtries','pscat'); |
|
} |
|
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
$r->print(); |
$r->print("\n<table><tr>"); |
$r->print("\n<table><tr>"); |
my $cnt=0; |
my $cnt=0; |
foreach $tempkey (sort { $$allparms{$a} cmp $$allparms{$b} } |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
keys %{$allparms} ) { |
|
$r->print("\n<td><font size='-1'><input type='checkbox' name='pscat' "); |
$r->print("\n<td><font size='-1'><input type='checkbox' name='pscat' "); |
$r->print('value="'.$tempkey.'"'); |
$r->print('value="'.$tempkey.'"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
Line 764 ENDSCRIPT
|
Line 820 ENDSCRIPT
|
} |
} |
$r->print(' |
$r->print(' |
</tr><tr><td> |
</tr><tr><td> |
<input type="button" onclick="checkall(true, \'pscat\')" value="Select All" /> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a> |
</td><td></td><td> |
<a href="javascript:checkstandard()">Select Standard</a> |
<input type="button" onclick="checkall(false, \'pscat\')" value="Unselect All" /> |
</td><td> |
|
<a href="javascript:checkdates()">Select Dates</a> |
|
<a href="javascript:checkvisi()">Select Visibilities</a> |
|
<a href="javascript:checkparts()">Select Part Parameters</a> |
|
</td><td> |
|
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
</td> |
</td> |
'); |
'); |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
Line 774 ENDSCRIPT
|
Line 835 ENDSCRIPT
|
|
|
sub partmenu { |
sub partmenu { |
my ($r,$allparts,$psprt)=@_; |
my ($r,$allparts,$psprt)=@_; |
$r->print('<select multiple name="psprt" size="5">'); |
$r->print('<select multiple name="psprt" size="8">'); |
$r->print('<option value="all"'); |
$r->print('<option value="all"'); |
$r->print(' selected') unless (@{$psprt}); |
$r->print(' selected') unless (@{$psprt}); |
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
Line 831 ENDMENU
|
Line 892 ENDMENU
|
} |
} |
|
|
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$allparts,$pscat,$psprt)=@_; |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
$r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
$r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
&mt('Select Parts to View').'</th></tr><tr><td>'); |
&mt('Select Parts to View').'</th></tr><tr><td>'); |
&parmmenu($r,$allparms,$pscat); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print('</td><td>'); |
$r->print('</td><td>'); |
&partmenu($r,$allparts,$psprt); |
&partmenu($r,$allparts,$psprt); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
Line 868 sub levelmenu {
|
Line 929 sub levelmenu {
|
$r->print("</select>"); |
$r->print("</select>"); |
} |
} |
|
|
|
|
|
sub sectionmenu { |
|
my ($r,$selectedsections)=@_; |
|
my %sectionhash=(); |
|
|
|
if (&Apache::loncommon::get_sections( |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}, |
|
\%sectionhash)) { |
|
$r->print('<select name="Section" multiple="true" size="8" >'); |
|
foreach my $s ('all',sort keys %sectionhash) { |
|
$r->print(' <option value="'.$s.'"'); |
|
foreach (@{$selectedsections}) { |
|
if ($s eq $_) { |
|
$r->print(' selected'); |
|
last; |
|
} |
|
} |
|
$r->print('>'.$s."</option>\n"); |
|
} |
|
$r->print("</select>\n"); |
|
} |
|
} |
|
|
|
sub keysplit { |
|
my $keyp=shift; |
|
return (split(/\,/,$keyp)); |
|
} |
|
|
|
sub keysinorder { |
|
my ($name,$keyorder)=@_; |
|
return sort { |
|
$$keyorder{$a} <=> $$keyorder{$b}; |
|
} (keys %{$name}); |
|
} |
|
|
|
sub keysindisplayorder { |
|
my ($name,$keyorder)=@_; |
|
return sort { |
|
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
|
} (keys %{$name}); |
|
} |
|
|
|
sub sortmenu { |
|
my ($r,$sortorder)=@_; |
|
$r->print('<br /><input type="radio" name="sortorder" value="realmstudent"'); |
|
if ($sortorder eq 'realmstudent') { |
|
$r->print(' checked="on"'); |
|
} |
|
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
|
$r->print('<br /><input type="radio" name="sortorder" value="studentrealm"'); |
|
if ($sortorder eq 'studentrealm') { |
|
$r->print(' checked="on"'); |
|
} |
|
$r->print(' />'.&mt('Sort by student (group/section) first, then realm')); |
|
} |
|
|
|
sub standardkeyorder { |
|
return ('parameter_0_opendate' => 1, |
|
'parameter_0_duedate' => 2, |
|
'parameter_0_answerdate' => 3, |
|
'parameter_0_interval' => 4, |
|
'parameter_0_weight' => 5, |
|
'parameter_0_maxtries' => 6, |
|
'parameter_0_hinttries' => 7, |
|
'parameter_0_contentopen' => 8, |
|
'parameter_0_contentclose' => 9, |
|
'parameter_0_type' => 10, |
|
'parameter_0_problemstatus' => 11, |
|
'parameter_0_hiddenresource' => 12, |
|
'parameter_0_hiddenparts' => 13, |
|
'parameter_0_display' => 14, |
|
'parameter_0_ordered' => 15, |
|
'parameter_0_tol' => 16, |
|
'parameter_0_sig' => 17, |
|
'parameter_0_turnoffunit' => 18); |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 923 sub assessparms {
|
Line 1062 sub assessparms {
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
$alllevs{'Resource Level'}='full'; |
$alllevs{'Resource Level'}='full'; |
$alllevs{'Map Level'}='map'; |
$alllevs{'Map/Folder Level'}='map'; |
$alllevs{'Course Level'}='general'; |
$alllevs{'Course Level'}='general'; |
|
|
my %allparms; |
my %allparms; |
my %allparts; |
my %allparts; |
|
# |
|
# Order in which these parameters will be displayed |
|
# |
|
my %keyorder=&standardkeyorder(); |
|
|
@ids=(); |
@ids=(); |
%symbp=(); |
%symbp=(); |
Line 1022 sub assessparms {
|
Line 1165 sub assessparms {
|
unless ($csec) { $csec=''; } |
unless ($csec) { $csec=''; } |
|
|
# --------------------------------------------------------- Get all assessments |
# --------------------------------------------------------- Get all assessments |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, \%mapp, \%symbp,\%maptitles,\%uris); |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
|
\%mapp, \%symbp,\%maptitles,\%uris, |
|
\%keyorder); |
|
|
$mapp{'0.0'} = ''; |
$mapp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
Line 1054 sub assessparms {
|
Line 1199 sub assessparms {
|
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
} |
} |
|
|
$r->print('<h2>'.$message.'</h2>'); |
|
|
|
if (!$pssymb) { |
if (!$pssymb) { |
$r->print('<table border="1"><tr><td>'); |
$r->print('<table border="1"><tr><td>'); |
Line 1066 sub assessparms {
|
Line 1209 sub assessparms {
|
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&mt('Specific Resource').": ".$resource. |
$r->print(&mt('Specific Resource').": ".$resource. |
'<input type="hidden" value="'.$pssymb.'" name="symb">'); |
'<input type="hidden" value="'.$pssymb.'" name="symb"><br />'); |
} |
} |
&usermenu($r,$uname,$id,$udom,$csec); |
&usermenu($r,$uname,$id,$udom,$csec); |
|
|
|
$r->print('<p>'.$message.'</p>'); |
|
|
$r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />'); |
$r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />'); |
|
|
my @temp_pscat; |
my @temp_pscat; |
Line 1176 ENDTABLEHEADFOUR
|
Line 1321 ENDTABLEHEADFOUR
|
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
foreach (split(/\,/,$keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
Line 1220 ENDTABLEHEADFOUR
|
Line 1365 ENDTABLEHEADFOUR
|
|
|
$r->print('</font></tt></td>'); |
$r->print('</font></tt></td>'); |
|
|
foreach (sort keys %name) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
Line 1283 ENDTABLEHEADFOUR
|
Line 1428 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (split(/\,/,$keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
Line 1333 ENDMAPONE
|
Line 1478 ENDMAPONE
|
$r->print('<th>'.&mt('Default Value').'</th>'); |
$r->print('<th>'.&mt('Default Value').'</th>'); |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
|
|
foreach (sort keys %name) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$parmlev,$uname,$udom,$csec); |
$parmlev,$uname,$udom,$csec); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
|
} |
} |
$r->print("</table></center>"); |
$r->print("</table></center>"); |
} # end each map |
} # end each map |
Line 1370 ENDMAPONE
|
Line 1514 ENDMAPONE
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (split(/\,/,$keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
Line 1411 ENDMAPONE
|
Line 1555 ENDMAPONE
|
$r->print('<th>'.&mt('Default Value').'</th>'); |
$r->print('<th>'.&mt('Default Value').'</th>'); |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
$r->print('<th>'.&mt('Parameter in Effect').'</th></tr>'); |
|
|
foreach (sort keys %name) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); |
\%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); |
# $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n"); |
|
} |
} |
$r->print("</table></center>"); |
$r->print("</table></center>"); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
Line 1825 sub storedata {
|
Line 1968 sub storedata {
|
} |
} |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
my $data=$env{$_}; |
my $data=$env{$_}; |
if ($$olddata{$thiskey} ne $data) { |
my $typeof=$env{'form.typeof_'.$thiskey}; |
|
if ($$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data},$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
|
$tkey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
Line 1837 sub storedata {
|
Line 1983 sub storedata {
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
$newdata{$thiskey}=$data; |
$newdata{$thiskey}=$data; |
} |
$newdata{$thiskey.'.type'}=$typeof; |
|
} |
} |
} |
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
Line 1853 sub storedata {
|
Line 2000 sub storedata {
|
} |
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
|
my $typeof=$env{'form.typeof_'.$thiskey}; |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data},$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
|
$tkey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
Line 1863 sub storedata {
|
Line 2013 sub storedata {
|
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
$newdata{$thiskey}=$data; |
$newdata{$thiskey}=$data; |
|
$newdata{$thiskey.'.type'}=$typeof; |
} |
} |
} |
} |
} |
} |
Line 1884 sub storedata {
|
Line 2035 sub storedata {
|
} |
} |
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
$r->print('<h2>'.&mt('Stored [_1] parameter(s)</h2>',$putentries)); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<h2><font color="red">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</font></h2>'); |
Line 1899 sub extractuser {
|
Line 2050 sub extractuser {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata)=@_; |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 1908 sub listdata {
|
Line 2059 sub listdata {
|
my $pointer=0; |
my $pointer=0; |
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
foreach my $thiskey (sort keys %{$listdata}) { |
foreach my $thiskey (sort { |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($sortorder eq 'realmstudent') { |
|
my ($astudent,$arealm)=($a=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
|
my ($bstudent,$brealm)=($b=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} else { |
|
$a cmp $b; |
|
} |
|
} keys %{$listdata}) { |
|
if ($$listdata{$thiskey.'.type'}) { |
|
my $thistype=$$listdata{$thiskey.'.type'}; |
|
if ($$resourcedata{$thiskey.'.type'}) { |
|
$thistype=$$resourcedata{$thiskey.'.type'}; |
|
} |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
Line 1931 sub listdata {
|
Line 2094 sub listdata {
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
} |
} |
if ($section ne $oldsection) { |
if ($sortorder eq 'realmstudent') { |
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
if ($realm ne $oldrealm) { |
$oldsection=$section; |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
$oldrealm=''; |
$oldrealm=$realm; |
} |
$oldsection=''; |
if ($realm ne $oldrealm) { |
} |
$r->print(&tableend()."\n<h2>$realm</h2>"); |
if ($section ne $oldsection) { |
$oldrealm=$realm; |
$r->print(&tableend()."\n<h2>$section</h2>"); |
$oldpart=''; |
$oldsection=$section; |
|
$oldpart=''; |
|
} |
|
} else { |
|
if ($section ne $oldsection) { |
|
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
|
$oldsection=$section; |
|
$oldrealm=''; |
|
} |
|
if ($realm ne $oldrealm) { |
|
$r->print(&tableend()."\n<h2>$realm</h2>"); |
|
$oldrealm=$realm; |
|
$oldpart=''; |
|
} |
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$r->print(&tableend(). |
"\n<h3><font color='blue'>".&mt('Part').": $part</font></h3>"); |
"\n<font color='blue'>".&mt('Part').": $part</font>"); |
$oldpart=$part; |
$oldpart=$part; |
} |
} |
# |
# |
Line 1953 sub listdata {
|
Line 2129 sub listdata {
|
':</b></td><td><input type="checkbox" name="del_'. |
':</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if ($$resourcedata{$thiskey.'.type'}=~/^date/) { |
if (&isdateparm($thistype)) { |
my $jskey='key_'.$pointer; |
my $jskey='key_'.$pointer; |
$pointer++; |
$pointer++; |
$r->print( |
$r->print( |
Line 1963 sub listdata {
|
Line 2139 sub listdata {
|
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
); |
); |
} else { |
} else { |
$r->print( |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
'<input type="text" name="set_'.$thiskey.'" value="'. |
|
$$resourcedata{$thiskey}.'">'); |
$$resourcedata{$thiskey}.'">'); |
} |
} |
|
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
|
$thistype.'">'); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
} |
} |
} |
} |
Line 1988 $html
|
Line 2165 $html
|
</head> |
</head> |
$bodytag |
$bodytag |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=newoverview" name="overviewform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
$r->print(&tableend(). |
my @ids=(); |
'<p><input type="submit" value="'.&mt('Submit').'" /></p></form></body></html>'); |
my %typep=(); |
|
my %keyp=(); |
|
my %allparms=(); |
|
my %allparts=(); |
|
my %allmaps=(); |
|
my %mapp=(); |
|
my %symbp=(); |
|
my %maptitles=(); |
|
my %uris=(); |
|
my %keyorder=&standardkeyorder(); |
|
my %defkeytype=(); |
|
|
|
my %alllevs=(); |
|
$alllevs{'Resource Level'}='full'; |
|
$alllevs{'Map/Folder Level'}='map'; |
|
$alllevs{'Course Level'}='general'; |
|
|
|
my $csec=$env{'form.csec'}; |
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
|
my $pschp=$env{'form.pschp'}; |
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
|
if (!@psprt) { $psprt[0]='0'; } |
|
|
|
my @selected_sections = |
|
&Apache::loncommon::get_env_multiple('form.Section'); |
|
@selected_sections = ('all') if (! @selected_sections); |
|
foreach (@selected_sections) { |
|
if ($_ eq 'all') { |
|
@selected_sections = ('all'); |
|
} |
|
} |
|
|
|
my $pssymb=''; |
|
my $parmlev=''; |
|
|
|
unless ($env{'form.parmlev'}) { |
|
$parmlev = 'map'; |
|
} else { |
|
$parmlev = $env{'form.parmlev'}; |
|
} |
|
|
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
|
\%mapp, \%symbp,\%maptitles,\%uris, |
|
\%keyorder,\%defkeytype); |
|
|
|
# Menu to select levels, etc |
|
|
|
$r->print('<table border="1"><tr><td>'); |
|
&levelmenu($r,\%alllevs,$parmlev); |
|
if ($parmlev ne 'general') { |
|
$r->print('<td>'); |
|
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
|
$r->print('</td>'); |
|
} |
|
$r->print('</td></tr></table>'); |
|
|
|
$r->print('<table border="1"><tr><td>'); |
|
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
|
$r->print('</td><td>'); |
|
&partmenu($r,\%allparts,\@psprt); |
|
$r->print('</td><td>'); |
|
§ionmenu($r,\@selected_sections); |
|
|
|
$r->print('</td></tr></table>'); |
|
|
|
my $sortorder=$env{'form.sortorder'}; |
|
unless ($sortorder) { $sortorder='realmstudent'; } |
|
&sortmenu($r,$sortorder); |
|
|
|
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
|
|
|
# Build the list data hash from the specified parms |
|
|
|
my $listdata; |
|
%{$listdata}=(); |
|
|
|
foreach my $cat (@pscat) { |
|
foreach my $section (@selected_sections) { |
|
foreach my $part (@psprt) { |
|
my $rootparmkey=$env{'request.course.id'}; |
|
if (($section ne 'all') && ($section ne 'none') && ($section)) { |
|
$rootparmkey.='.['.$section.']'; |
|
} |
|
if ($parmlev eq 'general') { |
|
# course-level parameter |
|
my $newparmkey=$rootparmkey.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} elsif ($parmlev eq 'map') { |
|
# map-level parameter |
|
foreach my $mapid (keys %allmaps) { |
|
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} |
|
} else { |
|
# resource-level parameter |
|
foreach my $rid (@ids) { |
|
my ($map,$resid,$url)=&Apache::lonnet::decode_symb($symbp{$rid}); |
|
if (($pschp ne 'all') && ($allmaps{$pschp} ne $map)) { next; } |
|
my $newparmkey=$rootparmkey.'.'.$symbp{$rid}.'.'.$part.'.'.$cat; |
|
$$listdata{$newparmkey}=1; |
|
$$listdata{$newparmkey.'.type'}=$defkeytype{$cat}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
if (($env{'form.store'}) || ($env{'form.dis'})) { |
|
|
|
if ($env{'form.store'}) { &storedata($r,$crs,$dom); } |
|
|
|
# Read modified data |
|
|
|
my $resourcedata=&readdata($crs,$dom); |
|
|
|
# List data |
|
|
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
|
} |
|
$r->print(&tableend(). |
|
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
|
'</form></body></html>'); |
} |
} |
|
|
sub overview { |
sub overview { |
Line 2019 ENDOVER
|
Line 2321 ENDOVER
|
|
|
my $resourcedata=&readdata($crs,$dom); |
my $resourcedata=&readdata($crs,$dom); |
|
|
|
|
|
my $sortorder=$env{'form.sortorder'}; |
|
unless ($sortorder) { $sortorder='realmstudent'; } |
|
&sortmenu($r,$sortorder); |
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
Line 2229 sub handler {
|
Line 2536 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname']); |
'udom','uname','symb']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |