version 1.413.4.6, 2010/02/15 01:20:08
|
version 1.492, 2010/01/30 17:35:10
|
Line 44 This module sets coursewide and assessme
|
Line 44 This module sets coursewide and assessme
|
|
|
=head1 INTERNAL SUBROUTINES |
=head1 INTERNAL SUBROUTINES |
|
|
=over 4 |
=over |
|
|
|
=pod |
|
|
=item parmval() |
=item parmval() |
|
|
Line 56 Inputs: $what - a parameter spec (inclu
|
Line 58 Inputs: $what - a parameter spec (inclu
|
|
|
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels |
Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels |
|
|
14- General Course |
14- General Course |
13- Map or Folder level in course |
13- Map or Folder level in course |
12- resource default |
12- resource default |
11- map default |
11- map default |
10- resource level in course |
10- resource level in course |
9 - General for section |
9 - General for section |
8 - Map or Folder level for section |
8 - Map or Folder level for section |
7 - resource level in section |
7 - resource level in section |
6 - General for group |
6 - General for group |
5 - Map or Folder level for group |
5 - Map or Folder level for group |
4 - resource level in group |
4 - resource level in group |
3 - General for specific student |
3 - General for specific student |
2 - Map or Folder level for specific student |
2 - Map or Folder level for specific student |
1 - resource level for specific student |
1 - resource level for specific student |
|
|
=item parmval_by_symb() |
=item parmval_by_symb() |
|
|
=item reset_caches() |
=item reset_caches() |
|
|
=item cacheparmhash() |
=item cacheparmhash() |
|
|
=item parmhash() |
=item parmhash() |
|
|
Line 118 Produces a link anchor.
|
Line 120 Produces a link anchor.
|
|
|
Inputs: $type,$dis,$value,$marker,$return,$call |
Inputs: $type,$dis,$value,$marker,$return,$call |
|
|
Returns: scalar with html code for a link which will envoke the |
Returns: scalar with html code for a link which will envoke the |
javascript function 'pjump'. |
javascript function 'pjump'. |
|
|
=item page_js() |
=item page_js() |
Line 133 javascript function 'pjump'.
|
Line 135 javascript function 'pjump'.
|
|
|
=item parm_control_group() |
=item parm_control_group() |
|
|
=item extractResourceInformation() : |
=item extractResourceInformation() : |
|
|
Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. |
Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. |
|
|
Line 145 Input: See list below:
|
Line 147 Input: See list below:
|
|
|
=item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
=item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
|
|
|
|
=item * B<allparms> : hash, name of parameter->display value (what is the display value?) |
=item * B<allparms> : hash, name of parameter->display value (what is the display value?) |
|
|
=item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
=item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
Line 190 Input: See list below:
|
Line 191 Input: See list below:
|
|
|
=item standardkeyorder() |
=item standardkeyorder() |
|
|
=item assessparms() : |
=item assessparms() : |
|
|
Show assessment data and parameters. This is a large routine that should |
Show assessment data and parameters. This is a large routine that should |
be simplified and shortened... someday. |
be simplified and shortened... someday. |
Line 250 Variables used (guessed by Jeremy):
|
Line 251 Variables used (guessed by Jeremy):
|
=item check_cloners() : |
=item check_cloners() : |
|
|
Checks if new users included in list of allowed cloners |
Checks if new users included in list of allowed cloners |
are valid users. Replaces supplied list with |
are valid users. Replaces supplied list with |
cleaned list containing only users with valid usernames |
cleaned list containing only users with valid usernames |
and domains. |
and domains. |
|
|
Inputs: $clonelist, $oldcloner |
Inputs: $clonelist, $oldcloner |
where $clonelist is ref to array of requested cloners, |
where $clonelist is ref to array of requested cloners, |
and $oldcloner is ref to array of currently allowed |
and $oldcloner is ref to array of currently allowed |
cloners. |
cloners. |
Line 270 change is made to the list of users allo
|
Line 271 change is made to the list of users allo
|
a course. |
a course. |
|
|
Inputs: $action,$cloner |
Inputs: $action,$cloner |
where $action is add or drop, and $cloner is identity of |
where $action is add or drop, and $cloner is identity of |
user for whom cloning ability is to be changed in course. |
user for whom cloning ability is to be changed in course. |
|
|
|
|
=item check_cloners() |
=item check_cloners() |
Line 306 Set portfolio metadata
|
Line 307 Set portfolio metadata
|
|
|
=item parm_change_log() |
=item parm_change_log() |
|
|
=item handler() : |
=item handler() : |
|
|
Main handler. Calls &assessparms subroutine. |
Main handler. Calls &assessparms subroutine. |
|
|
Line 315 Main handler. Calls &assessparms subrou
|
Line 316 Main handler. Calls &assessparms subrou
|
|
|
=cut |
=cut |
|
|
|
|
################################################################### |
################################################################### |
################################################################### |
################################################################### |
|
|
Line 335 use Apache::longroup;
|
Line 335 use Apache::longroup;
|
use Apache::lonrss; |
use Apache::lonrss; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
sub parmval { |
sub parmval { |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
Line 346 sub parmval_by_symb {
|
Line 347 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=''; |
my @outpar=(); |
my @outpar=(); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
$map = &Apache::lonnet::deversion($map); |
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
Line 374 sub parmval_by_symb {
|
Line 375 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 393 sub parmval_by_symb {
|
Line 394 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 432 sub parmval_by_symb {
|
Line 433 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 454 sub parmval_by_symb {
|
Line 455 sub parmval_by_symb {
|
|
|
# --- Caches local to lonparmset |
# --- Caches local to lonparmset |
|
|
|
|
sub reset_caches { |
sub reset_caches { |
&resetparmhash(); |
&resetparmhash(); |
&resetsymbcache(); |
&resetsymbcache(); |
Line 465 sub reset_caches {
|
Line 466 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}; |
} |
} |
} |
} |
|
|
{ |
{ |
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}; |
} |
} |
} |
} |
|
|
{ |
{ |
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}; |
} |
} |
} |
} |
|
|
|
|
|
|
sub preset_defaults { |
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 ('','','','',''); |
} |
} |
} |
} |
|
|
|
|
|
|
|
|
sub date_sanity_info { |
sub date_sanity_info { |
my $checkdate=shift; |
my $checkdate=shift; |
unless ($checkdate) { return ''; } |
unless ($checkdate) { return ''; } |
Line 610 sub storeparm_by_symb {
|
Line 614 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 625 sub storeparm_by_symb {
|
Line 629 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 666 sub storeparm_by_symb_inner {
|
Line 670 sub storeparm_by_symb_inner {
|
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
# ---------------------------------------------------------- Construct prefixes |
# ---------------------------------------------------------- Construct prefixes |
$spnam=~s/\_([^\_]+)$/\.$1/; |
$spnam=~s/\_([^\_]+)$/\.$1/; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
$map = &Apache::lonnet::deversion($map); |
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$spnam; |
my $symbparm=$symb.'.'.$spnam; |
Line 679 sub storeparm_by_symb_inner {
|
Line 683 sub storeparm_by_symb_inner {
|
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; |
|
|
my $courselevel=$env{'request.course.id'}.'.'.$spnam; |
my $courselevel=$env{'request.course.id'}.'.'.$spnam; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; |
|
|
my $storeunder=''; |
my $storeunder=''; |
if (($snum==14) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==14) || ($snum==3)) { $storeunder=$courselevel; } |
if (($snum==13) || ($snum==2)) { $storeunder=$courselevelm; } |
if (($snum==13) || ($snum==2)) { $storeunder=$courselevelm; } |
Line 695 sub storeparm_by_symb_inner {
|
Line 699 sub storeparm_by_symb_inner {
|
if ($snum==5) { $storeunder=$grplevelm; } |
if ($snum==5) { $storeunder=$grplevelm; } |
if ($snum==4) { $storeunder=$grplevelr; } |
if ($snum==4) { $storeunder=$grplevelr; } |
|
|
|
|
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 ''; |
} |
} |
|
|
|
|
sub valout { |
sub valout { |
my ($value,$type,$editable)=@_; |
my ($value,$type,$editable)=@_; |
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 806 sub valout {
|
Line 811 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; |
} |
} |
|
|
|
|
sub plink { |
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 831 sub plink {
|
Line 837 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="'.$marker.'" /></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."','" |
.$unencmarker."','".$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 848 sub page_js {
|
Line 854 sub page_js {
|
|
|
return(<<ENDJS); |
return(<<ENDJS); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function pclose() { |
function pclose() { |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
"height=350,width=350,scrollbars=no,menubar=no"); |
"height=350,width=350,scrollbars=no,menubar=no"); |
Line 867 sub page_js {
|
Line 873 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 887 sub page_js {
|
Line 893 sub page_js {
|
var newWin = window.open(url, wdwName, options); |
var newWin = window.open(url, wdwName, options); |
newWin.focus(); |
newWin.focus(); |
} |
} |
|
// ]]> |
</script> |
</script> |
$selscript |
$selscript |
ENDJS |
ENDJS |
Line 896 sub startpage {
|
Line 903 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')", |
|
); |
|
|
my $start_page = |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&page_js(), |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
{'add_entries' => \%loaditems,}); |
text=>"Problem Parameters"}); |
my $breadcrumbs = |
} else { |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Table Mode", |
|
help => 'Course_Setting_Parameters'}); |
|
} |
|
my $start_page = |
|
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
|
&page_js(), |
|
{'add_entries' => \%loaditems,}); |
|
my $breadcrumbs = |
|
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 918 ENDHEAD
|
Line 935 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 945 sub print_row {
|
Line 962 sub print_row {
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
.$$part{$which}.'</td>'); |
.$$part{$which}.'</td>'); |
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
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>'); |
|
|
my $thismarker=$which; |
my $thismarker=$which; |
$thismarker=~s/^parameter\_//; |
$thismarker=~s/^parameter\_//; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
Line 967 sub print_row {
|
Line 984 sub print_row {
|
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
Line 1002 sub print_row {
|
Line 1019 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); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&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 1040 sub print_row {
|
Line 1057 sub print_row {
|
&valout($sessionval,$sessionvaltype).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
} |
} |
|
$r->print('</tr>'); |
|
$r->print("\n"); |
} |
} |
|
|
sub print_td { |
sub print_td { |
Line 1077 sub print_usergroups {
|
Line 1096 sub print_usergroups {
|
$courseopt); |
$courseopt); |
my $bgcolor = $defbg; |
my $bgcolor = $defbg; |
my $grp_parm; |
my $grp_parm; |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '#AAFFAA'; |
$bgcolor = '#AAFFAA'; |
$grp_parm = &valout($coursereply,$resulttype); |
$grp_parm = &valout($coursereply,$resulttype); |
Line 1120 sub parm_control_group {
|
Line 1139 sub parm_control_group {
|
return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); |
} |
} |
|
|
|
|
|
|
sub extractResourceInformation { |
sub extractResourceInformation { |
my $ids = shift; |
my $ids = shift; |
my $typep = shift; |
my $typep = shift; |
Line 1139 sub extractResourceInformation {
|
Line 1160 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 '') { |
Line 1167 sub extractResourceInformation {
|
Line 1188 sub extractResourceInformation {
|
} else { |
} else { |
$parmdis = &mt($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); |
|
} |
} |
} |
} |
|
|
|
|
################################################## |
|
################################################## |
|
|
|
sub isdateparm { |
sub isdateparm { |
my $type=shift; |
my $type=shift; |
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
} |
} |
|
|
|
# |
|
# This function prints a list of parameters, which were selected. It also display a link from which you can |
|
# hide or show the complete parameter list, from which you can choose your parameters. |
|
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my $tempkey; |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function checkall(value, checkName) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
|
|
var li = "_li"; |
|
var displayOverview = ""; |
|
|
|
if (value == false) { |
|
displayOverview = "none" |
|
} |
|
|
|
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; |
|
document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview; |
} |
} |
} |
} |
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
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'); |
|
} |
|
|
|
function hideParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = "none"; |
|
} |
|
|
|
function showParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = ""; |
} |
} |
|
|
|
function checkboxChecked(id) { |
|
var li = "_li"; |
|
var id_li = id.concat(li); |
|
if (document.getElementById(id_li).style.display == "none") { |
|
document.getElementById(id_li).style.display = ""; |
|
} |
|
else { |
|
document.getElementById(id_li).style.display = "none"; |
|
} |
|
} |
|
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>'); |
|
my $cnt=0; |
#part to print selected parms overview |
|
$r->print(&mt('Selected Parameters:').'<br />'); |
|
|
|
#print out all possible parms and hide them by default |
|
$r->print('<ul>'); |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print("\n".'<td><label><input type="checkbox" name="pscat" '); |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
$r->print('value="'.$tempkey.'"'); |
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(' checked="checked"'); |
} |
} |
$r->print('>' |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) |
: $tempkey). |
.'</li>' |
'</label></td>'); |
); |
$cnt++; |
} |
if ($cnt==3) { |
$r->print('</ul>'); |
$r->print("</tr>\n<tr>"); |
|
$cnt=0; |
$r->print('<hr />'); |
} |
&shortCuts($r,$allparms,$pscat,$keyorder); |
} |
$r->print('<hr />'); |
$r->print('</tr>' |
|
.'<tr id="LC_parm_overview_parm_menu_selectors">' |
$r->print( |
.'<td valign="top">' |
'<p><a href="javascript:showParms()">' |
.'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>' |
.&mt('Show detailed Parameter Selection') |
.'<span class="LC_nobreak">' |
.'</a></p>' |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
); |
.'</span>' |
|
.'<br />' |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
.'<span class="LC_nobreak">' |
} |
.'• <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>' |
# return a hash |
.'</span>' |
sub categories { |
.'<br />' |
return ('time_settings' => 'Time Settings', |
.'<span class="LC_nobreak">' |
'grading' => 'Grading', |
.'• <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>' |
'tries' => 'Tries', |
.'</span>' |
'problem_appearance' => 'Problem Appearance', |
.'</fieldset>' |
'behaviour_of_input_fields' => 'Behaviour of Input Fields', |
.'</td>' |
'hiding' => 'Hiding', |
.'<td colspan="2" valign="top">' |
'high_level_randomization' => 'High Level Randomization', |
.'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>' |
'slots' => 'Slots', |
.'<span class="LC_nobreak">' |
'file_submission' => 'File Submission', |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
'misc' => 'Miscellaneous' ); |
.'</span>' |
} |
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>' |
# return a hash. Like a look-up table |
.'</span>' |
sub lookUpTableParameter { |
# .'<br />' |
|
.'<span class="LC_nobreak">' |
return ( |
.' • <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>' |
'opendate' => 'time_settings', |
.'</span>' |
'duedate' => 'time_settings', |
.'<span class="LC_nobreak">' |
'answerdate' => 'time_settings', |
.' • <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>' |
'interval' => 'time_settings', |
.'</span>' |
'contentopen' => 'time_settings', |
# .'<br />' |
'contentclose' => 'time_settings', |
.'<span class="LC_nobreak">' |
'discussend' => 'time_settings', |
.' • <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>' |
'weight' => 'grading', |
.'</span>' |
'handgrade' => 'grading', |
.'</fieldset>' |
'maxtries' => 'tries', |
.'</td>' |
'hinttries' => 'tries', |
.'</tr></table>' |
'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 { |
|
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
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 |
|
$r->print( |
|
'<div id="LC_parm_overview_parm_menu" class="LC_Box" style="display:none">'."\n" |
|
.'<h3>'.&mt('Parameter').'</h3>'."\n" |
|
.$hidelink |
|
.'<div class="LC_columnSection">'."\n" |
|
); |
|
|
|
#Print parameters |
|
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
|
if(@{$categoryList{$key}} == 0) { |
|
next; |
|
} else { |
|
$r->print('<div class="LC_Box LC_400Box">' |
|
.'<h4 class="LC_hcell">' |
|
.&mt($categories{$key}) |
|
.'</h4>'."\n"); |
|
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
|
$r->print('<span class="LC_nobreak">' |
|
.'<label><input type="checkbox" name="pscat" '); |
|
$r->print('value="'.$tempkey.'" '); |
|
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
|
} |
|
$r->print("</div>\n"); |
|
} |
|
} |
|
|
|
#&shortCuts($r,$allparms,$pscat,$keyorder); |
|
$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 { |
|
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
|
|
# Parameter Selection |
|
$r->print( |
|
&Apache::lonhtmlcommon::start_funclist(&mt('Parameter Selection')) |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>') |
|
.&Apache::lonhtmlcommon::end_funclist() |
|
); |
|
|
|
# Add Selection for... |
|
$r->print( |
|
&Apache::lonhtmlcommon::start_funclist(&mt('Add Selection for...')) |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>') |
|
.&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>') |
|
.&Apache::lonhtmlcommon::end_funclist() |
); |
); |
} |
} |
|
|
sub partmenu { |
sub partmenu { |
my ($r,$allparts,$psprt)=@_; |
my ($r,$allparts,$psprt)=@_; |
|
|
$r->print('<select multiple="multiple" name="psprt" size="8">'); |
$r->print('<select multiple="multiple" name="psprt" size="8">'); |
$r->print('<option value="all"'); |
$r->print('<option value="all"'); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print(' selected="selected"') unless (@{$psprt}); |
Line 1360 sub partmenu {
|
Line 1594 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 1394 sub usermenu {
|
Line 1628 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 1406 sub usermenu {
|
Line 1640 sub usermenu {
|
$sections .= ' '.&mt('or').' '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function group_or_section(caller) { |
function group_or_section(caller) { |
if (caller == "cgroup") { |
if (caller == "cgroup") { |
if (document.parmform.cgroup.selectedIndex != 0) { |
if (document.parmform.cgroup.selectedIndex != 0) { |
Line 1417 function group_or_section(caller) {
|
Line 1652 function group_or_section(caller) {
|
} |
} |
} |
} |
} |
} |
|
// ]]> |
</script> |
</script> |
|; |
|; |
} else { |
} else { |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function group_or_section(caller) { |
function group_or_section(caller) { |
return; |
return; |
} |
} |
|
// ]]> |
</script> |
</script> |
|; |
|; |
} |
} |
|
|
if (%grouphash) { |
if (%grouphash) { |
$groups=&mt('Group:').' <select name="cgroup"'; |
$groups=&mt('Group:').' <select name="cgroup"'; |
Line 1454 function group_or_section(caller) {
|
Line 1692 function group_or_section(caller) {
|
} |
} |
|
|
if (%sectionhash || %grouphash) { |
if (%sectionhash || %grouphash) { |
$g_s_header='<fieldset><legend>'.&mt('Group/Section').'</legend><div>'; |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); |
$g_s_footer='</div></fieldset>'; |
$r->print($sections.$groups); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
} |
} |
|
|
$r->print('<b>' |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); |
.$g_s_header |
$r->print(&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]' |
.$sections |
|
.$groups |
|
.$g_s_footer |
|
.'<fieldset><legend>'.&mt('User').'</legend><div>' |
|
.&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]' |
|
,'<input type="text" value="'.$uname.'" size="12" name="uname" />' |
,'<input type="text" value="'.$uname.'" size="12" name="uname" />' |
,'<input type="text" value="'.$id.'" size="12" name="id" /> ' |
,'<input type="text" value="'.$id.'" size="12" name="id" /> ' |
,$chooseopt) |
,$chooseopt)); |
.'</div></fieldset>' |
|
.'</b>' |
|
); |
|
} |
} |
|
|
|
# |
|
# 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('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&mt('Select Parts to View').'</th></tr><tr><td>'); |
|
&parmmenu($r,$allparms,$pscat,$keyorder); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print('</td><td valign="top" align="center">'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
&partmenu($r,$allparts,$psprt); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print('</td></tr></table>'); |
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_; |
$r->print('<b>'.&mt('Select Enclosing Map or Folder').'</b> '); |
my %allmaps_inverted = reverse %$allmaps; |
$r->print('<select name="pschp">'); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
my $tree=[]; |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
my $treeinfo={}; |
$r->print('<option value="'.$_.'"'); |
if (defined($navmap)) { |
if (($pschp eq $_)) { $r->print(' selected="selected"'); } |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
$r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>'); |
my $curRes; |
|
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, |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
# 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="" />'; |
|
$r->print(&Apache::loncommon::start_data_table() |
|
.&Apache::loncommon::start_data_table_row() |
|
.'<td>'.$icon |
|
.'<label> ' |
|
.'<input type="radio" name="pschp" checked="checked" value="all" />' |
|
.&mt('All Maps or Folders') |
|
.'</label></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
my $whitespace = '<img src="' |
|
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
|
.'" alt="" />'; |
|
if (exists($$allmaps{1})) { |
|
$r->print(&Apache::loncommon::start_data_table_row() |
|
.'<td>'.$icon |
|
.'<label> ' |
|
.'<input type="radio" name="pschp" value="1"' |
|
); |
|
if ($pschp eq 1) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print('/>' |
|
.$$maptitles{1} |
|
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
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>'.$indent.$icon |
|
.'<label> ' |
|
.'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"' |
|
); |
|
if ($pschp eq $allmaps_inverted{$symb_name}) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print('/>' |
|
.$treeinfo->{$id}->{name} |
|
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
} |
} |
$r->print("</select>"); |
|
} |
} |
|
|
|
# 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('<b>'.&mt('Select Parameter Level'). |
|
&Apache::loncommon::help_open_topic('Course_Parameter_Levels').'</b> '); |
$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 1517 sub sectionmenu {
|
Line 1854 sub sectionmenu {
|
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
return if (!%sectionhash); |
return if (!%sectionhash); |
|
|
$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 1536 sub groupmenu {
|
Line 1873 sub groupmenu {
|
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash = &Apache::longroup::coursegroups(); |
return if (!%grouphash); |
return if (!%grouphash); |
|
|
$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 1559 sub keysplit {
|
Line 1896 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 1594 sub sortmenu {
|
Line 1931 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); |
} |
} |
|
|
|
|
sub assessparms { |
sub assessparms { |
|
|
my $r=shift; |
my $r=shift; |
Line 1643 sub assessparms {
|
Line 1981 sub assessparms {
|
my $csec; |
my $csec; |
my $cgroup; |
my $cgroup; |
my @usersgroups = (); |
my @usersgroups = (); |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
$alllevs{'Resource Level'}='full'; |
$alllevs{'Resource Level'}='full'; |
Line 1670 sub assessparms {
|
Line 2008 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 1680 sub assessparms {
|
Line 2019 sub assessparms {
|
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
|
|
unless ($env{'form.parmlev'}) { |
unless ($env{'form.parmlev'}) { |
$parmlev = 'map'; |
$parmlev = 'map'; |
} else { |
} else { |
Line 1690 sub assessparms {
|
Line 2029 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('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 1761 sub assessparms {
|
Line 2099 sub assessparms {
|
unless ($cgroup) { $cgroup=''; } |
unless ($cgroup) { $cgroup=''; } |
|
|
# --------------------------------------------------------- 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 1773 sub assessparms {
|
Line 2111 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++) { |
for (my $i=0;$i<=$#markers;$i++) { |
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 $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
Line 1807 sub assessparms {
|
Line 2145 sub assessparms {
|
} |
} |
} |
} |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$message.=&storeparm(split(/\&/,$markers[$i]), |
$values[$i], |
$values[$i], |
$types[$i], |
$types[$i], |
$uname,$udom,$csec,$cgroup); |
$uname,$udom,$csec,$cgroup); |
} |
} |
# ---------------------------------------------------------------- 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>'; |
$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') }; |
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('<table border="1"><tr><td>'); |
my $parmselhiddenstyle=' style="display:none"'; |
|
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('</td>'); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
if ($parmlev ne 'general') { |
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
$r->print('<td>'); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print('</td>'); |
&partmenu($r,\%allparts,\@psprt); |
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print('</tr></table>'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
|
|
# Step 2 |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'))); |
|
&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::end_pick_box()); |
|
|
|
# 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); |
|
my $title = &Apache::lonnet::gettitle($pssymb); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br />'); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><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>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' /></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>'); |
} |
} |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
|
|
# ----- 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 1870 sub assessparms {
|
Line 2296 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('<tr><td colspan="5"></td>'); |
|
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
|
if ($uname) { |
|
if (@usersgroups > 1) { |
|
$userspan ++; |
|
} |
} |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
|
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
$r->print('<p><table border="2">'); |
} |
$r->print('<tr><td colspan="5"></td>'); |
my %lt=&Apache::lonlocal::texthash( |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
'pie' => "Parameter in Effect", |
if ($uname) { |
'csv' => "Current Session Value", |
if (@usersgroups > 1) { |
'at' => 'at', |
$userspan ++; |
'rl' => "Resource Level", |
} |
'ic' => 'in Course', |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
'aut' => "Assessment URL and Title", |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
'type' => 'Type', |
} |
'emof' => "Enclosing Map or Folder", |
my %lt=&Apache::lonlocal::texthash( |
'part' => 'Part', |
'pie' => "Parameter in Effect", |
'pn' => 'Parameter Name', |
'csv' => "Current Session Value", |
'def' => 'default', |
'at' => 'at', |
'femof' => 'from Enclosing Map or Folder', |
'rl' => "Resource Level", |
'gen' => 'general', |
'ic' => 'in Course', |
'foremf' => 'for Enclosing Map or Folder', |
'aut' => "Assessment URL and Title", |
'fr' => 'for Resource' |
'type' => 'Type', |
); |
'emof' => "Enclosing Map or Folder", |
$r->print(<<ENDTABLETWO); |
'part' => 'Part', |
|
'pn' => 'Parameter Name', |
|
'def' => 'default', |
|
'femof' => 'from Enclosing Map or Folder', |
|
'gen' => 'general', |
|
'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 $lt{'at'} $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 1986 ENDTABLEHEADFOUR
|
Line 2412 ENDTABLEHEADFOUR
|
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
unless ($display{$_}) { $display{$_}=''; } |
|
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
if ($allparms{$name{$_}} ne '') { |
if ($allparms{$name{$_}} ne '') { |
my $identifier; |
my $identifier; |
Line 1997 ENDTABLEHEADFOUR
|
Line 2422 ENDTABLEHEADFOUR
|
} else { |
} else { |
$display{$_} = $parmdis; |
$display{$_} = $parmdis; |
} |
} |
|
unless ($display{$_}) { $display{$_}=''; } |
$display{$_}.=' ('.$name{$_}.')'; |
$display{$_}.=' ('.$name{$_}.')'; |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
} |
} |
} |
} |
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 2023 ENDTABLEHEADFOUR
|
Line 2449 ENDTABLEHEADFOUR
|
} |
} |
$r->print('</a></b></td>'); |
$r->print('</a></b></td>'); |
$r->print('<td style="background-color:'.$defbgtwo.';"'. |
$r->print('<td style="background-color:'.$defbgtwo.';"'. |
' rowspan="'.$totalparms.'">'.$typep{$rid}. |
' rowspan='.$totalparms.'>'.$typep{$rid}. |
'</td>'); |
'</td>'); |
|
|
$r->print('<td style="background-color:'.$defbgone.';"'. |
$r->print('<td style="background-color:'.$defbgone.';"'. |
' rowspan="'.$totalparms. |
' rowspan='.$totalparms. |
'">'.$maptitles{$mapp{$rid}}.'</td>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
|
|
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
unless ($firstrow) { |
unless ($firstrow) { |
Line 2040 ENDTABLEHEADFOUR
|
Line 2466 ENDTABLEHEADFOUR
|
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$cgroup,\@usersgroups); |
$cgroup,\@usersgroups); |
$r->print('</tr>'."\n"); |
|
} |
} |
} |
} |
} |
} |
Line 2050 ENDTABLEHEADFOUR
|
Line 2475 ENDTABLEHEADFOUR
|
} # end of full |
} # end of full |
#--------------------------------------------------- Entry for parm level map |
#--------------------------------------------------- Entry for parm level map |
if ($parmlev eq 'map') { |
if ($parmlev eq 'map') { |
my $defbgone = 'E0E099'; |
my $defbgone = '#E0E099'; |
my $defbgtwo = 'FFFF99'; |
my $defbgtwo = '#FFFF99'; |
my $defbgthree = 'FFBB99'; |
my $defbgthree = '#FFBB99'; |
|
|
my %maplist; |
my %maplist; |
|
|
if ($pschp eq 'all') { |
if ($pschp eq 'all') { |
%maplist = %allmaps; |
%maplist = %allmaps; |
} else { |
} else { |
%maplist = ($pschp => $mapp{$pschp}); |
%maplist = ($pschp => $mapp{$pschp}); |
} |
} |
|
|
#-------------------------------------------- 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 2076 ENDTABLEHEADFOUR
|
Line 2501 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 2095 ENDTABLEHEADFOUR
|
Line 2520 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 |
my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); |
my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); |
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 2149 ENDTABLEHEADFOUR
|
Line 2574 ENDTABLEHEADFOUR
|
,'<font color="red"><i>'.$coursename.'</i></font>' |
,'<font color="red"><i>'.$coursename.'</i></font>' |
) |
) |
."<br /></h4>\n" |
."<br /></h4>\n" |
); |
); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p>'..&Apache::loncommon::start_data_table(). |
$r->print('<p>'.&Apache::loncommon::start_data_table() |
&Apache::loncommon::start_data_table_header_row(). |
.&Apache::loncommon::start_data_table_header_row() |
'<tr><th>'.&mt('Parameter Name').'</th>'. |
.'<th>'.&mt('Parameter Name').'</th>' |
'<th>'.&mt('Default Value').'</th>'. |
.'<th>'.&mt('Default Value').'</th>' |
'<th>'.&mt('Parameter in Effect').'</th>'. |
.'<th>'.&mt('Parameter in Effect').'</th>' |
&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, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
$r->print(&Apache::loncommon::end_data_table_row()); |
|
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p></div>'); |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
|
.'</div>' |
|
); |
} # end each map |
} # end each map |
} # end of $parmlev eq map |
} # end of $parmlev eq map |
#--------------------------------- Entry for parm level general (Course level) |
#--------------------------------- Entry for parm level general (Course level) |
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
my $defbgone = 'E0E099'; |
my $defbgone = '#E0E099'; |
my $defbgtwo = 'FFFF99'; |
my $defbgtwo = '#FFFF99'; |
my $defbgthree = 'FFBB99'; |
my $defbgthree = '#FFBB99'; |
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid="0.0"; |
my $mapid="0.0"; |
Line 2183 ENDTABLEHEADFOUR
|
Line 2610 ENDTABLEHEADFOUR
|
my %display = (); |
my %display = (); |
my %type = (); |
my %type = (); |
my %default = (); |
my %default = (); |
|
|
foreach (@ids) { |
foreach (@ids) { |
my $rid = $_; |
my $rid = $_; |
|
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
#-------------------------------------------------------------------- |
#-------------------------------------------------------------------- |
Line 2197 ENDTABLEHEADFOUR
|
Line 2624 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"); |
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p>'.&Apache::loncommon::start_data_table(). |
$r->print('<p>'.&Apache::loncommon::start_data_table() |
&Apache::loncommon::start_data_table_header_row(). |
.&Apache::loncommon::start_data_table_header_row() |
'<th>'.&mt('Parameter Name').'</th>'. |
.'<th>'.&mt('Parameter Name').'</th>' |
'<th>'.&mt('Default Value').'</th>'. |
.'<th>'.&mt('Default Value').'</th>' |
'<th>'.&mt('Parameter in Effect').'</th>'. |
.'<th>'.&mt('Parameter in Effect').'</th>' |
&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, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
$r->print(&Apache::loncommon::end_data_table_row()); |
|
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p></center>'); |
$r->print(&Apache::loncommon::end_data_table() |
|
.'</p>' |
|
.'</center>' |
|
); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
################################################## |
################################################## |
# Overview mode |
# Overview mode |
################################################## |
################################################## |
Line 2268 my $tableopen;
|
Line 2697 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 2294 sub readdata {
|
Line 2723 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 2321 sub storedata {
|
Line 2750 sub storedata {
|
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
foreach (keys %env) { |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $tkey=$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{$_}; |
$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') { |
} elsif ($cmd eq 'datepointer') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
} elsif ($cmd eq 'dateinterval') { |
} elsif ($cmd eq 'dateinterval') { |
$data=&get_date_interval_from_form($thiskey); |
$data=&get_date_interval_from_form($thiskey); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
} |
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.$text.' '. |
$r->print('<br />'.$text.' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
$newdata{$thiskey}=$data; |
$newdata{$thiskey}=$data; |
$newdata{$thiskey.'.type'}=$typeof; |
$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 2414 sub parse_listdata_key {
|
Line 2843 sub parse_listdata_key {
|
my ($key,$listdata) = @_; |
my ($key,$listdata) = @_; |
# 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 2443 sub listdata {
|
Line 2872 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 |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
|
$r->print(&tablestart(). |
$r->print(&tablestart(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td><td><input type="checkbox" name="del_'. |
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
my $jskey='key_'.$pointer; |
my $jskey='key_'.$pointer; |
$pointer++; |
$pointer++; |
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::date_setter('parmform', |
&Apache::lonhtmlcommon::date_setter('parmform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'',''). |
'',1,'',''). |
|
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
(($$resourcedata{$thiskey}!=0)?'<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 2583 sub date_interval_selector {
|
Line 3011 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 2604 sub get_date_interval_from_form {
|
Line 3032 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 2621 sub default_selector {
|
Line 3049 sub default_selector {
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
} |
} |
|
|
my %strings = |
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.' ]], |
); |
); |
|
|
|
|
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 $result; |
my $result; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
my ($name, $description) = @{ $possibilities }; |
my ($name, $description) = @{ $possibilities }; |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
'" value="'.$name.'"'; |
'" value="'.$name.'"'; |
if ($showval eq $name) { |
if ($showval eq $name) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
} |
} |
$result .= ' />'.&mt($description).'</label> '; |
$result .= ' />'.&mt($description).'</label> '; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 2694 sub newoverview {
|
Line 3122 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', |
|
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 2727 ENDOVER
|
Line 3157 ENDOVER
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
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 2740 ENDOVER
|
Line 3170 ENDOVER
|
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
|
|
unless ($env{'form.parmlev'}) { |
unless ($env{'form.parmlev'}) { |
$parmlev = 'map'; |
$parmlev = 'map'; |
} else { |
} else { |
$parmlev = $env{'form.parmlev'}; |
$parmlev = $env{'form.parmlev'}; |
} |
} |
|
|
&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"> |
$r->print('<div class="LC_Box">'); |
<tr><td class="LC_parm_overview_level_menu">'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
|
$r->print('<div>'); |
|
$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()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
$r->print('</td>'); |
|
} |
} |
$r->print('</td></tr></table>'); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('<table id="LC_parm_overview_controls"> |
$r->print('</div></div>'); |
<tr><td class="LC_parm_overview_parm_selectors">'); |
|
|
$r->print('<div class="LC_Box">'); |
|
$r->print('<div>'); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print('</td><td class="LC_parm_overview_restrictions"> |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
<table class="LC_parm_overview_restrictions">'. |
&parmboxes($r,\%allparms,\@pscat,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
|
$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 2779 ENDOVER
|
Line 3216 ENDOVER
|
$r->print('</td><td>'); |
$r->print('</td><td>'); |
&groupmenu($r,\@selected_groups); |
&groupmenu($r,\@selected_groups); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
#$r->print('</td></tr></table>'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print('</div></div>'); |
|
|
|
$r->print('<div class="LC_Box">'); |
|
$r->print('<div>'); |
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder); |
|
$r->print('</div></div>'); |
|
|
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
|
|
Line 2799 ENDOVER
|
Line 3242 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 2854 sub overview {
|
Line 3297 sub overview {
|
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', |
|
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 2879 ENDOVER
|
Line 3324 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 2888 sub clean_parameters {
|
Line 3333 sub clean_parameters {
|
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=cleanparameters', |
|
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 2906 ENDOVER
|
Line 3353 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); |
} |
} |
my $parmitem = &standard_parameter_names($data{'parameter_name'}); |
my $parmitem = &standard_parameter_names($data{'parameter_name'}); |
$parmitem = &mt($parmitem); |
$parmitem = &mt($parmitem); |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$parmitem,$resourcedata->{$thiskey})); |
$parmitem,$resourcedata->{$thiskey})); |
$r->print('<br />'); |
$r->print('<br />'); |
if ($data{'scope_type'} eq 'all') { |
if ($data{'scope_type'} eq 'all') { |
$r->print(&mt('All users')); |
$r->print(&mt('All users')); |
} elsif ($data{'scope_type'} eq 'user') { |
} elsif ($data{'scope_type'} eq 'user') { |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
} elsif ($data{'scope_type'} eq 'section') { |
} elsif ($data{'scope_type'} eq 'section') { |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
} elsif ($data{'scope_type'} eq 'group') { |
} elsif ($data{'scope_type'} eq 'group') { |
$r->print(&mt('Group: [_1]',$data{'scope'})); |
$r->print(&mt('Group: [_1]',$data{'scope'})); |
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
if ($data{'realm_type'} eq 'all') { |
if ($data{'realm_type'} eq 'all') { |
$r->print(&mt('All Resources')); |
$r->print(&mt('All Resources')); |
} elsif ($data{'realm_type'} eq 'folder') { |
} elsif ($data{'realm_type'} eq 'folder') { |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
} elsif ($data{'realm_type'} eq 'symb') { |
} elsif ($data{'realm_type'} eq 'symb') { |
my ($map,$resid,$url) = |
my ($map,$resid,$url) = |
&Apache::lonnet::decode_symb($data{'realm'}); |
&Apache::lonnet::decode_symb($data{'realm'}); |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$url,$resid,$map)); |
$url,$resid,$map)); |
} |
} |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$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 2972 sub date_shift_one {
|
Line 3419 sub date_shift_one {
|
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'}, |
|
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 2997 sub date_shift_two {
|
Line 3446 sub date_shift_two {
|
my ($r) = @_; |
my ($r) = @_; |
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'}, |
|
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 3016 sub parse_key {
|
Line 3467 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; |
$data{'parameter_name'} = $name; |
$data{'parameter_name'} = $name; |
|
|
return %data; |
return %data; |
} |
} |
|
|
|
|
|
|
sub extract_cloners { |
sub extract_cloners { |
my ($clonelist,$allowclone) = @_; |
my ($clonelist,$allowclone) = @_; |
if ($clonelist =~ /,/) { |
if ($clonelist =~ /,/) { |
Line 3082 sub check_cloners {
|
Line 3535 sub check_cloners {
|
$disallowed{'format'} .= $currclone.','; |
$disallowed{'format'} .= $currclone.','; |
} |
} |
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
$disallowed{'format'} .= $currclone.','; |
$disallowed{'format'} .= $currclone.','; |
} else { |
} else { |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
$disallowed{'newuser'} .= $currclone.','; |
$disallowed{'newuser'} .= $currclone.','; |
Line 3111 sub change_clone {
|
Line 3564 sub change_clone {
|
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 $clone_crs = $cnum.':'.$cdom; |
my $clone_crs = $cnum.':'.$cdom; |
|
|
if ($cnum && $cdom) { |
if ($cnum && $cdom) { |
my @allowclone; |
my @allowclone; |
&extract_cloners($clonelist,\@allowclone); |
&extract_cloners($clonelist,\@allowclone); |
Line 3166 sub change_clone {
|
Line 3619 sub change_clone {
|
} |
} |
|
|
|
|
|
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Parameter Manager'); |
return &Apache::loncommon::start_page('Parameter Manager'); |
} |
} |
|
|
|
|
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$parm_permission)=@_; |
my ($r,$parm_permission)=@_; |
# |
# |
|
$r->print(&header()); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
$r->print(<<ENDMAINFORMHEAD); |
$r->print(<<ENDMAINFORMHEAD); |
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/parmset" name="studentform"> |
action="/adm/parmset" name="studentform"> |
Line 3187 ENDMAINFORMHEAD
|
Line 3645 ENDMAINFORMHEAD
|
my $lc_crstype = lc($crstype); |
my $lc_crstype = lc($crstype); |
|
|
my @menu = |
my @menu = |
( { divider=>"Settings for Your $crstype", |
( { categorytitle=>"Settings for this $crstype", |
}, |
items => [ |
{ text => 'Set Portfolio Metadata', |
{ linktext => "$crstype Configuration", |
action => 'setrestrictmeta', |
url => '/adm/courseprefs?origin=params', |
|
permission => $parm_permission, |
|
linktitle => "Edit $lc_crstype configuration." , |
|
icon => 'preferences-desktop-remote-desktop.png' , |
|
#help => 'Course_Environment', |
|
}, |
|
{ linktext => 'Portfolio Metadata', |
|
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission, |
|
linktitle => "Restrict metadata for this $lc_crstype." , |
|
icon =>'contact-new.png' , |
}, |
}, |
{ text => "Manage $crstype Slots", |
{ linktext => "Manage $crstype Slots", |
url => '/adm/slotrequest?command=showslots', |
url => '/adm/slotrequest?command=showslots', |
permission => $vgr, |
permission => $vgr, |
|
linktitle => "Manage slots for this $lc_crstype." , |
|
icon => 'rsrv.png' , |
}, |
}, |
{ text => 'Reset Student Access Times', |
{ linktext => 'Reset Student Access Times', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/helper/resettimes.helper', |
permission => $mgr, |
permission => $mgr, |
|
linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , |
|
icon => 'start-here.png' , |
}, |
}, |
|
|
{ text => 'Set Parameter Setting Default Actions', |
{ linktext => 'Set Parameter Setting Default Actions', |
action => 'setdefaults', |
url => '/adm/parmset?action=setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
linktitle =>'Set default actions for parameters.' , |
{ divider => 'New and Existing Parameter Settings for Your Resources', |
icon => 'folder-new.png' , |
}, |
}]}, |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
{ categorytitle => 'New and Existing Parameter Settings for Resources', |
|
items => [ |
|
{ linktext => 'Edit Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Parameter_Helper', |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
|
icon => 'dialog-information.png' , |
|
#help => 'Parameter_Helper', |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Overview Mode', |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
action => 'newoverview', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Parameter_Overview', |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
|
icon => 'edit-find.png' , |
|
#help => 'Parameter_Overview', |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
{ linktext => 'Edit Resource Parameters - Table Mode', |
action => 'settable', |
url => '/adm/parmset?action=settable', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Table_Mode', |
linktitle =>'Set/Modify resource parameters in table mode.' , |
}, |
icon => 'edit-copy.png' , |
{ divider => 'Existing Parameter Settings for Your Resources', |
#help => 'Table_Mode', |
}, |
}]}, |
{ text => 'Modify Resource Parameters - Overview Mode', |
{ categorytitle => 'Existing Parameter Settings for Resources', |
action => 'setoverview', |
items => [ |
permission => $parm_permission, |
{ linktext => 'Modify Resource Parameters - Overview Mode', |
help => 'Parameter_Overview', |
url => '/adm/parmset?action=setoverview', |
}, |
|
{ text => "Parameter Change Log and $crstype Blog Posting/User Notification", |
|
action => 'parameterchangelog', |
|
permission => $parm_permission, |
permission => $parm_permission, |
|
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
|
icon => 'preferences-desktop-wallpaper.png' , |
|
#help => 'Parameter_Overview', |
}, |
}, |
|
{ linktext => 'Change Log', |
|
url => '/adm/parmset?action=parameterchangelog', |
|
permission => $parm_permission, |
|
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
|
icon => 'document-properties.png', |
|
}]} |
); |
); |
my $menu_html = ''; |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
foreach my $menu_item (@menu) { |
|
if ($menu_item->{'divider'}) { |
|
$menu_html .= '<h3>'.&mt($menu_item->{'divider'}).'</h3>'; |
|
next; |
|
} |
|
next if (! $menu_item->{'permission'}); |
|
$menu_html.='<p>'; |
|
$menu_html.='<span class="LC_parm_menu_item">'; |
|
if (exists($menu_item->{'url'})) { |
|
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
|
} else { |
|
$menu_html.= |
|
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
|
} |
|
$menu_html.= &mt($menu_item->{'text'}).'</a></span>'; |
|
if (exists($menu_item->{'help'})) { |
|
$menu_html.= |
|
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
|
} |
|
$menu_html.='</p>'.$/; |
|
} |
|
$r->print($menu_html); |
|
return; |
return; |
} |
} |
### Set portfolio metadata |
|
|
|
|
|
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my $output; |
my $output; |
Line 3274 sub output_row {
|
Line 3737 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']; |
} |
} |
$output = &Apache::loncommon::start_data_table_row(); |
$output = &Apache::loncommon::start_data_table_row(); |
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></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 .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label> |
|
<input type="checkbox" name="'. |
|
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label></span> </td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
} |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
$output .= '<td>'.(' ' x 5).'<label> |
|
<input type="checkbox" name="'. |
|
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label></td>'; |
|
$output .= &Apache::loncommon::end_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 .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
my $multiple_checked; |
my $multiple_checked; |
my $single_checked; |
my $single_checked; |
if ($options =~ m/onlyone/) { |
if ($options =~ m/onlyone/) { |
$multiple_checked = ""; |
$multiple_checked = ''; |
$single_checked = ' checked="checked"'; |
$single_checked = ' checked="checked"'; |
} else { |
} else { |
$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).'<span class="LC_metadata"> |
$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').'</span></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).'<span class="LC_metadata"> |
$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').'</span></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); |
} |
} |
|
|
|
|
|
|
sub order_meta_fields { |
sub order_meta_fields { |
my ($r)=@_; |
my ($r)=@_; |
my $idx = 1; |
my $idx = 1; |
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'}; |
$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', |
|
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 3335 sub order_meta_fields {
|
Line 3803 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 3372 sub order_meta_fields {
|
Line 3840 sub order_meta_fields {
|
$ordered_fields = join ",", @fields_in_order; |
$ordered_fields = join ",", @fields_in_order; |
} |
} |
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); |
} |
} |
$r->print('<table>'); |
$r->print('<table>'); |
my $num_fields = scalar(@fields_in_order); |
my $num_fields = scalar(@fields_in_order); |
foreach my $key (@fields_in_order) { |
foreach my $key (@fields_in_order) { |
Line 3397 sub order_meta_fields {
|
Line 3865 sub order_meta_fields {
|
$r->print('</table>'); |
$r->print('</table>'); |
return 'ok'; |
return 'ok'; |
} |
} |
|
|
|
|
sub continue { |
sub continue { |
my $output; |
my $output; |
$output .= '<form action="" method="post">'; |
$output .= '<form action="" method="post">'; |
Line 3404 sub continue {
|
Line 3874 sub continue {
|
$output .= '<input type="submit" value="Continue" />'; |
$output .= '<input type="submit" value="Continue" />'; |
return ($output); |
return ($output); |
} |
} |
|
|
|
|
sub addmetafield { |
sub addmetafield { |
my ($r)=@_; |
my ($r)=@_; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
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 3418 sub addmetafield {
|
Line 3892 sub addmetafield {
|
$options =~ s/,,/,/; |
$options =~ s/,,/,/; |
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
|
|
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
} |
} |
$r->print(&continue()); |
$r->print(&continue()); |
Line 3450 sub addmetafield {
|
Line 3924 sub addmetafield {
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
|
|
|
|
|
|
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
|
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 3470 sub setrestrictmeta {
|
Line 3949 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 3495 sub setrestrictmeta {
|
Line 3974 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 3505 sub setrestrictmeta {
|
Line 3984 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 3524 ENDButtons
|
Line 4003 ENDButtons
|
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); |
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); |
} |
} |
$output .= &Apache::loncommon::end_data_table(); |
$output .= &Apache::loncommon::end_data_table(); |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
$output |
$output |
$buttons |
$buttons |
Line 3533 ENDenv
|
Line 4012 ENDenv
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return 'ok'; |
return 'ok'; |
} |
} |
################################################## |
|
|
|
|
|
sub get_added_meta_fieldnames { |
sub get_added_meta_fieldnames { |
my ($cid) = @_; |
my ($cid) = @_; |
my %fields; |
my %fields; |
Line 3546 sub get_added_meta_fieldnames {
|
Line 4027 sub get_added_meta_fieldnames {
|
} |
} |
return \%fields; |
return \%fields; |
} |
} |
|
|
|
|
|
|
sub get_deleted_meta_fieldnames { |
sub get_deleted_meta_fieldnames { |
my ($cid) = @_; |
my ($cid) = @_; |
my %fields; |
my %fields; |
Line 3563 sub get_deleted_meta_fieldnames {
|
Line 4047 sub get_deleted_meta_fieldnames {
|
sub defaultsetter { |
sub defaultsetter { |
my ($r) = @_; |
my ($r) = @_; |
|
|
my $start_page = |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
text=>"Set Defaults"}); |
|
my $start_page = |
|
&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 3587 ENDDEFHEAD
|
Line 4073 ENDDEFHEAD
|
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
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 3724 sub components {
|
Line 4210 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'; |
Line 3778 sub load_parameter_names {
|
Line 4268 sub load_parameter_names {
|
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 { |
# Parameter Change Log |
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', |
|
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); } |
|
|
$r->print('<form action="/adm/parmset?action=parameterchangelog" |
$r->print('<form action="/adm/parmset?action=parameterchangelog" |
method="post" name="parameterlog">'); |
method="post" name="parameterlog">'); |
|
|
my %saveable_parameters = ('show' => 'scalar',); |
my %saveable_parameters = ('show' => 'scalar',); |
&Apache::loncommon::store_course_settings('parameter_log', |
&Apache::loncommon::store_course_settings('parameter_log', |
\%saveable_parameters); |
\%saveable_parameters); |
Line 3813 sub parm_change_log {
|
Line 4311 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; |
} |
} |
my $parmitem = &standard_parameter_names($parmname); |
my $parmitem = &standard_parameter_names($parmname); |
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
&mt($parmitem).'</td><td>'. |
&mt($parmitem).'</td><td>'. |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
my $stillactive=0; |
my $stillactive=0; |
if ($parmlog{$id}{'delflag'}) { |
if ($parmlog{$id}{'delflag'}) { |
$output .= &mt('Deleted'); |
$output .= &mt('Deleted'); |
} else { |
} else { |
if ($typeflag) { |
if ($typeflag) { |
my $parmitem = &standard_parameter_names($value); |
my $parmitem = &standard_parameter_names($value); |
$parmitem = &mt($parmitem); |
$parmitem = &mt($parmitem); |
$output .= &mt('Type: [_1]',$parmitem); |
$output .= &mt('Type: [_1]',$parmitem); |
} else { |
} else { |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
$uname,$udom,$issection,$issection,$courseopt); |
$uname,$udom,$issection,$issection,$courseopt); |
if (&isdateparm($istype{$parmname})) { |
my $showvalue = $value; |
$output .= &Apache::lonlocal::locallocaltime($value); |
if ($istype{$parmname} eq '') { |
} else { |
my $type = &standard_parameter_types($parmname); |
$output .= $value; |
if ($type ne '') { |
} |
if (&isdateparm($type)) { |
if ($value ne $all[$level]) { |
$showvalue = |
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
&Apache::lonlocal::locallocaltime($value); |
} else { |
} |
$stillactive=1; |
} |
} |
} else { |
} |
if (&isdateparm($istype{$parmname})) { |
} |
$showvalue = |
$output .= '</td><td>'; |
&Apache::lonlocal::locallocaltime($value); |
if ($stillactive) { |
} |
|
} |
|
$output .= $showvalue; |
|
if ($value ne $all[$level]) { |
|
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
|
} else { |
|
$stillactive=1; |
|
} |
|
} |
|
} |
|
$output .= '</td><td>'; |
|
|
|
if ($stillactive) { |
my $parmitem = &standard_parameter_names($parmname); |
my $parmitem = &standard_parameter_names($parmname); |
$parmitem = &mt($parmitem); |
$parmitem = &mt($parmitem); |
my $title=&mt('Changed [_1]',$parmitem); |
my $title=&mt('Changed [_1]',$parmitem); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
$parmitem,$realmdescription, |
$parmitem,$realmdescription, |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
if (($uname) && ($udom)) { |
if (($uname) && ($udom)) { |
$output .= |
$output .= |
&Apache::loncommon::messagewrapper('Notify User', |
&Apache::loncommon::messagewrapper('Notify User', |
$uname,$udom,$title, |
$uname,$udom,$title, |
$description); |
$description); |
} else { |
} else { |
$output .= |
$output .= |
&Apache::lonrss::course_blog_link($id,$title, |
&Apache::lonrss::course_blog_link($id,$title, |
$description); |
$description); |
} |
} |
} |
} |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
$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 4049 sub check_for_course_info {
|
Line 4559 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
&reset_caches(); |
&reset_caches(); |
|
|
if ($r->header_only) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK; |
|
} |
|
&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 4069 sub handler {
|
Line 4579 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 => 'Parameter_Manager'}); |
help => |
|
'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) { |
|
|
# Start Page |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
|
|
|
|
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
# 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'})) { |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
&assessparms($r); |
text=>"Problem Parameters"}); |
|
&assessparms($r); |
|
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
$r->print(&header()); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&overview($r); |
text=>"Overview Mode"}); |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&overview($r); |
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&order_meta_fields($r); |
text=>"Add Metadata Field"}); |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&addmetafield($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'newoverview') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&newoverview($r); |
text=>"Add Metadata Field"}); |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&order_meta_fields($r); |
&defaultsetter($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'settable') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&assessparms($r); |
text=>"Restrict Metadata"}); |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&setrestrictmeta($r); |
&parm_change_log($r); |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&clean_parameters($r); |
text=>"Overview Mode"}); |
} elsif ($env{'form.action'} eq 'dateshift1') { |
&newoverview($r); |
|
} elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
|
text=>"Set Defaults"}); |
|
&defaultsetter($r); |
|
} elsif ($env{'form.action'} eq 'settable' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Table Mode", |
|
help => 'Course_Setting_Parameters'}); |
|
&assessparms($r); |
|
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log"}); |
|
&parm_change_log($r); |
|
} elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
|
text=>"Clean Parameters"}); |
|
&clean_parameters($r); |
|
} elsif ($env{'form.action'} eq 'dateshift1' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_one($r); |
&date_shift_one($r); |
} elsif ($env{'form.action'} eq 'dateshift2' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'dateshift2') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
&date_shift_two($r); |
&date_shift_two($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(); |
|
|
Line 4168 sub handler {
|
Line 4645 sub handler {
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|