version 1.339, 2006/10/07 20:02:16
|
version 1.408, 2008/08/28 04:42:27
|
Line 65 use Apache::lonlocal;
|
Line 65 use Apache::lonlocal;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
|
|
# --- Caches local to lonparmset |
|
|
|
my $parmhashid; |
|
my %parmhash; |
|
my $symbsid; |
|
my %symbs; |
|
my $rulesid; |
|
my %rules; |
|
|
|
# --- end local caches |
|
|
|
################################################## |
################################################## |
################################################## |
################################################## |
Line 119 sub parmval {
|
Line 109 sub parmval {
|
|
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
# load caches |
|
&cacheparmhash(); |
|
|
|
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $useropt; |
|
if ($uname ne '' && $udom ne '') { |
|
$useropt = &Apache::lonnet::get_userresdata($uname,$udom); |
|
} |
|
|
my $result=''; |
my $result=''; |
my @outpar=(); |
my @outpar=(); |
Line 164 sub parmval_by_symb {
|
Line 155 sub parmval_by_symb {
|
|
|
# ------------------------------------------------------ third, check map parms |
# ------------------------------------------------------ third, check map parms |
|
|
my $thisparm=$parmhash{$symbparm}; |
my $thisparm=&parmhash($symbparm); |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
|
|
if (defined($$courseopt{$courselevelr})) { |
if (defined($$courseopt{$courselevelr})) { |
Line 173 sub parmval_by_symb {
|
Line 164 sub parmval_by_symb {
|
} |
} |
|
|
# ------------------------------------------------------ fourth, back to course |
# ------------------------------------------------------ fourth, back to course |
if (defined($csec)) { |
if ($csec ne '') { |
if (defined($$courseopt{$seclevel})) { |
if (defined($$courseopt{$seclevel})) { |
$outpar[9]=$$courseopt{$seclevel}; |
$outpar[9]=$$courseopt{$seclevel}; |
$result=9; |
$result=9; |
Line 189 sub parmval_by_symb {
|
Line 180 sub parmval_by_symb {
|
} |
} |
} |
} |
# ------------------------------------------------------ fifth, check course group |
# ------------------------------------------------------ fifth, check course group |
if (defined($cgroup)) { |
if ($cgroup ne '') { |
if (defined($$courseopt{$grplevel})) { |
if (defined($$courseopt{$grplevel})) { |
$outpar[6]=$$courseopt{$grplevel}; |
$outpar[6]=$$courseopt{$grplevel}; |
$result=6; |
$result=6; |
Line 206 sub parmval_by_symb {
|
Line 197 sub parmval_by_symb {
|
|
|
# ---------------------------------------------------------- fifth, check user |
# ---------------------------------------------------------- fifth, check user |
|
|
if (defined($uname)) { |
if ($uname ne '') { |
if (defined($$useropt{$courselevel})) { |
if (defined($$useropt{$courselevel})) { |
$outpar[3]=$$useropt{$courselevel}; |
$outpar[3]=$$useropt{$courselevel}; |
$result=3; |
$result=3; |
Line 225 sub parmval_by_symb {
|
Line 216 sub parmval_by_symb {
|
return ($result,@outpar); |
return ($result,@outpar); |
} |
} |
|
|
sub resetparmhash { |
|
$parmhashid=''; |
|
} |
|
|
|
sub cacheparmhash { |
|
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
|
my %parmhashfile; |
|
if (tie(%parmhashfile,'GDBM_File', |
|
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
|
%parmhash=%parmhashfile; |
|
untie %parmhashfile; |
|
$parmhashid=$env{'request.course.fn'}; |
|
} |
|
} |
|
|
|
sub resetsymbcache { |
# --- Caches local to lonparmset |
$symbsid=''; |
|
|
|
|
sub reset_caches { |
|
&resetparmhash(); |
|
&resetsymbcache(); |
|
&resetrulescache(); |
} |
} |
|
|
sub symbcache { |
{ |
my $id=shift; |
my $parmhashid; |
if ($symbsid ne $env{'request.course.id'}) { |
my %parmhash; |
%symbs=(); |
sub resetparmhash { |
|
undef($parmhashid); |
|
undef(%parmhash); |
} |
} |
unless ($symbs{$id}) { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
sub cacheparmhash { |
if ($id=~/\./) { |
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
my $resource=$navmap->getById($id); |
my %parmhashfile; |
$symbs{$id}=$resource->symb(); |
if (tie(%parmhashfile,'GDBM_File', |
} else { |
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
my $resource=$navmap->getByMapPc($id); |
%parmhash=%parmhashfile; |
$symbs{$id}=&Apache::lonnet::declutter($resource->src()); |
untie(%parmhashfile); |
|
$parmhashid=$env{'request.course.fn'}; |
} |
} |
$symbsid=$env{'request.course.id'}; |
|
} |
} |
return $symbs{$id}; |
|
} |
sub parmhash { |
|
my ($id) = @_; |
sub resetrulescache { |
&cacheparmhash(); |
$rulesid=''; |
return $parmhash{$id}; |
} |
} |
|
} |
|
|
|
{ |
|
my $symbsid; |
|
my %symbs; |
|
sub resetsymbcache { |
|
undef($symbsid); |
|
undef(%symbs); |
|
} |
|
|
|
sub symbcache { |
|
my $id=shift; |
|
if ($symbsid ne $env{'request.course.id'}) { |
|
undef(%symbs); |
|
} |
|
if (!$symbs{$id}) { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if ($id=~/\./) { |
|
my $resource=$navmap->getById($id); |
|
$symbs{$id}=$resource->symb(); |
|
} else { |
|
my $resource=$navmap->getByMapPc($id); |
|
$symbs{$id}=&Apache::lonnet::declutter($resource->src()); |
|
} |
|
$symbsid=$env{'request.course.id'}; |
|
} |
|
return $symbs{$id}; |
|
} |
|
} |
|
|
sub rulescache { |
{ |
my $id=shift; |
my $rulesid; |
if ($rulesid ne $env{'request.course.id'}) { |
my %rules; |
%rules=(); |
sub resetrulescache { |
|
undef($rulesid); |
|
undef(%rules); |
} |
} |
unless (defined($rules{$id})) { |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
sub rulescache { |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $id=shift; |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
if ($rulesid ne $env{'request.course.id'} |
$rulesid=$env{'request.course.id'}; |
&& !defined($rules{$id})) { |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
|
$rulesid=$env{'request.course.id'}; |
|
} |
|
return $rules{$id}; |
} |
} |
return $rules{$id}; |
|
} |
} |
|
|
sub preset_defaults { |
sub preset_defaults { |
Line 344 sub storeparm {
|
Line 365 sub storeparm {
|
# - new type |
# - new type |
# - username |
# - username |
# - userdomain |
# - userdomain |
|
|
my %recstack; |
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; |
Line 553 sub valout {
|
Line 573 sub valout {
|
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value).&date_sanity_info($value); |
$result = &Apache::lonlocal::locallocaltime($value). |
|
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
|
$result = &HTML::Entities::encode($result,'"<>&'); |
} |
} |
} |
} |
return $result; |
return $result; |
Line 592 sub plink {
|
Line 614 sub plink {
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
|
my $valout = &valout($value,$type,1); |
|
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
|
\$hour, \$min, \$sec) { |
|
$$item = &HTML::Entities::encode($$item,'"<>&'); |
|
$$item =~ s/\'/\\\'/g; |
|
} |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type,1).'</a></td></tr></table>'; |
$valout.'</a></td></tr></table>'; |
} |
} |
|
|
sub page_js { |
sub page_js { |
Line 933 sub extractResourceInformation {
|
Line 961 sub extractResourceInformation {
|
$$typep{$id}=$1; |
$$typep{$id}=$1; |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
if ($_=~/^parameter\_(.*)/) { |
next if ($key!~/^parameter_/); |
my $key=$_; |
|
# Hidden parameters |
# Hidden parameters |
if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm') { |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
next; |
|
} |
|
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
|
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
|
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
|
# |
# |
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
|
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
|
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
|
my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
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'); |
if (ref($defkeytype)) { |
|
$$defkeytype{$name}= |
|
&Apache::lonnet::metadata($srcf,$key.'.type'); |
|
} |
|
} |
|
|
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
$$allparts{$part} = "Part: $part"; |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
|
$$allparts{$part} = "Part: $part"; |
# |
# |
# Remember all keys going with this resource |
# Remember all keys going with this resource |
# |
# |
if ($$keyp{$id}) { |
if ($$keyp{$id}) { |
$$keyp{$id}.=','.$key; |
$$keyp{$id}.=','.$key; |
} else { |
} else { |
$$keyp{$id}=$key; |
$$keyp{$id}=$key; |
} |
} |
# |
# |
# Put in order |
# Put in order |
# |
# |
unless ($$keyorder{$key}) { |
unless ($$keyorder{$key}) { |
$$keyorder{$key}=$keyordercnt; |
$$keyorder{$key}=$keyordercnt; |
$keyordercnt++; |
$keyordercnt++; |
} |
|
|
|
} |
} |
} |
} |
$$mapp{$id}= |
|
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
|
$$mapp{$mapid}=$$mapp{$id}; |
if (!exists($$mapp{$mapid})) { |
$$allmaps{$mapid}=$$mapp{$id}; |
$$mapp{$id}= |
if ($mapid eq '1') { |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
$$maptitles{$mapid}='Main Course Documents'; |
$$mapp{$mapid}=$$mapp{$id}; |
|
$$allmaps{$mapid}=$$mapp{$id}; |
|
if ($mapid eq '1') { |
|
$$maptitles{$mapid}=&mt('Main Course Documents'); |
|
} else { |
|
$$maptitles{$mapid}= |
|
&Apache::lonnet::gettitle($$mapp{$id}); |
|
} |
|
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
|
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle(&Apache::lonnet::clutter($$mapp{$id})); |
$$mapp{$id} = $$mapp{$mapid}; |
} |
} |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
|
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
|
} |
} |
} |
} |
|
|
Line 1070 ENDSCRIPT
|
Line 1107 ENDSCRIPT
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked'); |
} |
} |
$r->print('>'.$$allparms{$tempkey}.'</label></td>'); |
$r->print('>'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 1098 sub partmenu {
|
Line 1137 sub partmenu {
|
my ($r,$allparts,$psprt)=@_; |
my ($r,$allparts,$psprt)=@_; |
$r->print('<select multiple name="psprt" size="8">'); |
$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="selected"') unless (@{$psprt}); |
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
my %temphash=(); |
my %temphash=(); |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach (@{$psprt}) { $temphash{$_}=1; } |
Line 1108 sub partmenu {
|
Line 1147 sub partmenu {
|
unless ($tempkey =~ /\./) { |
unless ($tempkey =~ /\./) { |
$r->print('<option value="'.$tempkey.'"'); |
$r->print('<option value="'.$tempkey.'"'); |
if ($$psprt[0] eq "all" || $temphash{$tempkey}) { |
if ($$psprt[0] eq "all" || $temphash{$tempkey}) { |
$r->print(' selected'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.$$allparts{$tempkey}.'</option>'); |
$r->print('>'.$$allparts{$tempkey}.'</option>'); |
} |
} |
Line 1229 sub mapmenu {
|
Line 1268 sub mapmenu {
|
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
$r->print('<option value="'.$_.'"'); |
$r->print('<option value="'.$_.'"'); |
if (($pschp eq $_)) { $r->print(' selected'); } |
if (($pschp eq $_)) { $r->print(' selected="selected"'); } |
$r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>'); |
$r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>'); |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
Line 1243 sub levelmenu {
|
Line 1282 sub levelmenu {
|
foreach (reverse sort keys %{$alllevs}) { |
foreach (reverse sort keys %{$alllevs}) { |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
if ($parmlev eq $$alllevs{$_}) { |
if ($parmlev eq $$alllevs{$_}) { |
$r->print(' selected'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.$_.'</option>'); |
$r->print('>'.&mt($_).'</option>'); |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
} |
} |
Line 1261 sub sectionmenu {
|
Line 1300 sub sectionmenu {
|
$r->print(' <option value="'.$s.'"'); |
$r->print(' <option value="'.$s.'"'); |
foreach (@{$selectedsections}) { |
foreach (@{$selectedsections}) { |
if ($s eq $_) { |
if ($s eq $_) { |
$r->print(' selected'); |
$r->print(' selected="selected"'); |
last; |
last; |
} |
} |
} |
} |
Line 1280 sub groupmenu {
|
Line 1319 sub groupmenu {
|
$r->print(' <option value="'.$group.'"'); |
$r->print(' <option value="'.$group.'"'); |
foreach (@{$selectedgroups}) { |
foreach (@{$selectedgroups}) { |
if ($group eq $_) { |
if ($group eq $_) { |
$r->print(' selected'); |
$r->print(' selected="selected"'); |
last; |
last; |
} |
} |
} |
} |
Line 1562 sub assessparms {
|
Line 1601 sub assessparms {
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'" />'); |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
|
'" name="recent_'.$_.'" />'); |
} |
} |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
Line 1841 ENDTABLEHEADFOUR
|
Line 1881 ENDTABLEHEADFOUR
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); |
my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
$r->print(<<ENDMAPONE); |
my $tmp=""; |
<center><h4> |
|
Set Defaults for All Resources in $foldermap<br /> |
|
<font color="red"><i>$showtitle</i></font><br /> |
|
Specifically for |
|
ENDMAPONE |
|
if ($uname) { |
if ($uname) { |
my $person=&Apache::loncommon::plainname($uname,$udom); |
my $person=&Apache::loncommon::plainname($uname,$udom); |
$r->print(&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ". |
$tmp.=&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ". |
&mt('in')." \n"); |
&mt('in')." \n"; |
} else { |
} else { |
$r->print("<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n"); |
$tmp.="<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n"; |
} |
} |
if ($cgroup) { |
if ($cgroup) { |
$r->print(&mt("Group")." <font color=\"red\"><i>$cgroup". |
$tmp.=&mt("Group")." <font color=\"red\"><i>$cgroup". |
"</i></font> ".&mt('of')." \n"); |
"</i></font> ".&mt('of')." \n"; |
$csec = ''; |
$csec = ''; |
} elsif ($csec) { |
} elsif ($csec) { |
$r->print(&mt("Section")." <font color=\"red\"><i>$csec". |
$tmp.=&mt("Section")." <font color=\"red\"><i>$csec". |
"</i></font> ".&mt('of')." \n"); |
"</i></font> ".&mt('of')." \n"; |
} |
} |
$r->print("<font color=\"red\"><i>$coursename</i></font><br />"); |
$r->print('<div align="center"><h4>' |
$r->print("</h4>\n"); |
.&mt('Set Defaults for All Resources in [_1]Specifically for [_2][_3]' |
|
,$foldermap.'<br /><font color="red"><i>'.$showtitle.'</i></font><br />' |
|
,$tmp |
|
,'<font color="red"><i>'.$coursename.'</i></font>' |
|
) |
|
."<br /></h4>\n" |
|
); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
$r->print('<tr><th>'.&mt('Parameter Name').'</th>'); |
Line 1876 ENDMAPONE
|
Line 1917 ENDMAPONE
|
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
$r->print("</table></center>"); |
$r->print("</table></div>"); |
} # end each map |
} # end each map |
} # end of $parmlev eq map |
} # end of $parmlev eq map |
#--------------------------------- Entry for parm level general (Course level) |
#--------------------------------- Entry for parm level general (Course level) |
Line 1986 sub crsenv {
|
Line 2027 sub crsenv {
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my (%crsinfo,$chome); |
|
|
# |
# |
# Go through list of changes |
# Go through list of changes |
foreach (keys %env) { |
foreach (keys %env) { |
Line 2033 sub crsenv {
|
Line 2076 sub crsenv {
|
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
} |
} |
|
# |
|
# Deal with the emails |
|
if ($name =~ /\.email$/) { |
|
foreach my $specifier (split(',',$value)) { |
|
my ($user,$sections_or_groups)= |
|
($specifier=~/^([^\(]+)\(([^\)]+)\)/); |
|
if (!$sections_or_groups) { |
|
$user = $specifier; |
|
} |
|
my ($name,$domain) = split(':',$user); |
|
if (!defined($user) || !defined($domain)) { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid email address specified, address must be of the form username:domain what was specified was ([_1])",$user). |
|
'</span>'; |
|
undef($value); |
|
} elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { |
|
$setoutput.= '<br /> <span class="LC_error">'. |
|
&mt("Invalid email address specified, user [_1] is unknown.",$name). |
|
'</span>'; |
|
undef($value); |
|
} |
|
} |
|
} |
# Get existing cloners |
# Get existing cloners |
my @oldcloner = (); |
my @oldcloner = (); |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
Line 2046 sub crsenv {
|
Line 2112 sub crsenv {
|
# |
# |
# Let the user know we made the changes |
# Let the user know we made the changes |
if ($name && defined($value)) { |
if ($name && defined($value)) { |
my $failed_cloners; |
my %failed_cloners; |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
$value =~ s/\s//g; |
$value =~ s/\s//g; |
$value =~ s/^,//; |
$value =~ s/^,//; |
$value =~ s/,$//; |
$value =~ s/,$//; |
# check requested clones are valid users. |
# check requested clones are valid users. |
$failed_cloners = &check_cloners(\$value,\@oldcloner); |
%failed_cloners = &check_cloners(\$value,\@oldcloner); |
} |
} |
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{$name=>$value},$dom,$crs); |
{$name=>$value},$dom,$crs); |
if ($put_result eq 'ok') { |
if ($put_result eq 'ok') { |
$setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'.$value.'</b>.<br />'; |
$setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'; |
|
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
|
$setoutput .= &Apache::lonlocal::locallocaltime($value); |
|
} elsif ($name eq 'categories') { |
|
$setoutput .= $env{'form.categories_display'}; |
|
} else { |
|
$setoutput .= $value; |
|
} |
|
$setoutput .= '</b>.<br />'; |
if ($name eq 'cloners') { |
if ($name eq 'cloners') { |
&change_clone($value,\@oldcloner); |
&change_clone($value,\@oldcloner); |
} |
} |
# Flush the course logs so course description is immediately updated |
# Update environment and nohist_courseids.db |
|
if (($name eq 'description') || ($name eq 'cloners') || |
|
($name eq 'hidefromcat') || ($name eq 'categories')) { |
|
if ($chome eq '') { |
|
%crsinfo = |
|
&Apache::lonnet::courseiddump($dom,'.',1,'.','.', |
|
$crs,undef,undef,'.'); |
|
$chome = &Apache::lonnet::homeserver($crs,$dom); |
|
} |
|
} |
if ($name eq 'description' && defined($value)) { |
if ($name eq 'description' && defined($value)) { |
&Apache::lonnet::flushcourselogs(); |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value}); |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
$crsinfo{$env{'request.course.id'}}{'description'} = $value; |
|
my $putresult = |
|
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
|
} |
|
if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) { |
|
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value}); |
|
$crsinfo{$env{'request.course.id'}}{$name} = $value; |
|
my $putresult = |
|
&Apache::lonnet::courseidput($dom,\%crsinfo, |
|
$chome,'notime'); |
|
} |
} |
} |
} else { |
} else { |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
$setoutput.=&mt('Unable to set').' <b>'.$name.'</b> '.&mt('to'). |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
' <b>'.$value.'</b> '.&mt('due to').' '.$put_result.'.<br />'; |
} |
} |
if (($name eq 'cloners') && ($failed_cloners)) { |
if (($name eq 'cloners') && (keys(%failed_cloners) > 0)) { |
$setoutput.= &mt('Unable to include').' - <b>'.$failed_cloners.'</b>, '. |
$setoutput.= &mt('Unable to include').': '; |
&mt('reason').' - '.&mt('LON-CAPA user(s) do(es) not exist'). |
my @fails; |
'.<br />'.&mt('Please '). |
my $num = 0; |
' <a href="/adm/createuser">'. |
if (defined($failed_cloners{'format'})) { |
&mt('add the user(s)').'</a>, '. |
$fails[$num] .= '<b>'.$failed_cloners{'format'}. |
&mt('and then return to the '). |
'</b>, '.&mt('reason').' - '. |
'<a href="/admparmset?action=crsenv">'. |
&mt('Invalid format'); |
&mt('Course Parameters page').'</a> '. |
$num ++; |
&mt('to add the new user(s) to the list of possible cloners'). |
} |
'.<br />'; |
if (defined($failed_cloners{'domain'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'domain'}. |
|
'</b>, '.&mt('reason').' - '. |
|
&mt('Domain does not exist'); |
|
$num ++; |
|
} |
|
if (defined($failed_cloners{'newuser'})) { |
|
$fails[$num] .= '<b>'.$failed_cloners{'newuser'}. '</b>, '.&mt('reason').' - '. |
|
&mt('LON-CAPA user(s) do(es) not exist.'). |
|
'.<br />'.&mt('Please '). |
|
' <a href="/adm/createuser">'. |
|
&mt('add the user(s)').'</a>, '. |
|
&mt('and then return to the '). |
|
'<a href="/adm/parmset?action=crsenv">'. |
|
&mt('Course Parameters page').'</a> '. |
|
&mt('to add the new user(s) to the list of possible cloners'); |
|
} |
|
$setoutput .= join('; ',@fails).'.<br />'; |
} |
} |
} |
} |
} |
} |
Line 2098 sub crsenv {
|
Line 2213 sub crsenv {
|
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectStyleFile=&mt('Select Style File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); |
my $output=''; |
my $output=''; |
|
my $can_categorize; |
if (! exists($values{'con_lost'})) { |
if (! exists($values{'con_lost'})) { |
my %descriptions= |
my %descriptions= |
('url' => '<b>'.&mt('Top Level Map').'</b> '. |
('url' => '<b>'.&mt('Top Level Map').'</b><br />'. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','url','sequence')\">". |
"('envform','url','sequence')\">". |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Modification may make assessment data inaccessible'). |
&mt('Modification may make assessment data inaccessible!'). |
'</span>', |
'</span>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
'('.&mt('internal').', '.&mt('optional').')', |
'('.&mt('internal, optional').')', |
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain)</tt><br />'.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'), |
'cloners' => '<b>'.&mt('Users allowed to clone course').'</b><br />' |
|
.'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")<br />' |
|
.&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'<br />' |
|
.&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"<tt>*:domain</tt>"').'<br />' |
|
.&mt('Use [_1] to allow unrestricted cloning in all domains.','"<tt>*</tt>"'), |
'grading' => '<b>'.&mt('Grading').'</b><br />'. |
'grading' => '<b>'.&mt('Grading').'</b><br />'. |
'<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'), |
&mt('[_1], [_2], or [_3]','"<tt>standard</tt>"','"<tt>external</tt>"','"<tt>spreadsheet</tt>"').&Apache::loncommon::help_open_topic('GradingOptions'), |
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'task_grading' => '<b>'.&mt('Bridge Task Grading').'</b><br />' |
|
.&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'<br />' |
|
.'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"<tt>any</tt>"','"<tt>section</tt>"').')', |
|
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b><br />'. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','default_xml_style'". |
"('envform','default_xml_style'". |
",'sty')\">$SelectStyleFile</a><br />", |
",'sty')\">$SelectStyleFile</a><br />", |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').'</b><br />' |
'</b><br />(<tt>user:domain,'. |
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
'user:domain(section;section;...;*;...),...</tt>)', |
'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').'</b>', |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'. |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />' |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'. |
'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').'</b>', |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b><br />' |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'. |
.'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")', |
'('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')', |
'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').'</b>', |
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'. |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />' |
'('.&mt('"[_1]" for visible separation','<tt>yes</tt>').', '. |
.'('.&mt('[_1] for default hiding','"<tt>yes</tt>"').')', |
&mt('changes will not show until next login').')', |
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />' |
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b>'.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.'), |
.'('.&mt('[_1] for visible separation.','"<tt>yes</tt>"').' ' |
|
.&mt('Changes will not show until next login.').')', |
'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles'). |
'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />' |
'</b><br />"<tt>st</tt>": '. |
.'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')', |
&mt('student').', "<tt>ta</tt>": '. |
'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />' |
'TA, "<tt>in</tt>": '. |
.'('.&mt('[_1] for link to each a listing of each student\'s files.','"<tt>yes</tt>"').')', |
&mt('instructor').';<br /><tt>'.&mt('role,role,...').'</tt>) '. |
'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />' |
Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
.'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')', |
|
'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').'</b><br />' |
|
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
|
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
|
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
'plc.users.denied' => |
'plc.users.denied' => |
'<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'. |
'<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'. |
'(<tt>user:domain,user:domain,...</tt>)', |
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
|
|
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles'). |
'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />' |
'</b><br />"<tt>st</tt>": '. |
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"') |
'student, "<tt>ta</tt>": '. |
.'("<tt>'.&mt('role,role,...').'</tt>") ' |
'TA, "<tt>in</tt>": '. |
.Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
'instructor;<br /><tt>role,role,...</tt>) '. |
|
Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
|
'pch.users.denied' => |
'pch.users.denied' => |
'<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'. |
'<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'. |
'(<tt>user:domain,user:domain,...</tt>)', |
'("<tt>'.&mt('user:domain,user:domain,...').'</tt>")', |
'spreadsheet_default_classcalc' |
'spreadsheet_default_classcalc' |
=> '<b>'.&mt('Default Course Spreadsheet').'</b> '. |
=> '<b>'.&mt('Default Course Spreadsheet').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','spreadsheet_default_classcalc'". |
"('envform','spreadsheet_default_classcalc'". |
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
'spreadsheet_default_studentcalc' |
'spreadsheet_default_studentcalc' |
=> '<b>'.&mt('Default Student Spreadsheet').'</b> '. |
=> '<b>'.&mt('Default Student Spreadsheet').'</b><br />'. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','spreadsheet_default_calc'". |
"('envform','spreadsheet_default_calc'". |
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
Line 2167 sub crsenv {
|
Line 2292 sub crsenv {
|
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
",'spreadsheet')\">$SelectSpreadsheetFile</a><br />", |
'allow_limited_html_in_feedback' |
'allow_limited_html_in_feedback' |
=> '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'. |
=> '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'. |
'('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')', |
'('.&mt('Set value to [_1] to allow.','"<tt>yes</tt>"').')', |
'allow_discussion_post_editing' |
'allow_discussion_post_editing' |
=> '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />"<tt>st</tt>": '. |
=> '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />' |
&mt('student').', "<tt>ta</tt>": '. |
.'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />' |
'TA, "<tt>in</tt>": '. |
.'('.&mt('Set value to [_1] to allow all roles.','"<tt>yes</tt>"').')' |
&mt('instructor').'; (<tt>'.&mt('role:section,role:section,..., e.g., st:001,st:002,in,cc would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').'</tt>)<br />'. |
.'("<tt>'.&mt('role:section,role:section,...').'</tt>")<br />' |
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
.'('.&mt('Example: "<tt>st:001,st:002,in,cc</tt>" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')', |
'rndseed' |
'rndseed' |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Randomization algorithm used').'</b><br />' |
'<span class="LC_error">'.&mt('Modifying this will make problems').' '. |
.'<span class="LC_error">' |
&mt('have different numbers and answers').'</span>', |
.&mt('Modifying this will make problems have different numbers and answers!') |
|
.'</span>', |
'receiptalg' |
'receiptalg' |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
&mt('This controls how receipt numbers are generated.'), |
&mt('This controls how receipt numbers are generated.'), |
'suppress_tries' |
'suppress_tries' |
=> '<b>'.&mt('Suppress number of tries in printing').'</b><br />'. |
=> '<b>'.&mt('Suppress number of tries in printing').'</b><br />'. |
' ('.&mt('"[_1]" to suppress, anything else to not suppress','<tt>yes</tt>').')', |
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
'problem_stream_switch' |
'problem_stream_switch' |
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'. |
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'. |
' ('.&mt('"[_1]" if allowed, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('[_1] if allowed, anything else if not','"<tt>yes</tt>"').')', |
'default_paper_size' |
'default_paper_size' |
=> '<b>'.&mt('Default paper type').'</b><br />'. |
=> '<b>'.&mt('Default paper type').'</b><br />'. |
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
'print_header_format' |
'print_header_format' |
=> '<b>Print header format; substitutions: %n student name %c course id %a assignment', |
=> ' <b>'.&mt('Print header format').'</b><br />' |
'anonymous_quiz' |
.&mt('Substitutions:<br />[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the <tt>%</tt> limit the field size.','"<tt>%n</tt>"','"<tt>%c</tt>"','"<tt>%a</tt>"'), |
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
|
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
|
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'. |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b><br />' |
'<br />(<tt>user:domain,user:domain,...</tt>)', |
.'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")', |
'languages' => '<b>'.&mt('Languages used').'</b>', |
'languages' => '<b>'.&mt('Languages used').'</b>', |
'disable_receipt_display' |
'disable_receipt_display' |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
'task_messages' |
'task_messages' |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>', |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','"<tt>only_student</tt>"','"<tt>student_and_user_notes_screen</tt>"').')', |
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
Line 2216 sub crsenv {
|
Line 2340 sub crsenv {
|
'externalsyllabus' |
'externalsyllabus' |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
=> '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>', |
'tthoptions' |
'tthoptions' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>' |
=> '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>', |
); |
|
my @Display_Order = ('url','description','courseid','cloners','grading', |
'texengine' |
|
=> '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />' |
|
.'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')', |
|
'timezone' |
|
=> '<b>'.&mt('Timezone in which the course takes place').'</b>', |
|
|
|
'suppress_embed_prompt' |
|
=> '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'. |
|
' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')', |
|
'hidefromcat' |
|
=> '<b>'.&mt('Exclude from course catalog').'</b><br />'. |
|
' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')', |
|
'categories' |
|
=> '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'. |
|
&mt('Display Categories').'</a>', |
|
); |
|
my @Display_Order = ('url','description','courseid','cloners'); |
|
(my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); |
|
if ($can_toggle_cat) { |
|
push(@Display_Order,'hidefromcat'); |
|
} |
|
if ($can_categorize) { |
|
push(@Display_Order,'categories'); |
|
} |
|
push (@Display_Order,('grading', |
'externalsyllabus', |
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
'question.email','comment.email','policy.email', |
'question.email','question.email.text','comment.email', |
|
'comment.email.text','policy.email','policy.email.text', |
'student_classlist_view', |
'student_classlist_view', |
|
'student_classlist_opt_in', |
|
'student_classlist_portfiles', |
'plc.roles.denied','plc.users.denied', |
'plc.roles.denied','plc.users.denied', |
'pch.roles.denied','pch.users.denied', |
'pch.roles.denied','pch.users.denied', |
'allow_limited_html_in_feedback', |
'allow_limited_html_in_feedback', |
'allow_discussion_post_editing', |
'allow_discussion_post_editing', |
'languages', |
'languages', |
|
'timezone', |
'nothideprivileged', |
'nothideprivileged', |
'rndseed', |
'rndseed', |
'receiptalg', |
'receiptalg', |
'problem_stream_switch', |
'problem_stream_switch', |
'suppress_tries', |
'suppress_tries', |
|
'suppress_embed_prompt', |
'default_paper_size', |
'default_paper_size', |
'print_header_format', |
'print_header_format', |
'disable_receipt_display', |
'disable_receipt_display', |
Line 2243 sub crsenv {
|
Line 2396 sub crsenv {
|
'default_enrollment_start_date', |
'default_enrollment_start_date', |
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'tthoptions', |
'tthoptions', |
|
'texengine', |
'disablesigfigs', |
'disablesigfigs', |
'disableexampointprint', |
'disableexampointprint', |
'task_messages' |
'task_messages','task_grading')); |
); |
|
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || |
|
($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) |
|
|| ($parameter eq 'type')) { |
if (! $descriptions{$parameter}) { |
if (! $descriptions{$parameter}) { |
$descriptions{$parameter}=$parameter; |
$descriptions{$parameter}=$parameter; |
push(@Display_Order,$parameter); |
push(@Display_Order,$parameter); |
Line 2271 sub crsenv {
|
Line 2426 sub crsenv {
|
$values{$parameter}, |
$values{$parameter}, |
$onchange). |
$onchange). |
'</td>'; |
'</td>'; |
|
} elsif ($parameter eq 'timezone') { |
|
my $includeempty = 1; |
|
my $timezone = &Apache::lonlocal::gettimezone(); |
|
$output .= '<td>'. |
|
&Apache::loncommon::select_timezone($parameter.'_value', |
|
$timezone, |
|
$onchange,$includeempty).'</td>'; |
|
} elsif ($parameter eq 'categories') { |
|
my $catdisplay; |
|
if ($values{'categories'} ne '') { |
|
my @curritems = split(/\&/,$values{'categories'}); |
|
foreach my $item (@curritems) { |
|
my ($name,$parent,$pos) = split(/:/,$item); |
|
$catdisplay .= &unescape($name).'&'; |
|
} |
|
$catdisplay =~ s/\&$//; |
|
} |
|
$output .= '<td>'. |
|
'<input type="hidden" name="categories_value" value="'. |
|
$values{'categories'}.'" />'. |
|
'<input type="textbox" name="categories_display" value="'. |
|
$catdisplay.'" readonly="readonly" size="40" /></td>'; |
} else { |
} else { |
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::textbox($parameter.'_value', |
&Apache::lonhtmlcommon::textbox($parameter.'_value', |
Line 2297 sub crsenv {
|
Line 2474 sub crsenv {
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'par' => 'Parameter', |
'par' => 'Parameter', |
'val' => 'Value', |
'val' => 'Value', |
'set' => 'Set', |
'set' => 'Set?', |
'sce' => 'Set Course Environment' |
'sav' => 'Save' |
); |
); |
|
|
my $Parameter=&mt('Parameter'); |
my $Parameter=&mt('Parameter'); |
my $Value=&mt('Value'); |
my $Value=&mt('Value'); |
my $Set=&mt('Set'); |
my $Set=&mt('Set'); |
my $browse_js= |
my ($jscript,$categorize_js); |
'<script type="text/javascript" language="Javascript">'. |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
if ($can_categorize) { |
'</script>'; |
$categorize_js = <<ENDSCRIPT; |
|
function catsbrowser() { |
|
var catswin = null; |
|
var url = '/adm/parmset?action=categorizecourse'; |
|
if (!catswin || catswin.closed) { |
|
catswin=window.open(url,'categorieswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
|
} else { |
|
catswin.focus(); |
|
} |
|
} |
|
ENDSCRIPT |
|
} |
|
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
|
$browse_js."\n".$categorize_js."\n".'</script>'; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set Course Environment', |
&Apache::loncommon::start_page('Set Course Environment', |
$browse_js); |
$jscript); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
my $end_table=&Apache::loncommon::end_data_table(); |
my $end_table=&Apache::loncommon::end_data_table(); |
Line 2320 $start_page
|
Line 2509 $start_page
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
|
<div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div> |
$start_table |
$start_table |
$start_header_row |
$start_header_row |
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th> |
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th> |
$end_header_row |
$end_header_row |
$output |
$output |
$end_table |
$end_table |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
<input type="submit" name="crsenv" value="$lt{'sav'}" /> |
</form> |
</form> |
$end_page |
$end_page |
ENDENV |
ENDENV |
} |
} |
|
|
|
sub can_modify_catsettings { |
|
my ($dom) = @_; |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
|
my ($can_toggle_cat,$can_categorize); |
|
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
|
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { |
|
$can_toggle_cat = 1; |
|
} |
|
if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { |
|
$can_categorize = 1; |
|
} |
|
} |
|
return ($can_toggle_cat,$can_categorize); |
|
} |
|
|
|
sub assign_course_categories { |
|
my ($r) = @_; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $hascats = 0; |
|
my $cathash; |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); |
|
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconf{'coursecategories'}{'cats'}; |
|
if (ref($cathash) eq 'HASH') { |
|
$hascats = 1; |
|
} |
|
} |
|
my $catwin_js; |
|
if ($hascats) { |
|
my $alert = &mt('Use \"Save\" in the main window to save course categories'); |
|
$catwin_js = <<ENDSCRIPT; |
|
<script type="text/javascript"> |
|
|
|
function updateCategories() { |
|
var newcategories = ''; |
|
var unescapedcats = ''; |
|
if (document.chgcats.usecategory.length) { |
|
for (var i=0; i<document.chgcats.usecategory.length; i++) { |
|
if (document.chgcats.usecategory[i].checked == true) { |
|
newcategories = newcategories + document.chgcats.usecategory[i].value + '&'; |
|
unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & '; |
|
} |
|
} |
|
if (newcategories.length > 0) { |
|
newcategories = newcategories.slice(0,-1); |
|
} |
|
if (unescapedcats.length > 0) { |
|
unescapedcats = unescapedcats.slice(0,-3); |
|
} |
|
} else { |
|
if (document.chgcats.usecategory.checked == true) { |
|
newcategories = document.chgcats.usecategory.value; |
|
unescapedcats = document.chgcats.catname.value; |
|
} |
|
} |
|
opener.document.envform.categories_value.value = newcategories; |
|
opener.document.envform.categories_display.value = unescapedcats; |
|
opener.document.envform.categories_setparmval.checked = true; |
|
alert("$alert"); |
|
self.close(); |
|
return; |
|
} |
|
|
|
</script> |
|
ENDSCRIPT |
|
} else { |
|
my $onload; |
|
} |
|
my $start_page = |
|
&Apache::loncommon::start_page('Course Categories',$catwin_js, |
|
{'only_body' => 1,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>'; |
|
if ($hascats) { |
|
my %currsettings = |
|
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); |
|
$categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'. |
|
'<form name="chgcats" action="/adm/parmset" method="post">'."\n" |
|
.&Apache::loncommon::assign_categories_table($cathash, |
|
$currsettings{'categories'})."\n" |
|
.'<br /><input type="button" name="changes" value="' |
|
.&mt('Copy to main window').'" ' |
|
.'onclick="javascript:updateCategories()" /></form><br />'; |
|
} else { |
|
$categoriesform .= &mt('No categories defined for this domain'); |
|
} |
|
$r->print($start_page.$categoriesform.$end_page); |
|
return; |
|
} |
|
|
################################################## |
################################################## |
# Overview mode |
# Overview mode |
################################################## |
################################################## |
Line 2363 sub readdata {
|
Line 2645 sub readdata {
|
|
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach (keys %$classlist) { |
# the following undefs are for 'domain', and 'username' respectively. |
if ($_=~/^($match_username)\:($match_domain)$/) { |
if ($_=~/^(\w+)\:(\w+)$/) { |
|
my ($tuname,$tudom)=($1,$2); |
my ($tuname,$tudom)=($1,$2); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
foreach my $userkey (keys %{$useropt}) { |
foreach my $userkey (keys %{$useropt}) { |
Line 2400 sub storedata {
|
Line 2681 sub storedata {
|
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my $data=$env{$_}; |
my ($data, $typeof, $text); |
my $typeof=$env{'form.typeof_'.$thiskey}; |
if ($cmd eq 'set') { |
if ($$olddata{$thiskey} ne $data) { |
$data=$env{$_}; |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified parameter for'); |
|
} elsif ($cmd eq 'datepointer') { |
|
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.$text.' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2434 sub storedata {
|
Line 2727 sub storedata {
|
} else { |
} else { |
push (@deldata,$thiskey,$thiskey.'.type'); |
push (@deldata,$thiskey,$thiskey.'.type'); |
} |
} |
} elsif ($cmd eq 'datepointer') { |
|
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
|
my $typeof=$env{'form.typeof_'.$thiskey}; |
|
if (defined($data) and $$olddata{$thiskey} ne $data) { |
|
if ($tuname) { |
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
|
$tkey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
|
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error storing parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
|
$newdata{$thiskey}=$data; |
|
$newdata{$thiskey.'.type'}=$typeof; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 2475 sub storedata {
|
Line 2748 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') { |
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
Line 2486 sub storedata {
|
Line 2759 sub storedata {
|
|
|
sub extractuser { |
sub extractuser { |
my $key=shift; |
my $key=shift; |
return ($key=~/^$env{'request.course.id'}.\[useropt\:(\w+)\:(\w+)\]\./); |
return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./); |
|
} |
|
|
|
sub parse_listdata_key { |
|
my ($key,$listdata) = @_; |
|
# split into student/section affected, and |
|
# the realm (folder/resource part and parameter |
|
my ($student,$realm) = |
|
($key=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)$/); |
|
# if course wide student would be undefined |
|
if (!defined($student)) { |
|
($realm)=($key=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
# strip off the .type if it's not the Question type parameter |
|
if ($realm=~/\.type$/ && !exists($listdata->{$key.'.type'})) { |
|
$realm=~s/\.type//; |
|
} |
|
# split into resource+part and parameter name |
|
my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/); |
|
($res, my $part) = ($res =~/^(.*)\.(.*)$/); |
|
return ($student,$res,$part,$parm); |
} |
} |
|
|
sub listdata { |
sub listdata { |
Line 2500 sub listdata {
|
Line 2793 sub listdata {
|
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
|
foreach my $thiskey (sort { |
foreach my $thiskey (sort { |
|
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
|
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
|
|
# get the numerical order for the param |
|
$aparm=$keyorder{'parameter_0_'.$aparm}; |
|
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
|
|
my $result=0; |
|
|
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
my ($astudent,$arealm)=($a=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
if ($ares ne $bres ) { |
my ($bstudent,$brealm)=($b=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)\.[^\.]+$/); |
$result = ($ares cmp $bres); |
if (!defined($astudent)) { |
} elsif ($astudent ne $bstudent) { |
($arealm)=($a=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
$result = ($astudent cmp $bstudent); |
} |
} elsif ($apart ne $bpart ) { |
if (!defined($bstudent)) { |
$result = ($apart cmp $bpart); |
($brealm)=($b=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
|
} |
|
$arealm=~s/\.type//; |
|
my ($ares, $aparm) = ($arealm=~/^(.*)\.(.*)$/); |
|
$aparm=$keyorder{'parameter_0_'.$aparm}; |
|
$brealm=~s/\.type//; |
|
my ($bres, $bparm) = ($brealm=~/^(.*)\.(.*)$/); |
|
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
if ($ares eq $bres) { |
|
if (defined($aparm) && defined($bparm)) { |
|
($aparm <=> $bparm); |
|
} elsif (defined($aparm)) { |
|
-1; |
|
} elsif (defined($bparm)) { |
|
1; |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
|
} else { |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} |
} |
} else { |
} else { |
$a cmp $b; |
if ($astudent ne $bstudent) { |
|
$result = ($astudent cmp $bstudent); |
|
} elsif ($ares ne $bres ) { |
|
$result = ($ares cmp $bres); |
|
} elsif ($apart ne $bpart ) { |
|
$result = ($apart cmp $bpart); |
|
} |
|
} |
|
|
|
if (!$result) { |
|
if (defined($aparm) && defined($bparm)) { |
|
$result = ($aparm <=> $bparm); |
|
} elsif (defined($aparm)) { |
|
$result = -1; |
|
} elsif (defined($bparm)) { |
|
$result = 1; |
|
} |
} |
} |
|
|
|
$result; |
} keys %{$listdata}) { |
} keys %{$listdata}) { |
|
|
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($$resourcedata{$thiskey.'.type'}) { |
Line 2544 sub listdata {
|
Line 2845 sub listdata {
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:(\w+)\:(\w+)/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
} else { |
} else { |
$section=&mt('Group/Section').': '.$issection; |
$section=&mt('Group/Section').': '.$issection; |
Line 2606 sub listdata {
|
Line 2907 sub listdata {
|
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'',''). |
'',1,'',''). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
|
(($$resourcedata{$thiskey}!=0)?'<a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
|
&mt('Shift all dates based on this date').'</a>':''). |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'string_yesno') { |
} elsif ($thistype eq 'date_interval') { |
my $showval; |
$r->print(&date_interval_selector($thiskey, |
if (defined($$resourcedata{$thiskey})) { |
$$resourcedata{$thiskey})); |
$showval=$$resourcedata{$thiskey}; |
} elsif ($thistype =~ m/^string/) { |
} |
$r->print(&string_selector($thistype,$thiskey, |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
$$resourcedata{$thiskey})); |
'" value="yes"'); |
|
if ($showval eq 'yes') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('Yes').'</label> '); |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="no"'); |
|
if ($showval eq 'no') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('No').'</label>'); |
|
} else { |
} else { |
my $showval; |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} |
|
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
|
$showval.'">'); |
|
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
Line 2641 sub listdata {
|
Line 2928 sub listdata {
|
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
|
|
|
sub date_interval_selector { |
|
my ($thiskey, $showval) = @_; |
|
my $result; |
|
foreach my $which (['days', 86400, 31], |
|
['hours', 3600, 23], |
|
['minutes', 60, 59], |
|
['seconds', 1, 59]) { |
|
my ($name, $factor, $max) = @{ $which }; |
|
my $amount = int($showval/$factor); |
|
$showval %= $factor; |
|
my %select = ((map {$_ => $_} (0..$max)), |
|
'select_form_order' => [0..$max]); |
|
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
|
%select); |
|
$result .= ' '.&mt($name); |
|
} |
|
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
|
return $result; |
|
|
|
} |
|
|
|
sub get_date_interval_from_form { |
|
my ($key) = @_; |
|
my $seconds = 0; |
|
foreach my $which (['days', 86400], |
|
['hours', 3600], |
|
['minutes', 60], |
|
['seconds', 1]) { |
|
my ($name, $factor) = @{ $which }; |
|
if (defined($env{'form.'.$name.'_'.$key})) { |
|
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
|
} |
|
} |
|
return $seconds; |
|
} |
|
|
|
|
|
sub default_selector { |
|
my ($thiskey, $showval) = @_; |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
|
} |
|
|
|
my %strings = |
|
( |
|
'string_yesno' |
|
=> [[ 'yes', 'Yes' ], |
|
[ 'no', 'No' ]], |
|
'string_problemstatus' |
|
=> [[ 'yes', 'Yes' ], |
|
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
|
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
|
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
); |
|
|
|
|
|
sub string_selector { |
|
my ($thistype, $thiskey, $showval) = @_; |
|
|
|
if (!exists($strings{$thistype})) { |
|
return &default_selector($thiskey,$showval); |
|
} |
|
|
|
my $result; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
my ($name, $description) = @{ $possibilities }; |
|
$result .= '<label><input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label> '; |
|
} |
|
return $result; |
|
} |
|
|
|
# |
|
# Shift all start and end dates by $shift |
|
# |
|
|
|
sub dateshift { |
|
my ($shift)=@_; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
|
# ugly retro fix for broken version of types |
|
foreach my $key (keys %data) { |
|
if ($key=~/\wtype$/) { |
|
my $newkey=$key; |
|
$newkey=~s/type$/\.type/; |
|
$data{$newkey}=$data{$key}; |
|
delete $data{$key}; |
|
} |
|
} |
|
my %storecontent=(); |
|
# go through all parameters and look for dates |
|
foreach my $key (keys %data) { |
|
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
|
my $newdate=$data{$key}+$shift; |
|
$storecontent{$key}=$newdate; |
|
} |
|
} |
|
my $reply=&Apache::lonnet::cput |
|
('resourcedata',\%storecontent,$dom,$crs); |
|
if ($reply eq 'ok') { |
|
&log_parmset(\%storecontent); |
|
} |
|
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
|
return $reply; |
|
} |
|
|
sub newoverview { |
sub newoverview { |
my ($r) = @_; |
my ($r) = @_; |
|
|
Line 2682 ENDOVER
|
Line 3080 ENDOVER
|
my @selected_sections = |
my @selected_sections = |
&Apache::loncommon::get_env_multiple('form.Section'); |
&Apache::loncommon::get_env_multiple('form.Section'); |
@selected_sections = ('all') if (! @selected_sections); |
@selected_sections = ('all') if (! @selected_sections); |
foreach (@selected_sections) { |
foreach my $sec (@selected_sections) { |
if ($_ eq 'all') { |
if ($sec eq 'all') { |
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
Line 2703 ENDOVER
|
Line 3101 ENDOVER
|
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
|
|
|
if (grep {$_ eq 'all'} (@psprt)) { |
|
@psprt = keys(%allparts); |
|
} |
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
$r->print('<table id="LC_parm_overview_scope"> |
$r->print('<table id="LC_parm_overview_scope"> |
Line 2759 ENDOVER
|
Line 3160 ENDOVER
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
&listdata($r,$resourcedata,$listdata,$sortorder); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
'</form>'.&Apache::loncommon::end_page()); |
'</form>'.&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 2868 ENDOVER
|
Line 3269 ENDOVER
|
next if (!exists($resourcedata->{$thiskey.'.type'}) |
next if (!exists($resourcedata->{$thiskey.'.type'}) |
&& $thiskey=~/\.type$/); |
&& $thiskey=~/\.type$/); |
my %data = &parse_key($thiskey); |
my %data = &parse_key($thiskey); |
if (exists($data{'realm_exists'}) |
if (1) { #exists($data{'realm_exists'}) |
&& !$data{'realm_exists'}) { |
#&& !$data{'realm_exists'}) { |
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<tr>'. |
'<tr>'. |
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
|
|
$r->print('<td>'); |
$r->print('<td>'); |
|
my $display_value = $resourcedata->{$thiskey}; |
|
if (&isdateparm($resourcedata->{$thiskey.'.type'})) { |
|
$display_value = |
|
&Apache::lonlocal::locallocaltime($display_value); |
|
} |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
&standard_parameter_names($data{'parameter_name'}), |
&standard_parameter_names($data{'parameter_name'}), |
$resourcedata->{$thiskey})); |
$resourcedata->{$thiskey})); |
Line 2899 ENDOVER
|
Line 3305 ENDOVER
|
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$url,$resid,$map)); |
$url,$resid,$map)); |
} |
} |
$r->print(&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
|
|
} |
} |
Line 2910 ENDOVER
|
Line 3316 ENDOVER
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub date_shift_one { |
|
my ($r) = @_; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
|
$r->print(<<ENDOVER); |
|
$start_page |
|
$breadcrumbs |
|
ENDOVER |
|
$r->print('<form name="shiftform" method="post">'. |
|
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
|
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
|
&Apache::lonhtmlcommon::date_setter('shiftform', |
|
'timeshifted', |
|
$env{'form.timebase'},, |
|
''). |
|
'</td></tr></table>'. |
|
'<input type="hidden" name="action" value="dateshift2" />'. |
|
'<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'. |
|
'<input type="submit" value="'.&mt('Shift all dates accordingly').'" /></form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub date_shift_two { |
|
my ($r) = @_; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
|
$r->print(<<ENDOVER); |
|
$start_page |
|
$breadcrumbs |
|
ENDOVER |
|
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
|
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted))); |
|
my $delta=$timeshifted-$env{'form.timebase'}; |
|
&dateshift($delta); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
sub parse_key { |
sub parse_key { |
my ($key) = @_; |
my ($key) = @_; |
my %data; |
my %data; |
Line 2918 sub parse_key {
|
Line 3369 sub parse_key {
|
$data{'scope_type'} = 'all'; |
$data{'scope_type'} = 'all'; |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$data{'scope'} = $1; |
$data{'scope'} = $1; |
if ($data{'scope'}=~/^useropt\:(\w+)\:(\w+)/) { |
if ($data{'scope'}=~/^useropt\:($match_username)\:($match_domain)/) { |
$data{'scope_type'} = 'user'; |
$data{'scope_type'} = 'user'; |
$data{'scope'} = [$1,$2]; |
$data{'scope'} = [$1,$2]; |
} else { |
} else { |
Line 2935 sub parse_key {
|
Line 3386 sub parse_key {
|
$data{'realm_type'} = 'folder'; |
$data{'realm_type'} = 'folder'; |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
&Apache::lonnet::logthis($1." siad ". $data{'realm_exists'} ); |
|
} elsif ($middle) { |
} elsif ($middle) { |
$data{'realm'} = $middle; |
$data{'realm'} = $middle; |
$data{'realm_type'} = 'symb'; |
$data{'realm_type'} = 'symb'; |
Line 2982 where $action is add or drop, and $clone
|
Line 3432 where $action is add or drop, and $clone
|
user for whom cloning ability is to be changed in course. |
user for whom cloning ability is to be changed in course. |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
sub extract_cloners { |
sub extract_cloners { |
my ($clonelist,$allowclone) = @_; |
my ($clonelist,$allowclone) = @_; |
if ($clonelist =~ /,/) { |
if ($clonelist =~ /,/) { |
@{$allowclone} = split/,/,$clonelist; |
@{$allowclone} = split(/,/,$clonelist); |
} else { |
} else { |
$$allowclone[0] = $clonelist; |
$$allowclone[0] = $clonelist; |
} |
} |
} |
} |
|
|
|
|
sub check_cloners { |
sub check_cloners { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
my ($clean_clonelist,$disallowed); |
my ($clean_clonelist,%disallowed); |
my @allowclone = (); |
my @allowclone = (); |
&extract_cloners($$clonelist,\@allowclone); |
&extract_cloners($$clonelist,\@allowclone); |
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
my ($uname,$udom) = split/:/,$currclone; |
if ($currclone eq '*') { |
if ($uname && $udom) { |
$clean_clonelist .= $currclone.','; |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
} else { |
$disallowed .= $currclone.','; |
my ($uname,$udom) = split(/:/,$currclone); |
|
if ($uname eq '*') { |
|
if ($udom =~ /^$match_domain$/) { |
|
if (!&Apache::lonnet::domain($udom)) { |
|
$disallowed{'domain'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} else { |
|
$disallowed{'format'} .= $currclone.','; |
|
} |
|
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
|
$disallowed{'format'} .= $currclone.','; |
} else { |
} else { |
$clean_clonelist .= $currclone.','; |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
$clean_clonelist .= $currclone.','; |
$clean_clonelist .= $currclone.','; |
} |
} |
} |
} |
if ($disallowed) { |
foreach my $key (keys(%disallowed)) { |
$disallowed =~ s/,$//; |
$disallowed{$key} =~ s/,$//; |
} |
} |
if ($clean_clonelist) { |
if ($clean_clonelist) { |
$clean_clonelist =~ s/,$//; |
$clean_clonelist =~ s/,$//; |
} |
} |
$$clonelist = $clean_clonelist; |
$$clonelist = $clean_clonelist; |
return $disallowed; |
return %disallowed; |
} |
} |
|
|
sub change_clone { |
sub change_clone { |
my ($clonelist,$oldcloner) = @_; |
my ($clonelist,$oldcloner) = @_; |
Line 3036 sub change_clone {
|
Line 3501 sub change_clone {
|
my @allowclone; |
my @allowclone; |
&extract_cloners($clonelist,\@allowclone); |
&extract_cloners($clonelist,\@allowclone); |
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep/^$currclone$/,@$oldcloner) { |
if (!grep(/^$currclone$/,@$oldcloner)) { |
($uname,$udom) = split/:/,$currclone; |
if ($currclone ne '*') { |
if ($uname && $udom) { |
($uname,$udom) = split(/:/,$currclone); |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if ($uname && $udom && $uname ne '*') { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} eq '') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
$currclonecrs{'cloneable'} = $clone_crs; |
if ($currclonecrs{'cloneable'} eq '') { |
} else { |
$currclonecrs{'cloneable'} = $clone_crs; |
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
} |
} |
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
foreach my $oldclone (@$oldcloner) { |
foreach my $oldclone (@$oldcloner) { |
if (!grep/^$oldclone$/,@allowclone) { |
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
($uname,$udom) = split/:/,$oldclone; |
if ($oldclone ne '*') { |
if ($uname && $udom) { |
($uname,$udom) = split(/:/,$oldclone); |
unless (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if ($uname && $udom && $uname ne '*' ) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
my %newclonecrs = (); |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my %newclonecrs = (); |
if ($currclonecrs{'cloneable'} =~ /,/) { |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
if ($currclonecrs{'cloneable'} =~ /,/) { |
foreach (@currclonecrs) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
unless ($_ eq $clone_crs) { |
foreach my $crs (@currclonecrs) { |
$newclonecrs{'cloneable'} .= $_.','; |
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
} |
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
} |
} |
$newclonecrs{'cloneable'} =~ s/,$//; |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
} |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |
Line 3111 ENDMAINFORMHEAD
|
Line 3580 ENDMAINFORMHEAD
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
|
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
|
my @menu = |
my @menu = |
( { divider=>'Settings for Your Course', |
( { divider=>'Settings for Your Course', |
Line 3128 ENDMAINFORMHEAD
|
Line 3598 ENDMAINFORMHEAD
|
url => '/adm/slotrequest?command=showslots', |
url => '/adm/slotrequest?command=showslots', |
permission => $vgr, |
permission => $vgr, |
}, |
}, |
|
{ text => 'Reset Student Access Times', |
|
url => '/adm/helper/resettimes.helper', |
|
permission => $mgr, |
|
}, |
|
|
{ text => 'Set Parameter Setting Default Actions', |
{ text => 'Set Parameter Setting Default Actions', |
action => 'setdefaults', |
action => 'setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
Line 3197 sub output_row {
|
Line 3672 sub output_row {
|
$values = ''; |
$values = ''; |
} |
} |
if (!($options =~ /deleted/)) { |
if (!($options =~ /deleted/)) { |
$output.='<strong>'.$field_text.':</strong>'; |
|
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
|
|
|
my @options= ( ['active', 'Show to student'], |
my @options= ( ['active', 'Show to student'], |
['onlyone','Student may select only one choice'], |
['stuadd', 'Provide text area for students to type catalog information'], |
['stuadd', 'Student may type choices']); |
['choices','Provide choices for students to select from']); |
|
# ['onlyone','Student may select only one choice']); |
if ($added_flag) { |
if ($added_flag) { |
push @options,['deleted', 'Delete Metadata Field']; |
push @options,['deleted', 'Delete Metadata Field']; |
} |
} |
|
$output = &Apache::loncommon::start_data_table_row(); |
|
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
foreach my $opt (@options) { |
foreach my $opt (@options) { |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
$output .= &Apache::loncommon::continue_data_table_row(); |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
$output .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label> |
&mt($opt->[1]).'</label> <br />'; |
<input type="checkbox" name="'. |
} |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label></span> </td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
} |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
my $multiple_checked; |
|
my $single_checked; |
|
if ($options =~ m/onlyone/) { |
|
$multiple_checked = ""; |
|
$single_checked = " CHECKED "; |
|
} else { |
|
$multiple_checked = " CHECKED "; |
|
$single_checked = ""; |
|
} |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
|
<input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/> |
|
Student may select multiple choices from list</span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
|
<input type="radio" name="'.$field_name.'_onlyone" value="single" '.$single_checked.'/> |
|
Student may select only one choice from list</span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
return ($output); |
return ($output); |
} |
} |
|
sub order_meta_fields { |
|
my ($r)=@_; |
|
my $idx = 1; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"/adm/parmset?action=setrestrictmeta", |
|
text=>"Restrict Metadata"}, |
|
{text=>"Order Metadata"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
|
if ($env{'form.storeorder'}) { |
|
my $newpos = $env{'form.newpos'} - 1; |
|
my $currentpos = $env{'form.currentpos'} - 1; |
|
my @neworder = (); |
|
my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
|
my $i; |
|
if ($newpos > $currentpos) { |
|
# moving stuff up |
|
for ($i=0;$i<$currentpos;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
for ($i=$currentpos;$i<$newpos;$i++) { |
|
$neworder[$i]=$oldorder[$i+1]; |
|
} |
|
$neworder[$newpos]=$oldorder[$currentpos]; |
|
for ($i=$newpos+1;$i<=$#oldorder;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
} else { |
|
# moving stuff down |
|
for ($i=0;$i<$newpos;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
$neworder[$newpos]=$oldorder[$currentpos]; |
|
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
|
$neworder[$i]=$oldorder[$i-1]; |
|
} |
|
for ($i=$currentpos+1;$i<=$#oldorder;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
} |
|
my $ordered_fields = join ",", @neworder; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
|
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields}); |
|
} |
|
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
|
my $ordered_fields; |
|
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
|
if (!@fields_in_order) { |
|
# no order found, pick sorted order then create metadata.addedorder key. |
|
foreach my $key (sort keys %$fields) { |
|
push @fields_in_order, $key; |
|
$ordered_fields = join ",", @fields_in_order; |
|
} |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
|
} |
|
$r->print('<table>'); |
|
my $num_fields = scalar(@fields_in_order); |
|
foreach my $key (@fields_in_order) { |
|
$r->print('<tr><td>'); |
|
$r->print('<form method="post" action="">'); |
|
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
|
for (my $i = 1;$i le $num_fields;$i ++) { |
|
if ($i eq $idx) { |
|
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
|
} else { |
|
$r->print('<option value="'.$i.'">'.$i.'</option>'); |
|
} |
|
} |
|
$r->print('</select></td><td>'); |
|
$r->print('<input type="hidden" name="currentpos" value="'.$idx.'" />'); |
|
$r->print('<input type="hidden" name="storeorder" value="true" />'); |
|
$r->print('</form>'); |
|
$r->print($$fields{$key}.'</td></tr>'); |
|
$idx ++; |
|
} |
|
$r->print('</table>'); |
|
return 'ok'; |
|
} |
|
sub continue { |
|
my $output; |
|
$output .= '<form action="" method="post">'; |
|
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
|
$output .= '<input type="submit" value="Continue" />'; |
|
return ($output); |
|
} |
sub addmetafield { |
sub addmetafield { |
my ($r)=@_; |
my ($r)=@_; |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
Line 3222 sub addmetafield {
|
Line 3812 sub addmetafield {
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
if (exists($env{'form.undelete'})) { |
if (exists($env{'form.undelete'})) { |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undelete'); |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); |
foreach my $meta_field(@meta_fields) { |
foreach my $meta_field(@meta_fields) { |
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
$options =~ s/deleted//; |
$options =~ s/deleted//; |
Line 3232 sub addmetafield {
|
Line 3822 sub addmetafield {
|
|
|
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
} |
} |
$r->print('<form action="" method="post">'); |
$r->print(&continue()); |
$r->print('<input type="hidden" name="action" value="setrestrictmeta" />'); |
|
$r->print('<input type="submit" value="Continue" />'); |
|
} elsif (exists($env{'form.fieldname'})) { |
} elsif (exists($env{'form.fieldname'})) { |
my $meta_field = $env{'form.fieldname'}; |
my $meta_field = $env{'form.fieldname'}; |
my $display_field = $env{'form.fieldname'}; |
my $display_field = $env{'form.fieldname'}; |
Line 3244 sub addmetafield {
|
Line 3832 sub addmetafield {
|
{'metadata.'.$meta_field.'.values'=>"", |
{'metadata.'.$meta_field.'.values'=>"", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
$r->print('Added new Metadata Field '.$env{'form.fieldname'}." with result ".$put_result); |
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
|
$r->print(&continue()); |
} else { |
} else { |
my $fields = &get_deleted_meta_fieldnames(); |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
if ($fields) { |
if ($fields) { |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
foreach my $key(keys(%$fields)) { |
foreach my $key(keys(%$fields)) { |
$r->print('<input type="checkbox" name="undelete" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
} |
} |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
Line 3259 sub addmetafield {
|
Line 3848 sub addmetafield {
|
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('</form>'); |
|
} |
} |
|
$r->print('</form>'); |
} |
} |
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
Line 3285 sub setrestrictmeta {
|
Line 3874 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_stuadd'}) { |
if ($env{'form.'.$meta_field.'_stuadd'}) { |
$options.='stuadd,'; |
$options.='stuadd,'; |
} |
} |
if ($env{'form.'.$meta_field.'_onlyone'}) { |
if ($env{'form.'.$meta_field.'_choices'}) { |
|
$options.='choices,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') { |
$options.='onlyone,'; |
$options.='onlyone,'; |
} |
} |
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
Line 3294 sub setrestrictmeta {
|
Line 3886 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_deleted'}) { |
if ($env{'form.'.$meta_field.'_deleted'}) { |
$options.='deleted,'; |
$options.='deleted,'; |
} |
} |
|
|
my $name = $save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options, |
{'metadata.'.$meta_field.'.options'=>$options, |
Line 3309 sub setrestrictmeta {
|
Line 3900 sub setrestrictmeta {
|
# Get the default metadata fields |
# Get the default metadata fields |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
# Now get possible added metadata fields |
# Now get possible added metadata fields |
my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields); |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
|
my $row_alt = 1; |
|
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
if ($field ne 'courserestricted') { |
if ($field ne 'courserestricted') { |
|
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
} |
} |
|
my $buttons = (<<ENDButtons); |
|
<input type="submit" name="restrictmeta" value="Save" /> |
|
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
|
</form> |
|
<br /> |
|
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
|
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
|
ENDButtons |
my $added_flag = 1; |
my $added_flag = 1; |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag); |
$row_alt = $row_alt ? 0 : 1; |
|
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); |
} |
} |
|
$output .= &Apache::loncommon::end_data_table(); |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<p> |
|
$output |
$output |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
$buttons |
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field"> |
|
</form> |
</form> |
ENDenv |
ENDenv |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
Line 3334 ENDenv
|
Line 3936 ENDenv
|
} |
} |
################################################## |
################################################## |
sub get_added_meta_fieldnames { |
sub get_added_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |
$fields{$field_name} = $display_field_name; |
$fields{$field_name} = $display_field_name; |
Line 3346 sub get_added_meta_fieldnames {
|
Line 3948 sub get_added_meta_fieldnames {
|
return \%fields; |
return \%fields; |
} |
} |
sub get_deleted_meta_fieldnames { |
sub get_deleted_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |
Line 3514 ENDYESNO
|
Line 4116 ENDYESNO
|
} |
} |
$r->print(&Apache::loncommon::end_data_table(). |
$r->print(&Apache::loncommon::end_data_table(). |
"\n<input type='submit' name='storerules' value='". |
"\n<input type='submit' name='storerules' value='". |
&mt('Store Rules')."' /></form>\n". |
&mt('Save Rules')."' /></form>\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 3611 sub parm_change_log {
|
Line 4213 sub parm_change_log {
|
\%saveable_parameters); |
\%saveable_parameters); |
&Apache::loncommon::restore_course_settings('parameter_log', |
&Apache::loncommon::restore_course_settings('parameter_log', |
\%saveable_parameters); |
\%saveable_parameters); |
if (!$env{'form.show'}) { $env{'form.show'}=10; } |
$r->print(&Apache::loncommon::display_filter(). |
|
|
my $countselect = |
|
&Apache::lonmeta::selectbox('show',$env{'form.show'},undef, |
|
(&mt('all'),10,20,50,100,1000,10000)); |
|
|
|
$r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'. |
|
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
' '.&mt('Include parameter types').'</label>'. |
' '.&mt('Include parameter types').'</label>'. |
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
Line 3629 sub parm_change_log {
|
Line 4225 sub parm_change_log {
|
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&Apache::loncommon::end_data_table_header_row()); |
&Apache::loncommon::end_data_table_header_row()); |
my $shown=0; |
my $shown=0; |
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
my $folder=''; |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
my $last=''; |
|
if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', |
|
&GDBM_READER(),0640)) { |
|
$last=$hash{'last_known'}; |
|
untie(%hash); |
|
} |
|
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
|
} |
|
foreach my $id (sort |
|
{ |
|
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
|
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
|
} |
|
my $aid = (split('00000',$a))[-1]; |
|
my $bid = (split('00000',$b))[-1]; |
|
return $bid<=>$aid; |
|
} (keys(%parmlog))) { |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my $count = 0; |
my $count = 0; |
my $time = |
my $time = |
Line 3650 sub parm_change_log {
|
Line 4264 sub parm_change_log {
|
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
} |
} |
my $row_start=&Apache::loncommon::start_data_table_row(); |
my $row_start=&Apache::loncommon::start_data_table_row(); |
$r->print($row_start); |
|
my $makenewrow=0; |
my $makenewrow=0; |
my %istype=(); |
my %istype=(); |
my $output; |
my $output; |
Line 3660 sub parm_change_log {
|
Line 4273 sub parm_change_log {
|
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
if ($folder) { |
|
if ($middle!~/^\Q$folder\E/) { next; } |
|
} |
|
} |
if ($typeflag) { |
if ($typeflag) { |
$istype{$parmname}=$value; |
$istype{$parmname}=$value; |
if (!$env{'form.includetypes'}) { next; } |
if (!$env{'form.includetypes'}) { next; } |
Line 3712 sub parm_change_log {
|
Line 4330 sub parm_change_log {
|
} |
} |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
} |
} |
$r->print('<td rowspan="'.$count.'">'.$time.'</td> |
if ($env{'form.displayfilter'} eq 'containing') { |
|
my $wholeentry=$about_me_link.':'. |
|
$parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'. |
|
$output; |
|
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
|
} |
|
if ($count) { |
|
$r->print($row_start.'<td rowspan="'.$count.'">'.$time.'</td> |
<td rowspan="'.$count.'">'.$about_me_link. |
<td rowspan="'.$count.'">'.$about_me_link. |
'<br /><tt>'.$parmlog{$id}{'exe_uname'}. |
'<br /><tt>'.$parmlog{$id}{'exe_uname'}. |
':'.$parmlog{$id}{'exe_udom'}.'</tt>'. |
':'.$parmlog{$id}{'exe_udom'}.'</tt>'. |
$send_msg_link.'</td>'.$output); |
$send_msg_link.'</td>'.$output); |
|
$shown++; |
$shown++; |
} |
if (!($env{'form.show'} eq &mt('all') |
if (!($env{'form.show'} eq &mt('all') |
|| $shown<=$env{'form.show'})) { last; } |
|| $shown<=$env{'form.show'})) { last; } |
} |
} |
Line 3726 sub parm_change_log {
|
Line 4351 sub parm_change_log {
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub check_for_course_info { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
return 1 if ($navmap); |
|
return 0; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 3736 sub parm_change_log {
|
Line 4367 sub parm_change_log {
|
Main handler. Calls &assessparms and &crsenv subroutines. |
Main handler. Calls &assessparms and &crsenv subroutines. |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
# use Data::Dumper; |
|
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
|
&reset_caches(); |
|
|
if ($r->header_only) { |
if ($r->header_only) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
Line 3754 sub handler {
|
Line 4386 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname','symb','serial']); |
'udom','uname','symb','serial','timebase']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 3769 sub handler {
|
Line 4401 sub handler {
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
$env{'request.course.sec'})); |
$env{'request.course.sec'})); |
if ($env{'request.course.id'} && $parm_permission) { |
my $exists = &check_for_course_info(); |
|
|
|
if ($env{'request.course.id'} && $parm_permission && $exists) { |
|
|
# Start Page |
# Start Page |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
|
|
# id numbers can change on re-ordering of folders |
|
|
|
&resetsymbcache(); |
|
|
|
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
Line 3807 sub handler {
|
Line 4437 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
text=>"Add Metadata Field"}); |
text=>"Add Metadata Field"}); |
&addmetafield($r); |
&addmetafield($r); |
|
} elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
Line 3832 sub handler {
|
Line 4466 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
text=>"Clean Parameters"}); |
text=>"Clean Parameters"}); |
&clean_parameters($r); |
&clean_parameters($r); |
} |
} elsif ($env{'form.action'} eq 'dateshift1' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_one($r); |
|
} elsif ($env{'form.action'} eq 'dateshift2' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_two($r); |
|
} elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) { |
|
&assign_course_categories($r); |
|
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
$env{'user.error.msg'}= |
if ($exists) { |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
$env{'user.error.msg'}= |
|
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
|
} else { |
|
$env{'user.error.msg'}= |
|
"/adm/parmset::0:1:Course environment gone, reinitialize the course"; |
|
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
&reset_caches(); |
|
|
return OK; |
return OK; |
} |
} |
|
|