version 1.457, 2009/06/09 22:50:28
|
version 1.505.2.1, 2011/10/07 15:25:40
|
Line 248 Variables used (guessed by Jeremy):
|
Line 248 Variables used (guessed by Jeremy):
|
|
|
=item parse_key() |
=item parse_key() |
|
|
=item check_cloners() : |
|
|
|
Checks if new users included in list of allowed cloners |
|
are valid users. Replaces supplied list with |
|
cleaned list containing only users with valid usernames |
|
and domains. |
|
|
|
Inputs: $clonelist, $oldcloner |
|
where $clonelist is ref to array of requested cloners, |
|
and $oldcloner is ref to array of currently allowed |
|
cloners. |
|
|
|
Returns: string - comma separated list of requested |
|
cloners (username:domain) who do not exist in system. |
|
|
|
=item change_clone() : |
|
|
|
Modifies the list of courses a user can clone (stored |
|
in the user's environment.db file), called when a |
|
change is made to the list of users allowed to clone |
|
a course. |
|
|
|
Inputs: $action,$cloner |
|
where $action is add or drop, and $cloner is identity of |
|
user for whom cloning ability is to be changed in course. |
|
|
|
|
|
=item check_cloners() |
|
|
|
=item change_clone() |
|
|
|
=item header() |
=item header() |
|
|
Output html header for page |
Output html header for page |
Line 347 sub parmval_by_symb {
|
Line 316 sub parmval_by_symb {
|
|
|
my $useropt; |
my $useropt; |
if ($uname ne '' && $udom ne '') { |
if ($uname ne '' && $udom ne '') { |
$useropt = &Apache::lonnet::get_userresdata($uname,$udom); |
$useropt = &Apache::lonnet::get_userresdata($uname,$udom); |
} |
} |
|
|
my $result=''; |
my $result=''; |
Line 375 sub parmval_by_symb {
|
Line 344 sub parmval_by_symb {
|
# --------------------------------------------------------- first, check course |
# --------------------------------------------------------- first, check course |
|
|
if (defined($$courseopt{$courselevel})) { |
if (defined($$courseopt{$courselevel})) { |
$outpar[14]=$$courseopt{$courselevel}; |
$outpar[14]=$$courseopt{$courselevel}; |
$result=14; |
$result=14; |
} |
} |
|
|
if (defined($$courseopt{$courselevelm})) { |
if (defined($$courseopt{$courselevelm})) { |
$outpar[13]=$$courseopt{$courselevelm}; |
$outpar[13]=$$courseopt{$courselevelm}; |
$result=13; |
$result=13; |
} |
} |
|
|
# ------------------------------------------------------- second, check default |
# ------------------------------------------------------- second, check default |
Line 394 sub parmval_by_symb {
|
Line 363 sub parmval_by_symb {
|
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
if (defined($thisparm)) { $outpar[11]=$thisparm; $result=11; } |
|
|
if (defined($$courseopt{$courselevelr})) { |
if (defined($$courseopt{$courselevelr})) { |
$outpar[10]=$$courseopt{$courselevelr}; |
$outpar[10]=$$courseopt{$courselevelr}; |
$result=10; |
$result=10; |
} |
} |
|
|
# ------------------------------------------------------ fourth, back to course |
# ------------------------------------------------------ fourth, back to course |
if ($csec ne '') { |
if ($csec ne '') { |
if (defined($$courseopt{$seclevel})) { |
if (defined($$courseopt{$seclevel})) { |
$outpar[9]=$$courseopt{$seclevel}; |
$outpar[9]=$$courseopt{$seclevel}; |
$result=9; |
$result=9; |
} |
} |
if (defined($$courseopt{$seclevelm})) { |
if (defined($$courseopt{$seclevelm})) { |
$outpar[8]=$$courseopt{$seclevelm}; |
$outpar[8]=$$courseopt{$seclevelm}; |
$result=8; |
$result=8; |
} |
} |
|
|
if (defined($$courseopt{$seclevelr})) { |
if (defined($$courseopt{$seclevelr})) { |
$outpar[7]=$$courseopt{$seclevelr}; |
$outpar[7]=$$courseopt{$seclevelr}; |
$result=7; |
$result=7; |
} |
} |
} |
} |
# ------------------------------------------------------ fifth, check course group |
# ------------------------------------------------------ fifth, check course group |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
Line 433 sub parmval_by_symb {
|
Line 402 sub parmval_by_symb {
|
# ---------------------------------------------------------- fifth, check user |
# ---------------------------------------------------------- fifth, check user |
|
|
if ($uname ne '') { |
if ($uname ne '') { |
if (defined($$useropt{$courselevel})) { |
if (defined($$useropt{$courselevel})) { |
$outpar[3]=$$useropt{$courselevel}; |
$outpar[3]=$$useropt{$courselevel}; |
$result=3; |
$result=3; |
} |
} |
|
|
if (defined($$useropt{$courselevelm})) { |
if (defined($$useropt{$courselevelm})) { |
$outpar[2]=$$useropt{$courselevelm}; |
$outpar[2]=$$useropt{$courselevelm}; |
$result=2; |
$result=2; |
} |
} |
|
|
if (defined($$useropt{$courselevelr})) { |
if (defined($$useropt{$courselevelr})) { |
$outpar[1]=$$useropt{$courselevelr}; |
$outpar[1]=$$useropt{$courselevelr}; |
$result=1; |
$result=1; |
} |
} |
} |
} |
return ($result,@outpar); |
return ($result,@outpar); |
} |
} |
Line 466 sub reset_caches {
|
Line 435 sub reset_caches {
|
my $parmhashid; |
my $parmhashid; |
my %parmhash; |
my %parmhash; |
sub resetparmhash { |
sub resetparmhash { |
undef($parmhashid); |
undef($parmhashid); |
undef(%parmhash); |
undef(%parmhash); |
} |
} |
|
|
sub cacheparmhash { |
sub cacheparmhash { |
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
if ($parmhashid eq $env{'request.course.fn'}) { return; } |
my %parmhashfile; |
my %parmhashfile; |
if (tie(%parmhashfile,'GDBM_File', |
if (tie(%parmhashfile,'GDBM_File', |
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
$env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { |
%parmhash=%parmhashfile; |
%parmhash=%parmhashfile; |
untie(%parmhashfile); |
untie(%parmhashfile); |
$parmhashid=$env{'request.course.fn'}; |
$parmhashid=$env{'request.course.fn'}; |
} |
} |
} |
} |
|
|
sub parmhash { |
sub parmhash { |
my ($id) = @_; |
my ($id) = @_; |
&cacheparmhash(); |
&cacheparmhash(); |
return $parmhash{$id}; |
return $parmhash{$id}; |
} |
} |
} |
} |
|
|
Line 492 sub reset_caches {
|
Line 461 sub reset_caches {
|
my $symbsid; |
my $symbsid; |
my %symbs; |
my %symbs; |
sub resetsymbcache { |
sub resetsymbcache { |
undef($symbsid); |
undef($symbsid); |
undef(%symbs); |
undef(%symbs); |
} |
} |
|
|
sub symbcache { |
sub symbcache { |
my $id=shift; |
my $id=shift; |
if ($symbsid ne $env{'request.course.id'}) { |
if ($symbsid ne $env{'request.course.id'}) { |
undef(%symbs); |
undef(%symbs); |
} |
} |
if (!$symbs{$id}) { |
if (!$symbs{$id}) { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
if ($id=~/\./) { |
if ($id=~/\./) { |
my $resource=$navmap->getById($id); |
my $resource=$navmap->getById($id); |
$symbs{$id}=$resource->symb(); |
$symbs{$id}=$resource->symb(); |
} else { |
} else { |
my $resource=$navmap->getByMapPc($id); |
my $resource=$navmap->getByMapPc($id); |
$symbs{$id}=&Apache::lonnet::declutter($resource->src()); |
$symbs{$id}=&Apache::lonnet::declutter($resource->src()); |
} |
} |
$symbsid=$env{'request.course.id'}; |
$symbsid=$env{'request.course.id'}; |
} |
} |
return $symbs{$id}; |
return $symbs{$id}; |
} |
} |
} |
} |
|
|
Line 520 sub reset_caches {
|
Line 489 sub reset_caches {
|
my $rulesid; |
my $rulesid; |
my %rules; |
my %rules; |
sub resetrulescache { |
sub resetrulescache { |
undef($rulesid); |
undef($rulesid); |
undef(%rules); |
undef(%rules); |
} |
} |
|
|
sub rulescache { |
sub rulescache { |
my $id=shift; |
my $id=shift; |
if ($rulesid ne $env{'request.course.id'} |
if ($rulesid ne $env{'request.course.id'} |
&& !defined($rules{$id})) { |
&& !defined($rules{$id})) { |
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'}; |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
$rulesid=$env{'request.course.id'}; |
$rulesid=$env{'request.course.id'}; |
} |
} |
return $rules{$id}; |
return $rules{$id}; |
} |
} |
} |
} |
|
|
Line 543 sub preset_defaults {
|
Line 512 sub preset_defaults {
|
my $type=shift; |
my $type=shift; |
if (&rulescache($type.'_action') eq 'default') { |
if (&rulescache($type.'_action') eq 'default') { |
# yes, there is something |
# yes, there is something |
return (&rulescache($type.'_hours'), |
return (&rulescache($type.'_hours'), |
&rulescache($type.'_min'), |
&rulescache($type.'_min'), |
&rulescache($type.'_sec'), |
&rulescache($type.'_sec'), |
&rulescache($type.'_value')); |
&rulescache($type.'_value')); |
} else { |
} else { |
# nothing there or something else |
# nothing there or something else |
return ('','','','',''); |
return ('','','','',''); |
} |
} |
} |
} |
|
|
Line 614 sub storeparm_by_symb {
|
Line 583 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)=@_; |
unless ($recflag) { |
unless ($recflag) { |
# first time call |
# first time call |
%recstack=(); |
%recstack=(); |
$recflag=1; |
$recflag=1; |
} |
} |
# store parameter |
# store parameter |
&storeparm_by_symb_inner |
&storeparm_by_symb_inner |
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup); |
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup); |
# don't do anything if parameter was reset |
# don't do anything if parameter was reset |
unless ($nval) { return; } |
unless ($nval) { return; } |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
Line 629 sub storeparm_by_symb {
|
Line 598 sub storeparm_by_symb {
|
foreach my $triggered (split(/\:/,&rulescache($parm.'_triggers'))) { |
foreach my $triggered (split(/\:/,&rulescache($parm.'_triggers'))) { |
# don't backfire |
# don't backfire |
unless ((!$triggered) || ($recstack{$triggered})) { |
unless ((!$triggered) || ($recstack{$triggered})) { |
my $action=&rulescache($triggered.'_action'); |
my $action=&rulescache($triggered.'_action'); |
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
# set triggered parameter on same level |
# set triggered parameter on same level |
my $newspnam=$prefix.$triggered; |
my $newspnam=$prefix.$triggered; |
my $newvalue=''; |
my $newvalue=''; |
my $active=1; |
my $active=1; |
if ($action=~/^when\_setting/) { |
if ($action=~/^when\_setting/) { |
# are there restrictions? |
# are there restrictions? |
if (&rulescache($triggered.'_triggervalue')=~/\w/) { |
if (&rulescache($triggered.'_triggervalue')=~/\w/) { |
$active=0; |
$active=0; |
foreach my $possiblevalue (split(/\s*\,\s*/,&rulescache($triggered.'_triggervalue'))) { |
foreach my $possiblevalue (split(/\s*\,\s*/,&rulescache($triggered.'_triggervalue'))) { |
if (lc($possiblevalue) eq lc($nval)) { $active=1; } |
if (lc($possiblevalue) eq lc($nval)) { $active=1; } |
} |
} |
} |
} |
$newvalue=&rulescache($triggered.'_value'); |
$newvalue=&rulescache($triggered.'_value'); |
} else { |
} else { |
my $totalsecs=((&rulescache($triggered.'_days')*24+&rulescache($triggered.'_hours'))*60+&rulescache($triggered.'_min'))*60+&rulescache($triggered.'_sec'); |
my $totalsecs=((&rulescache($triggered.'_days')*24+&rulescache($triggered.'_hours'))*60+&rulescache($triggered.'_min'))*60+&rulescache($triggered.'_sec'); |
if ($action=~/^later\_than/) { |
if ($action=~/^later\_than/) { |
$newvalue=$nval+$totalsecs; |
$newvalue=$nval+$totalsecs; |
} else { |
} else { |
$newvalue=$nval-$totalsecs; |
$newvalue=$nval-$totalsecs; |
} |
} |
} |
} |
if ($active) { |
if ($active) { |
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
$uname,$udom,$csec,$recflag,$cgroup); |
$uname,$udom,$csec,$recflag,$cgroup); |
} |
} |
} |
} |
} |
} |
return ''; |
return ''; |
Line 703 sub storeparm_by_symb_inner {
|
Line 672 sub storeparm_by_symb_inner {
|
my $delete; |
my $delete; |
if ($nval eq '') { $delete=1;} |
if ($nval eq '') { $delete=1;} |
my %storecontent = ($storeunder => $nval, |
my %storecontent = ($storeunder => $nval, |
$storeunder.'.type' => $ntype); |
$storeunder.'.type' => $ntype); |
my $reply=''; |
my $reply=''; |
if ($snum>3) { |
if ($snum>3) { |
# ---------------------------------------------------------------- Store Course |
# ---------------------------------------------------------------- Store Course |
# |
# |
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'}; |
# Expire sheets |
# Expire sheets |
&Apache::lonnet::expirespread('','','studentcalc'); |
&Apache::lonnet::expirespread('','','studentcalc'); |
if (($snum==10) || ($snum==7) || ($snum==4)) { |
if (($snum==10) || ($snum==7) || ($snum==4)) { |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
&Apache::lonnet::expirespread('','','assesscalc',$symb); |
} elsif (($snum==11) || ($snum==8) || ($snum==5)) { |
} elsif (($snum==11) || ($snum==8) || ($snum==5)) { |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
&Apache::lonnet::expirespread('','','assesscalc',$map); |
} else { |
} else { |
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
} |
} |
# Store parameter |
# Store parameter |
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
&log_parmset(\%storecontent,1); |
&log_parmset(\%storecontent,1); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$cdom,$cnum); |
('resourcedata',\%storecontent,$cdom,$cnum); |
&log_parmset(\%storecontent); |
&log_parmset(\%storecontent); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
} else { |
} else { |
# ------------------------------------------------------------------ Store User |
# ------------------------------------------------------------------ Store User |
# |
# |
# Expire sheets |
# Expire sheets |
&Apache::lonnet::expirespread($uname,$udom,'studentcalc'); |
&Apache::lonnet::expirespread($uname,$udom,'studentcalc'); |
if ($snum==1) { |
if ($snum==1) { |
&Apache::lonnet::expirespread |
&Apache::lonnet::expirespread |
($uname,$udom,'assesscalc',$symb); |
($uname,$udom,'assesscalc',$symb); |
} elsif ($snum==2) { |
} elsif ($snum==2) { |
&Apache::lonnet::expirespread |
&Apache::lonnet::expirespread |
($uname,$udom,'assesscalc',$map); |
($uname,$udom,'assesscalc',$map); |
} else { |
} else { |
&Apache::lonnet::expirespread($uname,$udom,'assesscalc'); |
&Apache::lonnet::expirespread($uname,$udom,'assesscalc'); |
} |
} |
# Store parameter |
# Store parameter |
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
&log_parmset(\%storecontent,1,$uname,$udom); |
&log_parmset(\%storecontent,1,$uname,$udom); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
&log_parmset(\%storecontent,0,$uname,$udom); |
&log_parmset(\%storecontent,0,$uname,$udom); |
} |
} |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
|
|
if ($reply=~/^error\:(.*)/) { |
if ($reply=~/^error\:(.*)/) { |
return "<span class=\"LC_error\">Write Error: $1</span>"; |
return "<span class=\"LC_error\">Write Error: $1</span>"; |
} |
} |
return ''; |
return ''; |
} |
} |
Line 769 sub valout {
|
Line 738 sub valout {
|
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
if ($editable) { |
if ($editable) { |
$result = '<span class="LC_clickhere">*</span>'; |
$result = '<span class="LC_clickhere">*</span>'; |
} else { |
} else { |
$result=' '; |
$result=' '; |
} |
} |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
Line 811 sub valout {
|
Line 780 sub valout {
|
$result.=join(", ",@timer); |
$result.=join(", ",@timer); |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = &Apache::lonlocal::locallocaltime($value). |
$result = &Apache::lonlocal::locallocaltime($value). |
&date_sanity_info($value); |
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
$result = &HTML::Entities::encode($result,'"<>&'); |
$result = &HTML::Entities::encode($result,'"<>&'); |
} |
} |
} |
} |
return $result; |
return $result; |
Line 825 sub plink {
|
Line 794 sub plink {
|
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my $winvalue=$value; |
my $winvalue=$value; |
unless ($winvalue) { |
unless ($winvalue) { |
if (&isdateparm($type)) { |
if (&isdateparm($type)) { |
$winvalue=$env{'form.recent_'.$type}; |
$winvalue=$env{'form.recent_'.$type}; |
} else { |
} else { |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
Line 837 sub plink {
|
Line 806 sub plink {
|
my $valout = &valout($value,$type,1); |
my $valout = &valout($value,$type,1); |
my $unencmarker = $marker; |
my $unencmarker = $marker; |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
\$hour, \$min, \$sec) { |
\$hour, \$min, \$sec) { |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item =~ s/\'/\\\'/g; |
$$item =~ s/\'/\\\'/g; |
} |
} |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></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.'</a></td></tr></table>'; |
$valout.'</a></td></tr></table>'; |
} |
} |
|
|
sub page_js { |
sub page_js { |
Line 873 sub page_js {
|
Line 842 sub page_js {
|
if (typedef[0]=='date') { |
if (typedef[0]=='date') { |
eval('document.parmform.recent_'+ |
eval('document.parmform.recent_'+ |
document.parmform.pres_type.value+ |
document.parmform.pres_type.value+ |
'.value=document.parmform.pres_value.value;'); |
'.value=document.parmform.pres_value.value;'); |
} else { |
} else { |
eval('document.parmform.recent_'+typedef[0]+ |
eval('document.parmform.recent_'+typedef[0]+ |
'.value=document.parmform.pres_value.value;'); |
'.value=document.parmform.pres_value.value;'); |
} |
} |
} |
} |
document.parmform.submit(); |
document.parmform.submit(); |
} else { |
} else { |
document.parmform.pres_value.value=''; |
document.parmform.pres_value.value=''; |
Line 903 sub startpage {
|
Line 872 sub startpage {
|
my ($r) = @_; |
my ($r) = @_; |
|
|
my %loaditems = ('onunload' => "pclose()", |
my %loaditems = ('onunload' => "pclose()", |
'onload' => "group_or_section('cgroup')",); |
'onload' => "showHide_courseContent(); group_or_section('cgroup')", |
|
); |
|
|
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
text=>"Problem Parameters"}); |
text=>"Problem Parameters"}); |
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |
} |
} |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&page_js(), |
&page_js(), |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 934 ENDHEAD
|
Line 904 ENDHEAD
|
|
|
sub print_row { |
sub print_row { |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; |
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 $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
# get the values for the parameter in cascading order |
# get the values for the parameter in cascading order |
# empty levels will remain empty |
# empty levels will remain empty |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which}, |
$rid,$$default{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
$rid,$$default{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
# get the type for the parameters |
# get the type for the parameters |
# problem: these may not be set for all levels |
# problem: these may not be set for all levels |
my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'. |
my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'. |
$$name{$which}.'.type',$rid, |
$$name{$which}.'.type',$rid, |
$$defaulttype{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
$$defaulttype{$which},$uname,$udom,$csec,$cgroup,$courseopt); |
# cascade down manually |
# cascade down manually |
my $cascadetype=$$defaulttype{$which}; |
my $cascadetype=$$defaulttype{$which}; |
for (my $i=14;$i>0;$i--) { |
for (my $i=14;$i>0;$i--) { |
if ($typeoutpar[$i]) { |
if ($typeoutpar[$i]) { |
$cascadetype=$typeoutpar[$i]; |
$cascadetype=$typeoutpar[$i]; |
} else { |
} else { |
$typeoutpar[$i]=$cascadetype; |
$typeoutpar[$i]=$cascadetype; |
} |
} |
} |
} |
Line 966 sub print_row {
|
Line 936 sub print_row {
|
} |
} |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
if ($automatic) { |
if ($automatic) { |
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>'; |
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>'; |
} |
} |
$r->print('<td>'.$parm.'</td>'); |
$r->print('<td>'.$parm.'</td>'); |
|
|
Line 1018 sub print_row {
|
Line 988 sub print_row {
|
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
Line 1035 sub print_row {
|
Line 1005 sub print_row {
|
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
Line 1159 sub extractResourceInformation {
|
Line 1129 sub extractResourceInformation {
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
my $id=$resource->id(); |
my $id=$resource->id(); |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
if ($mapid eq '0') { next; } |
if ($mapid eq '0') { next; } |
$$ids[$#$ids+1]=$id; |
$$ids[$#$ids+1]=$id; |
my $srcf=$resource->src(); |
my $srcf=$resource->src(); |
$srcf=~/\.(\w+)$/; |
$srcf=~/\.(\w+)$/; |
$$typep{$id}=$1; |
$$typep{$id}=$1; |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
next if ($key!~/^parameter_/); |
next if ($key!~/^parameter_/); |
|
|
# Hidden parameters |
# Hidden parameters |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm'); |
# |
# |
# allparms is a hash of parameter names |
# allparms is a hash of parameter names |
# |
# |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { |
my ($display,$parmdis); |
my ($display,$parmdis); |
$display = &standard_parameter_names($name); |
$display = &standard_parameter_names($name); |
if ($display eq '') { |
if ($display eq '') { |
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
$display= &Apache::lonnet::metadata($srcf,$key.'.display'); |
$parmdis = $display; |
$parmdis = $display; |
$parmdis =~ s/\s*\[Part.*$//g; |
$parmdis =~ s/\s*\[Part.*$//g; |
} else { |
} else { |
$parmdis = $display; |
$parmdis = &mt($display); |
} |
} |
$$allparms{$name}=$parmdis; |
$$allparms{$name}=$parmdis; |
if (ref($defkeytype)) { |
if (ref($defkeytype)) { |
$$defkeytype{$name}= |
$$defkeytype{$name}= |
&Apache::lonnet::metadata($srcf,$key.'.type'); |
&Apache::lonnet::metadata($srcf,$key.'.type'); |
} |
} |
} |
} |
|
|
# |
# |
# allparts is a hash of all parts |
# allparts is a hash of all parts |
# |
# |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); |
$$allparts{$part} = &mt('Part: [_1]',$part); |
$$allparts{$part} = &mt('Part: [_1]',$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++; |
} |
} |
} |
} |
|
|
|
|
if (!exists($$mapp{$mapid})) { |
if (!exists($$mapp{$mapid})) { |
$$mapp{$id}= |
$$mapp{$id}= |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
&Apache::lonnet::declutter($resource->enclosing_map_src()); |
$$mapp{$mapid}=$$mapp{$id}; |
$$mapp{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
if ($mapid eq '1') { |
if ($mapid eq '1') { |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
} else { |
} else { |
$$maptitles{$mapid}= |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
&Apache::lonnet::gettitle($$mapp{$id}); |
} |
} |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
$$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
$$symbp{$mapid}=$$mapp{$id}.'___(all)'; |
} else { |
} else { |
$$mapp{$id} = $$mapp{$mapid}; |
$$mapp{$id} = $$mapp{$mapid}; |
} |
} |
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
$$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf); |
|
} |
} |
} |
} |
|
|
Line 1244 sub isdateparm {
|
Line 1213 sub isdateparm {
|
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
} |
} |
|
|
|
# |
|
# parmmenu displays a list of the selected parameters. |
|
# It also offers a link to show/hide the complete parameter list |
|
# from which you can select all desired parameters. |
|
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
Line 1259 sub parmmenu {
|
Line 1233 sub parmmenu {
|
displayOverview = "none" |
displayOverview = "none" |
} |
} |
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
document.forms.parmform.elements[i].checked=value; |
document.forms.parmform.elements[i].checked=value; |
Line 1269 sub parmmenu {
|
Line 1243 sub parmmenu {
|
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
checkboxChecked(thisvalue); |
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
document.getElementById(thisvalue.concat("_li")).style.display = ""; |
|
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
if (ele.value == thisvalue) { |
if (ele.value == thisvalue) { |
document.forms.parmform.elements[i].checked=true; |
document.forms.parmform.elements[i].checked=true; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
function checkdates() { |
function checkdates() { |
checkthis('duedate','pscat'); |
checkthis('duedate','pscat'); |
checkthis('opendate','pscat'); |
checkthis('opendate','pscat'); |
checkthis('answerdate','pscat'); |
checkthis('answerdate','pscat'); |
} |
} |
|
|
function checkdisset() { |
function checkdisset() { |
checkthis('discussend','pscat'); |
checkthis('discussend','pscat'); |
checkthis('discusshide','pscat'); |
checkthis('discusshide','pscat'); |
} |
} |
|
|
function checkcontdates() { |
function checkcontdates() { |
checkthis('contentopen','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('contentclose','pscat'); |
checkthis('contentclose','pscat'); |
} |
} |
|
|
function checkvisi() { |
function checkvisi() { |
checkthis('hiddenresource','pscat'); |
checkthis('hiddenresource','pscat'); |
checkthis('encrypturl','pscat'); |
checkthis('encrypturl','pscat'); |
checkthis('problemstatus','pscat'); |
checkthis('problemstatus','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('opendate','pscat'); |
checkthis('opendate','pscat'); |
} |
} |
|
|
function checkparts() { |
function checkparts() { |
checkthis('hiddenparts','pscat'); |
checkthis('hiddenparts','pscat'); |
checkthis('display','pscat'); |
checkthis('display','pscat'); |
checkthis('ordered','pscat'); |
checkthis('ordered','pscat'); |
} |
} |
|
|
function checkstandard() { |
function checkstandard() { |
checkall(false,'pscat'); |
checkall(false,'pscat'); |
checkdates(); |
checkdates(); |
checkthis('weight','pscat'); |
checkthis('weight','pscat'); |
checkthis('maxtries','pscat'); |
checkthis('maxtries','pscat'); |
|
checkthis('type','pscat'); |
|
checkthis('problemstatus','pscat'); |
} |
} |
|
|
function hideParms() { |
function hideParms() { |
Line 1328 sub parmmenu {
|
Line 1306 sub parmmenu {
|
function checkboxChecked(id) { |
function checkboxChecked(id) { |
var li = "_li"; |
var li = "_li"; |
var id_li = id.concat(li); |
var id_li = id.concat(li); |
|
|
if (document.getElementById(id_li).style.display == "none") { |
if (document.getElementById(id_li).style.display == "none") { |
document.getElementById(id_li).style.display = ""; |
document.getElementById(id_li).style.display = ""; |
} |
} |
Line 1345 ENDSCRIPT
|
Line 1322 ENDSCRIPT
|
$r->print(&mt('Selected Parameters:').'<br />'); |
$r->print(&mt('Selected Parameters:').'<br />'); |
|
|
#print out all possible parms and hide them by default |
#print out all possible parms and hide them by default |
$r->print('<ul>'); |
$r->print('<ul class="LC_parm_parmlist">'); |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
$r->print(' style="display:none"'); |
$r->print(' style="display:none"'); |
} |
} |
$r->print(' />' |
$r->print('>' |
.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) |
.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) |
.'</li>' |
.'</li>' |
); |
); |
} |
} |
$r->print('</ul>' |
$r->print('</ul>'); |
.'<p><a href="javascript:showParms()">' |
|
.&mt('Show detailed Parameter Selection') |
|
.'</a></p>' |
|
); |
|
|
|
|
$r->print('<hr />'); |
&shortCuts($r,$allparms,$pscat,$keyorder); |
&shortCuts($r,$allparms,$pscat,$keyorder); |
|
$r->print('<hr />'); |
|
|
|
$r->print( |
|
'<p><a href="javascript:showParms()">' |
|
.&mt('Show detailed Parameter Selection') |
|
.'</a></p>' |
|
); |
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
} |
} |
|
# return a hash |
|
sub categories { |
|
return ('time_settings' => 'Time Settings', |
|
'grading' => 'Grading', |
|
'tries' => 'Tries', |
|
'problem_appearance' => 'Problem Appearance', |
|
'behaviour_of_input_fields' => 'Behaviour of Input Fields', |
|
'hiding' => 'Hiding', |
|
'high_level_randomization' => 'High Level Randomization', |
|
'slots' => 'Slots', |
|
'file_submission' => 'File Submission', |
|
'misc' => 'Miscellaneous' ); |
|
} |
|
|
|
# return a hash. Like a look-up table |
|
sub lookUpTableParameter { |
|
|
|
return ( |
|
'opendate' => 'time_settings', |
|
'duedate' => 'time_settings', |
|
'answerdate' => 'time_settings', |
|
'interval' => 'time_settings', |
|
'contentopen' => 'time_settings', |
|
'contentclose' => 'time_settings', |
|
'discussend' => 'time_settings', |
|
'weight' => 'grading', |
|
'handgrade' => 'grading', |
|
'maxtries' => 'tries', |
|
'hinttries' => 'tries', |
|
'randomizeontries' => 'tries', |
|
'type' => 'problem_appearance', |
|
'problemstatus' => 'problem_appearance', |
|
'display' => 'problem_appearance', |
|
'ordered' => 'problem_appearance', |
|
'numbubbles' => 'problem_appearance', |
|
'tol' => 'behaviour_of_input_fields', |
|
'sig' => 'behaviour_of_input_fields', |
|
'turnoffunit' => 'behaviour_of_input_fields', |
|
'hiddenresource' => 'hiding', |
|
'hiddenparts' => 'hiding', |
|
'discusshide' => 'hiding', |
|
'buttonshide' => 'hiding', |
|
'turnoffeditor' => 'hiding', |
|
'encrypturl' => 'hiding', |
|
'randomorder' => 'high_level_randomization', |
|
'randompick' => 'high_level_randomization', |
|
'available' => 'slots', |
|
'useslots' => 'slots', |
|
'availablestudent' => 'slots', |
|
'uploadedfiletypes' => 'file_submission', |
|
'maxfilesize' => 'file_submission', |
|
'cssfile' => 'misc', |
|
'mapalias' => 'misc', |
|
'acc' => 'misc', |
|
'maxcollaborators' => 'misc', |
|
'scoreformat' => 'misc', |
|
|
|
); |
|
} |
|
|
|
sub whatIsMyCategory { |
|
my $name = shift; |
|
my $catList = shift; |
|
my @list; |
|
my %lookUpList = &lookUpTableParameter; #Initilize the lookupList |
|
my $cat = $lookUpList{$name}; |
|
if (defined($cat)) { |
|
if (!defined($$catList{$cat})){ |
|
push @list, ($name); |
|
$$catList{$cat} = \@list; |
|
} else { |
|
push @{${$catList}{$cat}}, ($name); |
|
} |
|
} else { |
|
if (!defined($$catList{'misc'})){ |
|
push @list, ($name); |
|
$$catList{'misc'} = \@list; |
|
} else { |
|
push @{${$catList}{'misc'}}, ($name); |
|
} |
|
} |
|
} |
|
|
|
sub keysindisplayorderCategory { |
|
my ($name,$keyorder)=@_; |
|
return sort { |
|
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
|
} ( @{$name}); |
|
} |
|
|
|
sub category_order { |
|
return ( |
|
'time_settings' => 1, |
|
'grading' => 2, |
|
'tries' => 3, |
|
'problem_appearance' => 4, |
|
'hiding' => 5, |
|
'behaviour_of_input_fields' => 6, |
|
'high_level_randomization' => 7, |
|
'slots' => 8, |
|
'file_submission' => 9, |
|
'misc' => 10 |
|
); |
|
|
|
} |
|
|
sub parmboxes { |
sub parmboxes { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
|
my $tempparameter; |
|
my %categories = &categories; |
|
my %category_order = &category_order(); |
|
my %categoryList = ( |
|
'time_settings' => [], |
|
'grading' => [], |
|
'tries' => [], |
|
'problem_appearance' => [], |
|
'behaviour_of_input_fields' => [], |
|
'hiding' => [], |
|
'high_level_randomization' => [], |
|
'slots' => [], |
|
'file_submission' => [], |
|
'misc' => [], |
|
); |
|
my $hidelink = |
|
'<p>' |
|
.'<a href="javascript:hideParms()">' |
|
.&mt('Hide detailed Parameter Selection') |
|
.'</a>' |
|
.'</p>' |
|
."\n"; |
|
; |
|
foreach $tempparameter (keys %$allparms) { |
|
&whatIsMyCategory($tempparameter, \%categoryList); |
|
} |
#part to print the parm-list |
#part to print the parm-list |
$r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">' |
$r->print( |
.'<legend>'.&mt('Parameter').'</legend>' |
'<div id="LC_parm_overview_parm_menu" class="LC_Box" style="display:none">'."\n" |
."\n" |
.'<h3>'.&mt('Parameter').'</h3>'."\n" |
.'<table>' |
.$hidelink |
|
.'<div class="LC_columnSection">'."\n" |
); |
); |
my $cnt=0; |
|
|
|
$r->print('<tr>'); |
#Print parameters |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
$r->print("\n".'<td><label><input type="checkbox" name="pscat" '); |
if(@{$categoryList{$key}} == 0) { |
$r->print('value="'.$tempkey.'" '); |
next; |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
} else { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print('<div class="LC_Box LC_400Box">' |
$r->print(' checked="checked"'); |
.'<h4 class="LC_hcell">' |
} |
.&mt($categories{$key}) |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
.'</h4>'."\n"); |
: $tempkey) |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
.'</label></td>'); |
$r->print('<span class="LC_nobreak">' |
$cnt++; |
.'<label><input type="checkbox" name="pscat" '); |
if ($cnt==4) { |
$r->print('value="'.$tempkey.'" '); |
$r->print("</tr>\n<tr>"); |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
$cnt=0; |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
} |
$r->print(' checked="checked"'); |
} |
} |
$r->print('</tr>' |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
.'</table>' |
: $tempkey) |
.'<hr />' |
.'</label></span><br />'."\n"); |
.'<a href="javascript:hideParms()">' |
} |
.&mt('Hide') |
$r->print("</div>\n"); |
.'</a>' |
} |
); |
} |
|
|
#&shortCuts($r,$allparms,$pscat,$keyorder); |
#&shortCuts($r,$allparms,$pscat,$keyorder); |
$r->print('</fieldset>'); |
$r->print( |
|
"</div>\n" |
|
.$hidelink |
|
."</div>\n" |
|
); |
} |
} |
|
# |
|
# This function offers some links on the parameter section to get with one click a group a parameters |
|
# |
sub shortCuts { |
sub shortCuts { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
|
#part to print out the shortcuts for parmselection |
# Parameter Selection |
$r->print('<table><tr id="LC_parm_overview_parm_menu_selectors">' |
$r->print( |
.'<td valign="top">' |
&Apache::lonhtmlcommon::start_funclist(&mt('Parameter Selection')) |
.'<fieldset><legend>'.&mt('Parameter Selection').'</legend>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>') |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</span>' |
'<a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>') |
.'<br />' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>') |
.'• <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>' |
.&Apache::lonhtmlcommon::end_funclist() |
.'</span>' |
); |
.'<br />' |
|
.'<span class="LC_nobreak">' |
# Add Selection for... |
.'• <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>' |
$r->print( |
.'</span>' |
&Apache::lonhtmlcommon::start_funclist(&mt('Add Selection for...')) |
.'</fieldset>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</td>' |
'<a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>') |
.'<td colspan="2" valign="top">' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<fieldset><legend>'.&mt('Add Selection for...').'</legend>' |
'<a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>') |
.'<span class="LC_nobreak">' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
'<a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>') |
.'</span>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>') |
.' • <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</span>' |
'<a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>') |
# .'<br />' |
.&Apache::lonhtmlcommon::end_funclist() |
.'<span class="LC_nobreak">' |
); |
.' • <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>' |
|
.'</span>' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>' |
|
.'</span>' |
|
# .'<br />' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>' |
|
.'</span>' |
|
.'</fieldset>' |
|
.'</td>' |
|
.'</tr></table>'); |
|
} |
} |
|
|
sub partmenu { |
sub partmenu { |
Line 1461 sub partmenu {
|
Line 1567 sub partmenu {
|
my %temphash=(); |
my %temphash=(); |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach my $tempkey (sort { |
foreach my $tempkey (sort { |
if ($a==$b) { return ($a cmp $b) } else { return ($a <=> $b); } |
if ($a==$b) { return ($a cmp $b) } else { return ($a <=> $b); } |
} keys(%{$allparts})) { |
} keys(%{$allparts})) { |
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="selected"'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.$$allparts{$tempkey}.'</option>'); |
$r->print('>'.$$allparts{$tempkey}.'</option>'); |
} |
} |
} |
} |
$r->print('</select>'); |
$r->print('</select>'); |
} |
} |
Line 1495 sub usermenu {
|
Line 1601 sub usermenu {
|
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
$sections .= '>'; |
$sections .= '>'; |
foreach my $section ('',sort keys %sectionhash) { |
foreach my $section ('',sort keys %sectionhash) { |
$sections.='<option value="'.$section.'" '. |
$sections.='<option value="'.$section.'" '. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
'</option>'; |
'</option>'; |
} |
} |
$sections.='</select>'; |
$sections.='</select>'; |
Line 1571 function group_or_section(caller) {
|
Line 1677 function group_or_section(caller) {
|
,$chooseopt)); |
,$chooseopt)); |
} |
} |
|
|
|
# |
|
# This function shows on table Mode the available Parameters for the selected Resources |
|
# |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; |
$r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
|
&partmenu($r,$allparts,$psprt); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; |
|
my %allmaps_inverted = reverse %$allmaps; |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$r->print('<select name="pschp">'); |
my $tree=[]; |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
my $treeinfo={}; |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
if (defined($navmap)) { |
$r->print('<option value="'.$_.'"'); |
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); |
if (($pschp eq $_)) { $r->print(' selected="selected"'); } |
my $curRes; |
$r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>'); |
my $depth = 0; |
|
my %parent = (); |
|
my $startcount = 5; |
|
my $lastcontainer = $startcount; |
|
# preparing what is to show ... |
|
while ($curRes = $it->next()) { |
|
if ($curRes == $it->BEGIN_MAP()) { |
|
$depth++; |
|
$parent{$depth}= $lastcontainer; |
|
} |
|
if ($curRes == $it->END_MAP()) { |
|
$depth--; |
|
$lastcontainer = $parent{$depth}; |
|
} |
|
if (ref($curRes)) { |
|
my $symb = $curRes->symb(); |
|
my $ressymb = $symb; |
|
if (($curRes->is_sequence()) || ($curRes->is_page())) { |
|
my $type = 'sequence'; |
|
if ($curRes->is_page()) { |
|
$type = 'page'; |
|
} |
|
my $id= $curRes->id(); |
|
my $srcf = $curRes->src(); |
|
my $resource_name = &Apache::lonnet::gettitle($srcf); |
|
if(!exists($treeinfo->{$id})) { |
|
push(@$tree,$id); |
|
my $enclosing_map_folder = &Apache::lonnet::declutter($curRes->enclosing_map_src()); |
|
$treeinfo->{$id} = { |
|
depth => $depth, |
|
type => $type, |
|
name => $resource_name, |
|
enclosing_map_folder => $enclosing_map_folder, |
|
}; |
|
} |
|
} |
|
} |
|
} |
} |
} |
$r->print("</select>"); |
# Show it ... |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
|
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
|
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
|
my $whitespace = |
|
'<img src="' |
|
.&Apache::loncommon::lonhttpdurl('/adm/lonIcons/whitespace_21.gif') |
|
.'" alt="" />'; |
|
|
|
# Info about selectable folders/maps |
|
$r->print( |
|
'<div class="LC_info">' |
|
.&mt('You can only select maps and folders which have modifiable settings.') |
|
.' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') |
|
.'</div>' |
|
); |
|
|
|
$r->print(&Apache::loncommon::start_data_table()); |
|
|
|
# Display row: "All Maps or Folders" |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp"' |
|
); |
|
$r->print(' checked="checked"') if ($pschp eq 'all' || !$pschp); |
|
$r->print( |
|
' value="all" /> '.$icon.' ' |
|
.&mt('All Maps or Folders') |
|
.'</label>' |
|
.'<hr /></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
|
|
# Display row: "Main Course Documents" |
|
if (exists($$allmaps{1})) { |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp" value="1"' |
|
); |
|
$r->print(' checked="checked"') if ($pschp eq '1'); |
|
$r->print( |
|
'/> '.$icon.' ' |
|
.$$maptitles{1} |
|
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
|
|
# Display rows for all course maps and folders |
|
foreach my $id (@{$tree}) { |
|
my ($mapid,$resid)=split(/\./,$id); |
|
# Indentation |
|
my $depth = $treeinfo->{$id}->{'depth'}; |
|
my $indent; |
|
for (my $i = 0; $i < $depth; $i++) { |
|
$indent.= $whitespace; |
|
} |
|
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
|
if ($treeinfo->{$id}->{'type'} eq 'page') { |
|
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />'; |
|
} |
|
my $symb_name = $$symbp{$id}; |
|
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
|
$symb_name = $tail; |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
); |
|
# Only offer radio button for folders/maps which can be parameterized |
|
if ($allmaps_inverted{$symb_name}) { |
|
$r->print( |
|
'<input type ="radio" name="pschp"' |
|
.' value="'.$allmaps_inverted{$symb_name}.'"' |
|
); |
|
$r->print(' checked="checked"') if ($allmaps_inverted{$symb_name} eq $pschp); |
|
$r->print('/>'); |
|
} else { |
|
$r->print($whitespace); |
|
} |
|
$r->print( |
|
$indent.$icon.' ' |
|
.$treeinfo->{$id}->{name} |
|
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
|
|
$r->print(&Apache::loncommon::end_data_table()); |
|
} |
} |
} |
|
|
|
# Build up the select Box to choose if your parameter specification should work for the resource, map/folder or the course level |
|
# The value of default selection in the select box is set by the value that is given by the argument in $parmlev. |
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print('<select name="parmlev">'); |
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">'); |
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="selected"'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.&mt($_).'</option>'); |
$r->print('>'.&mt($_).'</option>'); |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
} |
} |
Line 1623 sub sectionmenu {
|
Line 1861 sub sectionmenu {
|
|
|
$r->print('<select name="Section" multiple="multiple" size="8">'); |
$r->print('<select name="Section" multiple="multiple" size="8">'); |
foreach my $s ('all',sort keys %sectionhash) { |
foreach my $s ('all',sort keys %sectionhash) { |
$r->print(' <option value="'.$s.'"'); |
$r->print(' <option value="'.$s.'"'); |
foreach (@{$selectedsections}) { |
foreach (@{$selectedsections}) { |
if ($s eq $_) { |
if ($s eq $_) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
last; |
last; |
} |
} |
} |
} |
$r->print('>'.$s."</option>\n"); |
$r->print('>'.$s."</option>\n"); |
} |
} |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
} |
} |
Line 1642 sub groupmenu {
|
Line 1880 sub groupmenu {
|
|
|
$r->print('<select name="Group" multiple="multiple" size="8">'); |
$r->print('<select name="Group" multiple="multiple" size="8">'); |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$r->print(' <option value="'.$group.'"'); |
foreach (@{$selectedgroups}) { |
foreach (@{$selectedgroups}) { |
if ($group eq $_) { |
if ($group eq $_) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
last; |
last; |
} |
} |
} |
} |
$r->print('>'.$group."</option>\n"); |
$r->print('>'.$group."</option>\n"); |
} |
} |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
} |
} |
Line 1663 sub keysplit {
|
Line 1901 sub keysplit {
|
sub keysinorder { |
sub keysinorder { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{$a} <=> $$keyorder{$b}; |
$$keyorder{$a} <=> $$keyorder{$b}; |
} (keys %{$name}); |
} (keys %{$name}); |
} |
} |
|
|
sub keysinorder_bytype { |
sub keysinorder_bytype { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
my $ta=(split('_',$a))[-1]; |
my $ta=(split('_',$a))[-1]; |
my $tb=(split('_',$b))[-1]; |
my $tb=(split('_',$b))[-1]; |
if ($$keyorder{'parameter_0_'.$ta} == $$keyorder{'parameter_0_'.$tb}) { |
if ($$keyorder{'parameter_0_'.$ta} == $$keyorder{'parameter_0_'.$tb}) { |
return ($a cmp $b); |
return ($a cmp $b); |
} |
} |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
} (keys %{$name}); |
} (keys %{$name}); |
} |
} |
|
|
sub keysindisplayorder { |
sub keysindisplayorder { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
} (keys %{$name}); |
} (keys %{$name}); |
} |
} |
|
|
Line 1698 sub sortmenu {
|
Line 1936 sub sortmenu {
|
$r->print(' checked="checked"'); |
$r->print(' checked="checked"'); |
} |
} |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
'</label>'); |
'</label>'); |
} |
} |
|
|
sub standardkeyorder { |
sub standardkeyorder { |
return ('parameter_0_opendate' => 1, |
return ('parameter_0_opendate' => 1, |
'parameter_0_duedate' => 2, |
'parameter_0_duedate' => 2, |
'parameter_0_answerdate' => 3, |
'parameter_0_answerdate' => 3, |
'parameter_0_interval' => 4, |
'parameter_0_interval' => 4, |
'parameter_0_weight' => 5, |
'parameter_0_weight' => 5, |
'parameter_0_maxtries' => 6, |
'parameter_0_maxtries' => 6, |
'parameter_0_hinttries' => 7, |
'parameter_0_hinttries' => 7, |
'parameter_0_contentopen' => 8, |
'parameter_0_contentopen' => 8, |
'parameter_0_contentclose' => 9, |
'parameter_0_contentclose' => 9, |
'parameter_0_type' => 10, |
'parameter_0_type' => 10, |
'parameter_0_problemstatus' => 11, |
'parameter_0_problemstatus' => 11, |
'parameter_0_hiddenresource' => 12, |
'parameter_0_hiddenresource' => 12, |
'parameter_0_hiddenparts' => 13, |
'parameter_0_hiddenparts' => 13, |
'parameter_0_display' => 14, |
'parameter_0_display' => 14, |
'parameter_0_ordered' => 15, |
'parameter_0_ordered' => 15, |
'parameter_0_tol' => 16, |
'parameter_0_tol' => 16, |
'parameter_0_sig' => 17, |
'parameter_0_sig' => 17, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20); |
'parameter_0_discusshide' => 20); |
} |
} |
Line 1775 sub assessparms {
|
Line 2013 sub assessparms {
|
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$env{'user.domain'}) { |
} elsif ($udom=$env{'user.domain'}) { |
} else { |
} else { |
$udom=$r->dir_config('lonDefDomain'); |
$udom=$r->dir_config('lonDefDomain'); |
} |
} |
|
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
Line 1795 sub assessparms {
|
Line 2034 sub assessparms {
|
# ----------------------------------------------- Was this started from grades? |
# ----------------------------------------------- Was this started from grades? |
|
|
if (($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if (($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) { |
&& (!$env{'form.dis'})) { |
my $url=$env{'form.url'}; |
my $url=$env{'form.url'}; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
$pssymb=&Apache::lonnet::symbread($url); |
$pssymb=&Apache::lonnet::symbread($url); |
if (!@pscat) { @pscat=('all'); } |
if (!@pscat) { @pscat=('all'); } |
$pschp=''; |
$pschp=''; |
$parmlev = 'full'; |
$parmlev = 'full'; |
} elsif ($env{'form.symb'}) { |
} elsif ($env{'form.symb'}) { |
$pssymb=$env{'form.symb'}; |
$pssymb=$env{'form.symb'}; |
if (!@pscat) { @pscat=('all'); } |
if (!@pscat) { @pscat=('all'); } |
$pschp=''; |
$pschp=''; |
$parmlev = 'full'; |
$parmlev = 'full'; |
} else { |
} else { |
$env{'form.url'}=''; |
$env{'form.url'}=''; |
} |
} |
|
|
my $id=$env{'form.id'}; |
my $id=$env{'form.id'}; |
if (($id) && ($udom)) { |
if (($id) && ($udom)) { |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
if ($uname) { |
if ($uname) { |
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
&mt('at domain')." '$udom'</span>"; |
&mt('at domain')." '$udom'</span>"; |
} |
} |
} else { |
} else { |
$uname=$env{'form.uname'}; |
$uname=$env{'form.uname'}; |
} |
} |
unless ($udom) { $uname=''; } |
unless ($udom) { $uname=''; } |
$uhome=''; |
$uhome=''; |
if ($uname) { |
if ($uname) { |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
&mt("at domain")." '$udom'</span>"; |
&mt("at domain")." '$udom'</span>"; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message='<span class="LC_error">'. |
$message='<span class="LC_error">'. |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("not in this course")."</span>"; |
&mt("not in this course")."</span>"; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
} else { |
} else { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation','id')); |
('firstname','middlename','lastname','generation','id')); |
$message="\n<p>\n".&mt("Full Name").": ". |
$message="\n<p>\n".&mt("Full Name").": ". |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br />\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br />\n".&mt('Student/Employee ID').": ".$name{'id'}.'<p>'; |
} |
} |
@usersgroups = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if (@usersgroups > 0) { |
if (@usersgroups > 0) { |
Line 1867 sub assessparms {
|
Line 2105 sub assessparms {
|
|
|
# --------------------------------------------------------- Get all assessments |
# --------------------------------------------------------- Get all assessments |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder); |
\%keyorder); |
|
|
$mapp{'0.0'} = ''; |
$mapp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
Line 1878 sub assessparms {
|
Line 2116 sub assessparms {
|
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
for (my $i=0;$i<=$#markers;$i++) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $totalstored = 0; |
|
for (my $i=0;$i<=$#markers;$i++) { |
|
my ($needsrelease,$needsnewer); |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my ($level,@all) = |
my ($level,@all) = |
Line 1911 sub assessparms {
|
Line 2153 sub assessparms {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($markers[$i] =~ /_type\&\d+$/) { |
|
$needsrelease = |
|
$Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = &questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = &questiontype_releasecheck($values[$i], |
|
$needsrelease, |
|
$chostname, |
|
$cmajor,$cminor); |
|
} |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
if ($needsnewer) { |
$values[$i], |
$message .= &oldversion_warning($values[$i],$chostname,$cmajor, |
$types[$i], |
$cminor,$needsrelease); |
$uname,$udom,$csec,$cgroup); |
} else { |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
$totalstored ++; |
|
} |
|
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>'; |
if ($totalstored) { |
|
$message.='<p class="LC_warning">' |
|
.&mt('Changes can take up to 10 minutes before being active for all students.') |
|
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</p>'; |
|
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
&startpage($r); |
&startpage($r); |
|
|
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="'. |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
'" name="recent_'.$_.'" />'); |
'" name="recent_'.$_.'" />'); |
} |
} |
|
|
|
# ----- Start Parameter Selection |
|
|
|
# Hide parm selection? |
|
$r->print(<<ENDPARMSELSCRIPT); |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function parmsel_show() { |
|
document.getElementById('parmsel').style.display = ""; |
|
document.getElementById('parmsellink').style.display = "none"; |
|
} |
|
// ]]> |
|
</script> |
|
ENDPARMSELSCRIPT |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
$r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); |
my $parmselhiddenstyle=' style="display:none"'; |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
if($env{'form.hideparmsel'} eq 'hidden') { |
|
$r->print('<div id="parmsel"'.$parmselhiddenstyle.'>'); |
|
} else { |
|
$r->print('<div id="parmsel">'); |
|
} |
|
|
|
# Step 1 |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'))); |
|
$r->print(<<COURSECONTENTSCRIPT); |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function showHide_courseContent(){ |
|
var parmlevValue=document.getElementById("parmlev").value; |
|
if (parmlevValue == 'general') { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} else { |
|
if ((parmlevValue == "full") || (parmlevValue == "map")) { |
|
document.getElementById('mapmenu').style.display =""; |
|
} else { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} |
|
} |
|
} |
|
// ]]> |
|
</script> |
|
COURSECONTENTSCRIPT |
|
|
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
|
&partmenu($r,\%allparts,\@psprt); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
if ($parmlev ne 'general') { |
# Step 2 |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'))); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} |
|
|
|
|
# Step 3 |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
# Update Display Button |
|
$r->print('<p>' |
|
.'<input type="submit" name="dis"' |
|
.' value="'.&mt('Update Parameter Display').'" />' |
|
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
|
.'</p>'); |
|
$r->print('</div>'); |
|
|
|
# Offer link to display parameter selection again |
|
$r->print('<p id="parmsellink"'); |
|
if ($env{'form.hideparmsel'} ne 'hidden') { |
|
$r->print($parmselhiddenstyle); |
|
} |
|
$r->print('>' |
|
.'<a href="javascript:parmsel_show()">' |
|
.&mt('Change Parameter Selection') |
|
.'</a>' |
|
.'</p>'); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
# parameter screen for a single resource. |
my $title = &Apache::lonnet::gettitle($pssymb); |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
my $title = &Apache::lonnet::gettitle($pssymb); |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
$r->print(&mt('Specific Resource: [_1] ([_2])', |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
$title,'<span class="LC_filename">'.$resource.'</span>'). |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
|
'<br />'); |
|
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
|
'<label>'. |
|
'<input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' />'. |
|
&mt('Show all parts'). |
|
'</label></td></tr>'); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print('<p>' |
|
.'<input type="submit" name="dis"' |
|
.' value="'.&mt('Update Parameter Display').'" />' |
|
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
|
.'</p>'); |
} |
} |
$r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
|
|
# ----- End Parameter Selection |
|
|
$r->print('<p>'.$message.'</p>'); |
# Display Messages |
|
$r->print('<div>'.$message.'</div>'); |
|
|
$r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />'); |
|
|
|
my @temp_pscat; |
my @temp_pscat; |
map { |
map { |
Line 1984 sub assessparms {
|
Line 2330 sub assessparms {
|
my $csudom=$env{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
my $userspan=3; |
my $userspan=3; |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
$coursespan += 3; |
$coursespan += 3; |
} |
} |
|
|
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
if ($uname) { |
if ($uname) { |
if (@usersgroups > 1) { |
if (@usersgroups > 1) { |
$userspan ++; |
$userspan ++; |
|
} |
|
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
|
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
} |
} |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
my %lt=&Apache::lonlocal::texthash( |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
'pie' => "Parameter in Effect", |
} |
'csv' => "Current Session Value", |
my %lt=&Apache::lonlocal::texthash( |
'rl' => "Resource Level", |
'pie' => "Parameter in Effect", |
'ic' => 'in Course', |
'csv' => "Current Session Value", |
'aut' => "Assessment URL and Title", |
'at' => 'at', |
'type' => 'Type', |
'rl' => "Resource Level", |
'emof' => "Enclosing Map or Folder", |
'ic' => 'in Course', |
'part' => 'Part', |
'aut' => "Assessment URL and Title", |
'pn' => 'Parameter Name', |
'type' => 'Type', |
'def' => 'default', |
'emof' => "Enclosing Map or Folder", |
'femof' => 'from Enclosing Map or Folder', |
'part' => 'Part', |
'gen' => 'general', |
'pn' => 'Parameter Name', |
'foremf' => 'for Enclosing Map or Folder', |
'def' => 'default', |
'fr' => 'for Resource' |
'femof' => 'from Enclosing Map or Folder', |
); |
'gen' => 'general', |
$r->print(<<ENDTABLETWO); |
'foremf' => 'for Enclosing Map or Folder', |
|
'fr' => 'for Resource' |
|
); |
|
$r->print(<<ENDTABLETWO); |
|
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
<th colspan="1">$lt{'ic'}</th> |
<th colspan="1">$lt{'ic'}</th> |
|
|
ENDTABLETWO |
ENDTABLETWO |
if ($csec) { |
if ($csec) { |
$r->print('<th colspan="3">'. |
$r->print('<th colspan="3">'. |
&mt("in Section")." $csec</th>"); |
&mt("in Section")." $csec</th>"); |
} |
} |
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th colspan="3">'. |
$r->print('<th colspan="3">'. |
&mt("in Group")." $cgroup</th>"); |
&mt("in Group")." $cgroup</th>"); |
} |
} |
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
</tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th> |
<th>$lt{'gen'}</th><th>$lt{'foremf'}</th> |
<th>$lt{'gen'}</th><th>$lt{'foremf'}</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th> |
<th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th> |
ENDTABLEHEADFOUR |
ENDTABLEHEADFOUR |
|
|
if ($csec) { |
if ($csec) { |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if (@usersgroups > 1) { |
if (@usersgroups > 1) { |
$r->print('<th>'.&mt('Control by other group?').'</th>'); |
$r->print('<th>'.&mt('Control by other group?').'</th>'); |
|
} |
|
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
} |
} |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
|
} |
|
|
|
$r->print('</tr>'); |
$r->print('</tr>'); |
|
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
my $defbgthree = ''; |
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach (@ids) { |
|
|
my $rid=$_; |
my $rid=$_; |
my ($inmapid)=($rid=~/\.(\d+)$/); |
my ($inmapid)=($rid=~/\.(\d+)$/); |
|
|
if ((!$pssymb && |
if ((!$pssymb && |
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) |
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) |
|| |
|| |
($pssymb && $pssymb eq $symbp{$rid})) { |
($pssymb && $pssymb eq $symbp{$rid})) { |
# ------------------------------------------------------ Entry for one resource |
# ------------------------------------------------------ Entry for one resource |
if ($defbgone eq '#E0E099') { |
if ($defbgone eq '#E0E099') { |
$defbgone='#E0E0DD'; |
$defbgone='#E0E0DD'; |
Line 2119 ENDTABLEHEADFOUR
|
Line 2464 ENDTABLEHEADFOUR
|
} |
} |
my $totalparms=scalar keys %name; |
my $totalparms=scalar keys %name; |
if ($totalparms>0) { |
if ($totalparms>0) { |
my $firstrow=1; |
my $firstrow=1; |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
$r->print('<tr><td style="background-color:'.$defbgone.';"'. |
$r->print('<tr><td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'><tt><font size="-1">'. |
'><tt><font size="-1">'. |
join(' / ',split(/\//,$uri)). |
join(' / ',split(/\//,$uri)). |
'</font></tt><p><b>'. |
'</font></tt><p><b>'. |
"<a href=\"javascript:openWindow('". |
"<a href=\"javascript:openWindow('". |
&Apache::lonnet::clutter($uri).'?symb='. |
&Apache::lonnet::clutter($uri).'?symb='. |
&escape($symbp{$rid}). |
&escape($symbp{$rid}). |
"', 'metadatafile', '450', '500', 'no', 'yes');\"". |
"', 'metadatafile', '450', '500', 'no', 'yes');\"". |
" target=\"_self\">$title"); |
" target=\"_self\">$title"); |
|
|
Line 2177 ENDTABLEHEADFOUR
|
Line 2522 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
my $maptitle = $maplist{$mapid}; |
my $maptitle = $maplist{$mapid}; |
|
|
#----------------------- loop through ids and get all parameter types for map |
#----------------------- loop through ids and get all parameter types for map |
Line 2189 ENDTABLEHEADFOUR
|
Line 2534 ENDTABLEHEADFOUR
|
my %default = (); |
my %default = (); |
my $map = 0; |
my $map = 0; |
|
|
# $r->print("Catmarker: @catmarker<br />\n"); |
# $r->print("Catmarker: @catmarker<br />\n"); |
|
|
foreach (@ids) { |
foreach (@ids) { |
($map)=(/([\d]*?)\./); |
($map)=(/([\d]*?)\./); |
my $rid = $_; |
my $rid = $_; |
|
|
# $r->print("$mapid:$map: $rid <br /> \n"); |
# $r->print("$mapid:$map: $rid <br /> \n"); |
|
|
if ($map eq $mapid) { |
if ($map eq $mapid) { |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
# $r->print("Keys: $keyp{$rid} <br />\n"); |
# $r->print("Keys: $keyp{$rid} <br />\n"); |
|
|
#-------------------------------------------------------------------- |
#-------------------------------------------------------------------- |
Line 2208 ENDTABLEHEADFOUR
|
Line 2553 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
|
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
if ($allparms{$name{$tempkeyp}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
$identifier = $1; |
$identifier = $1; |
} |
} |
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
} else { |
} else { |
$display{$tempkeyp} = $parmdis; |
$display{$tempkeyp} = $parmdis; |
} |
} |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
|
} |
|
} # end loop through keys |
} |
} |
} # end loop through keys |
|
} |
|
} # end loop through ids |
} # end loop through ids |
|
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
Line 2241 ENDTABLEHEADFOUR
|
Line 2586 ENDTABLEHEADFOUR
|
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
my $tmp=""; |
my $tmp=""; |
if ($uname) { |
if ($uname) { |
my $person=&Apache::loncommon::plainname($uname,$udom); |
my $person=&Apache::loncommon::plainname($uname,$udom); |
$tmp.=&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 { |
Line 2272 ENDTABLEHEADFOUR
|
Line 2617 ENDTABLEHEADFOUR
|
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
Line 2312 ENDTABLEHEADFOUR
|
Line 2657 ENDTABLEHEADFOUR
|
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
if ($allparms{$name{$tempkeyp}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
$identifier = $1; |
$identifier = $1; |
|
} |
|
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
|
} else { |
|
$display{$tempkeyp} = $parmdis; |
} |
} |
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
} else { |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} = $parmdis; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
} |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
} |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
|
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
|
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
|
} |
|
} # end loop through keys |
} # end loop through keys |
} # end loop through ids |
} # end loop through ids |
|
|
#---------------------------------------------------- print header information |
#---------------------------------------------------- print header information |
my $setdef=&mt("Set Defaults for All Resources in Course"); |
my $setdef=&mt("Set Defaults for All Resources in Course"); |
$r->print(<<ENDMAPONE); |
$r->print(<<ENDMAPONE); |
<center> |
<center> |
<h4>$setdef |
<h4>$setdef |
<font color="red"><i>$coursename</i></font><br /> |
<font color="red"><i>$coursename</i></font><br /> |
ENDMAPONE |
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> \n"); |
$r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n"); |
} else { |
} else { |
$r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n"); |
$r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n"); |
Line 2363 ENDMAPONE
|
Line 2708 ENDMAPONE
|
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
Line 2385 my $tableopen;
|
Line 2730 my $tableopen;
|
|
|
sub tablestart { |
sub tablestart { |
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
} |
} |
} |
} |
|
|
sub tableend { |
sub tableend { |
if ($tableopen) { |
if ($tableopen) { |
$tableopen=0; |
$tableopen=0; |
return &Apache::loncommon::end_data_table(); |
return &Apache::loncommon::end_data_table(); |
} else { |
} else { |
return''; |
return''; |
} |
} |
} |
} |
|
|
Line 2411 sub readdata {
|
Line 2756 sub readdata {
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach (keys %$classlist) { |
if ($_=~/^($match_username)\:($match_domain)$/) { |
if ($_=~/^($match_username)\:($match_domain)$/) { |
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}) { |
if ($userkey=~/^$env{'request.course.id'}/) { |
if ($userkey=~/^$env{'request.course.id'}/) { |
my $newkey=$userkey; |
my $newkey=$userkey; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
} |
} |
} |
} |
} |
} |
} |
} |
return $resourcedata; |
return $resourcedata; |
} |
} |
Line 2437 sub storedata {
|
Line 2782 sub storedata {
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
foreach my $key (keys(%env)) { |
my $cmd=$1; |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $thiskey=$2; |
my $cmd=$1; |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $thiskey=$2; |
my $tkey=$thiskey; |
my ($tuname,$tudom)=&extractuser($thiskey); |
|
my $tkey=$thiskey; |
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text); |
my ($data, $typeof, $text); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$_}; |
$data=$env{$key}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
} elsif ($cmd eq 'datepointer') { |
if ($typeof eq 'string_questiontype') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
my ($needsrelease,$needsnewer); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$data}; |
$text = &mt('Saved modified date for'); |
if ($needsrelease) { |
} elsif ($cmd eq 'dateinterval') { |
unless ($got_chostname) { |
$data=&get_date_interval_from_form($thiskey); |
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$got_chostname = 1; |
$text = &mt('Saved modified date for'); |
} |
} |
$needsnewer = &questiontype_releasecheck($data,$needsrelease, |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
$chostname,$cmajor, |
if ($tuname) { |
$cminor); |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
} |
$tkey.'.type' => $typeof}, |
if ($needsnewer) { |
$tudom,$tuname) eq 'ok') { |
$r->print('<br />'.&oldversion_warning($data,$chostname,$cmajor, |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$cminor,$needsrelease)); |
$r->print('<br />'.$text.' '. |
next; |
&Apache::loncommon::plainname($tuname,$tudom)); |
} |
} else { |
} |
$r->print('<div class="LC_error">'. |
} elsif ($cmd eq 'datepointer') { |
&mt('Error saving parameters').'</div>'); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
} |
$typeof=$env{'form.typeof_'.$thiskey}; |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
$text = &mt('Saved modified date for'); |
} else { |
} elsif ($cmd eq 'dateinterval') { |
$newdata{$thiskey}=$data; |
$data=&get_date_interval_from_form($thiskey); |
$newdata{$thiskey.'.type'}=$typeof; |
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
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 />'.$text.' '. |
|
&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error saving parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
|
$newdata{$thiskey}=$data; |
|
$newdata{$thiskey.'.type'}=$typeof; |
} |
} |
} |
} |
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
push (@deldata,$thiskey,$thiskey.'.type'); |
push (@deldata,$thiskey,$thiskey.'.type'); |
} |
} |
} |
} |
} |
} |
} |
} |
# Store all course level |
# Store all course level |
my $delentries=$#deldata+1; |
my $delentries=$#deldata+1; |
my @newdatakeys=keys %newdata; |
my @newdatakeys=keys %newdata; |
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
my %loghash=map { $_ => '' } @deldata; |
my %loghash=map { $_ => '' } @deldata; |
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
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('Saved [_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 saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
} |
} |
|
|
Line 2532 sub parse_listdata_key {
|
Line 2896 sub parse_listdata_key {
|
# split into student/section affected, and |
# split into student/section affected, and |
# the realm (folder/resource part and parameter |
# the realm (folder/resource part and parameter |
my ($student,$realm) = |
my ($student,$realm) = |
($key=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)$/); |
($key=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)$/); |
# if course wide student would be undefined |
# if course wide student would be undefined |
if (!defined($student)) { |
if (!defined($student)) { |
($realm)=($key=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
($realm)=($key=~/^\Q$env{'request.course.id'}\E\.(.+)$/); |
} |
} |
# strip off the .type if it's not the Question type parameter |
# strip off the .type if it's not the Question type parameter |
if ($realm=~/\.type$/ && !exists($listdata->{$key.'.type'})) { |
if ($realm=~/\.type$/ && !exists($listdata->{$key.'.type'})) { |
$realm=~s/\.type//; |
$realm=~s/\.type//; |
} |
} |
# split into resource+part and parameter name |
# split into resource+part and parameter name |
my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/); |
my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/); |
Line 2560 sub listdata {
|
Line 2924 sub listdata {
|
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 ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
|
# get the numerical order for the param |
# get the numerical order for the param |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
$bparm=$keyorder{'parameter_0_'.$bparm}; |
$bparm=$keyorder{'parameter_0_'.$bparm}; |
|
|
my $result=0; |
my $result=0; |
|
|
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($ares ne $bres ) { |
if ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
$result = ($ares cmp $bres); |
} elsif ($astudent ne $bstudent) { |
} elsif ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
$result = ($apart cmp $bpart); |
$result = ($apart cmp $bpart); |
} |
} |
} else { |
} else { |
if ($astudent ne $bstudent) { |
if ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($ares ne $bres ) { |
} elsif ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
$result = ($ares cmp $bres); |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
$result = ($apart cmp $bpart); |
$result = ($apart cmp $bpart); |
} |
} |
} |
} |
|
|
if (!$result) { |
if (!$result) { |
if (defined($aparm) && defined($bparm)) { |
if (defined($aparm) && defined($bparm)) { |
$result = ($aparm <=> $bparm); |
$result = ($aparm <=> $bparm); |
} elsif (defined($aparm)) { |
} elsif (defined($aparm)) { |
$result = -1; |
$result = -1; |
} elsif (defined($bparm)) { |
} elsif (defined($bparm)) { |
$result = 1; |
$result = 1; |
} |
} |
} |
} |
|
|
$result; |
$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'}) { |
$thistype=$$resourcedata{$thiskey.'.type'}; |
$thistype=$$resourcedata{$thiskey.'.type'}; |
} |
} |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
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; |
} |
} |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
} |
} |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($realm ne $oldrealm) { |
if ($realm ne $oldrealm) { |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
$oldrealm=$realm; |
$oldrealm=$realm; |
$oldsection=''; |
$oldsection=''; |
} |
} |
if ($section ne $oldsection) { |
if ($section ne $oldsection) { |
$r->print(&tableend()."\n<h2>$section</h2>"); |
$r->print(&tableend()."\n<h2>$section</h2>"); |
$oldsection=$section; |
$oldsection=$section; |
$oldpart=''; |
$oldpart=''; |
} |
} |
} else { |
} else { |
if ($section ne $oldsection) { |
if ($section ne $oldsection) { |
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
$oldsection=$section; |
$oldsection=$section; |
$oldrealm=''; |
$oldrealm=''; |
} |
} |
if ($realm ne $oldrealm) { |
if ($realm ne $oldrealm) { |
$r->print(&tableend()."\n<h2>$realm</h2>"); |
$r->print(&tableend()."\n<h2>$realm</h2>"); |
$oldrealm=$realm; |
$oldrealm=$realm; |
$oldpart=''; |
$oldpart=''; |
} |
} |
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$r->print(&tableend(). |
"\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>"); |
"\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>"); |
$oldpart=$part; |
$oldpart=$part; |
} |
} |
# |
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart(). |
my $parmitem = &standard_parameter_names($name); |
&Apache::loncommon::start_data_table_row(). |
$r->print(&tablestart(). |
'<td><b>'.&standard_parameter_names($name). |
&Apache::loncommon::start_data_table_row(). |
'</b></td><td><input type="checkbox" name="del_'. |
'<td><b>'.&mt($parmitem). |
$thiskey.'" /></td><td>'); |
'</b></td><td><input type="checkbox" name="del_'. |
$foundkeys++; |
$thiskey.'" /></td><td>'); |
if (&isdateparm($thistype)) { |
$foundkeys++; |
my $jskey='key_'.$pointer; |
if (&isdateparm($thistype)) { |
$pointer++; |
my $jskey='key_'.$pointer; |
$r->print( |
$pointer++; |
&Apache::lonhtmlcommon::date_setter('parmform', |
$r->print( |
$jskey, |
&Apache::lonhtmlcommon::date_setter('parmform', |
$$resourcedata{$thiskey}, |
$jskey, |
'',1,'',''). |
$$resourcedata{$thiskey}, |
|
'',1,'',''). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
&mt('Shift all dates based on this date').'</a></span>':''). |
&mt('Shift all dates based on this date').'</a></span>':''). |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} elsif ($thistype eq 'date_interval') { |
} elsif ($thistype eq 'date_interval') { |
$r->print(&date_interval_selector($thiskey, |
$r->print(&date_interval_selector($thiskey, |
$$resourcedata{$thiskey})); |
$$resourcedata{$thiskey})); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
$r->print(&string_selector($thistype,$thiskey, |
$r->print(&string_selector($thistype,$thiskey, |
$$resourcedata{$thiskey})); |
$$resourcedata{$thiskey})); |
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'" />'); |
$thistype.'" />'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
} |
} |
Line 2698 sub date_interval_selector {
|
Line 3063 sub date_interval_selector {
|
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval) = @_; |
my $result; |
my $result; |
foreach my $which (['days', 86400, 31], |
foreach my $which (['days', 86400, 31], |
['hours', 3600, 23], |
['hours', 3600, 23], |
['minutes', 60, 59], |
['minutes', 60, 59], |
['seconds', 1, 59]) { |
['seconds', 1, 59]) { |
my ($name, $factor, $max) = @{ $which }; |
my ($name, $factor, $max) = @{ $which }; |
my $amount = int($showval/$factor); |
my $amount = int($showval/$factor); |
$showval %= $factor; |
$showval %= $factor; |
my %select = ((map {$_ => $_} (0..$max)), |
my %select = ((map {$_ => $_} (0..$max)), |
'select_form_order' => [0..$max]); |
'select_form_order' => [0..$max]); |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
%select); |
\%select); |
$result .= ' '.&mt($name); |
$result .= ' '.&mt($name); |
} |
} |
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
return $result; |
return $result; |
Line 2719 sub get_date_interval_from_form {
|
Line 3084 sub get_date_interval_from_form {
|
my ($key) = @_; |
my ($key) = @_; |
my $seconds = 0; |
my $seconds = 0; |
foreach my $which (['days', 86400], |
foreach my $which (['days', 86400], |
['hours', 3600], |
['hours', 3600], |
['minutes', 60], |
['minutes', 60], |
['seconds', 1]) { |
['seconds', 1]) { |
my ($name, $factor) = @{ $which }; |
my ($name, $factor) = @{ $which }; |
if (defined($env{'form.'.$name.'_'.$key})) { |
if (defined($env{'form.'.$name.'_'.$key})) { |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
} |
} |
} |
} |
return $seconds; |
return $seconds; |
} |
} |
Line 2740 my %strings =
|
Line 3105 my %strings =
|
( |
( |
'string_yesno' |
'string_yesno' |
=> [[ 'yes', 'Yes' ], |
=> [[ 'yes', 'Yes' ], |
[ 'no', 'No' ]], |
[ 'no', 'No' ]], |
'string_problemstatus' |
'string_problemstatus' |
=> [[ 'yes', 'Yes' ], |
=> [[ 'yes', 'Yes' ], |
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
'string_questiontype' |
|
=> [[ 'problem', 'Standard Problem'], |
|
[ 'survey', 'Survey'], |
|
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
|
[ 'exam', 'Exam'], |
|
[ 'anonsurvey', 'Anonymous Survey'], |
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
|
[ 'practice', 'Practice'], |
|
[ 'surveycred', 'Survey (credit for submission)']], |
); |
); |
|
|
|
sub standard_string_options { |
|
my ($string_type) = @_; |
|
if (ref($strings{$string_type}) eq 'ARRAY') { |
|
return $strings{$string_type}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval); |
|
} |
|
|
|
my %skiptype; |
|
if ($thistype eq 'string_questiontype') { |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
my $needsrelease=$Apache::lonnet::needsrelease{'parameter:type:'.$name}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=&questiontype_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=&questiontype_releasecheck($name,$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
if ($needsnewer) { |
|
$skiptype{$name} = 1; |
|
} |
|
} |
|
} |
} |
} |
|
|
my $result; |
my $result; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
my $numinrow = 3; |
my ($name, $description) = @{ $possibilities }; |
if ($thistype eq 'string_problemstatus') { |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
$numinrow = 2; |
'" value="'.$name.'"'; |
} elsif ($thistype eq 'string_questiontype') { |
if ($showval eq $name) { |
if (keys(%skiptype) > 0) { |
$result .= ' checked="checked"'; |
$numinrow = 4; |
} |
} |
$result .= ' />'.&mt($description).'</label> '; |
} |
|
my $rem; |
|
if (ref($strings{$thistype}) eq 'ARRAY') { |
|
my $i=0; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
next if ($skiptype{$name}); |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$result .= '</tr>'; |
|
} |
|
$result .= '<tr>'; |
|
} |
|
$result .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label></span></td>'; |
|
$i++; |
|
} |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
|
} |
|
if ($result) { |
|
$result = '<table border="0">'.$result.'</table>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 2810 sub newoverview {
|
Line 3249 sub newoverview {
|
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'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 2845 ENDOVER
|
Line 3284 ENDOVER
|
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='0'; } |
|
|
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 my $sec (@selected_sections) { |
foreach my $sec (@selected_sections) { |
if ($sec eq 'all') { |
if ($sec eq 'all') { |
Line 2865 ENDOVER
|
Line 3304 ENDOVER
|
} |
} |
|
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
|
|
if (grep {$_ eq 'all'} (@psprt)) { |
if (grep {$_ eq 'all'} (@psprt)) { |
@psprt = keys(%allparts); |
@psprt = keys(%allparts); |
} |
} |
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
#$r->print('<table id="LC_parm_overview_scope"> |
|
# <tr><td class="LC_parm_overview_level_menu">'); |
|
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_Box">'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
#$r->print('</td>'); |
|
} |
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
#$r->print('</td></tr></table>'); |
|
|
|
#$r->print('<table id="LC_parm_overview_controls"> |
|
# <tr><td class="LC_parm_overview_parm_selectors">'); |
|
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_Box">'); |
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
Line 2901 ENDOVER
|
Line 3333 ENDOVER
|
&parmboxes($r,\%allparms,\@pscat,\%keyorder); |
&parmboxes($r,\%allparms,\@pscat,\%keyorder); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
$r->print('<table>'. |
$r->print('<table>'. |
|
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
Line 2937 ENDOVER
|
Line 3368 ENDOVER
|
|
|
if (($env{'form.store'}) || ($env{'form.dis'})) { |
if (($env{'form.store'}) || ($env{'form.dis'})) { |
|
|
if ($env{'form.store'}) { &storedata($r,$crs,$dom); } |
if ($env{'form.store'}) { &storedata($r,$crs,$dom); } |
|
|
# Read modified data |
# Read modified data |
|
|
my $resourcedata=&readdata($crs,$dom); |
my $resourcedata=&readdata($crs,$dom); |
|
|
# List data |
# List data |
|
|
&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('Save').'" /></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()); |
} |
} |
|
|
sub secgroup_lister { |
sub secgroup_lister { |
Line 2993 sub overview {
|
Line 3424 sub overview {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3019 ENDOVER
|
Line 3450 ENDOVER
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
sub clean_parameters { |
sub clean_parameters { |
Line 3029 sub clean_parameters {
|
Line 3460 sub clean_parameters {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
text=>"Clean Parameters"}); |
text=>"Clean Parameters"}); |
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3048 ENDOVER
|
Line 3479 ENDOVER
|
# List data |
# List data |
|
|
$r->print('<h3>'. |
$r->print('<h3>'. |
&mt('These parameters refer to resources that do not exist.'). |
&mt('These parameters refer to resources that do not exist.'). |
'</h3>'. |
'</h3>'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'.'<br />'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'.'<br />'. |
'<br />'); |
'<br />'); |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table(). |
'<tr>'. |
'<tr>'. |
'<th>'.&mt('Delete').'</th>'. |
'<th>'.&mt('Delete').'</th>'. |
'<th>'.&mt('Parameter').'</th>'. |
'<th>'.&mt('Parameter').'</th>'. |
'</tr>'); |
'</tr>'); |
foreach my $thiskey (sort(keys(%{$resourcedata}))) { |
foreach my $thiskey (sort(keys(%{$resourcedata}))) { |
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 (1) { #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}; |
my $display_value = $resourcedata->{$thiskey}; |
if (&isdateparm($resourcedata->{$thiskey.'.type'})) { |
if (&isdateparm($resourcedata->{$thiskey.'.type'})) { |
$display_value = |
$display_value = |
&Apache::lonlocal::locallocaltime($display_value); |
&Apache::lonlocal::locallocaltime($display_value); |
} |
} |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
my $parmitem = &standard_parameter_names($data{'parameter_name'}); |
&standard_parameter_names($data{'parameter_name'}), |
$parmitem = &mt($parmitem); |
$resourcedata->{$thiskey})); |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$r->print('<br />'); |
$parmitem,$resourcedata->{$thiskey})); |
if ($data{'scope_type'} eq 'all') { |
$r->print('<br />'); |
$r->print(&mt('All users')); |
if ($data{'scope_type'} eq 'all') { |
} elsif ($data{'scope_type'} eq 'user') { |
$r->print(&mt('All users')); |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
} elsif ($data{'scope_type'} eq 'user') { |
} elsif ($data{'scope_type'} eq 'section') { |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
} elsif ($data{'scope_type'} eq 'section') { |
} elsif ($data{'scope_type'} eq 'group') { |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
$r->print(&mt('Group: [_1]',$data{'scope'})); |
} elsif ($data{'scope_type'} eq 'group') { |
} |
$r->print(&mt('Group: [_1]',$data{'scope'})); |
$r->print('<br />'); |
} |
if ($data{'realm_type'} eq 'all') { |
$r->print('<br />'); |
$r->print(&mt('All Resources')); |
if ($data{'realm_type'} eq 'all') { |
} elsif ($data{'realm_type'} eq 'folder') { |
$r->print(&mt('All Resources')); |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
} elsif ($data{'realm_type'} eq 'folder') { |
} elsif ($data{'realm_type'} eq 'symb') { |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
my ($map,$resid,$url) = |
} elsif ($data{'realm_type'} eq 'symb') { |
&Apache::lonnet::decode_symb($data{'realm'}); |
my ($map,$resid,$url) = |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
&Apache::lonnet::decode_symb($data{'realm'}); |
$url,$resid,$map)); |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
} |
$url,$resid,$map)); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
} |
$r->print('</td></tr>'); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
|
$r->print('</td></tr>'); |
|
|
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'. |
'</p></form>'. |
'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
sub date_shift_one { |
sub date_shift_one { |
Line 3114 sub date_shift_one {
|
Line 3546 sub date_shift_one {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3141 sub date_shift_two {
|
Line 3573 sub date_shift_two {
|
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'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
Line 3161 sub parse_key {
|
Line 3593 sub parse_key {
|
my ($key) = @_; |
my ($key) = @_; |
my %data; |
my %data; |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
$data{'scope_type'} = 'all'; |
$data{'scope_type'} = 'all'; |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$data{'scope'} = $1; |
$data{'scope'} = $1; |
if ($data{'scope'}=~/^useropt\:($match_username)\:($match_domain)/) { |
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 { |
#FIXME check for group scope |
#FIXME check for group scope |
$data{'scope_type'} = 'section'; |
$data{'scope_type'} = 'section'; |
} |
} |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
$data{'realm_type'}='all'; |
$data{'realm_type'}='all'; |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$data{'realm'} = $1; |
$data{'realm'} = $1; |
$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'}); |
} elsif ($middle) { |
} elsif ($middle) { |
$data{'realm'} = $middle; |
$data{'realm'} = $middle; |
$data{'realm_type'} = 'symb'; |
$data{'realm_type'} = 'symb'; |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($data{'realm'}); |
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($data{'realm'}); |
$data{'realm_exists'} = &Apache::lonnet::symbverify($data{'realm'},$url); |
$data{'realm_exists'} = &Apache::lonnet::symbverify($data{'realm'},$url); |
} |
} |
|
|
$data{'parameter_part'} = $part; |
$data{'parameter_part'} = $part; |
Line 3197 sub parse_key {
|
Line 3629 sub parse_key {
|
} |
} |
|
|
|
|
|
|
sub extract_cloners { |
|
my ($clonelist,$allowclone) = @_; |
|
if ($clonelist =~ /,/) { |
|
@{$allowclone} = split(/,/,$clonelist); |
|
} else { |
|
$$allowclone[0] = $clonelist; |
|
} |
|
} |
|
|
|
sub check_cloners { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($clean_clonelist,%disallowed); |
|
my @allowclone = (); |
|
&extract_cloners($$clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
|
if ($currclone eq '*') { |
|
$clean_clonelist .= $currclone.','; |
|
} else { |
|
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 { |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
} |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
foreach my $key (keys(%disallowed)) { |
|
$disallowed{$key} =~ s/,$//; |
|
} |
|
if ($clean_clonelist) { |
|
$clean_clonelist =~ s/,$//; |
|
} |
|
$$clonelist = $clean_clonelist; |
|
return %disallowed; |
|
} |
|
|
|
sub change_clone { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($uname,$udom); |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $clone_crs = $cnum.':'.$cdom; |
|
|
|
if ($cnum && $cdom) { |
|
my @allowclone; |
|
&extract_cloners($clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^$currclone$/,@$oldcloner)) { |
|
if ($currclone ne '*') { |
|
($uname,$udom) = split(/:/,$currclone); |
|
if ($uname && $udom && $uname ne '*') { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} eq '') { |
|
$currclonecrs{'cloneable'} = $clone_crs; |
|
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
foreach my $oldclone (@$oldcloner) { |
|
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
|
if ($oldclone ne '*') { |
|
($uname,$udom) = split(/:/,$oldclone); |
|
if ($uname && $udom && $uname ne '*' ) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
my %newclonecrs = (); |
|
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} =~ /,/) { |
|
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
|
foreach my $crs (@currclonecrs) { |
|
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
|
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Parameter Manager'); |
return &Apache::loncommon::start_page('Parameter Manager'); |
} |
} |
Line 3335 ENDMAINFORMHEAD
|
Line 3650 ENDMAINFORMHEAD
|
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 $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
|
|
my $crstype = &Apache::loncommon::course_type(); |
|
my $lc_crstype = lc($crstype); |
|
|
my @menu = |
my @menu = |
( { categorytitle=>'Settings for this Course', |
( { categorytitle=>"Settings for this $crstype", |
items => [ |
items => [ |
{ linktext => 'Course Configuration', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/courseprefs?origin=params', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission, |
linktitle =>'Edit course configuration.' , |
linktitle => "Restrict metadata for this $lc_crstype." , |
icon => 'preferences-desktop-remote-desktop.png' , |
icon =>'contact-new.png' , |
#help => 'Course_Environment', |
}, |
}, |
{ linktext => 'Reset Student Access Times', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $mgr, |
permission => $parm_permission, |
linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , |
linktitle => 'Restrict metadata for this course.' , |
icon => 'start-here.png' , |
icon =>'contact-new.png' , |
}, |
}, |
|
{ linktext => 'Manage Course Slots', |
{ linktext => 'Set Parameter Setting Default Actions', |
url => '/adm/slotrequest?command=showslots', |
url => '/adm/parmset?action=setdefaults', |
permission => $vgr, |
permission => $parm_permission, |
linktitle =>'Manage slots for this course.' , |
linktitle =>'Set default actions for parameters.' , |
icon => 'format-justify-fill.png' , |
icon => 'folder-new.png' , |
}, |
}]}, |
{ linktext => 'Reset Student Access Times', |
{ categorytitle => 'New and Existing Parameter Settings for Resources', |
url => '/adm/helper/resettimes.helper', |
items => [ |
permission => $mgr, |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
linktitle =>'Reset access times for folders/maps, resources or the course.' , |
url => '/adm/helper/parameter.helper', |
icon => 'start-here.png' , |
permission => $parm_permission, |
}, |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
|
icon => 'dialog-information.png' , |
{ linktext => 'Set Parameter Setting Default Actions', |
#help => 'Parameter_Helper', |
url => '/adm/parmset?action=setdefaults', |
}, |
permission => $parm_permission, |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
linktitle =>'Set default actions for parameters.' , |
url => '/adm/parmset?action=newoverview', |
icon => 'folder-new.png' , |
permission => $parm_permission, |
}]}, |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
{ categorytitle => 'New and Existing Parameter Settings for Resources', |
icon => 'edit-find.png' , |
items => [ |
#help => 'Parameter_Overview', |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
}, |
url => '/adm/helper/parameter.helper', |
{ linktext => 'Edit Resource Parameters - Table Mode', |
permission => $parm_permission, |
url => '/adm/parmset?action=settable', |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
permission => $parm_permission, |
icon => 'dialog-information.png' , |
linktitle =>'Set/Modify resource parameters in table mode.' , |
#help => 'Parameter_Helper', |
icon => 'edit-copy.png' , |
}, |
#help => 'Table_Mode', |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
}]}, |
url => '/adm/parmset?action=newoverview', |
|
permission => $parm_permission, |
|
linktitle =>'Set/Modify resource parameters in overview mode.' , |
|
icon => 'edit-find.png' , |
|
#help => 'Parameter_Overview', |
|
}, |
|
{ linktext => 'Edit Resource Parameters - Table Mode', |
|
url => '/adm/parmset?action=settable', |
|
permission => $parm_permission, |
|
linktitle =>'Set/Modify resource parameters in table mode.' , |
|
icon => 'edit-copy.png' , |
|
#help => 'Table_Mode', |
|
}]}, |
|
{ categorytitle => 'Existing Parameter Settings for Resources', |
{ categorytitle => 'Existing Parameter Settings for Resources', |
items => [ |
items => [ |
{ linktext => 'Modify Resource Parameters - Overview Mode', |
{ linktext => 'Modify Resource Parameters - Overview Mode', |
url => '/adm/parmset?action=setoverview', |
url => '/adm/parmset?action=setoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
icon => 'preferences-desktop-wallpaper.png' , |
icon => 'preferences-desktop-wallpaper.png' , |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => 'Change Log', |
{ linktext => 'Change Log', |
url => '/adm/parmset?action=parameterchangelog', |
url => '/adm/parmset?action=parameterchangelog', |
permission => $parm_permission, |
permission => $parm_permission, |
linktitle =>'View parameter and course blog posting/user notification change log.' , |
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
icon => 'emblem-system.png' , |
icon => 'document-properties.png', |
}]} |
}]} |
); |
); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
return; |
return; |
Line 3429 sub output_row {
|
Line 3733 sub output_row {
|
my @options= ( ['active', 'Show to student'], |
my @options= ( ['active', 'Show to student'], |
['stuadd', 'Provide text area for students to type metadata'], |
['stuadd', 'Provide text area for students to type metadata'], |
['choices','Provide choices for students to select from']); |
['choices','Provide choices for students to select from']); |
# ['onlyone','Student may select only one choice']); |
# ['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']; |
} |
} |
Line 3437 sub output_row {
|
Line 3741 sub output_row {
|
$output .= '<td><strong>'.$field_text.':</strong></td>'; |
$output .= '<td><strong>'.$field_text.':</strong></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$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 .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 5).'<label> |
$output .= '<td>'.(' ' x 5).'<label> |
<input type="checkbox" name="'. |
<input type="checkbox" name="'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
&mt($opt->[1]).'</label></td>'; |
&mt($opt->[1]).'</label></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).'<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></td>'; |
$output .= '<td>'.(' ' x 10).'<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
Line 3457 sub output_row {
|
Line 3761 sub output_row {
|
$multiple_checked = ' checked="checked"'; |
$multiple_checked = ' checked="checked"'; |
$single_checked = ''; |
$single_checked = ''; |
} |
} |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).' |
$output .= '<td>'.(' ' x 10).' |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' /> |
<input type="radio" name="'.$field_name.'_onlyone" value="multiple"'.$multiple_checked .' /> |
'.&mt('Student may select multiple choices from list').'</td>'; |
'.&mt('Student may select multiple choices from list').'</td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).' |
$output .= '<td>'.(' ' x 10).' |
<input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' /> |
<input type="radio" name="'.$field_name.'_onlyone" value="single"'.$single_checked.' /> |
'.&mt('Student may select only one choice from list').'</td>'; |
'.&mt('Student may select only one choice from list').'</td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
return ($output); |
return ($output); |
} |
} |
Line 3480 sub order_meta_fields {
|
Line 3784 sub order_meta_fields {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
&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"}); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/parmset?action=setrestrictmeta", |
({href=>"/adm/parmset?action=setrestrictmeta", |
text=>"Restrict Metadata"}, |
text=>"Restrict Metadata"}, |
Line 3495 sub order_meta_fields {
|
Line 3799 sub order_meta_fields {
|
if ($newpos > $currentpos) { |
if ($newpos > $currentpos) { |
# moving stuff up |
# moving stuff up |
for ($i=0;$i<$currentpos;$i++) { |
for ($i=0;$i<$currentpos;$i++) { |
$neworder[$i]=$oldorder[$i]; |
$neworder[$i]=$oldorder[$i]; |
} |
} |
for ($i=$currentpos;$i<$newpos;$i++) { |
for ($i=$currentpos;$i<$newpos;$i++) { |
$neworder[$i]=$oldorder[$i+1]; |
$neworder[$i]=$oldorder[$i+1]; |
} |
} |
$neworder[$newpos]=$oldorder[$currentpos]; |
$neworder[$newpos]=$oldorder[$currentpos]; |
for ($i=$newpos+1;$i<=$#oldorder;$i++) { |
for ($i=$newpos+1;$i<=$#oldorder;$i++) { |
$neworder[$i]=$oldorder[$i]; |
$neworder[$i]=$oldorder[$i]; |
} |
} |
} else { |
} else { |
# moving stuff down |
# moving stuff down |
for ($i=0;$i<$newpos;$i++) { |
for ($i=0;$i<$newpos;$i++) { |
$neworder[$i]=$oldorder[$i]; |
$neworder[$i]=$oldorder[$i]; |
} |
} |
$neworder[$newpos]=$oldorder[$currentpos]; |
$neworder[$newpos]=$oldorder[$currentpos]; |
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
$neworder[$i]=$oldorder[$i-1]; |
$neworder[$i]=$oldorder[$i-1]; |
} |
} |
for ($i=$currentpos+1;$i<=$#oldorder;$i++) { |
for ($i=$currentpos+1;$i<=$#oldorder;$i++) { |
$neworder[$i]=$oldorder[$i]; |
$neworder[$i]=$oldorder[$i]; |
} |
} |
} |
} |
my $ordered_fields = join ",", @neworder; |
my $ordered_fields = join ",", @neworder; |
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields}); |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields}); |
} |
} |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $ordered_fields; |
my $ordered_fields; |
Line 3571 sub continue {
|
Line 3875 sub continue {
|
sub addmetafield { |
sub addmetafield { |
my ($r)=@_; |
my ($r)=@_; |
&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"}); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 3626 sub setrestrictmeta {
|
Line 3930 sub setrestrictmeta {
|
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 3641 sub setrestrictmeta {
|
Line 3945 sub setrestrictmeta {
|
my $meta_key = $2; |
my $meta_key = $2; |
if ($save_field ne $meta_field) { |
if ($save_field ne $meta_field) { |
$save_field = $meta_field; |
$save_field = $meta_field; |
if ($env{'form.'.$meta_field.'_stuadd'}) { |
if ($env{'form.'.$meta_field.'_stuadd'}) { |
$options.='stuadd,'; |
$options.='stuadd,'; |
} |
} |
if ($env{'form.'.$meta_field.'_choices'}) { |
if ($env{'form.'.$meta_field.'_choices'}) { |
$options.='choices,'; |
$options.='choices,'; |
} |
} |
if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') { |
if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') { |
$options.='onlyone,'; |
$options.='onlyone,'; |
} |
} |
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
$options.='active,'; |
$options.='active,'; |
} |
} |
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 3666 sub setrestrictmeta {
|
Line 3970 sub setrestrictmeta {
|
} |
} |
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
{'freshen_cache' => 1}); |
{'freshen_cache' => 1}); |
# 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 |
Line 3676 sub setrestrictmeta {
|
Line 3980 sub setrestrictmeta {
|
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; |
$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); |
my $buttons = (<<ENDButtons); |
<input type="submit" name="restrictmeta" value="Save" /> |
<input type="submit" name="restrictmeta" value="Save" /> |
Line 3740 sub defaultsetter {
|
Line 4044 sub defaultsetter {
|
my ($r) = @_; |
my ($r) = @_; |
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
text=>"Set Defaults"}); |
text=>"Set Defaults"}); |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
$r->print(<<ENDDEFHEAD); |
$r->print(<<ENDDEFHEAD); |
$start_page |
$start_page |
Line 3766 ENDDEFHEAD
|
Line 4070 ENDDEFHEAD
|
my %defkeytype=(); |
my %defkeytype=(); |
|
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype); |
if ($env{'form.storerules'}) { |
if ($env{'form.storerules'}) { |
my %newrules=(); |
my %newrules=(); |
my @delrules=(); |
my @delrules=(); |
my %triggers=(); |
my %triggers=(); |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key=~/^form\.(\w+)\_action$/) { |
if ($key=~/^form\.(\w+)\_action$/) { |
my $tempkey=$1; |
my $tempkey=$1; |
my $action=$env{$key}; |
my $action=$env{$key}; |
if ($action) { |
if ($action) { |
$newrules{$tempkey.'_action'}=$action; |
$newrules{$tempkey.'_action'}=$action; |
if ($action ne 'default') { |
if ($action ne 'default') { |
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
$triggers{$whichparm}.=$tempkey.':'; |
$triggers{$whichparm}.=$tempkey.':'; |
} |
} |
$newrules{$tempkey.'_type'}=$defkeytype{$tempkey}; |
$newrules{$tempkey.'_type'}=$defkeytype{$tempkey}; |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
$newrules{$tempkey.'_days'}=$env{'form.'.$tempkey.'_days'}; |
$newrules{$tempkey.'_days'}=$env{'form.'.$tempkey.'_days'}; |
$newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'}; |
$newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'}; |
$newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'}; |
$newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'}; |
$newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'}; |
$newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'}; |
} else { |
} else { |
$newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'}; |
$newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'}; |
$newrules{$tempkey.'_triggervalue'}=$env{'form.'.$tempkey.'_triggervalue'}; |
$newrules{$tempkey.'_triggervalue'}=$env{'form.'.$tempkey.'_triggervalue'}; |
} |
} |
} else { |
} else { |
push(@delrules,$tempkey.'_action'); |
push(@delrules,$tempkey.'_action'); |
push(@delrules,$tempkey.'_type'); |
push(@delrules,$tempkey.'_type'); |
push(@delrules,$tempkey.'_hours'); |
push(@delrules,$tempkey.'_hours'); |
push(@delrules,$tempkey.'_min'); |
push(@delrules,$tempkey.'_min'); |
push(@delrules,$tempkey.'_sec'); |
push(@delrules,$tempkey.'_sec'); |
push(@delrules,$tempkey.'_value'); |
push(@delrules,$tempkey.'_value'); |
} |
} |
} |
} |
} |
} |
foreach my $key (keys %allparms) { |
foreach my $key (keys %allparms) { |
$newrules{$key.'_triggers'}=$triggers{$key}; |
$newrules{$key.'_triggers'}=$triggers{$key}; |
} |
} |
&Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs); |
&Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs); |
&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs); |
&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs); |
&resetrulescache(); |
&resetrulescache(); |
} |
} |
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
'hours' => 'Hours', |
'hours' => 'Hours', |
'min' => 'Minutes', |
'min' => 'Minutes', |
'sec' => 'Seconds', |
'sec' => 'Seconds', |
'yes' => 'Yes', |
'yes' => 'Yes', |
'no' => 'No'); |
'no' => 'No'); |
my @standardoptions=('','default'); |
my @standardoptions=('','default'); |
my @standarddisplay=('',&mt('Default value when manually setting')); |
my @standarddisplay=('',&mt('Default value when manually setting')); |
my @dateoptions=('','default'); |
my @dateoptions=('','default'); |
my @datedisplay=('',&mt('Default value when manually setting')); |
my @datedisplay=('',&mt('Default value when manually setting')); |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
unless ($tempkey) { next; } |
unless ($tempkey) { next; } |
push @standardoptions,'when_setting_'.$tempkey; |
push @standardoptions,'when_setting_'.$tempkey; |
push @standarddisplay,&mt('Automatically set when setting ').$tempkey; |
push @standarddisplay,&mt('Automatically set when setting ').$tempkey; |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
push @dateoptions,'later_than_'.$tempkey; |
push @dateoptions,'later_than_'.$tempkey; |
push @datedisplay,&mt('Automatically set later than ').$tempkey; |
push @datedisplay,&mt('Automatically set later than ').$tempkey; |
push @dateoptions,'earlier_than_'.$tempkey; |
push @dateoptions,'earlier_than_'.$tempkey; |
push @datedisplay,&mt('Automatically set earlier than ').$tempkey; |
push @datedisplay,&mt('Automatically set earlier than ').$tempkey; |
} |
} |
} |
} |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
$r->print("\n".&Apache::loncommon::start_data_table(). |
$r->print("\n".&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
"<th>".&mt('Rule for parameter').'</th><th>'. |
"<th>".&mt('Rule for parameter').'</th><th>'. |
&mt('Action').'</th><th>'.&mt('Value').'</th>'. |
&mt('Action').'</th><th>'.&mt('Value').'</th>'. |
&Apache::loncommon::end_data_table_header_row()); |
&Apache::loncommon::end_data_table_header_row()); |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
unless ($tempkey) { next; } |
unless ($tempkey) { next; } |
$r->print("\n".&Apache::loncommon::start_data_table_row(). |
$r->print("\n".&Apache::loncommon::start_data_table_row(). |
"<td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
"<td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
my $action=&rulescache($tempkey.'_action'); |
my $action=&rulescache($tempkey.'_action'); |
$r->print('<select name="'.$tempkey.'_action">'); |
$r->print('<select name="'.$tempkey.'_action">'); |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
for (my $i=0;$i<=$#dateoptions;$i++) { |
for (my $i=0;$i<=$#dateoptions;$i++) { |
if ($dateoptions[$i]=~/\_$tempkey$/) { next; } |
if ($dateoptions[$i]=~/\_$tempkey$/) { next; } |
$r->print("\n<option value='$dateoptions[$i]'". |
$r->print("\n<option value='$dateoptions[$i]'". |
($dateoptions[$i] eq $action?' selected="selected"':''). |
($dateoptions[$i] eq $action?' selected="selected"':''). |
">$datedisplay[$i]</option>"); |
">$datedisplay[$i]</option>"); |
} |
} |
} else { |
} else { |
for (my $i=0;$i<=$#standardoptions;$i++) { |
for (my $i=0;$i<=$#standardoptions;$i++) { |
if ($standardoptions[$i]=~/\_$tempkey$/) { next; } |
if ($standardoptions[$i]=~/\_$tempkey$/) { next; } |
$r->print("\n<option value='$standardoptions[$i]'". |
$r->print("\n<option value='$standardoptions[$i]'". |
($standardoptions[$i] eq $action?' selected="selected"':''). |
($standardoptions[$i] eq $action?' selected="selected"':''). |
">$standarddisplay[$i]</option>"); |
">$standarddisplay[$i]</option>"); |
} |
} |
} |
} |
$r->print('</select>'); |
$r->print('</select>'); |
unless (&isdateparm($defkeytype{$tempkey})) { |
unless (&isdateparm($defkeytype{$tempkey})) { |
$r->print("\n<br />".&mt('Triggering value(s) of other parameter (optional, comma-separated):'). |
$r->print("\n<br />".&mt('Triggering value(s) of other parameter (optional, comma-separated):'). |
'<input type="text" size="20" name="'.$tempkey.'_triggervalue" value="'.&rulescache($tempkey.'_triggervalue').'" />'); |
'<input type="text" size="20" name="'.$tempkey.'_triggervalue" value="'.&rulescache($tempkey.'_triggervalue').'" />'); |
} |
} |
$r->print("\n</td><td>\n"); |
$r->print("\n</td><td>\n"); |
|
|
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
my $days=&rulescache($tempkey.'_days'); |
my $days=&rulescache($tempkey.'_days'); |
my $hours=&rulescache($tempkey.'_hours'); |
my $hours=&rulescache($tempkey.'_hours'); |
my $min=&rulescache($tempkey.'_min'); |
my $min=&rulescache($tempkey.'_min'); |
my $sec=&rulescache($tempkey.'_sec'); |
my $sec=&rulescache($tempkey.'_sec'); |
$r->print(<<ENDINPUTDATE); |
$r->print(<<ENDINPUTDATE); |
<input name="$tempkey\_days" type="text" size="4" value="$days" />$lt{'days'}<br /> |
<input name="$tempkey\_days" type="text" size="4" value="$days" />$lt{'days'}<br /> |
<input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br /> |
<input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br /> |
<input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br /> |
<input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br /> |
<input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'} |
<input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'} |
ENDINPUTDATE |
ENDINPUTDATE |
} elsif ($defkeytype{$tempkey} eq 'string_yesno') { |
} elsif ($defkeytype{$tempkey} eq 'string_yesno') { |
my $yeschecked=''; |
my $yeschecked=''; |
my $nochecked=''; |
my $nochecked=''; |
if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked=' checked="checked"'; } |
if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked=' checked="checked"'; } |
if (&rulescache($tempkey.'_value') eq 'no') { $nochecked=' checked="checked"'; } |
if (&rulescache($tempkey.'_value') eq 'no') { $nochecked=' checked="checked"'; } |
|
|
$r->print(<<ENDYESNO); |
$r->print(<<ENDYESNO); |
<label><input type="radio" name="$tempkey\_value" value="yes"$yeschecked /> $lt{'yes'}</label><br /> |
<label><input type="radio" name="$tempkey\_value" value="yes"$yeschecked /> $lt{'yes'}</label><br /> |
<label><input type="radio" name="$tempkey\_value" value="no"$nochecked /> $lt{'no'}</label> |
<label><input type="radio" name="$tempkey\_value" value="no"$nochecked /> $lt{'no'}</label> |
ENDYESNO |
ENDYESNO |
} else { |
} else { |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
} |
} |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$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('Save').'" /></form>'."\n". |
&mt('Save').'" /></form>'."\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 3902 sub components {
|
Line 4206 sub components {
|
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
|
|
if ($typeflag) { |
if ($typeflag) { |
$key=~s/\.type$//; |
$key=~s/\.type$//; |
} |
} |
|
|
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $issection; |
my $issection; |
|
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$issection=$1; |
$issection=$1; |
$section=&mt('Group/Section').': '.$issection; |
$section=&mt('Group/Section').': '.$issection; |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
if ($uname) { |
if ($uname) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$issection=''; |
$issection=''; |
} |
} |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realmdescription=&mt('all resources'); |
my $realmdescription=&mt('all resources'); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
} |
} |
my $what=$part.'.'.$name; |
my $what=$part.'.'.$name; |
return ($realm,$section,$name,$part, |
return ($realm,$section,$name,$part, |
$what,$middle,$uname,$udom,$issection,$realmdescription); |
$what,$middle,$uname,$udom,$issection,$realmdescription); |
} |
} |
|
|
my %standard_parms; |
my %standard_parms; |
|
my %standard_parms_types; |
|
|
sub load_parameter_names { |
sub load_parameter_names { |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
chomp($configline); |
chomp($configline); |
my ($short,$plain)=split(/:/,$configline); |
my ($short,$plain)=split(/:/,$configline); |
my (undef,$name,$type)=split(/\&/,$short,3); |
my (undef,$name,$type)=split(/\&/,$short,3); |
if ($type eq 'display') { |
if ($type eq 'display') { |
$standard_parms{$name} = $plain; |
$standard_parms{$name} = $plain; |
} |
} elsif ($type eq 'type') { |
|
$standard_parms_types{$name} = $plain; |
|
} |
} |
} |
close($config); |
close($config); |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
%standard_parms=&Apache::lonlocal::texthash(%standard_parms); |
|
} |
} |
|
|
sub standard_parameter_names { |
sub standard_parameter_names { |
my ($name)=@_; |
my ($name)=@_; |
if (!%standard_parms) { |
if (!%standard_parms) { |
&load_parameter_names(); |
&load_parameter_names(); |
} |
} |
if ($standard_parms{$name}) { |
if ($standard_parms{$name}) { |
return $standard_parms{$name}; |
return $standard_parms{$name}; |
} else { |
} else { |
return $name; |
return $name; |
} |
} |
} |
} |
|
|
|
sub standard_parameter_types { |
|
my ($name)=@_; |
|
if (!%standard_parms_types) { |
|
&load_parameter_names(); |
|
} |
|
if ($standard_parms_types{$name}) { |
|
return $standard_parms_types{$name}; |
|
} |
|
return; |
|
} |
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r)=@_; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log"}); |
text=>"Parameter Change Log"}); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
|
|
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
|
|
Line 3993 sub parm_change_log {
|
Line 4307 sub parm_change_log {
|
\%saveable_parameters); |
\%saveable_parameters); |
$r->print(&Apache::loncommon::display_filter(). |
$r->print(&Apache::loncommon::display_filter(). |
'<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>'); |
|
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&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; |
my $folder=''; |
my $folder=''; |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
my $last=''; |
my $last=''; |
if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', |
if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', |
&GDBM_READER(),0640)) { |
&GDBM_READER(),0640)) { |
$last=$hash{'last_known'}; |
$last=$hash{'last_known'}; |
untie(%hash); |
untie(%hash); |
} |
} |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
} |
} |
foreach my $id (sort |
foreach my $id (sort |
{ |
{ |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
} |
} |
my $aid = (split('00000',$a))[-1]; |
my $aid = (split('00000',$a))[-1]; |
my $bid = (split('00000',$b))[-1]; |
my $bid = (split('00000',$b))[-1]; |
return $bid<=>$aid; |
return $bid<=>$aid; |
} (keys(%parmlog))) { |
} (keys(%parmlog))) { |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my $count = 0; |
my $count = 0; |
my $time = |
my $time = |
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
my $plainname = |
my $plainname = |
&Apache::loncommon::plainname($parmlog{$id}{'exe_uname'}, |
&Apache::loncommon::plainname($parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
my $about_me_link = |
my $about_me_link = |
&Apache::loncommon::aboutmewrapper($plainname, |
&Apache::loncommon::aboutmewrapper($plainname, |
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
my $send_msg_link=''; |
my $send_msg_link=''; |
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
$send_msg_link ='<br />'. |
$send_msg_link ='<br />'. |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_uname'}, |
$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(); |
my $makenewrow=0; |
my $makenewrow=0; |
my %istype=(); |
my %istype=(); |
my $output; |
my $output; |
foreach my $changed (reverse(sort(@changes))) { |
foreach my $changed (reverse(sort(@changes))) { |
my $value=$parmlog{$id}{'logentry'}{$changed}; |
my $value=$parmlog{$id}{'logentry'}{$changed}; |
my $typeflag = ($changed =~/\.type$/ && |
my $typeflag = ($changed =~/\.type$/ && |
!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 ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($folder) { |
if ($folder) { |
if ($middle!~/^\Q$folder\E/) { next; } |
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; } |
} |
} |
$count++; |
$count++; |
if ($makenewrow) { |
if ($makenewrow) { |
$output .= $row_start; |
$output .= $row_start; |
} else { |
} else { |
$makenewrow=1; |
$makenewrow=1; |
} |
} |
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
my $parmitem = &standard_parameter_names($parmname); |
&standard_parameter_names($parmname).'</td><td>'. |
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
&mt($parmitem).'</td><td>'. |
my $stillactive=0; |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
if ($parmlog{$id}{'delflag'}) { |
my $stillactive=0; |
$output .= &mt('Deleted'); |
if ($parmlog{$id}{'delflag'}) { |
} else { |
$output .= &mt('Deleted'); |
if ($typeflag) { |
} else { |
$output .= &mt('Type: [_1]',&standard_parameter_names($value)); |
if ($typeflag) { |
} else { |
my $parmitem = &standard_parameter_names($value); |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
$parmitem = &mt($parmitem); |
$uname,$udom,$issection,$issection,$courseopt); |
$output .= &mt('Type: [_1]',$parmitem); |
if (&isdateparm($istype{$parmname})) { |
} else { |
$output .= &Apache::lonlocal::locallocaltime($value); |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
} else { |
$uname,$udom,$issection,$issection,$courseopt); |
$output .= $value; |
my $showvalue = $value; |
} |
if ($istype{$parmname} eq '') { |
if ($value ne $all[$level]) { |
my $type = &standard_parameter_types($parmname); |
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
if ($type ne '') { |
} else { |
if (&isdateparm($type)) { |
$stillactive=1; |
$showvalue = |
} |
&Apache::lonlocal::locallocaltime($value); |
} |
} |
} |
} |
$output .= '</td><td>'; |
} else { |
if ($stillactive) { |
if (&isdateparm($istype{$parmname})) { |
my $title=&mt('Changed [_1]',&standard_parameter_names($parmname)); |
$showvalue = |
my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription, |
&Apache::lonlocal::locallocaltime($value); |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
} |
if (($uname) && ($udom)) { |
} |
$output .= |
$output .= $showvalue; |
&Apache::loncommon::messagewrapper('Notify User', |
if ($value ne $all[$level]) { |
$uname,$udom,$title, |
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
$description); |
} else { |
} else { |
$stillactive=1; |
$output .= |
} |
&Apache::lonrss::course_blog_link($id,$title, |
} |
$description); |
} |
} |
$output .= '</td><td>'; |
} |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
if ($stillactive) { |
} |
my $parmitem = &standard_parameter_names($parmname); |
|
$parmitem = &mt($parmitem); |
|
my $title=&mt('Changed [_1]',$parmitem); |
|
my $description=&mt('Changed [_1] for [_2] to [_3]', |
|
$parmitem,$realmdescription, |
|
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
|
if (($uname) && ($udom)) { |
|
$output .= |
|
&Apache::loncommon::messagewrapper('Notify User', |
|
$uname,$udom,$title, |
|
$description); |
|
} else { |
|
$output .= |
|
&Apache::lonrss::course_blog_link($id,$title, |
|
$description); |
|
} |
|
} |
|
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
if ($env{'form.displayfilter'} eq 'containing') { |
if ($env{'form.displayfilter'} eq 'containing') { |
my $wholeentry=$about_me_link.':'. |
my $wholeentry=$about_me_link.':'. |
$parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'. |
$parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'. |
$output; |
$output; |
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
} |
} |
if ($count) { |
if ($count) { |
$r->print($row_start.'<td rowspan="'.$count.'">'.$time.'</td> |
$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; } |
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
Line 4223 sub check_for_course_info {
|
Line 4555 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub questiontype_release_vars { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my $chostname = &Apache::lonnet::hostname($chome); |
|
my ($cmajor,$cminor) = |
|
split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome)); |
|
return ($chostname,$cmajor,$cminor); |
|
} |
|
|
|
sub questiontype_releasecheck { |
|
my ($questiontype,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
|
my $needsnewer; |
|
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
|
if (($cmajor < $needsmajor) || |
|
($cmajor == $needsmajor && $cminor < $needsminor)) { |
|
$needsnewer = 1; |
|
} else { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$questiontype}); |
|
} |
|
return $needsnewer; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($questiontype,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
if (ref($strings{'string_questiontype'}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{'string_questiontype'} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
if ($name eq $questiontype) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
return '<p class="LC_warning">'. |
|
&mt('Question Type was [_1]not[_2] set to [_3].', |
|
'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
Line 4234 sub handler {
|
Line 4609 sub handler {
|
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['action','state', |
['action','state', |
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
Line 4243 sub handler {
|
Line 4618 sub handler {
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
text=>"Parameter Manager", |
text=>"Parameter Manager", |
faq=>10, |
faq=>10, |
bug=>'Instructor Interface', |
bug=>'Instructor Interface', |
help => |
help => |
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my $parm_permission = |
my $parm_permission = |
(&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'})); |
my $exists = &check_for_course_info(); |
my $exists = &check_for_course_info(); |
|
|
if ($env{'request.course.id'} && $parm_permission && $exists) { |
if ($env{'request.course.id'} && $parm_permission && $exists) { |
Line 4263 sub handler {
|
Line 4638 sub handler {
|
# Check first if coming from someone else headed directly for |
# Check first if coming from someone else headed directly for |
# the table mode |
# the table mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&assessparms($r); |
&assessparms($r); |
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'setoverview') { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&overview($r); |
&overview($r); |
} elsif ($env{'form.action'} eq 'addmetadata') { |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&addmetafield($r); |
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
&order_meta_fields($r); |
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&setrestrictmeta($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview') { |
} elsif ($env{'form.action'} eq 'newoverview') { |
&newoverview($r); |
&newoverview($r); |
} elsif ($env{'form.action'} eq 'setdefaults') { |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&defaultsetter($r); |
&defaultsetter($r); |
} elsif ($env{'form.action'} eq 'settable') { |
} elsif ($env{'form.action'} eq 'settable') { |
&assessparms($r); |
&assessparms($r); |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&parm_change_log($r); |
&parm_change_log($r); |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&clean_parameters($r); |
&clean_parameters($r); |
} elsif ($env{'form.action'} eq 'dateshift1') { |
} elsif ($env{'form.action'} eq 'dateshift1') { |
&date_shift_one($r); |
&date_shift_one($r); |
} elsif ($env{'form.action'} eq 'dateshift2') { |
} elsif ($env{'form.action'} eq 'dateshift2') { |
&date_shift_two($r); |
&date_shift_two($r); |
} elsif ($env{'form.action'} eq 'categorizecourse') { |
|
&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 |
if ($exists) { |
if ($exists) { |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
} else { |
} else { |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/parmset::0:1:Course environment gone, reinitialize the course"; |
"/adm/parmset::0:1:Course environment gone, reinitialize the course"; |
} |
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
&reset_caches(); |
&reset_caches(); |
|
|