version 1.413.4.3, 2010/01/25 21:58:31
|
version 1.522.2.27, 2020/02/12 19:54:47
|
Line 36 lonparmset - Handler to set parameters f
|
Line 36 lonparmset - Handler to set parameters f
|
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
lonparmset provides an interface to setting course parameters. |
lonparmset provides an interface to setting content parameters in a |
|
course. |
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
|
|
Line 44 This module sets coursewide and assessme
|
Line 45 This module sets coursewide and assessme
|
|
|
=head1 INTERNAL SUBROUTINES |
=head1 INTERNAL SUBROUTINES |
|
|
=over 4 |
=over |
|
|
=item parmval() |
=item parmval() |
|
|
Line 56 Inputs: $what - a parameter spec (inclu
|
Line 57 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 119 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 129 javascript function 'pjump'.
|
Line 130 javascript function 'pjump'.
|
|
|
=item print_td() |
=item print_td() |
|
|
=item print_usergroups() |
=item check_other_groups() |
|
|
=item parm_control_group() |
=item parm_control_group() |
|
|
=item extractResourceInformation() : |
=item extractResourceInformation() : |
|
|
|
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
|
|
|
Input: See list below |
|
|
Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. |
=over 4 |
|
|
|
=item * B<env{'user.name'}> : Current username |
|
|
Input: See list below: |
=item * B<env{'user.domain'}> : Domain of current user. |
|
|
=item * B<ids> : An array that will contain all of the ids in the course. |
=item * B<env{"request.course.fn"}> : Course |
|
|
=item * B<typep> : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
=back |
|
|
=item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
Outputs: See list below |
|
|
|
=over 4 |
|
|
=item * B<allparms> : hash, name of parameter->display value (what is the display value?) |
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
|
|
=item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
|
|
=item * B<allkeys> : hash, full key to part->display value (what's display value?) |
=item * B<keyp> (out) : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
|
|
=item * B<allmaps> : hash, ??? |
=item * B<allparms> (out) : hash, name of parameter->display value (what is the display value?) |
|
|
=item * B<fcat> : ??? |
=item * B<allparts> (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
|
|
=item * B<defp> : hash, ??? |
=item * B<allmaps> (out) : hash, ??? |
|
|
=item * B<mapp> : ?? |
=item * B<mapp> : ?? |
|
|
=item * B<symbp> : hash, id->full sym? |
=item * B<symbp> : hash, id->full sym? |
|
|
|
=item * B<maptitles> |
|
|
|
=item * B<uris> |
|
|
|
=item * B<keyorder> |
|
|
|
=item * B<defkeytype> |
|
|
|
=back |
|
|
=item isdateparm() |
=item isdateparm() |
|
|
Line 190 Input: See list below:
|
Line 206 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. |
|
|
Inputs: $r |
Inputs: $r - the Apache request object. |
|
|
Returns: nothing |
Returns: nothing |
|
|
Variables used (guessed by Jeremy): |
Variables used (guessed by Jeremy): |
|
|
|
=over |
|
|
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
|
|
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
Line 213 Variables used (guessed by Jeremy):
|
Line 231 Variables used (guessed by Jeremy):
|
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 |
|
|
|
=back |
|
|
=item tablestart() |
=item tablestart() |
|
|
=item tableend() |
=item tableend() |
Line 247 Variables used (guessed by Jeremy):
|
Line 267 Variables used (guessed by Jeremy):
|
|
|
=item parse_key() |
=item parse_key() |
|
|
=item check_cloners() : |
|
|
|
Checks if new users included in list of allowed cloners |
|
are valid users. Replaces supplied list with |
|
cleaned list containing only users with valid usernames |
|
and domains. |
|
|
|
Inputs: $clonelist, $oldcloner |
|
where $clonelist is ref to array of requested cloners, |
|
and $oldcloner is ref to array of currently allowed |
|
cloners. |
|
|
|
Returns: string - comma separated list of requested |
|
cloners (username:domain) who do not exist in system. |
|
|
|
=item change_clone() : |
|
|
|
Modifies the list of courses a user can clone (stored |
|
in the user's environment.db file), called when a |
|
change is made to the list of users allowed to clone |
|
a course. |
|
|
|
Inputs: $action,$cloner |
|
where $action is add or drop, and $cloner is identity of |
|
user for whom cloning ability is to be changed in course. |
|
|
|
|
|
=item check_cloners() |
|
|
|
=item change_clone() |
|
|
|
=item header() |
=item header() |
|
|
Output html header for page |
Output html header for page |
Line 306 Set portfolio metadata
|
Line 295 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. |
|
|
|
|
=back |
=back |
|
|
=cut |
=cut |
|
|
|
|
################################################################### |
################################################################### |
################################################################### |
################################################################### |
|
|
Line 333 use Apache::lonlocal;
|
Line 320 use Apache::lonlocal;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
|
use HTML::Entities; |
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 335 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 363 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 382 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 421 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 443 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 454 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 602 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 617 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 ''; |
} |
} |
|
|
sub log_parmset { |
sub log_parmset { |
return &Apache::lonnet::instructor_log('parameterlog',@_); |
return &Apache::lonnet::write_log('course','parameterlog',@_); |
} |
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
Line 666 sub storeparm_by_symb_inner {
|
Line 658 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 671 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 687 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 = |
} else { |
'<img src="/res/adm/pages/editmap.png"' |
$result=' '; |
.' alt="'.&mt('Change').'"' |
} |
.' title="'.&mt('Change').'" style="border:0;" />'; |
|
} else { |
|
$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 802 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=~s/\,/\, /gs; |
|
$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 829 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 846 sub page_js {
|
|
|
return(<<ENDJS); |
return(<<ENDJS); |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
function pclose() { |
|
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
|
"height=350,width=350,scrollbars=no,menubar=no"); |
|
parmwin.close(); |
|
} |
|
|
|
$pjump_def |
$pjump_def |
|
|
function psub() { |
function psub() { |
pclose(); |
|
if (document.parmform.pres_marker.value!='') { |
if (document.parmform.pres_marker.value!='') { |
document.parmform.action+='#'+document.parmform.pres_marker.value; |
document.parmform.action+='#'+document.parmform.pres_marker.value; |
var typedef=new Array(); |
var typedef=new Array(); |
Line 867 sub page_js {
|
Line 859 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 879 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 |
|
|
} |
} |
|
|
|
sub showhide_js { |
|
return <<"COURSECONTENTSCRIPT"; |
|
|
|
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"; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
COURSECONTENTSCRIPT |
|
} |
|
|
sub startpage { |
sub startpage { |
my ($r) = @_; |
my ($r,$psymb) = @_; |
|
|
my %loaditems = ('onunload' => "pclose()", |
my %loaditems = ( |
'onload' => "group_or_section('cgroup')",); |
'onload' => "group_or_section('cgroup')", |
|
); |
|
if (!$psymb) { |
|
$loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup'); resize_scrollbox('mapmenuscroll','1','1');"; |
|
} |
|
|
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 $js = &page_js().' |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
'. |
|
&Apache::lonhtmlcommon::resize_scrollbox_js('params').' |
|
// ]]> |
|
</script> |
|
'; |
|
my $start_page = |
|
&Apache::loncommon::start_page('Set/Modify Course Parameters',$js, |
|
{'add_entries' => \%loaditems,}); |
|
my $breadcrumbs = |
|
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
|
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
|
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
|
$r->print($start_page.$breadcrumbs); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value="" name="pres_value" /> |
<input type="hidden" value="" name="pres_value" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="1" name="prevvisit" /> |
<input type="hidden" value="1" name="prevvisit" /> |
|
<input type="hidden" value="$escfilter" name="filter" /> |
|
<input type="hidden" value="$escpart" name="part" /> |
ENDHEAD |
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,$noeditgrp, |
|
$readonly)=@_; |
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 944 sub print_row {
|
Line 982 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} eq '0'?'0 ('.&mt('default').')':$$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 963 sub print_row {
|
Line 1001 sub print_row {
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} else { |
} else { |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
if (@{$usersgroups} > 1) { |
if (@{$usersgroups} > 1) { |
my ($coursereply,$grp_parm,$controlgrp); |
my ($coursereply,$grp_parm,$controlgrp); |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
&print_usergroups($r,$$part{$which}.'.'.$$name{$which}, |
&check_other_groups($$part{$which}.'.'.$$name{$which}, |
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
if ($coursereply && $result > 3) { |
if ($coursereply && $result > 3) { |
if (defined($controlgrp)) { |
if (defined($controlgrp)) { |
Line 1000 sub print_row {
|
Line 1038 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
|
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} |
} |
|
|
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,'',$readonly); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
|
|
} # 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 1078 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 { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_; |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
';" align="center">'); |
';" align="center">'); |
my $nolink = 0; |
my $nolink = 0; |
if ($which == 11 || $which == 12) { |
if ($readonly) { |
$nolink = 1; |
$nolink = 1; |
} elsif ($mprefix =~ /availablestudent\&$/) { |
} else { |
if ($which > 3) { |
if ($which == 11 || $which == 12) { |
|
$nolink = 1; |
|
} elsif (($env{'request.course.sec'} ne '') && ($which > 9)) { |
$nolink = 1; |
$nolink = 1; |
|
} elsif ($which == 4 || $which == 5 || $which == 6) { |
|
if ($noeditgrp) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /availablestudent\&$/) { |
|
if ($which > 3) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
|
$nolink = 1; |
|
} |
} |
} |
} |
} |
if ($nolink) { |
if ($nolink) { |
Line 1064 sub print_td {
|
Line 1118 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
sub print_usergroups { |
sub check_other_groups { |
my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
my $output; |
my $output; |
my $symb = &symbcache($rid); |
my $symb = &symbcache($rid); |
Line 1077 sub print_usergroups {
|
Line 1131 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); |
$grp_parm = &valout($coursereply,$resulttype); |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
Line 1120 sub parm_control_group {
|
Line 1173 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 1194 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'))) { |
|
next if ($key!~/^parameter_/); |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
|
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 1223 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 Content'); |
} 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'))); |
} |
} |
|
|
|
# |
|
# parmmenu displays a list of the selected parameters. |
|
# It also offers a link to show/hide the complete parameter list |
|
# from which you can select all desired parameters. |
|
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r)=@_; |
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; |
Line 1241 sub parmmenu {
|
Line 1307 sub parmmenu {
|
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
|
|
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
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'); |
|
checkthis('discussvote','pscat'); |
} |
} |
|
|
function checkcontdates() { |
function checkcontdates() { |
checkthis('contentopen','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('contentclose','pscat'); |
checkthis('contentclose','pscat'); |
} |
} |
|
|
|
|
function checkvisi() { |
function checkvisi() { |
checkthis('hiddenresource','pscat'); |
checkthis('hiddenresource','pscat'); |
checkthis('encrypturl','pscat'); |
checkthis('encrypturl','pscat'); |
checkthis('problemstatus','pscat'); |
checkthis('problemstatus','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('contentopen','pscat'); |
checkthis('opendate','pscat'); |
checkthis('opendate','pscat'); |
} |
} |
|
|
function checkparts() { |
function checkparts() { |
checkthis('hiddenparts','pscat'); |
checkthis('hiddenparts','pscat'); |
checkthis('display','pscat'); |
checkthis('display','pscat'); |
checkthis('ordered','pscat'); |
checkthis('ordered','pscat'); |
} |
} |
|
|
function checkstandard() { |
function checkstandard() { |
checkall(false,'pscat'); |
checkall(false,'pscat'); |
checkdates(); |
checkdates(); |
checkthis('weight','pscat'); |
checkthis('weight','pscat'); |
checkthis('maxtries','pscat'); |
checkthis('maxtries','pscat'); |
|
checkthis('type','pscat'); |
|
checkthis('problemstatus','pscat'); |
} |
} |
|
|
|
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
|
$r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>'); |
$r->print('<hr />'); |
my $cnt=0; |
&shortCuts($r); |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print('<hr />'); |
$r->print("\n".'<td><label><input type="checkbox" name="pscat" '); |
} |
$r->print('value="'.$tempkey.'"'); |
# return a hash |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
sub categories { |
$r->print(' checked="checked"'); |
return ('time_settings' => 'Time Settings', |
} |
'grading' => 'Grading', |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
'tries' => 'Tries', |
: $tempkey). |
'problem_appearance' => 'Problem Appearance', |
'</label></td>'); |
'behaviour_of_input_fields' => 'Behaviour of Input Fields', |
$cnt++; |
'hiding' => 'Hiding', |
if ($cnt==3) { |
'high_level_randomization' => 'High Level Randomization', |
$r->print("</tr>\n<tr>"); |
'slots' => 'Slots', |
$cnt=0; |
'file_submission' => 'File Submission', |
} |
'misc' => 'Miscellaneous' ); |
} |
} |
$r->print('</tr>' |
|
.'<tr id="LC_parm_overview_parm_menu_selectors">' |
# return a hash. Like a look-up table |
.'<td valign="top">' |
sub lookUpTableParameter { |
.'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>' |
|
.'<span class="LC_nobreak">' |
return ( |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
'opendate' => 'time_settings', |
.'</span>' |
'duedate' => 'time_settings', |
.'<br />' |
'answerdate' => 'time_settings', |
.'<span class="LC_nobreak">' |
'interval' => 'time_settings', |
.'• <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>' |
'contentopen' => 'time_settings', |
.'</span>' |
'contentclose' => 'time_settings', |
.'<br />' |
'discussend' => 'time_settings', |
.'<span class="LC_nobreak">' |
'printstartdate' => 'time_settings', |
.'• <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>' |
'printenddate' => 'time_settings', |
.'</span>' |
'weight' => 'grading', |
.'</fieldset>' |
'handgrade' => 'grading', |
.'</td>' |
'maxtries' => 'tries', |
.'<td colspan="2" valign="top">' |
'hinttries' => 'tries', |
.'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>' |
'randomizeontries' => 'tries', |
.'<span class="LC_nobreak">' |
'type' => 'problem_appearance', |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
'problemstatus' => 'problem_appearance', |
.'</span>' |
'display' => 'problem_appearance', |
.'<span class="LC_nobreak">' |
'ordered' => 'problem_appearance', |
.' • <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>' |
'numbubbles' => 'problem_appearance', |
.'</span>' |
'tol' => 'behaviour_of_input_fields', |
# .'<br />' |
'sig' => 'behaviour_of_input_fields', |
.'<span class="LC_nobreak">' |
'turnoffunit' => 'behaviour_of_input_fields', |
.' • <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>' |
'hiddenresource' => 'hiding', |
.'</span>' |
'hiddenparts' => 'hiding', |
.'<span class="LC_nobreak">' |
'discusshide' => 'hiding', |
.' • <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>' |
'buttonshide' => 'hiding', |
.'</span>' |
'turnoffeditor' => 'hiding', |
# .'<br />' |
'encrypturl' => 'hiding', |
.'<span class="LC_nobreak">' |
'randomorder' => 'high_level_randomization', |
.' • <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>' |
'randompick' => 'high_level_randomization', |
.'</span>' |
'available' => 'slots', |
.'</fieldset>' |
'useslots' => 'slots', |
.'</td>' |
'availablestudent' => 'slots', |
.'</tr></table>' |
'uploadedfiletypes' => 'file_submission', |
|
'maxfilesize' => 'file_submission', |
|
'cssfile' => 'misc', |
|
'mapalias' => 'misc', |
|
'acc' => 'misc', |
|
'maxcollaborators' => 'misc', |
|
'scoreformat' => 'misc', |
|
'lenient' => 'grading', |
|
'retrypartial' => 'tries', |
|
'discussvote' => 'misc', |
|
'examcode' => 'high_level_randomization', |
|
); |
|
} |
|
|
|
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' => [], |
|
); |
|
|
|
foreach $tempparameter (keys %$allparms) { |
|
&whatIsMyCategory($tempparameter, \%categoryList); |
|
} |
|
#part to print the parm-list |
|
$r->print('<div class="LC_columnSection">'."\n"); |
|
|
|
#Print parameters |
|
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
|
next if(@{$categoryList{$key}} == 0); |
|
$r->print('<div class="LC_Box LC_400Box">' |
|
.'<h4 class="LC_hcell">' |
|
.&mt($categories{$key}) |
|
.'</h4>'."\n"); |
|
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
|
next if ($tempkey eq ''); |
|
$r->print('<span class="LC_nobreak">' |
|
.'<label><input type="checkbox" name="pscat" ' |
|
.'value="'.$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"); |
|
} |
|
|
|
$r->print("</div>\n"); |
|
} |
|
# |
|
# This function offers some links on the parameter section to get with one click a group a parameters |
|
# |
|
sub shortCuts { |
|
my ($r)=@_; |
|
|
|
# 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">'); |
my $selsize = 1+scalar(keys(%{$allparts})); |
|
if ($selsize > 8) { |
|
$selsize = 8; |
|
} |
|
|
|
$r->print('<select multiple="multiple" name="psprt" size="'.$selsize.'">'); |
$r->print('<option value="all"'); |
$r->print('<option value="all"'); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
my %temphash=(); |
my %temphash=(); |
foreach (@{$psprt}) { $temphash{$_}=1; } |
foreach (@{$psprt}) { $temphash{$_}=1; } |
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>'); |
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom','condition'). |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
&Apache::lonhtmlcommon::scripttag(<<ENDJS); |
|
function setCourseadv(form,caller) { |
|
if (caller.value == 'st') { |
|
form.courseadv.value = 'none'; |
|
} else { |
|
form.courseadv.value = ''; |
|
} |
|
return; |
|
} |
|
ENDJS |
|
|
|
my (%chkroles,$stuonly,$courseadv); |
|
if ($env{'form.userroles'} eq 'any') { |
|
$chkroles{'any'} = ' checked="checked"'; |
|
} else { |
|
$chkroles{'st'} = ' checked="checked"'; |
|
$courseadv = 'none'; |
|
} |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
if ($crstype eq 'Community') { |
|
$stuonly = &mt('member only'); |
|
} else { |
|
$stuonly = &mt('student only'); |
|
} |
|
$chooseopt .= '<br /><span class="LC_cusr_subheading">'. |
|
&mt("User's role").': '. |
|
'<label><input type="radio" name="userroles" value="st"'.$chkroles{'st'}.' onclick="setCourseadv(this.form,this);" />'. |
|
$stuonly.'</label> '. |
|
'<label><input type="radio" name="userroles" value="any"'.$chkroles{'any'}.' onclick="setCourseadv(this.form,this);" />'. |
|
&mt('any role').'</label><input type="hidden" id="courseadv" name="courseadv" value="'.$courseadv.'" /></span>'; |
my $sections=''; |
my $sections=''; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
|
|
my $groups; |
my $groups; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash; |
|
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
|
my $g_s_header=''; |
my $g_s_header=''; |
my $g_s_footer=''; |
my $g_s_footer=''; |
|
|
if (%sectionhash) { |
my $currsec = $env{'request.course.sec'}; |
|
if ($currsec) { |
|
$sections=&mt('Section:').' '.$currsec; |
|
if (%grouphash) { |
|
$sections .= ';'.(' ' x2); |
|
} |
|
} elsif (%sectionhash && $currsec eq '') { |
$sections=&mt('Section:').' <select name="csec"'; |
$sections=&mt('Section:').' <select name="csec"'; |
if (%grouphash && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$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>'; |
} |
} |
|
|
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full' && $currsec eq '') { |
$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 1673 function group_or_section(caller) {
|
} |
} |
} |
} |
} |
} |
|
// ]]> |
</script> |
</script> |
|; |
|; |
} else { |
} elsif ($currsec eq '') { |
$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"'; |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
Line 1454 function group_or_section(caller) {
|
Line 1713 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,$pscat,$keyorder,$divid)=@_; |
$r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'. |
|
&mt('Select Parts to View').'</th></tr><tr><td>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print('</td><td valign="top" align="center">'); |
|
&partmenu($r,$allparts,$psprt); |
&parmmenu($r); |
$r->print('</td></tr></table>'); |
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
|
&parmboxes($r,$allparms,$pscat,$keyorder); |
|
$r->print(&Apache::loncommon::end_scrollbox()); |
|
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; |
$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,1,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="" />'; |
|
my $whitespace = |
|
'<img src="' |
|
.&Apache::loncommon::lonhttpdurl('/adm/lonIcons/whitespace_21.gif') |
|
.'" alt="" />'; |
|
|
|
# Info about selectable folders/maps |
|
$r->print( |
|
'<div class="LC_info">' |
|
.&mt('You can only select maps and folders which have modifiable settings.') |
|
.' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') |
|
.'</div>' |
|
); |
|
|
|
$r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); |
|
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
|
|
|
# Display row: "All Maps or Folders" |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row(undef,'picklevel') |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp"' |
|
); |
|
$r->print(' checked="checked"') if ($pschp eq 'all' || !$pschp); |
|
$r->print( |
|
' value="all" /> '.$icon.' ' |
|
.&mt('All Maps or Folders') |
|
.'</label>' |
|
.'<hr /></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
|
|
# Display row: "Main Content" |
|
if (exists($$allmaps{1})) { |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp" value="1"' |
|
); |
|
$r->print(' checked="checked"') if ($pschp eq '1'); |
|
$r->print( |
|
'/> '.$icon.' ' |
|
.$$maptitles{1} |
|
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
|
|
# Display rows for all course maps and folders |
|
foreach my $id (@{$tree}) { |
|
my ($mapid,$resid)=split(/\./,$id); |
|
# Indentation |
|
my $depth = $treeinfo->{$id}->{'depth'}; |
|
my $indent; |
|
for (my $i = 0; $i < $depth; $i++) { |
|
$indent.= $whitespace; |
|
} |
|
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
|
if ($treeinfo->{$id}->{'type'} eq 'page') { |
|
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />'; |
|
} |
|
my $symb_name = $$symbp{$id}; |
|
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
|
$symb_name = $tail; |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.'<label>' |
|
); |
|
# Only offer radio button for folders/maps which can be parameterized |
|
if ($allmaps_inverted{$symb_name}) { |
|
$r->print( |
|
'<input type ="radio" name="pschp"' |
|
.' value="'.$allmaps_inverted{$symb_name}.'"' |
|
); |
|
$r->print(' checked="checked"') if ($allmaps_inverted{$symb_name} eq $pschp); |
|
$r->print('/>'); |
|
} else { |
|
$r->print($whitespace); |
|
} |
|
$r->print( |
|
$indent.$icon.' ' |
|
.$treeinfo->{$id}->{name} |
|
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
|
.'</label>' |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
} |
|
|
|
$r->print(&Apache::loncommon::end_data_table(). |
|
'<br style="line-height:2px;" />'. |
|
&Apache::loncommon::end_scrollbox()); |
} |
} |
$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>"); |
} |
} |
|
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($selectedsections)=@_; |
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" >'); |
my (@possibles,$disabled); |
foreach my $s ('all',sort keys %sectionhash) { |
if ($env{'request.course.sec'} ne '') { |
$r->print(' <option value="'.$s.'"'); |
@possibles = ($env{'request.course.sec'}); |
foreach (@{$selectedsections}) { |
$selectedsections = [$env{'request.course.sec'}]; |
if ($s eq $_) { |
$disabled = ' disabled="disabled"'; |
$r->print(' selected="selected"'); |
} else { |
last; |
@possibles = ('all',sort(keys(%sectionhash))); |
} |
} |
} |
my $output = '<select name="Section" multiple="multiple" size="8"'.$disabled.'>'; |
$r->print('>'.$s."</option>\n"); |
foreach my $s (@possibles) { |
|
$output .= ' <option value="'.$s.'"'; |
|
if ((@{$selectedsections}) && (grep(/^\Q$s\E$/,@{$selectedsections}))) { |
|
$output .= ' selected="selected"'; |
|
} |
|
$output .= '>'."$s</option>\n"; |
} |
} |
$r->print("</select>\n"); |
$output .= "</select>\n"; |
|
return $output; |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($selectedgroups)=@_; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash; |
return if (!%grouphash); |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
return '' if (!%grouphash); |
|
|
$r->print('<select name="Group" multiple="multiple" size="8" >'); |
my $output = '<select name="Group" multiple="multiple" size="8">'; |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$output .= ' <option value="'.$group.'"'; |
foreach (@{$selectedgroups}) { |
if ((@{$selectedgroups}) && (grep(/^\Q$group\E$/,\@{$selectedgroups}))) { |
if ($group eq $_) { |
$output .= ' selected="selected"'; |
$r->print(' selected="selected"'); |
} |
last; |
$output .= '>'.$group."</option>\n"; |
} |
|
} |
|
$r->print('>'.$group."</option>\n"); |
|
} |
} |
$r->print("</select>\n"); |
$output .= "</select>\n"; |
|
return $output; |
} |
} |
|
|
|
|
sub keysplit { |
sub keysplit { |
my $keyp=shift; |
my $keyp=shift; |
return (split(/\,/,$keyp)); |
return (split(/\,/,$keyp)); |
Line 1559 sub keysplit {
|
Line 1968 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 2003 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, |
|
'parameter_0_discussvote' => 21, |
|
'parameter_0_printstartdate' => 22, |
|
'parameter_0_printenddate' => 23); |
} |
} |
|
|
|
|
sub assessparms { |
sub assessparms { |
|
|
my $r=shift; |
my ($r,$parm_permission) = @_; |
|
|
|
|
|
# -------------------------------------------------------- Variable declaration |
my @ids=(); |
my @ids=(); |
my %symbp=(); |
my %symbp=(); |
my %mapp=(); |
my %mapp=(); |
Line 1631 sub assessparms {
|
Line 2046 sub assessparms {
|
my %keyp=(); |
my %keyp=(); |
my %uris=(); |
my %uris=(); |
my %maptitles=(); |
my %maptitles=(); |
|
|
# -------------------------------------------------------- Variable declaration |
|
|
|
my %allmaps=(); |
my %allmaps=(); |
my %alllevs=(); |
my %alllevs=(); |
|
|
Line 1643 sub assessparms {
|
Line 2055 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 1652 sub assessparms {
|
Line 2064 sub assessparms {
|
|
|
my %allparms; |
my %allparms; |
my %allparts; |
my %allparts; |
|
# ------------------------------------------------------------------------------ |
|
|
# |
# |
# Order in which these parameters will be displayed |
# Order in which these parameters will be displayed |
# |
# |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
|
@ids=(); |
# @ids=(); |
%symbp=(); |
# %symbp=(); # These seem defined above already. |
%typep=(); |
# %typep=(); |
|
|
my $message=''; |
my $message=''; |
|
|
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec = $env{'request.course.sec'}; |
|
} |
|
|
|
# Check group privs. |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
|
my $noeditgrp; |
|
if ($cgroup ne '') { |
|
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
if (($env{'request.course.groups'} eq '') || |
|
(!grep(/^\Q$cgroup\E$/,split(/:/,$env{'request.course.groups'})))) { |
|
$noeditgrp = 1; |
|
} |
|
} |
|
} |
|
|
if ($udom=$env{'form.udom'}) { |
if ($udom=$env{'form.udom'}) { |
} 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'}; |
|
|
|
|
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'; } |
|
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } |
|
|
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 2122 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') { |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
$message='<span class="LC_error">'. |
if ($env{'form.userroles'} eq 'any') { |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { |
&mt("not in this course")."</span>"; |
$csec = $env{'request.course.sec'}; |
$uname=''; |
$message = '<span class="LC_info">'; |
$csec=$env{'form.csec'}; |
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} else { |
|
my @possroles = ('in','ep','ta','cr'); |
|
if ($crstype eq 'Community') { |
|
unshift(@possroles,'co'); |
|
} else { |
|
unshift(@possroles,'cc'); |
|
} |
|
my %not_student_roles = |
|
&Apache::lonnet::get_my_roles($uname,$udom,'userroles',['active'], |
|
\@possroles,[$udom],1,1); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my %sections_by_role; |
|
foreach my $role (keys(%not_student_roles)) { |
|
if ($role =~ /^\Q$cnum:$cdom:\E([^:]+):(|[^:]+)$/) { |
|
my ($rolename,$sec) = ($1,$2); |
|
if ($rolename =~ m{^cr/}) { |
|
$rolename = 'cr'; |
|
} |
|
push(@{$sections_by_role{$rolename}},$sec); |
|
} |
|
} |
|
my $numroles = scalar(keys(%sections_by_role)); |
|
if ($numroles) { |
|
foreach my $role (@possroles) { |
|
if (ref($sections_by_role{$role}) eq 'ARRAY') { |
|
my @secs = sort { $a <=> $b } @{$sections_by_role{$role}}; |
|
$csec = $secs[0]; |
|
last; |
|
} |
|
} |
|
} |
|
if ($csec eq '-1') { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} else { |
|
$message = '<span class="LC_info">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} |
|
} |
|
} else { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} |
|
} elsif ($env{'request.course.sec'} ne '') { |
|
if ($csec ne $env{'request.course.sec'}) { |
|
$message='<span class="LC_warning">'. |
|
&mt("User '[_1]' at domain '[_2]' not in section '[_3]'", |
|
$uname,$udom,$env{'request.course.sec'}). |
|
'</span>'; |
|
$uname=''; |
|
$csec=$env{'request.course.sec'}; |
|
} |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
} else { |
} |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
if ($uname ne '') { |
('firstname','middlename','lastname','generation','id')); |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
$message="\n<p>\n".&mt("Full Name").": ". |
('firstname','middlename','lastname','generation','id')); |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
$message .= "\n<p>\n".&mt('Full Name').': ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'firstname'}.' '.$name{'middlename'}.' ' |
"<br />\n".&mt('ID').": ".$name{'id'}.'<p>'; |
.$name{'lastname'}.' '.$name{'generation'} |
} |
."<br />\n".&mt('Student/Employee ID').': '.$name{'id'}.'</p>'; |
@usersgroups = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if (@usersgroups > 0) { |
if (@usersgroups > 0) { |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
$cgroup = $usersgroups[0]; |
$cgroup = $usersgroups[0]; |
|
} |
|
} else { |
|
$cgroup = ''; |
} |
} |
} |
} |
} |
} |
Line 1761 sub assessparms {
|
Line 2291 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'} = ''; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($env{'form.pres_marker'}) { |
if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) { |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
for (my $i=0;$i<=$#markers;$i++) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $totalstored = 0; |
|
my $now = time; |
|
for (my $i=0;$i<=$#markers;$i++) { |
|
my ($needsrelease,$needsnewer,$name); |
|
if (($env{'request.course.sec'} ne '') && ($markers[$i] =~ /\&(7|8|9)$/)) { |
|
next if ($csec ne $env{'request.course.sec'}); |
|
} |
|
if ($markers[$i] =~ /\&(6|5|4)$/) { |
|
next if ($noeditgrp); |
|
} |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my ($level,@all) = |
my ($level,@all) = |
Line 1806 sub assessparms {
|
Line 2347 sub assessparms {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate)\&\d+$/) { |
|
$name = $1; |
|
my $val = $values[$i]; |
|
if ($name eq 'examcode') { |
|
if (&Apache::lonnet::validCODE($values[$i])) { |
|
$val = 'valid'; |
|
} |
|
} elsif ($name eq 'printstartdate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val > $now) { |
|
$val = 'future'; |
|
} |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val < $now) { |
|
$val = 'past'; |
|
} |
|
} |
|
} |
|
$needsrelease = |
|
$Apache::lonnet::needsrelease{"parameter:$name:$val"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck($name,$val, |
|
$needsrelease, |
|
$cmajor,$cminor); |
|
} |
|
} |
|
if ($needsnewer) { |
|
$message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, |
|
$cminor,$needsrelease); |
|
} else { |
|
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
$totalstored ++; |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
} |
$values[$i], |
|
$types[$i], |
|
$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>'; |
if ($totalstored) { |
|
$message.='<p class="LC_warning">' |
|
.&mt('Changes can take up to 10 minutes before being active for all students.') |
|
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</p>'; |
|
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
&startpage($r); |
&startpage($r,$pssymb); |
|
|
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'),'parmstep1')); |
|
$r->print(' |
|
<script type="text/javascript"> |
|
// <![CDATA['. |
|
&showhide_js().' |
|
// ]]> |
|
</script> |
|
'); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&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); |
|
} else { |
# Step 2 |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
my $title = &Apache::lonnet::gettitle($pssymb); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll'); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
|
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
# Step 3 |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
|
$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 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 { |
|
$r->print(); |
|
# parameter screen for a single resource. |
|
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
|
my $title = &Apache::lonnet::gettitle($pssymb); |
|
$r->print(&mt('Specific Resource: [_1] ([_2])', |
|
$title,'<span class="LC_filename">'.$resource.'</span>'). |
|
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
|
'<br />'); |
|
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
|
'<label>'. |
|
'<input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' />'. |
|
&mt('Show all parts'). |
|
'</label></td></tr>'); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
|
$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 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 1868 sub assessparms {
|
Line 2529 sub assessparms {
|
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my $csuname=$env{'user.name'}; |
my $csuname=$env{'user.name'}; |
my $csudom=$env{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
my $coursespan=$csec?8:5; |
# |
my $userspan=3; |
# This produces the cascading table output of parameters |
if ($cgroup ne '') { |
# |
$coursespan += 3; |
my $coursespan=$csec?8:5; |
} |
my $userspan=3; |
|
if ($cgroup ne '') { |
$r->print('<p><table border="2">'); |
$coursespan += 3; |
$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(&Apache::loncommon::start_data_table()); |
} |
# |
my %lt=&Apache::lonlocal::texthash( |
# This produces the headers |
'pie' => "Parameter in Effect", |
# |
'csv' => "Current Session Value", |
$r->print('<tr><td colspan="5"></td>'); |
'at' => 'at', |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
'rl' => "Resource Level", |
if ($uname) { |
'ic' => 'in Course', |
if (@usersgroups > 1) { |
'aut' => "Assessment URL and Title", |
$userspan ++; |
'type' => 'Type', |
} |
'emof' => "Enclosing Map or Folder", |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
'part' => 'Part', |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
'pn' => 'Parameter Name', |
} |
'def' => 'default', |
my %lt=&Apache::lonlocal::texthash( |
'femof' => 'from Enclosing Map or Folder', |
'pie' => "Parameter in Effect", |
'gen' => 'general', |
'csv' => "Current Session Value", |
'foremf' => 'for Enclosing Map or Folder', |
'rl' => "Resource Level", |
'fr' => 'for Resource' |
'ic' => 'in Course', |
); |
'aut' => "Assessment URL and Title", |
$r->print(<<ENDTABLETWO); |
'type' => 'Type', |
|
'emof' => "Enclosing Map or Folder", |
|
'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:$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) { |
|
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>'); |
|
} |
|
|
|
if ($uname) { |
if ($cgroup) { |
if (@usersgroups > 1) { |
$r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</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('</tr>'); |
if ($uname) { |
|
if (@usersgroups > 1) { |
|
$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>'); |
|
} |
|
|
my $defbgone=''; |
$r->print('</tr>'); |
my $defbgtwo=''; |
# |
my $defbgthree = ''; |
# Done with the headers |
|
# |
|
my $defbgone=''; |
|
my $defbgtwo=''; |
|
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 1981 ENDTABLEHEADFOUR
|
Line 2653 ENDTABLEHEADFOUR
|
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
|
my $filter=$env{'form.filter'}; |
foreach (&keysplit($keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
|
my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); |
|
# We may only want certain parameters listed |
|
if ($filter) { |
|
unless ($filter=~/\Q$parmname\E/) { next; } |
|
} |
|
$name{$_}=$parmname; |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$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 2675 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 2702 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) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
Line 2039 ENDTABLEHEADFOUR
|
Line 2718 ENDTABLEHEADFOUR
|
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$cgroup,\@usersgroups); |
$cgroup,\@usersgroups,$noeditgrp,$readonly); |
$r->print('</tr>'."\n"); |
|
} |
} |
} |
} |
} |
} |
} # end foreach ids |
} # end foreach ids |
# -------------------------------------------------- End entry for one resource |
# -------------------------------------------------- End entry for one resource |
$r->print('</table>'); |
$r->print(&Apache::loncommon::end_data_table); |
} # 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 2754 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 2773 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 2827 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,'',$noeditgrp, |
$r->print(&Apache::loncommon::end_data_table_row()); |
$readonly); |
} |
} |
$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 2864 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 2878 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,'',$noeditgrp, |
$r->print(&Apache::loncommon::end_data_table_row()); |
$readonly); |
} |
} |
$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>'); |
|
$r->print(&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
|
|
################################################## |
################################################## |
# Overview mode |
# Overview mode |
################################################## |
################################################## |
my $tableopen; |
my $tableopen; |
|
|
sub tablestart { |
sub tablestart { |
|
my ($readonly) = @_; |
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
my $output = &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
if ($readonly) { |
|
$output .= '<th>'.&mt('Current value').'</th>'; |
|
} else { |
|
$output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>'; |
|
} |
|
$output .= '</tr>'; |
|
return $output; |
} |
} |
} |
} |
|
|
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 2986 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}; |
} |
} |
} |
} |
} |
} |
|
} |
|
if (wantarray) { |
|
return ($resourcedata,$classlist); |
|
} else { |
|
return $resourcedata; |
} |
} |
return $resourcedata; |
|
} |
} |
|
|
|
|
Line 2320 sub storedata {
|
Line 3016 sub storedata {
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
my $now = time; |
my $cmd=$1; |
foreach my $key (keys(%env)) { |
my $thiskey=$2; |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $cmd=$1; |
my $tkey=$thiskey; |
my $thiskey=$2; |
|
my ($tuname,$tudom)=&extractuser($thiskey); |
|
my $tkey=$thiskey; |
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text); |
my ($data, $typeof, $text, $name, $valchk); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$_}; |
$data=$env{$key}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$valchk = $data; |
$text = &mt('Saved modified parameter for'); |
$typeof=$env{'form.typeof_'.$thiskey}; |
} elsif ($cmd eq 'datepointer') { |
$text = &mt('Saved modified parameter for'); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
if ($typeof eq 'string_questiontype') { |
$typeof=$env{'form.typeof_'.$thiskey}; |
$name = 'type'; |
$text = &mt('Saved modified date for'); |
} elsif ($typeof eq 'string_lenient') { |
} elsif ($cmd eq 'dateinterval') { |
$name = 'lenient'; |
$data=&get_date_interval_from_form($thiskey); |
} elsif ($typeof eq 'string_discussvote') { |
$typeof=$env{'form.typeof_'.$thiskey}; |
$name = 'discussvote'; |
$text = &mt('Saved modified date for'); |
} elsif ($typeof eq 'string_examcode') { |
} |
$name = 'examcode'; |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (&Apache::lonnet::validCODE($data)) { |
if ($tuname) { |
$valchk = 'valid'; |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
} |
$tkey.'.type' => $typeof}, |
} elsif ($typeof eq 'string_yesno') { |
$tudom,$tuname) eq 'ok') { |
if ($thiskey =~ /\.retrypartial$/) { |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$name = 'retrypartial'; |
$r->print('<br />'.$text.' '. |
} |
&Apache::loncommon::plainname($tuname,$tudom)); |
} |
} else { |
} elsif ($cmd eq 'datepointer') { |
$r->print('<div class="LC_error">'. |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
&mt('Error saving parameters').'</div>'); |
$typeof=$env{'form.typeof_'.$thiskey}; |
} |
$text = &mt('Saved modified date for'); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
if ($typeof eq 'date_start') { |
} else { |
if ($thiskey =~ /\.printstartdate$/) { |
$newdata{$thiskey}=$data; |
$name = 'printstartdate'; |
$newdata{$thiskey.'.type'}=$typeof; |
if (($data) && ($data > $now)) { |
} |
$valchk = 'future'; |
} |
} |
} elsif ($cmd eq 'del') { |
} |
if ($tuname) { |
} elsif ($typeof eq 'date_end') { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
if ($thiskey =~ /\.printenddate$/) { |
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
$name = 'printenddate'; |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
if (($data) && ($data < $now)) { |
} else { |
$valchk = 'past'; |
$r->print('<div class="LC_error">'. |
} |
&mt('Error deleting parameters').'</div>'); |
} |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} elsif ($cmd eq 'dateinterval') { |
} else { |
$data=&get_date_interval_from_form($thiskey); |
push (@deldata,$thiskey,$thiskey.'.type'); |
$typeof=$env{'form.typeof_'.$thiskey}; |
} |
$text = &mt('Saved modified date for'); |
} |
} |
} |
if ($name ne '') { |
|
my ($needsrelease,$needsnewer); |
|
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$valchk"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck($name,$valchk, |
|
$needsrelease, |
|
$cmajor,$cminor); |
|
if ($needsnewer) { |
|
$r->print('<br />'.&oldversion_warning($name,$data, |
|
$chostname,$cmajor, |
|
$cminor,$needsrelease)); |
|
next; |
|
} |
|
} |
|
} |
|
if (defined($data) and $$olddata{$thiskey} ne $data) { |
|
if ($tuname) { |
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
|
$tkey.'.type' => $typeof}, |
|
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
|
$r->print('<br />'.$text.' '. |
|
&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error saving parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
|
$newdata{$thiskey}=$data; |
|
$newdata{$thiskey.'.type'}=$typeof; |
|
} |
|
} |
|
} elsif ($cmd eq 'del') { |
|
if ($tuname) { |
|
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
|
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
|
} else { |
|
$r->print('<div class="LC_error">'. |
|
&mt('Error deleting parameters').'</div>'); |
|
} |
|
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
|
} else { |
|
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 [quant,_1,parameter]',$delentries/2).'</h2>'); |
} 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 [quant,_1,parameter]',$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 3163 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 2431 sub parse_listdata_key {
|
Line 3180 sub parse_listdata_key {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 2441 sub listdata {
|
Line 3190 sub listdata {
|
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
my $readonlyall = $readonly; |
|
|
|
my ($secidx,%grouphash); |
|
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
$secidx = &Apache::loncoursedata::CL_SECTION(); |
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
} |
|
|
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=~/^\[(.*)\]/) { |
$readonly = $readonlyall; |
my $issection=$1; |
if ($middle=~/^\[(.*)\]/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
my $issection=$1; |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
} else { |
my ($stuname,$studom) = ($1,$2); |
$section=&mt('Group/Section').': '.$issection; |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
} |
if (ref($classlist) eq 'HASH') { |
$middle=~s/^\[(.*)\]//; |
if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') { |
} |
next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'}); |
$middle=~s/\.+$//; |
} |
$middle=~s/^\.+//; |
} |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
} |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
} else { |
} elsif ($middle) { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
if (exists($grouphash{$issection})) { |
$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>'; |
$section=&mt('Group').': '.$issection; |
} |
} elsif ($issection eq $env{'request.course.sec'}) { |
if ($sortorder eq 'realmstudent') { |
$section = &mt('Section').': '.$issection; |
if ($realm ne $oldrealm) { |
} else { |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
next; |
$oldrealm=$realm; |
} |
$oldsection=''; |
} else { |
} |
$section=&mt('Group/Section').': '.$issection; |
if ($section ne $oldsection) { |
} |
$r->print(&tableend()."\n<h2>$section</h2>"); |
} |
$oldsection=$section; |
$middle=~s/^\[(.*)\]//; |
$oldpart=''; |
} elsif (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
} |
$readonly = 1; |
} else { |
} |
if ($section ne $oldsection) { |
$middle=~s/\.+$//; |
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
$middle=~s/^\.+//; |
$oldsection=$section; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
$oldrealm=''; |
|
} |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($realm ne $oldrealm) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
$r->print(&tableend()."\n<h2>$realm</h2>"); |
} elsif ($middle) { |
$oldrealm=$realm; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$oldpart=''; |
$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 ($part ne $oldpart) { |
if ($realm ne $oldrealm) { |
$r->print(&tableend(). |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
"\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>"); |
$oldrealm=$realm; |
$oldpart=$part; |
$oldsection=''; |
} |
} |
|
if ($section ne $oldsection) { |
|
$r->print(&tableend()."\n<h2>$section</h2>"); |
|
$oldsection=$section; |
|
$oldpart=''; |
|
} |
|
} else { |
|
if ($section ne $oldsection) { |
|
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
|
$oldsection=$section; |
|
$oldrealm=''; |
|
} |
|
if ($realm ne $oldrealm) { |
|
$r->print(&tableend()."\n<h2>$realm</h2>"); |
|
$oldrealm=$realm; |
|
$oldpart=''; |
|
} |
|
} |
|
if ($part ne $oldpart) { |
|
$r->print(&tableend(). |
|
"\n".'<span class="LC_parm_part">'.&mt('Part').": $part</span>"); |
|
$oldpart=$part; |
|
} |
# |
# |
# Ready to print |
# Ready to print |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
|
$r->print(&tablestart($readonly). |
$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>'); |
'</b></td><td><input type="checkbox" name="del_'. |
unless ($readonly) { |
$thiskey.'" /></td><td>'); |
$r->print('<td><input type="checkbox" name="del_'. |
$foundkeys++; |
$thiskey.'" /></td>'); |
if (&isdateparm($thistype)) { |
} |
my $jskey='key_'.$pointer; |
$r->print('<td>'); |
$pointer++; |
$foundkeys++; |
$r->print( |
if (&isdateparm($thistype)) { |
&Apache::lonhtmlcommon::date_setter('parmform', |
my $jskey='key_'.$pointer; |
$jskey, |
my $state; |
$$resourcedata{$thiskey}, |
$pointer++; |
'',1,'',''). |
if ($readonly) { |
|
$state = 'disabled'; |
|
} |
|
$r->print( |
|
&Apache::lonhtmlcommon::date_setter('parmform', |
|
$jskey, |
|
$$resourcedata{$thiskey}, |
|
'',1,$state)); |
|
unless ($readonly) { |
|
$r->print( |
'<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') { |
} |
$r->print(&date_interval_selector($thiskey, |
} elsif ($thistype eq 'date_interval') { |
$$resourcedata{$thiskey})); |
$r->print(&date_interval_selector($thiskey, |
} elsif ($thistype =~ m/^string/) { |
$$resourcedata{$thiskey},$readonly)); |
$r->print(&string_selector($thistype,$thiskey, |
} elsif ($thistype =~ m/^string/) { |
$$resourcedata{$thiskey})); |
$r->print(&string_selector($thistype,$thiskey, |
} else { |
$$resourcedata{$thiskey},$name,$readonly)); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
} else { |
} |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
} |
$thistype.'" />'); |
unless ($readonly) { |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
} |
$thistype.'" />'); |
|
} |
|
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
|
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
} |
} |
|
|
|
|
sub date_interval_selector { |
sub date_interval_selector { |
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
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,'',$readonly); |
$result .= ' '.&mt($name); |
$result .= ' '.&mt($name); |
|
} |
|
unless ($readonly) { |
|
$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 3400 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; |
} |
} |
|
|
|
|
sub default_selector { |
sub default_selector { |
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
my $disabled; |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'"'.$disabled.' />'; |
} |
} |
|
|
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.' ]], |
|
'string_questiontype' |
|
=> [[ 'problem', 'Standard Problem'], |
|
[ 'survey', 'Survey'], |
|
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
|
[ 'exam', 'Exam'], |
|
[ 'anonsurvey', 'Anonymous Survey'], |
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
|
[ 'practice', 'Practice'], |
|
[ 'surveycred', 'Survey (credit for submission)']], |
|
'string_lenient' |
|
=> [['yes', 'Yes' ], |
|
[ 'no', 'No' ], |
|
[ 'default', 'Default - only bubblesheet grading is lenient' ]], |
|
'string_discussvote' |
|
=> [['yes','Yes'], |
|
['notended','Yes, unless discussion ended'], |
|
['no','No']], |
); |
); |
|
|
|
sub standard_string_options { |
|
my ($string_type) = @_; |
|
if (ref($strings{$string_type}) eq 'ARRAY') { |
|
return $strings{$string_type}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval, $name, $readonly) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval,$readonly); |
} |
} |
|
|
my $result; |
my %skiptype; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
if (($thistype eq 'string_questiontype') || |
my ($name, $description) = @{ $possibilities }; |
($thistype eq 'string_lenient') || |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
($thistype eq 'string_discussvote') || |
'" value="'.$name.'"'; |
($name eq 'retrypartial')) { |
if ($showval eq $name) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
$result .= ' checked="checked"'; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
} |
next unless (ref($possibilities) eq 'ARRAY'); |
$result .= ' />'.&mt($description).'</label> '; |
my ($parmval, $description) = @{ $possibilities }; |
|
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
|
$cmajor,$cminor); |
|
if ($needsnewer) { |
|
$skiptype{$parmval} = 1; |
|
} |
|
} |
|
} |
|
} |
|
|
|
my ($result,$disabled); |
|
|
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my $numinrow = 3; |
|
if ($thistype eq 'string_problemstatus') { |
|
$numinrow = 2; |
|
} elsif ($thistype eq 'string_questiontype') { |
|
if (keys(%skiptype) > 0) { |
|
$numinrow = 4; |
|
} |
|
} |
|
my $rem; |
|
if (ref($strings{$thistype}) eq 'ARRAY') { |
|
my $i=0; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
next if ($skiptype{$name}); |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$result .= '</tr>'; |
|
} |
|
$result .= '<tr>'; |
|
} |
|
$result .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'.$disabled; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label></span></td>'; |
|
$i++; |
|
} |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
|
} |
|
if ($result) { |
|
$result = '<table border="0">'.$result.'</table>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 2659 sub string_selector {
|
Line 3547 sub string_selector {
|
# |
# |
|
|
sub dateshift { |
sub dateshift { |
my ($shift)=@_; |
my ($shift,$numchanges)=@_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $sec = $env{'request.course.sec'}; |
|
my $secgrpregex; |
|
if ($sec ne '') { |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$secgrpregex = '(?:'.join('|',($sec,@groups)).')'; |
|
} else { |
|
$secgrpregex = $sec; |
|
} |
|
} |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach my $key (keys %data) { |
foreach my $key (keys %data) { |
Line 2676 sub dateshift {
|
Line 3577 sub dateshift {
|
# go through all parameters and look for dates |
# go through all parameters and look for dates |
foreach my $key (keys %data) { |
foreach my $key (keys %data) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
|
if ($sec ne '') { |
|
next unless ($key =~ /^$env{'request.course.id'}\.\[$secgrpregex\]\./); |
|
} |
my $newdate=$data{$key}+$shift; |
my $newdate=$data{$key}+$shift; |
|
$$numchanges ++; |
$storecontent{$key}=$newdate; |
$storecontent{$key}=$newdate; |
} |
} |
} |
} |
Line 2690 sub dateshift {
|
Line 3595 sub dateshift {
|
} |
} |
|
|
sub newoverview { |
sub newoverview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
|
text=>"Overview Mode"}); |
|
|
|
my %loaditems = ( |
|
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');", |
|
); |
|
my $js = ' |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
'. |
|
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
|
&showhide_js()."\n". |
|
'// ]]> |
|
</script> |
|
'; |
|
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
|
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
|
$r->print($start_page.$breadcrumbs); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
my @ids=(); |
my @ids=(); |
Line 2724 ENDOVER
|
Line 3648 ENDOVER
|
|
|
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'}; |
|
|
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') { |
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
|
if ($env{'request.course.sec'} ne '') { |
|
@selected_sections = ($env{'request.course.sec'}); |
|
} |
my @selected_groups = |
my @selected_groups = |
&Apache::loncommon::get_env_multiple('form.Group'); |
&Apache::loncommon::get_env_multiple('form.Group'); |
|
|
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(undef,'parmlevel')); |
&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(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print('</td></tr></table>'); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
$r->print('</div></div>'); |
$r->print('<table id="LC_parm_overview_controls"> |
|
<tr><td class="LC_parm_overview_parm_selectors">'); |
$r->print('<div class="LC_Box">'); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print('<div>'); |
$r->print('</td><td class="LC_parm_overview_restrictions"> |
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
<table class="LC_parm_overview_restrictions">'. |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
my $sectionselector = §ionmenu(\@selected_sections); |
|
my $groupselector = &groupmenu(\@selected_groups); |
|
$r->print('<table>'. |
|
'<tr><th>'.&mt('Parts').'</th>'); |
|
if ($sectionselector) { |
|
$r->print('<th>'.&mt('Section(s)').'</th>'); |
|
} |
|
if ($groupselector) { |
|
$r->print('<th>'.&mt('Group(s)').'</th>'); |
|
} |
|
$r->print('</tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td>'); |
$r->print('</td>'); |
§ionmenu($r,\@selected_sections); |
if ($sectionselector) { |
$r->print('</td><td>'); |
$r->print('<td>'.$sectionselector.'</td>'); |
&groupmenu($r,\@selected_groups); |
} |
$r->print('</td></tr></table>'); |
if ($groupselector) { |
$r->print('</td></tr></table>'); |
$r->print('<td>'.$groupselector.'</td>'); |
|
} |
|
$r->print('</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 3747 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,'newoverview',undef,$readonly); |
|
} |
|
$r->print(&tableend()); |
|
unless ($readonly) { |
|
$r->print(((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':'')); |
} |
} |
$r->print(&tableend(). |
$r->print('</form>'); |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
$r->print(&Apache::loncommon::end_page()); |
'</form>'.&Apache::loncommon::end_page()); |
|
} |
} |
|
|
sub secgroup_lister { |
sub secgroup_lister { |
Line 2850 sub secgroup_lister {
|
Line 3801 sub secgroup_lister {
|
} |
} |
|
|
sub overview { |
sub overview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
&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($start_page.$breadcrumbs); |
$start_page |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
|
ENDOVER |
|
# Store modified |
|
|
|
&storedata($r,$crs,$dom); |
# Store modified |
|
unless ($readonly) { |
|
&storedata($r,$crs,$dom); |
|
} |
|
|
# Read modified data |
# Read modified data |
|
|
my $resourcedata=&readdata($crs,$dom); |
my ($resourcedata,$classlist)=&readdata($crs,$dom); |
|
|
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder); |
|
|
|
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
|
|
|
if ($readonly) { |
|
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
|
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist,$readonly); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'); |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
if ($foundkeys) { |
&Apache::loncommon::end_page()); |
unless ($readonly) { |
|
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
} else { |
|
$r->print('<p class="LC_info">'.&mt('There are no parameters.').'</p>'); |
|
} |
|
$r->print('</form>'.&Apache::loncommon::end_page()); |
} |
} |
|
|
sub clean_parameters { |
sub clean_parameters { |
Line 2888 sub clean_parameters {
|
Line 3856 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 3876 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 'secgroup') { |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
$r->print(&mt('Group/Section: [_1]',$data{'scope'})); |
} elsif ($data{'scope_type'} eq 'group') { |
} |
$r->print(&mt('Group: [_1]',$data{'scope'})); |
$r->print('<br />'); |
} |
if ($data{'realm_type'} eq 'all') { |
$r->print('<br />'); |
$r->print(&mt('All Resources')); |
if ($data{'realm_type'} eq 'all') { |
} elsif ($data{'realm_type'} eq 'folder') { |
$r->print(&mt('All Resources')); |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
} elsif ($data{'realm_type'} eq 'folder') { |
} elsif ($data{'realm_type'} eq 'symb') { |
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
my ($map,$resid,$url) = |
} elsif ($data{'realm_type'} eq 'symb') { |
&Apache::lonnet::decode_symb($data{'realm'}); |
my ($map,$resid,$url) = |
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', |
&Apache::lonnet::decode_symb($data{'realm'}); |
$url.' <br /> ', |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$resid.' <br /> ',$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()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
sub date_shift_one { |
sub date_shift_one { |
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'}; |
|
my $sec = $env{'request.course.sec'}; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
|
text=>"Shifting Dates"}); |
|
my $submit_text = &mt('Shift all dates accordingly'); |
|
if ($sec ne '') { |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$submit_text = &mt("Shift dates set just for your section/group(s), accordingly"); |
|
} else { |
|
$submit_text = &mt("Shift dates set just for your section, accordingly"); |
|
} |
|
} |
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($start_page.$breadcrumbs); |
$start_page |
$r->print('<form name="shiftform" method="post" action="">'. |
$breadcrumbs |
|
ENDOVER |
|
$r->print('<form name="shiftform" method="post">'. |
|
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
Line 2989 ENDOVER
|
Line 3969 ENDOVER
|
'</td></tr></table>'. |
'</td></tr></table>'. |
'<input type="hidden" name="action" value="dateshift2" />'. |
'<input type="hidden" name="action" value="dateshift2" />'. |
'<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'. |
'<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'. |
'<input type="submit" value="'.&mt('Shift all dates accordingly').'" /></form>'); |
'<input type="submit" value="'.$submit_text.'" /></form>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 2997 sub date_shift_two {
|
Line 3977 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'}; |
|
my $sec = $env{'request.course.sec'}; |
|
&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($start_page.$breadcrumbs); |
$start_page |
|
$breadcrumbs |
|
ENDOVER |
|
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'); |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
if ($sec ne '') { |
&Apache::lonlocal::locallocaltime($timeshifted))); |
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$r->print('<p>'. |
|
&mt("Shift dates set just for your section/group(s), such that [_1] becomes [_2]", |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} else { |
|
$r->print('<p>'. |
|
&mt("Shift dates set just for your section, such that [_1] becomes [_2]", |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} |
|
} else { |
|
$r->print('<p>'.&mt('Shifting all dates such that [_1] becomes [_2]', |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} |
my $delta=$timeshifted-$env{'form.timebase'}; |
my $delta=$timeshifted-$env{'form.timebase'}; |
&dateshift($delta); |
my $numchanges = 0; |
|
my $result = &dateshift($delta,\$numchanges); |
|
if ($result eq 'ok') { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Completed shifting of [quant,_1,date setting]', |
|
$numchanges))); |
|
} elsif ($result eq 'con_delayed') { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Queued shifting of [quant,_1,date setting]', |
|
$numchanges))); |
|
} else { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('An error occurred attempting to shift dates'),1)); |
|
} |
|
$r->print( |
|
'<br /><br />'. |
|
&Apache::lonhtmlcommon::actionbox( |
|
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3016 sub parse_key {
|
Line 4035 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 |
$data{'scope_type'} = 'secgroup'; |
$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 { |
|
my ($clonelist,$allowclone) = @_; |
|
if ($clonelist =~ /,/) { |
|
@{$allowclone} = split(/,/,$clonelist); |
|
} else { |
|
$$allowclone[0] = $clonelist; |
|
} |
|
} |
|
|
|
sub check_cloners { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($clean_clonelist,%disallowed); |
|
my @allowclone = (); |
|
&extract_cloners($$clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
|
if ($currclone eq '*') { |
|
$clean_clonelist .= $currclone.','; |
|
} else { |
|
my ($uname,$udom) = split(/:/,$currclone); |
|
if ($uname eq '*') { |
|
if ($udom =~ /^$match_domain$/) { |
|
if (!&Apache::lonnet::domain($udom)) { |
|
$disallowed{'domain'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} else { |
|
$disallowed{'format'} .= $currclone.','; |
|
} |
|
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
|
$disallowed{'format'} .= $currclone.','; |
|
} else { |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
} |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
foreach my $key (keys(%disallowed)) { |
|
$disallowed{$key} =~ s/,$//; |
|
} |
|
if ($clean_clonelist) { |
|
$clean_clonelist =~ s/,$//; |
|
} |
|
$$clonelist = $clean_clonelist; |
|
return %disallowed; |
|
} |
|
|
|
sub change_clone { |
sub header { |
my ($clonelist,$oldcloner) = @_; |
return &Apache::loncommon::start_page('Content and Problem Settings'); |
my ($uname,$udom); |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $clone_crs = $cnum.':'.$cdom; |
|
|
|
if ($cnum && $cdom) { |
|
my @allowclone; |
|
&extract_cloners($clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^$currclone$/,@$oldcloner)) { |
|
if ($currclone ne '*') { |
|
($uname,$udom) = split(/:/,$currclone); |
|
if ($uname && $udom && $uname ne '*') { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} eq '') { |
|
$currclonecrs{'cloneable'} = $clone_crs; |
|
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
foreach my $oldclone (@$oldcloner) { |
|
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
|
if ($oldclone ne '*') { |
|
($uname,$udom) = split(/:/,$oldclone); |
|
if ($uname && $udom && $uname ne '*' ) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
my %newclonecrs = (); |
|
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} =~ /,/) { |
|
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
|
foreach my $crs (@currclonecrs) { |
|
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
|
|
|
|
sub header { |
|
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('Content and Problem Settings')); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
my $lc_crstype = lc($crstype); |
|
|
$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 3182 ENDMAINFORMHEAD
|
Line 4093 ENDMAINFORMHEAD
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); |
|
my $vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}); |
|
my $vpa = &Apache::lonnet::allowed('vpa',$env{'request.course.id'}); |
|
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
|
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
if ((!$vcb) && ($env{'request.course.sec'} ne '')) { |
|
$vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
my (%linktext,%linktitle,%url); |
|
if ($parm_permission->{'edit'}) { |
|
%linktext = ( |
|
newoverview => 'Edit Resource Parameters - Overview Mode', |
|
settable => 'Edit Resource Parameters - Table Mode', |
|
setoverview => 'Modify Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Set/Modify resource parameters in overview mode.', |
|
settable => 'Set/Modify resource parameters in table mode.', |
|
setoverview => 'Set/Modify existing resource parameters in overview mode.', |
|
); |
|
} else { |
|
%linktext = ( |
|
newoverview => 'View Resource Parameters - Overview Mode', |
|
settable => 'View Resource Parameters - Table Mode', |
|
setoverview => 'View Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Display resource parameters in overview mode.', |
|
settable => 'Display resource parameters in table mode.', |
|
setoverview => 'Display existing resource parameters in overview mode.', |
|
); |
|
} |
|
if ($mgr) { |
|
$linktext{'resettimes'} = 'Reset Student Access Times'; |
|
$linktitle{'resettimes'} = "Reset access times for folders/maps, resources or the $lc_crstype."; |
|
$url{'resettimes'} = '/adm/helper/resettimes.helper'; |
|
} elsif ($vgr) { |
|
$linktext{'resettimes'} = 'Display Student Access Times', |
|
$linktitle{'resettimes'} = "Display access times for folders/maps, resources or the $lc_crstype.", |
|
$url{'resettimes'} = '/adm/accesstimes'; |
|
} |
my @menu = |
my @menu = |
( { divider=>'Settings for Your Course', |
( { categorytitle=>"Content Settings for this $crstype", |
}, |
items => [ |
{ text => 'Edit course configuration', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/courseprefs?origin=params', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission->{'setrestrictmeta'}, |
help => 'Course_Environment', |
linktitle => "Restrict metadata for this $lc_crstype." , |
}, |
icon =>'contact-new.png' , |
{ text => 'Set Portfolio Metadata', |
|
action => 'setrestrictmeta', |
|
permission => $parm_permission, |
|
}, |
}, |
{ text => 'Manage Course Slots', |
{ linktext => $linktext{'resettimes'}, |
url => '/adm/slotrequest?command=showslots', |
url => $url{'resettimes'}, |
permission => $vgr, |
permission => ($vgr || $mgr), |
|
linktitle => $linktitle{'resettimes'}, |
|
icon => 'start-here.png', |
}, |
}, |
{ text => 'Reset Student Access Times', |
{ linktext => 'Blocking Communication/Resource Access', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/setblock', |
permission => $mgr, |
permission => ($vcb || $dcm), |
|
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
|
icon => 'comblock.png', |
}, |
}, |
|
{ linktext => 'Set Parameter Setting Default Actions', |
{ text => 'Set Parameter Setting Default Actions', |
url => '/adm/parmset?action=setdefaults', |
action => 'setdefaults', |
permission => $parm_permission->{'setdefaults'}, |
permission => $parm_permission, |
linktitle =>'Set default actions for parameters.' , |
}, |
icon => 'folder-new.png' , |
{ divider => 'New and Existing Parameter Settings for Your Resources', |
}]}, |
}, |
{ categorytitle => 'New and Existing Parameter Settings for Resources', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
items => [ |
|
{ linktext => 'Edit Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission->{'helper'}, |
help => 'Parameter_Helper', |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
}, |
icon => 'dialog-information.png' , |
{ text => 'Set/Modify Resource Parameters - Overview Mode', |
#help => 'Parameter_Helper', |
action => 'newoverview', |
|
permission => $parm_permission, |
|
help => 'Parameter_Overview', |
|
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
{ linktext => $linktext{'newoverview'}, |
action => 'settable', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission, |
permission => $parm_permission->{'newoverview'}, |
help => 'Table_Mode', |
linktitle => $linktitle{'newoverview'}, |
|
icon => 'edit-find.png', |
|
#help => 'Parameter_Overview', |
}, |
}, |
{ divider => 'Existing Parameter Settings for Your Resources', |
{ linktext => $linktext{'settable'}, |
}, |
url => '/adm/parmset?action=settable', |
{ text => 'Modify Resource Parameters - Overview Mode', |
permission => $parm_permission->{'settable'}, |
action => 'setoverview', |
linktitle => $linktitle{'settable'}, |
permission => $parm_permission, |
icon => 'edit-copy.png', |
help => 'Parameter_Overview', |
#help => 'Table_Mode', |
}, |
}]}, |
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
{ categorytitle => 'Existing Parameter Settings for Resources', |
action => 'parameterchangelog', |
items => [ |
permission => $parm_permission, |
{ linktext => $linktext{'setoverview'}, |
|
url => '/adm/parmset?action=setoverview', |
|
permission => $parm_permission->{'setoverview'}, |
|
linktitle => $linktitle{'setoverview'}, |
|
icon => 'preferences-desktop-wallpaper.png', |
|
#help => 'Parameter_Overview', |
}, |
}, |
|
{ linktext => 'Change Log', |
|
url => '/adm/parmset?action=parameterchangelog', |
|
permission => $parm_permission->{'parameterchangelog'}, |
|
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) { |
$r->print('</form>'.&Apache::loncommon::end_page()); |
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 3276 sub output_row {
|
Line 4223 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 .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label> |
$output .= '<td>'.(' ' x 5).'<label> |
<input type="checkbox" name="'. |
<input type="checkbox" name="'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
&mt($opt->[1]).'</label></span> </td>'; |
&mt($opt->[1]).'</label></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
$output .= '<td>'.(' ' x 10).'<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
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 3337 sub order_meta_fields {
|
Line 4289 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 3374 sub order_meta_fields {
|
Line 4326 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) { |
$r->print('<tr><td>'); |
$r->print('<tr><td>'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
$r->print('<select name="newpos" onchange="this.form.submit()">'); |
for (my $i = 1;$i le $num_fields;$i ++) { |
for (my $i = 1;$i le $num_fields;$i ++) { |
if ($i eq $idx) { |
if ($i eq $idx) { |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
Line 3399 sub order_meta_fields {
|
Line 4351 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">'; |
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
$output .= '<input type="submit" value="Continue" />'; |
$output .= '<input type="submit" value="'.&mt('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 3420 sub addmetafield {
|
Line 4378 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(&mt('Undeleted Metadata Field [_1] with result [_2]', |
|
'<strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}. |
|
'</strong>',$put_result). |
|
'<br />'); |
} |
} |
$r->print(&continue()); |
$r->print(&continue()); |
} elsif (exists($env{'form.fieldname'})) { |
} elsif (exists($env{'form.fieldname'})) { |
Line 3433 sub addmetafield {
|
Line 4394 sub addmetafield {
|
{'metadata.'.$meta_field.'.values'=>"", |
{'metadata.'.$meta_field.'.values'=>"", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
$r->print(&mt('Added new Metadata Field [_1] with result [_2]', |
|
'<strong>'.$env{'form.fieldname'}.'</strong>',$put_result). |
|
'<br />'); |
$r->print(&continue()); |
$r->print(&continue()); |
} else { |
} else { |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
if ($fields) { |
if ($fields) { |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print(&mt('You may undelete previously deleted fields.'). |
|
'<br />'. |
|
&mt('Check those you wish to undelete and click Undelete.'). |
|
'<br />'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
foreach my $key(keys(%$fields)) { |
foreach my $key(keys(%$fields)) { |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
Line 3446 sub addmetafield {
|
Line 4412 sub addmetafield {
|
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<hr />'. |
|
&mt('[_1]Or[_2] you may enter a new metadata field name.', |
|
'<strong>','</strong>'). |
|
'<form method="post" action="/adm/parmset?action=addmetadata">'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('<input type="submit" value="'.&mt('Add Metadata Field').'" />'); |
} |
} |
$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'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $save_field = ''; |
my $save_field = ''; |
|
my %lt = &Apache::lonlocal::texthash( |
|
addm => 'Add Metadata Field', |
|
ordm => 'Order Metadata Fields', |
|
save => 'Save', |
|
); |
if ($env{'form.restrictmeta'}) { |
if ($env{'form.restrictmeta'}) { |
foreach my $field (sort(keys(%env))) { |
foreach my $field (sort(keys(%env))) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
Line 3472 sub setrestrictmeta {
|
Line 4451 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 3497 sub setrestrictmeta {
|
Line 4476 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 |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $row_alt = 1; |
|
$output .= &Apache::loncommon::start_data_table(); |
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
if ($field ne 'courserestricted') { |
if ($field ne 'courserestricted') { |
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
|
} |
} |
my $buttons = (<<ENDButtons); |
my $buttons = (<<ENDButtons); |
<input type="submit" name="restrictmeta" value="Save" /> |
<input type="submit" name="restrictmeta" value="$lt{'save'}" /> |
</form><br /> |
</form><br /> |
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
<input type="submit" name="restrictmeta" value="$lt{'addm'}" /> |
</form> |
</form> |
<br /> |
<br /> |
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
<input type="submit" name="restrictmeta" value="$lt{'ordm'}" /> |
ENDButtons |
ENDButtons |
my $added_flag = 1; |
my $added_flag = 1; |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r,$field,$$added_metadata_fields{$field},$added_flag); |
$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 3535 ENDenv
|
Line 4511 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 3548 sub get_added_meta_fieldnames {
|
Line 4526 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 3565 sub get_deleted_meta_fieldnames {
|
Line 4546 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($start_page.$breadcrumbs); |
$start_page |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
|
ENDDEFHEAD |
|
|
|
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'}; |
Line 3589 ENDDEFHEAD
|
Line 4569 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()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 3726 sub components {
|
Line 4706 sub components {
|
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
|
|
if ($typeflag) { |
if ($typeflag) { |
$key=~s/\.type$//; |
$key=~s/\.type$//; |
} |
} |
|
|
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $issection; |
my $issection; |
|
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$issection=$1; |
$issection=$1; |
$section=&mt('Group/Section').': '.$issection; |
$section=&mt('Group/Section').': '.$issection; |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
if ($uname) { |
if ($uname) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$issection=''; |
$issection=''; |
} |
} |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realmdescription=&mt('all resources'); |
my $realmdescription=&mt('all resources'); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
} |
} |
my $what=$part.'.'.$name; |
my $what=$part.'.'.$name; |
return ($realm,$section,$name,$part, |
return ($realm,$section,$name,$part, |
$what,$middle,$uname,$udom,$issection,$realmdescription); |
$what,$middle,$uname,$udom,$issection,$realmdescription); |
} |
} |
|
|
my %standard_parms; |
my %standard_parms; |
|
my %standard_parms_types; |
|
|
sub load_parameter_names { |
sub load_parameter_names { |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
chomp($configline); |
chomp($configline); |
my ($short,$plain)=split(/:/,$configline); |
my ($short,$plain)=split(/:/,$configline); |
my (undef,$name,$type)=split(/\&/,$short,3); |
my (undef,$name,$type)=split(/\&/,$short,3); |
if ($type eq 'display') { |
if ($type eq 'display') { |
$standard_parms{$name} = $plain; |
$standard_parms{$name} = $plain; |
} |
} elsif ($type eq 'type') { |
|
$standard_parms_types{$name} = $plain; |
|
} |
} |
} |
close($config); |
close($config); |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
|
$standard_parms{'scoreformat'} = 'Format for display of score'; |
} |
} |
|
|
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,$parm_permission)=@_; |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log"}); |
|
my $js = '<script type="text/javascript">'."\n". |
|
'// <![CDATA['."\n". |
|
&Apache::loncommon::display_filter_js('parmslog')."\n". |
|
'// ]]>'."\n". |
|
'</script>'."\n"; |
|
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js)); |
$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('<div class="LC_left_float">'. |
|
'<fieldset><legend>'.&mt('Display of Changes').'</legend>'. |
|
'<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); |
&Apache::loncommon::restore_course_settings('parameter_log', |
&Apache::loncommon::restore_course_settings('parameter_log', |
\%saveable_parameters); |
\%saveable_parameters); |
$r->print(&Apache::loncommon::display_filter(). |
$r->print(&Apache::loncommon::display_filter('parmslog').' '."\n". |
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
'<input type="submit" value="'.&mt('Display').'" />'. |
' '.&mt('Include parameter types').'</label>'. |
'</form></fieldset></div><br clear="all" />'); |
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
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>'); |
&Apache::loncommon::end_data_table_header_row()); |
unless ($readonly) { |
|
$r->print('<th>'.&mt('Announce').'</th>'); |
|
} |
|
$r->print(&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 |
my $numgroups = 0; |
{ |
my @groups; |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
if ($env{'request.course.groups'} ne '') { |
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
@groups = split(/:/,$env{'request.course.groups'}); |
} |
$numgroups = scalar(@groups); |
my $aid = (split('00000',$a))[-1]; |
} |
my $bid = (split('00000',$b))[-1]; |
foreach my $id (sort |
return $bid<=>$aid; |
{ |
} (keys(%parmlog))) { |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
|
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
|
} |
|
my $aid = (split('00000',$a))[-1]; |
|
my $bid = (split('00000',$b))[-1]; |
|
return $bid<=>$aid; |
|
} (keys(%parmlog))) { |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my $count = 0; |
my $count = 0; |
my $time = |
my $time = |
&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 ((!$readonly) && |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
(($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
$send_msg_link ='<br />'. |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
$send_msg_link ='<br />'. |
$parmlog{$id}{'exe_uname'}, |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_uname'}, |
} |
$parmlog{$id}{'exe_udom'}); |
my $row_start=&Apache::loncommon::start_data_table_row(); |
} |
my $makenewrow=0; |
my $row_start=&Apache::loncommon::start_data_table_row(); |
my %istype=(); |
my $makenewrow=0; |
my $output; |
my %istype=(); |
foreach my $changed (reverse(sort(@changes))) { |
my $output; |
|
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{'request.course.sec'} ne '') { |
if ($folder) { |
next if (($issection ne '') && (!(($issection eq $env{'request.course.sec'}) || |
if ($middle!~/^\Q$folder\E/) { next; } |
($numgroups && (grep(/^\Q$issection\E$/,@groups)))))); |
} |
if ($uname ne '') { |
} |
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'}); |
if ($typeflag) { |
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'})); |
$istype{$parmname}=$value; |
} |
if (!$env{'form.includetypes'}) { next; } |
} |
} |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
$count++; |
if ($folder) { |
if ($makenewrow) { |
if ($middle!~/^\Q$folder\E/) { next; } |
$output .= $row_start; |
} |
} else { |
} |
$makenewrow=1; |
if ($typeflag) { |
} |
$istype{$parmname}=$value; |
|
if (!$env{'form.includetypes'}) { next; } |
|
} |
|
$count++; |
|
if ($makenewrow) { |
|
$output .= $row_start; |
|
} else { |
|
$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) { |
} |
my $parmitem = &standard_parameter_names($parmname); |
} |
$parmitem = &mt($parmitem); |
$output .= $showvalue; |
my $title=&mt('Changed [_1]',$parmitem); |
if ($value ne $all[$level]) { |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
$parmitem,$realmdescription, |
} else { |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
$stillactive=1; |
if (($uname) && ($udom)) { |
} |
$output .= |
} |
&Apache::loncommon::messagewrapper('Notify User', |
} |
$uname,$udom,$title, |
$output .= '</td>'; |
$description); |
|
} else { |
unless ($readonly) { |
$output .= |
$output .= '<td>'; |
&Apache::lonrss::course_blog_link($id,$title, |
if ($stillactive) { |
$description); |
my $parmitem = &standard_parameter_names($parmname); |
} |
$parmitem = &mt($parmitem); |
} |
my $title=&mt('Changed [_1]',$parmitem); |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
} |
$parmitem,$realmdescription, |
|
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
|
if (($uname) && ($udom)) { |
|
$output .= |
|
&Apache::loncommon::messagewrapper('Notify User', |
|
$uname,$udom,$title, |
|
$description); |
|
} else { |
|
$output .= |
|
&Apache::lonrss::course_blog_link($id,$title, |
|
$description); |
|
} |
|
} |
|
$output .= '</td>'; |
|
} |
|
$output .= &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 4001 sub update_slots {
|
Line 5036 sub update_slots {
|
action => 'reserve', |
action => 'reserve', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
'',$uname,$udom,$cnum,$cdom); |
'',$uname,$udom,$cnum,$cdom); |
|
|
&Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
'',$uname,$udom,$uname,$udom); |
'',$uname,$udom,$uname,$udom); |
} |
} |
return $success; |
return $success; |
Line 4035 sub delete_slots {
|
Line 5070 sub delete_slots {
|
action => 'release', |
action => 'release', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
1,$uname,$udom,$cnum,$cdom); |
1,$uname,$udom,$cnum,$cdom); |
&Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
1,$uname,$udom,$uname,$udom); |
1,$uname,$udom,$uname,$udom); |
} |
} |
} |
} |
Line 4051 sub check_for_course_info {
|
Line 5086 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub parameter_release_vars { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my $chostname = &Apache::lonnet::hostname($chome); |
|
my ($cmajor,$cminor) = |
|
split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome)); |
|
return ($chostname,$cmajor,$cminor); |
|
} |
|
|
|
sub parameter_releasecheck { |
|
my ($name,$value,$needsrelease,$cmajor,$cminor) = @_; |
|
my $needsnewer; |
|
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
|
if (($cmajor < $needsmajor) || |
|
($cmajor == $needsmajor && $cminor < $needsminor)) { |
|
$needsnewer = 1; |
|
} else { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); |
|
} |
|
return $needsnewer; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
examcode => 'string_examcode', |
|
); |
|
if (exists($stringtypes{$name})) { |
|
if ($name eq 'examcode') { |
|
$desc = $value; |
|
} elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
if ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
} elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) { |
|
my $now = time; |
|
if ($value =~ /^\d+$/) { |
|
if ($name eq 'printstartdate') { |
|
if ($value > $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($value < $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} |
|
} |
|
} |
|
my $standard_name = &standard_parameter_names($name); |
|
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
|
sub get_permission { |
|
my %permission; |
|
my $allowed = 0; |
|
return (\%permission,$allowed) unless ($env{'request.course.id'}); |
|
if ((&Apache::lonnet::allowed('opa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission= ( |
|
'edit' => 1, |
|
'set' => 1, |
|
'setoverview' => 1, |
|
'addmetadata' => 1, |
|
'ordermetadata' => 1, |
|
'setrestrictmeta' => 1, |
|
'newoverview' => 1, |
|
'setdefaults' => 1, |
|
'settable' => 1, |
|
'parameterchangelog' => 1, |
|
'cleanparameters' => 1, |
|
'dateshift1' => 1, |
|
'dateshift2' => 1, |
|
'helper' => 1, |
|
); |
|
} elsif ((&Apache::lonnet::allowed('vpa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('vpa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission = ( |
|
'set' => 1, |
|
'settable' => 1, |
|
'newoverview' => 1, |
|
'setoverview' => 1, |
|
'parameterchangelog' => 1, |
|
); |
|
} |
|
foreach my $perm (values(%permission)) { |
|
if ($perm) { $allowed=1; last; } |
|
} |
|
return (\%permission,$allowed); |
|
} |
|
|
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', |
|
'filter','part', |
'udom','uname','symb','serial','timebase']); |
'udom','uname','symb','serial','timebase']); |
|
|
|
|
&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=>"Content and Problem Settings", |
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,$allowed) = &get_permission(); |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
|
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$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'} && $allowed && $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 (($parm_permission->{'set'}) && |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
&& (!$env{'form.dis'})) || ($env{'form.symb'}))) { |
text=>"Problem Parameters"}); |
&assessparms($r,$parm_permission); |
&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 (!$parm_permission->{$env{'form.action'}}) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&print_main_menu($r,$parm_permission); |
text=>"Overview Mode"}); |
} elsif ($env{'form.action'} eq 'setoverview') { |
&overview($r); |
&overview($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&addmetafield($r); |
text=>"Add Metadata Field"}); |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
&addmetafield($r); |
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&setrestrictmeta($r); |
text=>"Add Metadata Field"}); |
} elsif ($env{'form.action'} eq 'newoverview') { |
&order_meta_fields($r); |
&newoverview($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&defaultsetter($r); |
text=>"Restrict Metadata"}); |
} elsif ($env{'form.action'} eq 'settable') { |
&setrestrictmeta($r); |
&assessparms($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&parm_change_log($r,$parm_permission); |
text=>"Overview Mode"}); |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&newoverview($r); |
&clean_parameters($r); |
} elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'dateshift1') { |
&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); |
} elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) { |
} |
&assign_course_categories($r); |
|
} |
|
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
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 4172 sub handler {
|
Line 5281 sub handler {
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|