--- loncom/interface/lonparmset.pm 2010/01/12 18:11:58 1.491
+++ loncom/interface/lonparmset.pm 2010/12/16 17:03:42 1.502
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.491 2010/01/12 18:11:58 bisitz Exp $
+# $Id: lonparmset.pm,v 1.502 2010/12/16 17:03:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -248,37 +248,6 @@ Variables used (guessed by Jeremy):
=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()
Output html header for page
@@ -1245,8 +1214,9 @@ sub isdateparm {
}
#
-# This function prints a list of parameters, which were selected. It also display a link from which you can
-# hide or show the complete parameter list, from which you can choose your parameters.
+# 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 {
my ($r,$allparms,$pscat,$keyorder)=@_;
@@ -1321,6 +1291,8 @@ sub parmmenu {
checkdates();
checkthis('weight','pscat');
checkthis('maxtries','pscat');
+ checkthis('type','pscat');
+ checkthis('problemstatus','pscat');
}
function hideParms() {
@@ -1350,7 +1322,7 @@ ENDSCRIPT
$r->print(&mt('Selected Parameters:').'
');
#print out all possible parms and hide them by default
- $r->print('
\n".&mt("Full Name").": ".
$name{'firstname'}.' '.$name{'middlename'}.' '
.$name{'lastname'}.' '.$name{'generation'}.
- "
\n".&mt('ID').": ".$name{'id'}.'
';
+ "
\n".&mt('Student/Employee ID').": ".$name{'id'}.'
';
}
@usersgroups = &Apache::lonnet::get_users_groups(
$udom,$uname,$env{'request.course.id'});
@@ -2111,10 +2116,10 @@ sub assessparms {
my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
my @values=split(/\&\&\&/,$env{'form.pres_value'});
my @types=split(/\&\&\&/,$env{'form.pres_type'});
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
for (my $i=0;$i<=$#markers;$i++) {
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 $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
my ($level,@all) =
@@ -2144,6 +2149,10 @@ sub assessparms {
}
}
}
+ } elsif ($markers[$i] =~ /_type\&\d+$/) {
+ if (($values[$i] eq 'anonsurvey') || ($values[$i] eq 'anonsurveycred') || ($values[$i] eq 'randomizetry')) {
+ &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:type:'.$values[$i]});
+ }
}
$message.=&storeparm(split(/\&/,$markers[$i]),
$values[$i],
@@ -2158,7 +2167,7 @@ sub assessparms {
}
#----------------------------------------------- if all selected, fill in array
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);}
# ------------------------------------------------------------------ Start page
@@ -2257,14 +2266,18 @@ COURSECONTENTSCRIPT
# 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,$resource).
+ $r->print(&mt('Specific Resource: [_1] ([_2])',
+ $title,''.$resource.'').
''.
'
');
$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')).
- '$lt{'csv'}
+
($csuname $lt{'at'} $csudom)$lt{'csv'}
($csuname:$csudom)$lt{'ic'} $lt{'rl'}
$lt{'ic'}
@@ -3020,7 +3032,7 @@ sub date_interval_selector {
my %select = ((map {$_ => $_} (0..$max)),
'select_form_order' => [0..$max]);
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey,
- %select);
+ \%select);
$result .= ' '.&mt($name);
}
$result .= '';
@@ -3503,123 +3515,6 @@ sub parse_key {
}
-
-sub extract_cloners {
- my ($clonelist,$allowclone) = @_;
- if ($clonelist =~ /,/) {
- @{$allowclone} = split(/,/,$clonelist);
- } else {
- $$allowclone[0] = $clonelist;
- }
-}
-
-sub check_cloners {
- my ($clonelist,$oldcloner) = @_;
- my ($clean_clonelist,%disallowed);
- my @allowclone = ();
- &extract_cloners($$clonelist,\@allowclone);
- foreach my $currclone (@allowclone) {
- if (!grep(/^\Q$currclone\E$/,@$oldcloner)) {
- if ($currclone eq '*') {
- $clean_clonelist .= $currclone.',';
- } else {
- my ($uname,$udom) = split(/:/,$currclone);
- if ($uname eq '*') {
- if ($udom =~ /^$match_domain$/) {
- if (!&Apache::lonnet::domain($udom)) {
- $disallowed{'domain'} .= $currclone.',';
- } else {
- $clean_clonelist .= $currclone.',';
- }
- } else {
- $disallowed{'format'} .= $currclone.',';
- }
- } elsif ($currclone !~/^($match_username)\:($match_domain)$/) {
- $disallowed{'format'} .= $currclone.',';
- } else {
- if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') {
- $disallowed{'newuser'} .= $currclone.',';
- } else {
- $clean_clonelist .= $currclone.',';
- }
- }
- }
- } else {
- $clean_clonelist .= $currclone.',';
- }
- }
- foreach my $key (keys(%disallowed)) {
- $disallowed{$key} =~ s/,$//;
- }
- if ($clean_clonelist) {
- $clean_clonelist =~ s/,$//;
- }
- $$clonelist = $clean_clonelist;
- return %disallowed;
-}
-
-sub change_clone {
- my ($clonelist,$oldcloner) = @_;
- my ($uname,$udom);
- my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $clone_crs = $cnum.':'.$cdom;
-
- if ($cnum && $cdom) {
- my @allowclone;
- &extract_cloners($clonelist,\@allowclone);
- foreach my $currclone (@allowclone) {
- if (!grep(/^$currclone$/,@$oldcloner)) {
- if ($currclone ne '*') {
- ($uname,$udom) = split(/:/,$currclone);
- if ($uname && $udom && $uname ne '*') {
- if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') {
- my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable');
- if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) {
- if ($currclonecrs{'cloneable'} eq '') {
- $currclonecrs{'cloneable'} = $clone_crs;
- } else {
- $currclonecrs{'cloneable'} .= ','.$clone_crs;
- }
- &Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname);
- }
- }
- }
- }
- }
- }
- foreach my $oldclone (@$oldcloner) {
- if (!grep(/^\Q$oldclone\E$/,@allowclone)) {
- if ($oldclone ne '*') {
- ($uname,$udom) = split(/:/,$oldclone);
- if ($uname && $udom && $uname ne '*' ) {
- if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') {
- my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable');
- my %newclonecrs = ();
- if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) {
- if ($currclonecrs{'cloneable'} =~ /,/) {
- my @currclonecrs = split/,/,$currclonecrs{'cloneable'};
- foreach my $crs (@currclonecrs) {
- if ($crs ne $clone_crs) {
- $newclonecrs{'cloneable'} .= $crs.',';
- }
- }
- $newclonecrs{'cloneable'} =~ s/,$//;
- } else {
- $newclonecrs{'cloneable'} = '';
- }
- &Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname);
- }
- }
- }
- }
- }
- }
- }
-}
-
-
-
sub header {
return &Apache::loncommon::start_page('Parameter Manager');
}
@@ -3647,25 +3542,12 @@ ENDMAINFORMHEAD
my @menu =
( { categorytitle=>"Settings for this $crstype",
items => [
- { linktext => "$crstype Configuration",
- url => '/adm/courseprefs?origin=params',
- permission => $parm_permission,
- linktitle => "Edit $lc_crstype configuration." ,
- icon => 'preferences-desktop-remote-desktop.png' ,
- #help => 'Course_Environment',
- },
{ linktext => 'Portfolio Metadata',
url => '/adm/parmset?action=setrestrictmeta',
permission => $parm_permission,
linktitle => "Restrict metadata for this $lc_crstype." ,
icon =>'contact-new.png' ,
},
- { linktext => "Manage $crstype Slots",
- url => '/adm/slotrequest?command=showslots',
- permission => $vgr,
- linktitle => "Manage slots for this $lc_crstype." ,
- icon => 'rsrv.png' ,
- },
{ linktext => 'Reset Student Access Times',
url => '/adm/helper/resettimes.helper',
permission => $mgr,
@@ -4625,8 +4507,6 @@ sub handler {
&date_shift_one($r);
} elsif ($env{'form.action'} eq 'dateshift2') {
&date_shift_two($r);
- } elsif ($env{'form.action'} eq 'categorizecourse') {
- &assign_course_categories($r);
}
} else {
# ----------------------------- Not in a course, or not allowed to modify parms