--- loncom/interface/lonparmset.pm 2008/09/19 03:27:04 1.409 +++ loncom/interface/lonparmset.pm 2009/06/09 23:27:04 1.458 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.409 2008/09/19 03:27:04 raeburn Exp $ +# $Id: lonparmset.pm,v 1.458 2009/06/09 23:27:04 schualex Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,36 +44,11 @@ This module sets coursewide and assessme =head1 INTERNAL SUBROUTINES -=over 4 - -=cut - -################################################################### -################################################################### - -package Apache::lonparmset; - -use strict; -use Apache::lonnet; -use Apache::Constants qw(:common :http REDIRECT); -use Apache::lonhtmlcommon(); -use Apache::loncommon; -use GDBM_File; -use Apache::lonhomework; -use Apache::lonxml; -use Apache::lonlocal; -use Apache::lonnavmaps; -use Apache::longroup; -use Apache::lonrss; -use LONCAPA qw(:DEFAULT :match); - - -################################################## -################################################## +=over =pod -=item parmval +=item parmval() Figure out a cascading parameter. @@ -98,9 +73,269 @@ Returns: A list, the first item is the 2 - Map or Folder level for specific student 1 - resource level for specific student +=item parmval_by_symb() + +=item reset_caches() + +=item cacheparmhash() + +=item parmhash() + +=item symbcache() + +=item preset_defaults() + +=item date_sanity_info() + +=item storeparm() + +Store a parameter by symb + + Takes + - symb + - name of parameter + - level + - new value + - new type + - username + - userdomain + +=item log_parmset() + +=item storeparm_by_symb_inner() + +=item valout() + +Format a value for output. + +Inputs: $value, $type, $editable + +Returns: $value, formatted for output. If $type indicates it is a date, +localtime($value) is returned. +$editable will return an icon to click on + +=item plink() + +Produces a link anchor. + +Inputs: $type,$dis,$value,$marker,$return,$call + +Returns: scalar with html code for a link which will envoke the +javascript function 'pjump'. + +=item page_js() + +=item startpage() + +=item print_row() + +=item print_td() + +=item print_usergroups() + +=item parm_control_group() + +=item extractResourceInformation() : + +Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. + +Input: See list below: + +=item * B : An array that will contain all of the ids in the course. + +=item * B : hash, id->type, where "type" contains the extension of the file, thus, I. + +=item * B : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id + +=item * B : hash, name of parameter->display value (what is the display value?) + +=item * B : hash, part identification->text representation of part, where the text representation is "[Part $part]" + +=item * B : hash, full key to part->display value (what's display value?) + +=item * B : hash, ??? + +=item * B : ??? + +=item * B : hash, ??? + +=item * B : ?? + +=item * B : hash, id->full sym? + + + +=item isdateparm() + +=item parmmenu() + +=item partmenu() + +=item usermenu() + +=item displaymenu() + +=item mapmenu() + +=item levelmenu() + +=item sectionmenu() + +=item keysplit() + +=item keysinorder() + +=item keysinorder_bytype() + +=item keysindisplayorder() + +=item standardkeyorder() + +=item assessparms() : + +Show assessment data and parameters. This is a large routine that should +be simplified and shortened... someday. + +Inputs: $r + +Returns: nothing + +Variables used (guessed by Jeremy): + +=item * B: 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: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? + +=item * B<@catmarker> contains list of all possible parameters including part #s + +=item * B<$fullkeyp> contains the full part/id # for the extraction of proper parameters + +=item * B<$tempkeyp> contains part 0 only (no ids - ie, subparts) + When storing information, store as part 0 + When requesting information, request from full part + +=item tablestart() + +=item tableend() + +=item extractuser() + +=item parse_listdata_key() + +=item listdata() + +=item date_interval_selector() + +=item get_date_interval_from_form() + +=item default_selector() + +=item string_selector() + +=item dateshift() + +=item newoverview() + +=item secgroup_lister() + +=item overview() + +=item clean_parameters() + +=item date_shift_one() + +=item date_shift_two() + +=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 + +=item print_main_menu() + +=item output_row() + +Set portfolio metadata + +=item order_meta_fields() + +=item addmetafield() + +=item setrestrictmeta() + +=item get_added_meta_fieldnames() + +=item get_deleted_meta_fieldnames() + +=item defaultsetter() + +=item components() + +=item load_parameter_names() + +=item parm_change_log() + +=item handler() : + +Main handler. Calls &assessparms subroutine. + + +=back + =cut -################################################## +################################################################### +################################################################### + +package Apache::lonparmset; + +use strict; +use Apache::lonnet; +use Apache::Constants qw(:common :http REDIRECT); +use Apache::lonhtmlcommon(); +use Apache::loncommon; +use GDBM_File; +use Apache::lonhomework; +use Apache::lonxml; +use Apache::lonlocal; +use Apache::lonnavmaps; +use Apache::longroup; +use Apache::lonrss; +use LONCAPA qw(:DEFAULT :match); + + sub parmval { my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, @@ -118,7 +353,7 @@ sub parmval_by_symb { my $result=''; my @outpar=(); # ----------------------------------------------------- Cascading lookup scheme - my $map=(&Apache::lonnet::decode_symb($symb))[0]; + my $map=(&Apache::lonnet::decode_symb($symb))[0]; $map = &Apache::lonnet::deversion($map); my $symbparm=$symb.'.'.$what; @@ -220,7 +455,7 @@ sub parmval_by_symb { # --- Caches local to lonparmset - + sub reset_caches { &resetparmhash(); &resetsymbcache(); @@ -234,7 +469,7 @@ sub reset_caches { undef($parmhashid); undef(%parmhash); } - + sub cacheparmhash { if ($parmhashid eq $env{'request.course.fn'}) { return; } my %parmhashfile; @@ -245,7 +480,7 @@ sub reset_caches { $parmhashid=$env{'request.course.fn'}; } } - + sub parmhash { my ($id) = @_; &cacheparmhash(); @@ -253,14 +488,14 @@ sub reset_caches { } } -{ +{ my $symbsid; my %symbs; sub resetsymbcache { undef($symbsid); undef(%symbs); } - + sub symbcache { my $id=shift; if ($symbsid ne $env{'request.course.id'}) { @@ -281,14 +516,14 @@ sub reset_caches { } } -{ +{ my $rulesid; my %rules; sub resetrulescache { undef($rulesid); undef(%rules); } - + sub rulescache { my $id=shift; if ($rulesid ne $env{'request.course.id'} @@ -302,6 +537,8 @@ sub reset_caches { } } + + sub preset_defaults { my $type=shift; if (&rulescache($type.'_action') eq 'default') { @@ -316,7 +553,8 @@ sub preset_defaults { } } -################################################## + + sub date_sanity_info { my $checkdate=shift; @@ -325,14 +563,31 @@ sub date_sanity_info { my $crsprefix='course.'.$env{'request.course.id'}.'.'; if ($env{$crsprefix.'default_enrollment_end_date'}) { if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) { - $result.='
'.&mt('After course enrollment end!'); + $result.='
' + .&mt('After course enrollment end!') + .'
'; } } if ($env{$crsprefix.'default_enrollment_start_date'}) { if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) { - $result.='
'.&mt('Before course enrollment start!'); + $result.='
' + .&mt('Before course enrollment start!') + .'
'; } } +# Preparation for additional warnings about dates in the past/future. +# An improved, more context sensitive version is recommended, +# e.g. warn for due and answer dates which are defined before the corresponding open date, etc. +# if ($checkdate'; +# } +# if ($checkdate>time) { +# $result.='
' +# .'('.&mt('in the future').')' +# .'
'; +# } return $result; } ################################################## @@ -354,17 +609,6 @@ sub storeparm { &storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup); } -# -# Store a parameter by symb -# -# Takes -# - symb -# - name of parameter -# - level -# - new value -# - new type -# - username -# - userdomain my %recstack; sub storeparm_by_symb { my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_; @@ -426,7 +670,7 @@ sub storeparm_by_symb_inner { my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; # ---------------------------------------------------------- Construct prefixes $spnam=~s/\_([^\_]+)$/\.$1/; - my $map=(&Apache::lonnet::decode_symb($symb))[0]; + my $map=(&Apache::lonnet::decode_symb($symb))[0]; $map = &Apache::lonnet::deversion($map); my $symbparm=$symb.'.'.$spnam; @@ -439,11 +683,11 @@ sub storeparm_by_symb_inner { my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; - + my $courselevel=$env{'request.course.id'}.'.'.$spnam; my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; - + my $storeunder=''; if (($snum==14) || ($snum==3)) { $storeunder=$courselevel; } if (($snum==13) || ($snum==2)) { $storeunder=$courselevelm; } @@ -455,7 +699,7 @@ sub storeparm_by_symb_inner { if ($snum==5) { $storeunder=$grplevelm; } if ($snum==4) { $storeunder=$grplevelr; } - + my $delete; if ($nval eq '') { $delete=1;} my %storecontent = ($storeunder => $nval, @@ -512,32 +756,14 @@ sub storeparm_by_symb_inner { } &Apache::lonnet::devalidateuserresdata($uname,$udom); } - + if ($reply=~/^error\:(.*)/) { return "Write Error: $1"; } return ''; } -################################################## -################################################## - -=pod - -=item valout - -Format a value for output. - -Inputs: $value, $type, $editable - -Returns: $value, formatted for output. If $type indicates it is a date, -localtime($value) is returned. -$editable will return an icon to click on - -=cut -################################################## -################################################## sub valout { my ($value,$type,$editable)=@_; my $result = ''; @@ -551,27 +777,38 @@ sub valout { } else { if ($type eq 'date_interval') { my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); + my @timer; $year=$year-70; $mday--; if ($year) { - $result.=$year.' yrs '; +# $result.=&mt('[quant,_1,yr]',$year).' '; + push(@timer,&mt('[quant,_1,yr]',$year)); } if ($mon) { - $result.=$mon.' mths '; +# $result.=&mt('[quant,_1,mth]',$mon).' '; + push(@timer,&mt('[quant,_1,mth]',$mon)); } if ($mday) { - $result.=$mday.' days '; +# $result.=&mt('[quant,_1,day]',$mday).' '; + push(@timer,&mt('[quant,_1,day]',$mday)); } if ($hour) { - $result.=$hour.' hrs '; +# $result.=&mt('[quant,_1,hr]',$hour).' '; + push(@timer,&mt('[quant,_1,hr]',$hour)); } if ($min) { - $result.=$min.' mins '; +# $result.=&mt('[quant,_1,min]',$min).' '; + push(@timer,&mt('[quant,_1,min]',$min)); } if ($sec) { - $result.=$sec.' secs '; +# $result.=&mt('[quant,_1,sec]',$sec).' '; + push(@timer,&mt('[quant,_1,sec]',$sec)); + } +# $result=~s/\s+$//; + if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable + push(@timer,&mt('[quant,_1,sec]',0)); } - $result=~s/\s+$//; + $result.=join(", ",@timer); } elsif (&isdateparm($type)) { $result = &Apache::lonlocal::locallocaltime($value). &date_sanity_info($value); @@ -583,24 +820,7 @@ sub valout { return $result; } -################################################## -################################################## - -=pod - -=item plink - -Produces a link anchor. - -Inputs: $type,$dis,$value,$marker,$return,$call - -Returns: scalar with html code for a link which will envoke the -javascript function 'pjump'. - -=cut -################################################## -################################################## sub plink { my ($type,$dis,$value,$marker,$return,$call)=@_; my $winvalue=$value; @@ -615,12 +835,13 @@ sub plink { my ($hour,$min,$sec,$val)=&preset_defaults($parmname); unless (defined($winvalue)) { $winvalue=$val; } my $valout = &valout($value,$type,1); + my $unencmarker = $marker; foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, \$hour, \$min, \$sec) { $$item = &HTML::Entities::encode($$item,'"<>&'); $$item =~ s/\'/\\\'/g; } - return ''); - } else { + } else { $parm=~s|\[.*\]\s||g; } my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); if ($automatic) { $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'
'; } - $r->print(''); - + $r->print(''); + my $thismarker=$which; $thismarker=~s/^parameter\_//; my $mprefix=$rid.'&'.$thismarker.'&'; @@ -752,9 +983,9 @@ sub print_row { } elsif ($cgroup) { &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } elsif ($csec) { - &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } else { - &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); + &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } } elsif ($parmlev eq 'map') { @@ -791,7 +1022,7 @@ sub print_row { &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); - + if ($csec) { &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); @@ -803,7 +1034,7 @@ sub print_row { &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); } - + if ($uname) { if ($othergrp) { $r->print($othergrp); @@ -814,14 +1045,14 @@ sub print_row { } } # end of $parmlev if/else - $r->print(''); + $r->print(''); if ($parmlev eq 'full') { my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. '.'.$$name{$which},$$symbp{$rid}); my $sessionvaltype=$typeoutpar[$result]; if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } - $r->print(''); } @@ -831,14 +1062,22 @@ sub print_row { sub print_td { my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; - $r->print(''."\n"); } @@ -856,13 +1095,13 @@ sub print_usergroups { $courseopt); my $bgcolor = $defbg; my $grp_parm; - if (($coursereply) && ($cgroup ne $resultgroup)) { + if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { - $bgcolor = '"#AAFFAA"'; + $bgcolor = '#AAFFAA'; $grp_parm = &valout($coursereply,$resulttype); } $grp_parm = &valout($coursereply,$resulttype); - $output = ''; } else { - $output .= ''; + $output .= ''; } return ($coursereply,$output,$grp_parm,$resultgroup); } @@ -899,39 +1138,7 @@ sub parm_control_group { return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); } -=pod - -=item B: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. - -Input: See list below: - -=over 4 - -=item B: An array that will contain all of the ids in the course. - -=item B: hash, id->type, where "type" contains the extension of the file, thus, I. - -=item B: hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id - -=item B: hash, name of parameter->display value (what is the display value?) - -=item B: hash, part identification->text representation of part, where the text representation is "[Part $part]" -=item B: hash, full key to part->display value (what's display value?) - -=item B: hash, ??? - -=item B: ??? - -=item B: hash, ??? - -=item B: ?? - -=item B: hash, id->full sym? - -=back - -=cut sub extractResourceInformation { my $ids = shift; @@ -971,9 +1178,15 @@ sub extractResourceInformation { # my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { - my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); - my $parmdis = $display; - $parmdis =~ s/\[Part.*$//g; + my ($display,$parmdis); + $display = &standard_parameter_names($name); + if ($display eq '') { + $display= &Apache::lonnet::metadata($srcf,$key.'.display'); + $parmdis = $display; + $parmdis =~ s/\s*\[Part.*$//g; + } else { + $parmdis = $display; + } $$allparms{$name}=$parmdis; if (ref($defkeytype)) { $$defkeytype{$name}= @@ -985,7 +1198,7 @@ sub extractResourceInformation { # allparts is a hash of all parts # my $part= &Apache::lonnet::metadata($srcf,$key.'.part'); - $$allparts{$part} = "Part: $part"; + $$allparts{$part} = &mt('Part: [_1]',$part); # # Remember all keys going with this resource # @@ -996,14 +1209,14 @@ sub extractResourceInformation { } # # Put in order -# +# unless ($$keyorder{$key}) { $$keyorder{$key}=$keyordercnt; $keyordercnt++; } } - + if (!exists($$mapp{$mapid})) { $$mapp{$id}= &Apache::lonnet::declutter($resource->enclosing_map_src()); @@ -1013,7 +1226,7 @@ sub extractResourceInformation { $$maptitles{$mapid}=&mt('Main Course Documents'); } else { $$maptitles{$mapid}= - &Apache::lonnet::gettitle($$mapp{$id}); + &Apache::lonnet::gettitle($$mapp{$id}); } $$maptitles{$$mapp{$id}}=$$maptitles{$mapid}; $$symbp{$mapid}=$$mapp{$id}.'___(all)'; @@ -1025,8 +1238,6 @@ sub extractResourceInformation { } -################################################## -################################################## sub isdateparm { my $type=shift; @@ -1038,16 +1249,29 @@ sub parmmenu { my $tempkey; $r->print(< +// ENDSCRIPT - $r->print(); - $r->print("\n
'. + return '
'. ''. $valout.'
'; @@ -633,7 +854,7 @@ sub page_js { return(< - +// $selscript ENDJS @@ -683,20 +905,29 @@ sub startpage { my %loaditems = ('onunload' => "pclose()", 'onload' => "group_or_section('cgroup')",); - my $start_page = + if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) + && (!$env{'form.dis'})) || ($env{'form.symb'})) { + &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', + text=>"Problem Parameters"}); + } else { + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', + text=>"Table Mode", + help => 'Course_Setting_Parameters'}); + } + my $start_page = &Apache::loncommon::start_page('Set/Modify Course Parameters', &page_js(), {'add_entries' => \%loaditems,}); - my $breadcrumbs = + my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); $r->print(< - - - - + + + + ENDHEAD } @@ -719,7 +950,7 @@ sub print_row { # cascade down manually my $cascadetype=$$defaulttype{$which}; for (my $i=14;$i>0;$i--) { - if ($typeoutpar[$i]) { + if ($typeoutpar[$i]) { $cascadetype=$typeoutpar[$i]; } else { $typeoutpar[$i]=$cascadetype; @@ -728,17 +959,17 @@ sub print_row { my $parm=$$display{$which}; if ($parmlev eq 'full') { - $r->print('
' + $r->print('' .$$part{$which}.''.$parm.''.$parm.''.$effective_parm.''.$effective_parm.''. + $r->print(''. &valout($sessionval,$sessionvaltype).' '. ''); - if ($which<11 || $which > 12) { - $r->print(&plink($$typeoutpar[$which], - $$display{$value},$$outpar[$which], - $mprefix."$which",'parmform.pres','psub')); + $r->print(''); + my $nolink = 0; + if ($which == 11 || $which == 12) { + $nolink = 1; + } elsif ($mprefix =~ /availablestudent\&$/) { + if ($which > 3) { + $nolink = 1; + } + } + if ($nolink) { + $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); } else { - $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); + $r->print(&plink($$typeoutpar[$which], + $$display{$value},$$outpar[$which], + $mprefix."$which",'parmform.pres','psub')); } $r->print(''; + $output = ''; if ($resultgroup && $resultlevel) { $output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm; } else { @@ -870,7 +1109,7 @@ sub print_usergroups { } $output .= '  
"); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); + + #part to print selected parms overview + $r->print(&mt('Selected Parameters:').'
'); + + #print out all possible parms and hide them by default + $r->print('
    '); + foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { + $r->print('
  • print(' style="display:none"'); + } + $r->print(' />' + .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) + .'
  • ' + ); + } + $r->print('
' + .'

' + .&mt('Show detailed Parameter Selection') + .'

' + ); + + &shortCuts($r,$allparms,$pscat,$keyorder); + + $r->print(&Apache::lonhtmlcommon::row_closure(1)); +} + +sub parmboxes { + my ($r,$allparms,$pscat,$keyorder)=@_; + my $tempkey; + + #part to print the parm-list + $r->print('
' + ); my $cnt=0; + + $r->print(''); foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { - $r->print("\n'); + $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} + : $tempkey) + .''); $cnt++; - if ($cnt==3) { + if ($cnt==4) { $r->print("\n"); $cnt=0; } } - $r->print(' - -'); - $r->print('
-Select All
-Select Common Only -
-Add Problem Dates -Add Content Dates
-Add Discussion Settings -Add Visibilities
-Add Part Parameters -
-Unselect All -
'); + $r->print('' + .'' + .'
' + .'' + .&mt('Hide') + .'' + ); + + #&shortCuts($r,$allparms,$pscat,$keyorder); + $r->print(''); +} +sub shortCuts { + my ($r,$allparms,$pscat,$keyorder)=@_; + + #part to print out the shortcuts for parmselection + $r->print('' + .'' + .'' + .'
' + .'
'.&mt('Parameter Selection').'' + .'' + .'• '.&mt('Select All').'' + .'' + .'
' + .'' + .'• '.&mt('Select Common Only').'' + .'' + .'
' + .'' + .'• '.&mt('Unselect All').'' + .'' + .'
' + .'
' + .'
'.&mt('Add Selection for...').'' + .'' + .'• '.&mt('Problem Dates').'' + .'' + .'' + .' • '.&mt('Content Dates').'' + .'' +# .'
' + .'' + .' • '.&mt('Discussion Settings').'' + .'' + .'' + .' • '.&mt('Visibilities').'' + .'' +# .'
' + .'' + .' • '.&mt('Part Parameters').'' + .'' + .'
' + .'
'); } sub partmenu { my ($r,$allparts,$psprt)=@_; - $r->print(''); $r->print(''); @@ -1160,21 +1481,18 @@ sub usermenu { my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. &Apache::loncommon::selectstudent_link('parmform','uname','udom'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); - my %lt=&Apache::lonlocal::texthash( - 'se' => "Section", - 'gr' => "Group", - 'fu' => "For User", - 'oi' => "or ID", - 'ad' => "at Domain" - ); + my $sections=''; my %sectionhash = &Apache::loncommon::get_sections(); my $groups; my %grouphash = &Apache::longroup::coursegroups(); + my $g_s_header=''; + my $g_s_footer=''; + if (%sectionhash) { - $sections=$lt{'se'}.': print(< -$sections -$groups -
-$lt{'fu'} - -$lt{'oi'} - -$lt{'ad'} -$chooseopt - -ENDMENU + + if (%sectionhash || %grouphash) { + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Group/Section'))); + $r->print($sections.$groups); + $r->print(&Apache::lonhtmlcommon::row_closure()); + } + + $r->print(&Apache::lonhtmlcommon::row_title(&mt('User'))); + $r->print(&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]' + ,'' + ,' ' + ,$chooseopt)); } sub displaymenu { my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; - $r->print('
'.&mt('Select Parameters to View').''. - &mt('Select Parts to View').'
'); + $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); &parmmenu($r,$allparms,$pscat,$keyorder); - $r->print(''); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + &parmboxes($r,$allparms,$pscat,$keyorder); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); &partmenu($r,$allparts,$psprt); - $r->print('
'); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); } sub mapmenu { my ($r,$allmaps,$pschp,$maptitles)=@_; - $r->print(''.&mt('Select Enclosing Map or Folder').' '); + + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); $r->print('"); + } sub levelmenu { my ($r,$alllevs,$parmlev)=@_; - $r->print(''.&mt('Select Parameter Level'). - &Apache::loncommon::help_open_topic('Course_Parameter_Levels').' '); + + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); $r->print(''); + $r->print(''); + $r->print('print(' checked="on"'); + $r->print(' checked="checked"'); } $r->print(' />'.&mt('Sort by realm first, then student (group/section)')); $r->print('
'); @@ -1398,36 +1726,7 @@ sub standardkeyorder { 'parameter_0_discusshide' => 20); } -################################################## -################################################## - -=pod - -=item assessparms - -Show assessment data and parameters. This is a large routine that should -be simplified and shortened... someday. - -Inputs: $r - -Returns: nothing - -Variables used (guessed by Jeremy): - -=over 4 - -=item B: 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: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? - -=item B: - -=back - -=cut -################################################## -################################################## sub assessparms { my $r=shift; @@ -1451,7 +1750,7 @@ sub assessparms { my $csec; my $cgroup; my @usersgroups = (); - + my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; $alllevs{'Resource Level'}='full'; @@ -1488,7 +1787,7 @@ sub assessparms { my $pssymb=''; my $parmlev=''; - + unless ($env{'form.parmlev'}) { $parmlev = 'map'; } else { @@ -1539,7 +1838,7 @@ sub assessparms { } else { $csec=&Apache::lonnet::getsection($udom,$uname, $env{'request.course.id'}); - + if ($csec eq '-1') { $message=''. &mt("User")." '$uname' ".&mt("at domain")." '$udom' ". @@ -1569,7 +1868,7 @@ sub assessparms { unless ($cgroup) { $cgroup=''; } # --------------------------------------------------------- Get all assessments - &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, + &extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, \%mapp, \%symbp,\%maptitles,\%uris, \%keyorder); @@ -1582,6 +1881,39 @@ sub assessparms { my @values=split(/\&\&\&/,$env{'form.pres_value'}); my @types=split(/\&\&\&/,$env{'form.pres_type'}); 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) = + &parmval_by_symb('0.availablestudent',$pssymb,'',$uname,$udom, + $csec,$cgroup,$courseopt); + foreach my $slot_name (split(/:/,$values[$i])) { + next if ($slot_name eq ''); + if (&update_slots($slot_name,$cdom,$cnum,$pssymb,$uname,$udom) eq 'ok') { + push(@ok_slots,$slot_name); + + } else { + push(@fail_slots,$slot_name); + } + } + if (@ok_slots) { + $values[$i] = join(':',@ok_slots); + } else { + $values[$i] = ''; + } + if ($all[$level] ne '') { + my @existing = split(/:/,$all[$level]); + foreach my $slot_name (@existing) { + if (!grep(/^\Q$slot_name\E$/,split(/:/,$values[$i]))) { + if (&delete_slots($slot_name,$cdom,$cnum,$uname,$udom,$pssymb) eq 'ok') { + push(@del_slots,$slot_name); + } + } + } + } + } $message.=&storeparm(split(/\&/,$markers[$i]), $values[$i], $types[$i], @@ -1592,7 +1924,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') }; if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} # ------------------------------------------------------------------ Start page @@ -1604,16 +1936,21 @@ sub assessparms { &HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). '" name="recent_'.$_.'" />'); } - + if (!$pssymb) { - $r->print(''); } - $r->print('
'); + $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + &levelmenu($r,\%alllevs,$parmlev); + if ($parmlev ne 'general') { - $r->print(''); + $r->print(&Apache::lonhtmlcommon::row_closure()); &mapmenu($r,\%allmaps,$pschp,\%maptitles); - $r->print('
'); + + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); } else { my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); @@ -1623,7 +1960,12 @@ sub assessparms { '

'); } - &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); + $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection'))); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print('

'.$message.'

'); @@ -1648,11 +1990,11 @@ sub assessparms { my $userspan=3; if ($cgroup ne '') { $coursespan += 3; - } - - $r->print('

'); - $r->print(''); - $r->print(''); + } + + $r->print('

'.&mt('Any User').'
'); + $r->print(''); + $r->print(''); if ($uname) { if (@usersgroups > 1) { $userspan ++; @@ -1678,18 +2020,18 @@ sub assessparms { 'fr' => 'for Resource' ); $r->print(<$lt{'pie'} - - - + + + + ENDTABLETWO if ($csec) { - $r->print(""); } if ($cgroup) { - $r->print(""); } $r->print(<0) { my $firstrow=1; my $title=&Apache::lonnet::gettitle($symbp{$rid}); - $r->print(''); - $r->print(''); - $r->print(''); @@ -1814,14 +2165,14 @@ ENDTABLEHEADFOUR } # end of full #--------------------------------------------------- Entry for parm level map if ($parmlev eq 'map') { - my $defbgone = '"E0E099"'; - my $defbgtwo = '"FFFF99"'; - my $defbgthree = '"FFBB99"'; + my $defbgone = '#E0E099'; + my $defbgtwo = '#FFFF99'; + my $defbgthree = '#FFBB99'; my %maplist; if ($pschp eq 'all') { - %maplist = %allmaps; + %maplist = %allmaps; } else { %maplist = ($pschp => $mapp{$pschp}); } @@ -1841,11 +2192,11 @@ ENDTABLEHEADFOUR my $map = 0; # $r->print("Catmarker: @catmarker
\n"); - + foreach (@ids) { ($map)=(/([\d]*?)\./); my $rid = $_; - + # $r->print("$mapid:$map: $rid
\n"); if ($map eq $mapid) { @@ -1863,11 +2214,20 @@ ENDTABLEHEADFOUR my $tempkeyp = $_; my $fullkeyp = $tempkeyp; $tempkeyp =~ s/_\w+_/_0_/; - + if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { $part{$tempkeyp}="0"; $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); - $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + if ($allparms{$name{$tempkeyp}} ne '') { + my $identifier; + if ($parmdis =~ /(\s*\[Part.*)$/) { + $identifier = $1; + } + $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; + } else { + $display{$tempkeyp} = $parmdis; + } unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; $display{$tempkeyp} =~ s/_\w+_/_0_/; @@ -1877,7 +2237,7 @@ ENDTABLEHEADFOUR } # end loop through keys } } # end loop through ids - + #---------------------------------------------------- print header information my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); @@ -1904,27 +2264,32 @@ ENDTABLEHEADFOUR ,''.$coursename.'' ) ."
\n" - ); + ); #---------------------------------------------------------------- print table - $r->print('

'.&mt('Any User').'$lt{'csv'}
($csuname $lt{'at'} $csudom)
$lt{'ic'}$lt{'rl'}$lt{'ic'}$lt{'pie'}$lt{'csv'}
($csuname $lt{'at'} $csudom)
$lt{'ic'}$lt{'rl'}$lt{'ic'}". + $r->print(''. &mt("in Section")." $csec". + $r->print(''. &mt("in Group")." $cgroup
'. + '>'. join(' / ',split(/\//,$uri)). '

'. "print(' ('.$thistitle.')'); } $r->print('

'.$typep{$rid}. ''.$maptitles{$mapp{$rid}}.'
'); - $r->print(''); - $r->print(''); - $r->print(''); + $r->print('

'.&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .'

' + .'' + .'' + .&Apache::loncommon::end_data_table_header_row() + ); foreach (&keysinorder(\%name,\%keyorder)) { - $r->print(''); + $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, $parmlev,$uname,$udom,$csec,$cgroup); } - $r->print("
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'
"); + $r->print(&Apache::loncommon::end_data_table().'

' + .'' + ); } # end each map } # end of $parmlev eq map #--------------------------------- Entry for parm level general (Course level) if ($parmlev eq 'general') { - my $defbgone = '"E0E099"'; - my $defbgtwo = '"FFFF99"'; - my $defbgthree = '"FFBB99"'; + my $defbgone = '#E0E099'; + my $defbgtwo = '#FFFF99'; + my $defbgthree = '#FFBB99'; #-------------------------------------------- for each map, gather information my $mapid="0.0"; @@ -1935,10 +2300,10 @@ ENDTABLEHEADFOUR my %display = (); my %type = (); my %default = (); - + foreach (@ids) { my $rid = $_; - + my $uri=&Apache::lonnet::declutter($uris{$rid}); #-------------------------------------------------------------------- @@ -1955,7 +2320,16 @@ ENDTABLEHEADFOUR if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { $part{$tempkeyp}="0"; $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); - $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + if ($allparms{$name{$tempkeyp}} ne '') { + my $identifier; + if ($parmdis =~ /(\s*\[Part.*)$/) { + $identifier = $1; + } + $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; + } else { + $display{$tempkeyp} = $parmdis; + } unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; $display{$tempkeyp} =~ s/_\w+_/_0_/; @@ -1964,11 +2338,12 @@ ENDTABLEHEADFOUR } } # end loop through keys } # end loop through ids - + #---------------------------------------------------- print header information my $setdef=&mt("Set Defaults for All Resources in Course"); $r->print(<

$setdef +
+

$setdef $coursename
ENDMAPONE if ($uname) { @@ -1977,656 +2352,34 @@ ENDMAPONE } else { $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n"); } - + if ($csec) {$r->print(&mt("Section")." $csec\n")}; if ($cgroup) {$r->print(&mt("Group")." $cgroup\n")}; $r->print("

\n"); #---------------------------------------------------------------- print table - $r->print('

'); - $r->print(''); - $r->print(''); - $r->print(''); + $r->print('

'.&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .'

' + .'' + .'' + .&Apache::loncommon::end_data_table_header_row() + ); foreach (&keysinorder(\%name,\%keyorder)) { - $r->print(''); + $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, $parmlev,$uname,$udom,$csec,$cgroup); } - $r->print("
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'
'.&mt('Parameter Name').''.&mt('Default Value').''.&mt('Parameter in Effect').'

"); + $r->print(&Apache::loncommon::end_data_table() + .'

' + .'' + ); } # end of $parmlev eq general } $r->print(''.&Apache::loncommon::end_page()); } # end sub assessparms - -################################################## -################################################## - -=pod - -=item crsenv - -Show and set course data and parameters. This is a large routine that should -be simplified and shortened... someday. - -Inputs: $r - -Returns: nothing - -=cut - -################################################## -################################################## -sub crsenv { - my $r=shift; - my $setoutput=''; - - my $breadcrumbs = - &Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); - my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; - - my (%crsinfo,$chome); - - # - # Go through list of changes - foreach (keys %env) { - next if ($_!~/^form\.(.+)\_setparmval$/); - my $name = $1; - my $value = $env{'form.'.$name.'_value'}; - if ($name eq 'newp') { - $name = $env{'form.newp_name'}; - } - if ($name eq 'url') { - $value=~s/^\/res\///; - my $bkuptime=time; - my @tmp = &Apache::lonnet::get - ('environment',['url'],$dom,$crs); - $setoutput.=&mt('Backing up previous URL').': '. - &Apache::lonnet::put - ('environment', - {'top level map backup '.$bkuptime => $tmp[1] }, - $dom,$crs). - '
'; - } - # - # Deal with modified default spreadsheets - if ($name =~ /^spreadsheet_default_(classcalc| - studentcalc| - assesscalc)$/x) { - my $sheettype = $1; - if ($sheettype eq 'classcalc') { - # no need to do anything since viewing the sheet will - # cause it to be updated. - } elsif ($sheettype eq 'studentcalc') { - # expire all the student spreadsheets - &Apache::lonnet::expirespread('','','studentcalc'); - } else { - # expire all the assessment spreadsheets - # this includes non-default spreadsheets, but better to - # be safe than sorry. - &Apache::lonnet::expirespread('','','assesscalc'); - # expire all the student spreadsheets - &Apache::lonnet::expirespread('','','studentcalc'); - } - } - # - # Deal with the enrollment dates - if ($name =~ /^default_enrollment_(start|end)_date$/) { - $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); - } - # - # Deal with the emails - if ($name =~ /\.email$/) { - foreach my $specifier (split(',',$value)) { - my ($user,$sections_or_groups)= - ($specifier=~/^([^\(]+)\(([^\)]+)\)/); - if (!$sections_or_groups) { - $user = $specifier; - } - my ($name,$domain) = split(':',$user); - if (!defined($user) || !defined($domain)) { - $setoutput.= '
'. - &mt("Invalid email address specified, address must be of the form username:domain what was specified was ([_1])",$user). - ''; - undef($value); - } elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') { - $setoutput.= '
'. - &mt("Invalid email address specified, user [_1] is unknown.",$name). - ''; - undef($value); - } - } - } - # Get existing cloners - my @oldcloner = (); - if ($name eq 'cloners') { - my %clonenames=&Apache::lonnet::dump('environment',$dom,$crs,'cloners'); - if ($clonenames{'cloners'} =~ /,/) { - @oldcloner = split/,/,$clonenames{'cloners'}; - } else { - $oldcloner[0] = $clonenames{'cloners'}; - } - } - # - # Let the user know we made the changes - if ($name && defined($value)) { - my %failed_cloners; - if ($name eq 'cloners') { - $value =~ s/\s//g; - $value =~ s/^,//; - $value =~ s/,$//; - # check requested clones are valid users. - %failed_cloners = &check_cloners(\$value,\@oldcloner); - } - my $put_result = &Apache::lonnet::put('environment', - {$name=>$value},$dom,$crs); - if ($put_result eq 'ok') { - $setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '; - if ($name =~ /^default_enrollment_(start|end)_date$/) { - $setoutput .= &Apache::lonlocal::locallocaltime($value); - } elsif ($name eq 'categories') { - $setoutput .= $env{'form.categories_display'}; - } else { - $setoutput .= $value; - } - $setoutput .= '.
'; - if ($name eq 'cloners') { - &change_clone($value,\@oldcloner); - } - # Update environment and nohist_courseids.db - if (($name eq 'description') || ($name eq 'cloners') || - ($name eq 'hidefromcat') || ($name eq 'categories')) { - if ($chome eq '') { - %crsinfo = - &Apache::lonnet::courseiddump($dom,'.',1,'.','.', - $crs,undef,undef,'.'); - $chome = &Apache::lonnet::homeserver($crs,$dom); - } - } - if ($name eq 'description' && defined($value)) { - &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value}); - if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { - $crsinfo{$env{'request.course.id'}}{'description'} = $value; - my $putresult = - &Apache::lonnet::courseidput($dom,\%crsinfo, - $chome,'notime'); - } - } - if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) { - if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') { - &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value}); - $crsinfo{$env{'request.course.id'}}{$name} = $value; - my $putresult = - &Apache::lonnet::courseidput($dom,\%crsinfo, - $chome,'notime'); - } - } - } else { - $setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to'). - ' '.$value.' '.&mt('due to').' '.$put_result.'.
'; - } - if (($name eq 'cloners') && (keys(%failed_cloners) > 0)) { - $setoutput.= &mt('Unable to include').': '; - my @fails; - my $num = 0; - if (defined($failed_cloners{'format'})) { - $fails[$num] .= ''.$failed_cloners{'format'}. - ', '.&mt('reason').' - '. - &mt('Invalid format'); - $num ++; - } - if (defined($failed_cloners{'domain'})) { - $fails[$num] .= ''.$failed_cloners{'domain'}. - ', '.&mt('reason').' - '. - &mt('Domain does not exist'); - $num ++; - } - if (defined($failed_cloners{'newuser'})) { - $fails[$num] .= ''.$failed_cloners{'newuser'}. ', '.&mt('reason').' - '. - &mt('LON-CAPA user(s) do(es) not exist.'). - '.
'.&mt('Please '). - ' '. - &mt('add the user(s)').', '. - &mt('and then return to the '). - ''. - &mt('Course Parameters page').' '. - &mt('to add the new user(s) to the list of possible cloners'); - } - $setoutput .= join(';  ',@fails).'.
'; - } - } - } - - my $start_table =&Apache::loncommon::start_data_table(); - my $start_header_row=&Apache::loncommon::start_data_table_header_row(); - my $end_header_row =&Apache::loncommon::end_data_table_header_row(); -# ------------------------- Re-init course environment entries for this session - - &Apache::lonnet::coursedescription($env{'request.course.id'}, - {'freshen_cache' => 1}); - -# -------------------------------------------------------- Get parameters again - - my %values=&Apache::lonnet::dump('environment',$dom,$crs); - my $SelectStyleFile=&mt('Select Style File'); - my $SelectSpreadsheetFile=&mt('Select Spreadsheet File'); - my $output=''; - my $can_categorize; - if (! exists($values{'con_lost'})) { - my %descriptions= - ('url' => ''.&mt('Top Level Map').'
'. - '". - &mt('Select Map').'
'. - &mt('Modification may make assessment data inaccessible!'). - '', - 'description' => ''.&mt('Course Description').'', - 'courseid' => ''.&mt('Course ID or number'). - '
'. - '('.&mt('internal, optional').')', - 'cloners' => ''.&mt('Users allowed to clone course').'
' - .'("'.&mt('user:domain,user:domain,*:domain').'")
' - .&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'
' - .&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"*:domain"').'
' - .&mt('Use [_1] to allow unrestricted cloning in all domains.','"*"'), - 'grading' => ''.&mt('Grading').'
'. - &mt('[_1], [_2], or [_3]','"standard"','"external"','"spreadsheet"').&Apache::loncommon::help_open_topic('GradingOptions'), - 'task_grading' => ''.&mt('Bridge Task Grading').'
' - .&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'
' - .'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"any"','"section"').')', - 'default_xml_style' => ''.&mt('Default XML Style File').'
'. - '$SelectStyleFile
", - 'question.email' => ''.&mt('Feedback Addresses for Resource Content Question').'
' - .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', - 'question.email.text' => ''.&mt('Custom Text for Resource Content Question Option in Feedback').'', - 'comment.email' => ''.&mt('Feedback Addresses for Course Content Comments').'
' - .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', - 'comment.email.text' => ''.&mt('Custom Text for Course Content Option in Feedback').'', - 'policy.email' => ''.&mt('Feedback Addresses for Course Policy').'
' - .'("'.&mt('user:domain,user:domain(section;section;...;*;...),...').'")', - 'policy.email.text' => ''.&mt('Custom Text for Course Policy Option in Feedback').'', - 'hideemptyrows' => ''.&mt('Hide Empty Rows in Spreadsheets').'
' - .'('.&mt('[_1] for default hiding','"yes"').')', - 'pageseparators' => ''.&mt('Visibly Separate Items on Pages').'
' - .'('.&mt('[_1] for visible separation.','"yes"').' ' - .&mt('Changes will not show until next login.').')', - 'student_classlist_view' => ''.&mt('Allow students to view classlist.').'
' - .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"all"','"section"','"disabled"').')', - 'student_classlist_portfiles' => ''.&mt('Include link to accessible portfolio files').'
' - .'('.&mt('[_1] for link to each a listing of each student\'s files.','"yes"').')', - 'student_classlist_opt_in' => ''.&mt("Student's agreement needed for listing in student-viewable roster").'
' - .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"yes"').')', - 'plc.roles.denied'=> ''.&mt('Disallow live chatroom use for Roles').'
' - .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"').')
' - .'("'.&mt('role,role,...').'") ' - .Apache::loncommon::help_open_topic("Course_Disable_Discussion"), - 'plc.users.denied' => - ''.&mt('Disallow live chatroom use for Users').'
'. - '("'.&mt('user:domain,user:domain,...').'")', - - 'pch.roles.denied'=> ''.&mt('Disallow Resource Discussion for Roles').'
' - .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"') - .'("'.&mt('role,role,...').'") ' - .Apache::loncommon::help_open_topic("Course_Disable_Discussion"), - 'pch.users.denied' => - ''.&mt('Disallow Resource Discussion for Users').'
'. - '("'.&mt('user:domain,user:domain,...').'")', - 'spreadsheet_default_classcalc' - => ''.&mt('Default Course Spreadsheet').' '. - '$SelectSpreadsheetFile
", - 'spreadsheet_default_studentcalc' - => ''.&mt('Default Student Spreadsheet').'
'. - '$SelectSpreadsheetFile
", - 'spreadsheet_default_assesscalc' - => ''.&mt('Default Assessment Spreadsheet').' '. - '$SelectSpreadsheetFile
", - 'allow_limited_html_in_feedback' - => ''.&mt('Allow limited HTML in discussion posts').'
'. - '('.&mt('Set value to [_1] to allow.','"yes"').')', - 'allow_discussion_post_editing' - => ''.&mt('Allow users with specified roles to edit/delete their own discussion posts').'
' - .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"st"','"ta"','"in"').')
' - .'('.&mt('Set value to [_1] to allow all roles.','"yes"').')' - .'("'.&mt('role:section,role:section,...').'")
' - .'('.&mt('Example: "st:001,st:002,in,cc" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')', - 'rndseed' - => ''.&mt('Randomization algorithm used').'
' - .'' - .&mt('Modifying this will make problems have different numbers and answers!') - .'', - 'receiptalg' - => ''.&mt('Receipt algorithm used').'
'. - &mt('This controls how receipt numbers are generated.'), - 'suppress_tries' - => ''.&mt('Suppress number of tries in printing').'
'. - ' ('.&mt('[_1] to suppress, anything else to not suppress','"yes"').')', - 'problem_stream_switch' - => ''.&mt('Allow problems to be split over pages').'
'. - ' ('.&mt('[_1] if allowed, anything else if not','"yes"').')', - 'default_paper_size' - => ''.&mt('Default paper type').'
'. - ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. - ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. - ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', - 'print_header_format' - => ' '.&mt('Print header format').'
' - .&mt('Substitutions:
[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the % limit the field size.','"%n"','"%c"','"%a"'), - 'default_enrollment_start_date' => ''.&mt('Default beginning date for student access.').'', - 'default_enrollment_end_date' => ''.&mt('Default ending date for student access.').'', - 'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').'
' - .'("'.&mt('user:domain,user:domain,*:domain').'")', - 'languages' => ''.&mt('Languages used').'', - 'disable_receipt_display' - => ''.&mt('Disable display of problem receipts').'
'. - ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', - 'task_messages' - => ''.&mt('Send message to student when clicking Done on Tasks').'
('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','"only_student"','"student_and_user_notes_screen"').')', - 'disablesigfigs' - => ''.&mt('Disable checking of Significant Figures').'
'. - ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', - 'disableexampointprint' - => ''.&mt('Disable automatically printing point values onto exams.').'
'. - ' ('.&mt('"[_1]" to disable, anything else if not','yes').')', - 'externalsyllabus' - => ''.&mt('URL of Syllabus (not using internal handler)').'', - 'tthoptions' - => ''.&mt('Default set of options to pass to tth/m when converting tex').'', - - 'texengine' - => ''.&mt('Force all students in the course to use a specific math rendering engine.').'
' - .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"jsMath"','"mimetex"','"tth"').')', - 'timezone' - => ''.&mt('Timezone in which the course takes place').'', - - 'suppress_embed_prompt' - => ''.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'
'. - ' ('.&mt('[_1] to suppress, anything else to not suppress','"yes"').')', - 'hidefromcat' - => ''.&mt('Exclude from course catalog').'
'. - ' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"yes"').')', - 'categories' - => ''.&mt('Categorize course').' '. - &mt('Display Categories').'', - 'datelocale' - => ''.&mt('Locale used for course calendar').'', - ); - my @Display_Order = ('url','description','courseid','cloners'); - (my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom); - if ($can_toggle_cat) { - push(@Display_Order,'hidefromcat'); - } - if ($can_categorize) { - push(@Display_Order,'categories'); - } - push (@Display_Order,('grading', - 'externalsyllabus', - 'default_xml_style','pageseparators', - 'question.email','question.email.text','comment.email', - 'comment.email.text','policy.email','policy.email.text', - 'student_classlist_view', - 'student_classlist_opt_in', - 'student_classlist_portfiles', - 'plc.roles.denied','plc.users.denied', - 'pch.roles.denied','pch.users.denied', - 'allow_limited_html_in_feedback', - 'allow_discussion_post_editing', - 'languages', - 'timezone', - 'datelocale', - 'nothideprivileged', - 'rndseed', - 'receiptalg', - 'problem_stream_switch', - 'suppress_tries', - 'suppress_embed_prompt', - 'default_paper_size', - 'print_header_format', - 'disable_receipt_display', - 'spreadsheet_default_classcalc', - 'spreadsheet_default_studentcalc', - 'spreadsheet_default_assesscalc', - 'hideemptyrows', - 'default_enrollment_start_date', - 'default_enrollment_end_date', - 'tthoptions', - 'texengine', - 'disablesigfigs', - 'disableexampointprint', - 'task_messages','task_grading')); - foreach my $parameter (sort(keys(%values))) { - unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) || - ($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/) - || ($parameter eq 'type')) { - if (! $descriptions{$parameter}) { - $descriptions{$parameter}=$parameter; - push(@Display_Order,$parameter); - } - } - } - - foreach my $parameter (@Display_Order) { - my $description = $descriptions{$parameter}; - # onchange is javascript to automatically check the 'Set' button. - my $onchange = 'onFocus="javascript:window.document.forms'. - "['envform'].elements['".$parameter."_setparmval']". - '.checked=true;"'; - $output .= &Apache::loncommon::start_data_table_row(). - ''.$description.''; - if ($parameter =~ /^default_enrollment_(start|end)_date$/) { - $output .= ''. - &Apache::lonhtmlcommon::date_setter('envform', - $parameter.'_value', - $values{$parameter}, - $onchange). - ''; - } elsif ($parameter eq 'timezone') { - my $includeempty = 1; - my $timezone = &Apache::lonlocal::gettimezone(); - $output .= ''. - &Apache::loncommon::select_timezone($parameter.'_value', - $timezone, - $onchange,$includeempty).''; - } elsif ($parameter eq 'datelocale') { - my $includeempty = 1; - my $locale_obj = &Apache::lonlocal::getdatelocale(); - my $currdatelocale; - if (ref($locale_obj)) { - $currdatelocale = $locale_obj->id(); - } - $output .= ''. - &Apache::loncommon::select_datelocale($parameter.'_value', - $currdatelocale, - $onchange,$includeempty).''; - } elsif ($parameter eq 'categories') { - my $catdisplay; - if ($values{'categories'} ne '') { - my @curritems = split(/\&/,$values{'categories'}); - foreach my $item (@curritems) { - my ($name,$parent,$pos) = split(/:/,$item); - $catdisplay .= &unescape($name).'&'; - } - $catdisplay =~ s/\&$//; - } - $output .= ''. - ''. - ''; - } else { - $output .= ''. - &Apache::lonhtmlcommon::textbox($parameter.'_value', - $values{$parameter}, - 40,$onchange).''; - } - $output .= ''. - &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). - ''; - $output .= &Apache::loncommon::end_data_table_row()."\n"; - } - my $onchange = 'onFocus="javascript:window.document.forms'. - '[\'envform\'].elements[\'newp_setparmval\']'. - '.checked=true;"'; - $output.=&Apache::loncommon::start_data_table_row(). - ''.&mt('Create New Environment Variable').'
'. - ''. - ''. - ''. - &Apache::loncommon::end_data_table_row()."\n"; - } - my %lt=&Apache::lonlocal::texthash( - 'par' => 'Parameter', - 'val' => 'Value', - 'set' => 'Set?', - 'sav' => 'Save' - ); - - my $Parameter=&mt('Parameter'); - my $Value=&mt('Value'); - my $Set=&mt('Set'); - my ($jscript,$categorize_js); - my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); - if ($can_categorize) { - $categorize_js = <'; - my $start_page = - &Apache::loncommon::start_page('Set Course Environment', - $jscript); - my $end_page = - &Apache::loncommon::end_page(); - my $end_table=&Apache::loncommon::end_data_table(); - $r->print(< -$setoutput -
-$start_table -$start_header_row -$lt{'par'}$lt{'val'}$lt{'set'} -$end_header_row -$output -$end_table - - -$end_page -ENDENV -} - -sub can_modify_catsettings { - my ($dom) = @_; - my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); - my ($can_toggle_cat,$can_categorize); - if (ref($domconf{'coursecategories'}) eq 'HASH') { - if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') { - $can_toggle_cat = 1; - } - if ($domconf{'coursecategories'}{'categorize'} eq 'crs') { - $can_categorize = 1; - } - } - return ($can_toggle_cat,$can_categorize); -} - -sub assign_course_categories { - my ($r) = @_; - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $hascats = 0; - my $cathash; - my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); - if (ref($domconf{'coursecategories'}) eq 'HASH') { - $cathash = $domconf{'coursecategories'}{'cats'}; - if (ref($cathash) eq 'HASH') { - $hascats = 1; - } - } - my $catwin_js; - if ($hascats) { - my $alert = &mt('Use \"Save\" in the main window to save course categories'); - $catwin_js = < - -function updateCategories() { - var newcategories = ''; - var unescapedcats = ''; - if (document.chgcats.usecategory.length) { - for (var i=0; i 0) { - newcategories = newcategories.slice(0,-1); - } - if (unescapedcats.length > 0) { - unescapedcats = unescapedcats.slice(0,-3); - } - } else { - if (document.chgcats.usecategory.checked == true) { - newcategories = document.chgcats.usecategory.value; - unescapedcats = document.chgcats.catname.value; - } - } - opener.document.envform.categories_value.value = newcategories; - opener.document.envform.categories_display.value = unescapedcats; - opener.document.envform.categories_setparmval.checked = true; - alert("$alert"); - self.close(); - return; -} - - -ENDSCRIPT - } else { - my $onload; - } - my $start_page = - &Apache::loncommon::start_page('Course Categories',$catwin_js, - {'only_body' => 1,}); - my $end_page = &Apache::loncommon::end_page(); - my $categoriesform = '

'.&mt('Categorize Course').'

'; - if ($hascats) { - my %currsettings = - &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum); - $categoriesform .= &mt('Assign one or more categories to this course.').'

'. - '
'."\n" - .&Apache::loncommon::assign_categories_table($cathash, - $currsettings{'categories'})."\n" - .'

'; - } else { - $categoriesform .= &mt('No categories defined for this domain'); - } - $r->print($start_page.$categoriesform.$end_page); - return; -} - ################################################## # Overview mode ################################################## @@ -2710,7 +2463,7 @@ sub storedata { $typeof=$env{'form.typeof_'.$thiskey}; $text = &mt('Saved modified date for'); } - if (defined($data) and $$olddata{$thiskey} ne $data) { + if (defined($data) and $$olddata{$thiskey} ne $data) { if ($tuname) { if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, $tkey.'.type' => $typeof}, @@ -2725,8 +2478,8 @@ sub storedata { &Apache::lonnet::devalidateuserresdata($tuname,$tudom); } else { $newdata{$thiskey}=$data; - $newdata{$thiskey.'.type'}=$typeof; - } + $newdata{$thiskey.'.type'}=$typeof; + } } } elsif ($cmd eq 'del') { if ($tuname) { @@ -2780,7 +2533,7 @@ sub parse_listdata_key { my ($key,$listdata) = @_; # split into student/section affected, and # the realm (folder/resource part and parameter - my ($student,$realm) = + my ($student,$realm) = ($key=~/^\Q$env{'request.course.id'}\E\.\[([^\.]+)\]\.(.+)$/); # if course wide student would be undefined if (!defined($student)) { @@ -2821,13 +2574,13 @@ sub listdata { if ($sortorder eq 'realmstudent') { if ($ares ne $bres ) { $result = ($ares cmp $bres); - } elsif ($astudent ne $bstudent) { + } elsif ($astudent ne $bstudent) { $result = ($astudent cmp $bstudent); } elsif ($apart ne $bpart ) { $result = ($apart cmp $bpart); } } else { - if ($astudent ne $bstudent) { + if ($astudent ne $bstudent) { $result = ($astudent cmp $bstudent); } elsif ($ares ne $bres ) { $result = ($ares cmp $bres); @@ -2835,7 +2588,7 @@ sub listdata { $result = ($apart cmp $bpart); } } - + if (!$result) { if (defined($aparm) && defined($bparm)) { $result = ($aparm <=> $bparm); @@ -2900,7 +2653,7 @@ sub listdata { } if ($part ne $oldpart) { $r->print(&tableend(). - "\n".&mt('Part').": $part"); + "\n".''.&mt('Part').": $part"); $oldpart=$part; } # @@ -2921,8 +2674,8 @@ sub listdata { $$resourcedata{$thiskey}, '',1,'',''). ''. -(($$resourcedata{$thiskey}!=0)?''. -&mt('Shift all dates based on this date').'':''). +(($$resourcedata{$thiskey}!=0)?''. +&mt('Shift all dates based on this date').'':''). &date_sanity_info($$resourcedata{$thiskey}) ); } elsif ($thistype eq 'date_interval') { @@ -2935,7 +2688,7 @@ sub listdata { $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } $r->print(''); + $thistype.'" />'); $r->print(''.&Apache::loncommon::end_data_table_row()); } } @@ -2985,7 +2738,7 @@ sub default_selector { return ''; } -my %strings = +my %strings = ( 'string_yesno' => [[ 'yes', 'Yes' ], @@ -3000,7 +2753,7 @@ my %strings = sub string_selector { my ($thistype, $thiskey, $showval) = @_; - + if (!exists($strings{$thistype})) { return &default_selector($thiskey,$showval); } @@ -3058,6 +2811,8 @@ sub newoverview { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', + text=>"Overview Mode"}); my $start_page = &Apache::loncommon::start_page('Set Parameters'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); $r->print(<print(' - '. @@ -3288,11 +3068,11 @@ ENDOVER $r->print(&Apache::loncommon::start_data_table_row(). ''. '' ); - + $r->print(''); - + } } $r->print(&Apache::loncommon::end_data_table().'

'. - ''. + ''. '

'. &Apache::loncommon::end_page()); } @@ -3335,6 +3115,8 @@ sub date_shift_one { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, + text=>"Shifting Dates"}); my $start_page=&Apache::loncommon::start_page('Shift Dates'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); $r->print(<'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, + text=>"Shifting Dates"}); my $start_page=&Apache::loncommon::start_page('Shift Dates'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); $r->print(<print(&header()); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); $r->print(< @@ -3596,86 +3337,87 @@ ENDMAINFORMHEAD my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); + my @menu = - ( { divider=>'Settings for Your Course', - }, - { text => 'Set Course Environment', - action => 'crsenv', - permission => $parm_permission, - help => 'Course_Environment', - }, - { text => 'Set Portfolio Metadata', - action => 'setrestrictmeta', - permission => $parm_permission, - }, - { text => 'Manage Course Slots', - url => '/adm/slotrequest?command=showslots', - permission => $vgr, - }, - { text => 'Reset Student Access Times', - url => '/adm/helper/resettimes.helper', - permission => $mgr, - }, - - { text => 'Set Parameter Setting Default Actions', - action => 'setdefaults', - permission => $parm_permission, - }, - { divider => 'New and Existing Parameter Settings for Your Resources', - }, - { text => 'Set/Modify Resource Parameters - Helper Mode', - url => '/adm/helper/parameter.helper', - permission => $parm_permission, - help => 'Parameter_Helper', - }, - { text => 'Set/Modify Resource Parameters - Overview Mode', - action => 'newoverview', - permission => $parm_permission, - help => 'Parameter_Overview', - }, - { text => 'Set/Modify Resource Parameters - Table Mode', - action => 'settable', - permission => $parm_permission, - help => 'Table_Mode', - }, - { divider => 'Existing Parameter Settings for Your Resources', - }, - { text => 'Modify Resource Parameters - Overview Mode', - action => 'setoverview', - permission => $parm_permission, - help => 'Parameter_Overview', - }, - { text => 'Parameter Change Log and Course Blog Posting/User Notification', - action => 'parameterchangelog', - permission => $parm_permission, - }, + ( { categorytitle=>'Settings for this Course', + items => [ + { linktext => 'Course Configuration', + url => '/adm/courseprefs?origin=params', + permission => $parm_permission, + linktitle =>'Edit course 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 course.' , + icon =>'contact-new.png' , + }, + { linktext => 'Manage Course Slots', + url => '/adm/slotrequest?command=showslots', + permission => $vgr, + linktitle =>'Manage slots for this course.' , + icon => 'format-justify-fill.png' , + }, + { linktext => 'Reset Student Access Times', + url => '/adm/helper/resettimes.helper', + permission => $mgr, + linktitle =>'Reset access times for folders/maps, resources or the course.' , + icon => 'start-here.png' , + }, + + { linktext => 'Set Parameter Setting Default Actions', + url => '/adm/parmset?action=setdefaults', + permission => $parm_permission, + linktitle =>'Set default actions for parameters.' , + icon => 'folder-new.png' , + }]}, + { categorytitle => 'New and Existing Parameter Settings for Resources', + items => [ + { linktext => 'Edit Resource Parameters - Helper Mode', + url => '/adm/helper/parameter.helper', + permission => $parm_permission, + linktitle =>'Set/Modify resource parameters in helper mode.' , + icon => 'dialog-information.png' , + #help => 'Parameter_Helper', + }, + { linktext => 'Edit Resource Parameters - Overview Mode', + url => '/adm/parmset?action=newoverview', + permission => $parm_permission, + linktitle =>'Set/Modify resource parameters in overview mode.' , + icon => 'edit-find.png' , + #help => 'Parameter_Overview', + }, + { linktext => 'Edit Resource Parameters - Table Mode', + url => '/adm/parmset?action=settable', + permission => $parm_permission, + linktitle =>'Set/Modify resource parameters in table mode.' , + icon => 'edit-copy.png' , + #help => 'Table_Mode', + }]}, + { categorytitle => 'Existing Parameter Settings for Resources', + items => [ + { linktext => 'Modify Resource Parameters - Overview Mode', + url => '/adm/parmset?action=setoverview', + permission => $parm_permission, + linktitle =>'Set/Modify existing resource parameters in overview mode.' , + icon => 'preferences-desktop-wallpaper.png' , + #help => 'Parameter_Overview', + }, + { linktext => 'Change Log', + url => '/adm/parmset?action=parameterchangelog', + permission => $parm_permission, + linktitle =>'View parameter and course blog posting/user notification change log.' , + icon => 'emblem-system.png' , + }]} ); - my $menu_html = ''; - foreach my $menu_item (@menu) { - if ($menu_item->{'divider'}) { - $menu_html .= '

'.&mt($menu_item->{'divider'}).'

'; - next; - } - next if (! $menu_item->{'permission'}); - $menu_html.='

'; - $menu_html.=''; - if (exists($menu_item->{'url'})) { - $menu_html.=qq{}; - } else { - $menu_html.= - qq{}; - } - $menu_html.= &mt($menu_item->{'text'}).''; - if (exists($menu_item->{'help'})) { - $menu_html.= - &Apache::loncommon::help_open_topic($menu_item->{'help'}); - } - $menu_html.='

'.$/; - } - $r->print($menu_html); + $r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); return; } -### Set portfolio metadata + + + sub output_row { my ($r, $field_name, $field_text, $added_flag) = @_; my $output; @@ -3687,55 +3429,60 @@ sub output_row { } if (!($options =~ /deleted/)) { my @options= ( ['active', 'Show to student'], - ['stuadd', 'Provide text area for students to type catalog information'], + ['stuadd', 'Provide text area for students to type metadata'], ['choices','Provide choices for students to select from']); # ['onlyone','Student may select only one choice']); if ($added_flag) { push @options,['deleted', 'Delete Metadata Field']; } $output = &Apache::loncommon::start_data_table_row(); - $output .= '
'; + $output .= ''; $output .= &Apache::loncommon::end_data_table_row(); foreach my $opt (@options) { my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; $output .= &Apache::loncommon::continue_data_table_row(); - $output .= ''; + &mt($opt->[1]).''; $output .= &Apache::loncommon::end_data_table_row(); } $output .= &Apache::loncommon::continue_data_table_row(); - $output .= ''; + $output .= ''; $output .= &Apache::loncommon::end_data_table_row(); my $multiple_checked; my $single_checked; if ($options =~ m/onlyone/) { - $multiple_checked = ""; - $single_checked = " CHECKED "; + $multiple_checked = ''; + $single_checked = ' checked="checked"'; } else { - $multiple_checked = " CHECKED "; - $single_checked = ""; + $multiple_checked = ' checked="checked"'; + $single_checked = ''; } $output .= &Apache::loncommon::continue_data_table_row(); - $output .= ''; + $output .= ''; $output .= &Apache::loncommon::end_data_table_row(); $output .= &Apache::loncommon::continue_data_table_row(); - $output .= ''; + $output .= ''; $output .= &Apache::loncommon::end_data_table_row(); } return ($output); } + + + sub order_meta_fields { my ($r)=@_; my $idx = 1; my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; $r->print(&Apache::loncommon::start_page('Order Metadata Fields')); + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', + text=>"Add Metadata Field"}); &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/parmset?action=setrestrictmeta", text=>"Restrict Metadata"}, @@ -3774,7 +3521,7 @@ sub order_meta_fields { } my $ordered_fields = join ",", @neworder; 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}); } my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); @@ -3787,8 +3534,8 @@ sub order_meta_fields { $ordered_fields = join ",", @fields_in_order; } my $put_result = &Apache::lonnet::put('environment', - {'metadata.addedorder'=>$ordered_fields},$dom,$crs); - } + {'metadata.addedorder'=>$ordered_fields},$dom,$crs); + } $r->print('
'); + #$r->print(' + # '); + #$r->print(''); } - $r->print('
'); + $r->print('
'); + #$r->print('

Step 1

'); + $r->print('
'); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); &levelmenu($r,\%alllevs,$parmlev); if ($parmlev ne 'general') { - $r->print('
'); + #$r->print(''); + $r->print(&Apache::lonhtmlcommon::row_closure()); &mapmenu($r,\%allmaps,$pschp,\%maptitles); - $r->print('
'); - - $r->print(' -
'); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print(''); + #$r->print('
'); + + #$r->print(' + #
'); + $r->print('
'); + $r->print('
'); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); &parmmenu($r,\%allparms,\@pscat,\%keyorder); - $r->print('
- '. + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + &parmboxes($r,\%allparms,\@pscat,\%keyorder); + $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); + #$r->print('
'. + $r->print(''. '
'.&mt('Parts').''.&mt('Section(s)'). ''.&mt('Group(s)').'
'); &partmenu($r,\%allparts,\@psprt); @@ -3143,11 +2913,17 @@ ENDOVER $r->print(''); &groupmenu($r,\@selected_groups); $r->print('
'); - $r->print('
'); - + #$r->print('
'); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print(''); + + $r->print('
'); + $r->print('
'); my $sortorder=$env{'form.sortorder'}; unless ($sortorder) { $sortorder='realmstudent'; } &sortmenu($r,$sortorder); + $r->print('
'); $r->print('

'); @@ -3218,6 +2994,8 @@ sub overview { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', + text=>"Overview Mode"}); my $start_page=&Apache::loncommon::start_page('Modify Parameters'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); $r->print(<print(&tableend().'

'. - ($foundkeys?'':&mt('There are no parameters.')).'

'. + ($foundkeys?'':&mt('There are no parameters.')).'

'. &Apache::loncommon::end_page()); } @@ -3252,6 +3030,8 @@ sub clean_parameters { my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; 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 $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); $r->print(<print('

'. &mt('These parameters refer to resources that do not exist.'). '

'. - ''.'
'. + ''.'
'. '
'); $r->print(&Apache::loncommon::start_data_table(). '
'); my $display_value = $resourcedata->{$thiskey}; if (&isdateparm($resourcedata->{$thiskey.'.type'})) { - $display_value = + $display_value = &Apache::lonlocal::locallocaltime($display_value); } $r->print(&mt('Parameter: "[_1]" with value: "[_2]"', @@ -3321,11 +3101,11 @@ ENDOVER } $r->print('
   '.&mt('Part: [_1]',$data{'parameter_part'})); $r->print('
'.$field_text.':'.(' ' x 5).''.(' ' x 5).' '.(' ' x 10).''.(' ' x 10).''.(' ' x 10).''.(' ' x 10).' + + '.&mt('Student may select multiple choices from list').''.(' ' x 10).''.(' ' x 10).' + + '.&mt('Student may select only one choice from list').'
'); my $num_fields = scalar(@fields_in_order); foreach my $key (@fields_in_order) { @@ -3812,6 +3559,8 @@ sub order_meta_fields { $r->print('
'); return 'ok'; } + + sub continue { my $output; $output .= '
'; @@ -3819,8 +3568,12 @@ sub continue { $output .= ''; return ($output); } + + sub addmetafield { 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::lonhtmlcommon::breadcrumbs('Add Metadata Field')); my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -3833,7 +3586,7 @@ sub addmetafield { $options =~ s/,,/,/; my $put_result = &Apache::lonnet::put('environment', {'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); - + $r->print('Undeleted Metadata Field '.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}." with result ".$put_result.'
'); } $r->print(&continue()); @@ -3865,12 +3618,17 @@ sub addmetafield { } $r->print('
'); } + + + sub setrestrictmeta { my ($r)=@_; my $next_meta; my $output; my $item_num; 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::lonhtmlcommon::breadcrumbs('Restrict Metadata')); my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; @@ -3887,13 +3645,13 @@ sub setrestrictmeta { $save_field = $meta_field; if ($env{'form.'.$meta_field.'_stuadd'}) { $options.='stuadd,'; - } + } if ($env{'form.'.$meta_field.'_choices'}) { $options.='choices,'; - } + } if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') { $options.='onlyone,'; - } + } if ($env{'form.'.$meta_field.'_active'}) { $options.='active,'; } @@ -3939,7 +3697,7 @@ ENDButtons $output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); } $output .= &Apache::loncommon::end_data_table(); - $r->print(<print(< $output $buttons @@ -3948,7 +3706,9 @@ ENDenv $r->print(&Apache::loncommon::end_page()); return 'ok'; } -################################################## + + + sub get_added_meta_fieldnames { my ($cid) = @_; my %fields; @@ -3961,6 +3721,9 @@ sub get_added_meta_fieldnames { } return \%fields; } + + + sub get_deleted_meta_fieldnames { my ($cid) = @_; my %fields; @@ -3978,7 +3741,9 @@ sub get_deleted_meta_fieldnames { sub defaultsetter { my ($r) = @_; - my $start_page = + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', + text=>"Set Defaults"}); + my $start_page = &Apache::loncommon::start_page('Parameter Setting Default Actions'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); $r->print(<print(&mt('Manual setting rules apply to all interfaces.').'
'. &mt('Automatic setting rules apply to table mode interfaces only.')); @@ -4116,12 +3881,12 @@ ENDINPUTDATE } elsif ($defkeytype{$tempkey} eq 'string_yesno') { my $yeschecked=''; my $nochecked=''; - if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked='checked="checked"'; } - if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; } + if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked=' checked="checked"'; } + if (&rulescache($tempkey.'_value') eq 'no') { $nochecked=' checked="checked"'; } $r->print(< $lt{'yes'}
- +
+ ENDYESNO } else { $r->print(''); @@ -4129,8 +3894,8 @@ ENDYESNO $r->print(''.&Apache::loncommon::end_data_table_row()); } $r->print(&Apache::loncommon::end_data_table(). - "\n\n". + "\n".''."\n". &Apache::loncommon::end_page()); return; } @@ -4159,7 +3924,7 @@ sub components { $issection=''; } my $realm=''.&mt('All Resources').''; - my $realmdescription=&mt('all resources'); + my $realmdescription=&mt('all resources'); if ($middle=~/^(.+)\_\_\_\(all\)$/) { $realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).'
('.$1.')
'; $realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); @@ -4174,6 +3939,8 @@ sub components { } my %standard_parms; + + sub load_parameter_names { open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); while (my $configline=<$config>) { @@ -4188,7 +3955,7 @@ sub load_parameter_names { close($config); $standard_parms{'int_pos'} = 'Positive Integer'; $standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; - %standard_parms=&Apache::lonlocal::texthash(%standard_parms); + %standard_parms=&Apache::lonlocal::texthash(%standard_parms); } sub standard_parameter_names { @@ -4197,19 +3964,18 @@ sub standard_parameter_names { &load_parameter_names(); } if ($standard_parms{$name}) { - return $standard_parms{$name}; - } else { - return $name; + return $standard_parms{$name}; + } else { + return $name; } } -# -# Parameter Change Log -# sub parm_change_log { my ($r)=@_; + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', + text=>"Parameter Change Log"}); $r->print(&Apache::loncommon::start_page('Parameter Change Log')); $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); @@ -4221,7 +3987,7 @@ sub parm_change_log { $r->print('
'); - + my %saveable_parameters = ('show' => 'scalar',); &Apache::loncommon::store_course_settings('parameter_log', \%saveable_parameters); @@ -4249,7 +4015,7 @@ sub parm_change_log { } if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } } - foreach my $id (sort + foreach my $id (sort { if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} @@ -4262,15 +4028,15 @@ sub parm_change_log { my $count = 0; my $time = &Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); - my $plainname = + my $plainname = &Apache::loncommon::plainname($parmlog{$id}{'exe_uname'}, $parmlog{$id}{'exe_udom'}); - my $about_me_link = + my $about_me_link = &Apache::loncommon::aboutmewrapper($plainname, $parmlog{$id}{'exe_uname'}, $parmlog{$id}{'exe_udom'}); my $send_msg_link=''; - if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) + if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) || ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { $send_msg_link ='
'. &Apache::loncommon::messagewrapper(&mt('Send message'), @@ -4293,8 +4059,8 @@ sub parm_change_log { } } if ($typeflag) { - $istype{$parmname}=$value; - if (!$env{'form.includetypes'}) { next; } + $istype{$parmname}=$value; + if (!$env{'form.includetypes'}) { next; } } $count++; if ($makenewrow) { @@ -4332,12 +4098,12 @@ sub parm_change_log { my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription, (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); if (($uname) && ($udom)) { - $output .= + $output .= &Apache::loncommon::messagewrapper('Notify User', $uname,$udom,$title, $description); } else { - $output .= + $output .= &Apache::lonrss::course_blog_link($id,$title, $description); } @@ -4348,7 +4114,7 @@ sub parm_change_log { my $wholeentry=$about_me_link.':'. $parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'. $output; - if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } + if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } } if ($count) { $r->print($row_start.''.$time.' @@ -4358,43 +4124,117 @@ sub parm_change_log { $send_msg_link.''.$output); $shown++; } - if (!($env{'form.show'} eq &mt('all') + if (!($env{'form.show'} eq &mt('all') || $shown<=$env{'form.show'})) { last; } } $r->print(&Apache::loncommon::end_data_table()); $r->print(&Apache::loncommon::end_page()); } +sub update_slots { + my ($slot_name,$cdom,$cnum,$symb,$uname,$udom) = @_; + my %slot=&Apache::lonnet::get_slot($slot_name); + if (!keys(%slot)) { + return 'error: slot does not exist'; + } + my $max=$slot{'maxspace'}; + if (!defined($max)) { $max=99999; } + + my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum, + "^$slot_name\0"); + my ($tmp)=%consumed; + if ($tmp=~/^error: 2 / ) { + return 'error: unable to determine current slot status'; + } + my $last=0; + foreach my $key (keys(%consumed)) { + my $num=(split('\0',$key))[1]; + if ($num > $last) { $last=$num; } + if ($consumed{$key}->{'name'} eq $uname.':'.$udom) { + return 'ok'; + } + } + + if (scalar(keys(%consumed)) >= $max) { + return 'error: no space left in slot'; + } + my $wanted=$last+1; + + my %reservation=('name' => $uname.':'.$udom, + 'timestamp' => time, + 'symb' => $symb); + + my $success=&Apache::lonnet::newput('slot_reservations', + {"$slot_name\0$wanted" => + \%reservation}, + $cdom, $cnum); + if ($success eq 'ok') { + my %storehash = ( + symb => $symb, + slot => $slot_name, + action => 'reserve', + context => 'parameter', + ); + &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + '',$uname,$udom,$cnum,$cdom); + + &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, + '',$uname,$udom,$uname,$udom); + } + return $success; +} + +sub delete_slots { + my ($slot_name,$cdom,$cnum,$uname,$udom,$symb) = @_; + my $delresult; + my %consumed = &Apache::lonnet::dump('slot_reservations',$cdom, + $cnum, "^$slot_name\0"); + if (&Apache::lonnet::error(%consumed)) { + return 'error: unable to determine current slot status'; + } + my ($tmp)=%consumed; + if ($tmp=~/^error: 2 /) { + return 'error: unable to determine current slot status'; + } + foreach my $key (keys(%consumed)) { + if ($consumed{$key}->{'name'} eq $uname.':'.$udom) { + my $num=(split('\0',$key))[1]; + my $entry = $slot_name.'\0'.$num; + $delresult = &Apache::lonnet::del('slot_reservations',[$entry], + $cdom,$cnum); + if ($delresult eq 'ok') { + my %storehash = ( + symb => $symb, + slot => $slot_name, + action => 'release', + context => 'parameter', + ); + &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + 1,$uname,$udom,$cnum,$cdom); + &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, + 1,$uname,$udom,$uname,$udom); + } + } + } + return $delresult; +} + sub check_for_course_info { my $navmap = Apache::lonnavmaps::navmap->new(); return 1 if ($navmap); return 0; } -################################################## -################################################## - -=pod - -=item * handler - -Main handler. Calls &assessparms and &crsenv subroutines. - -=cut - -################################################## -################################################## sub handler { my $r=shift; &reset_caches(); - if ($r->header_only) { - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - return OK; - } + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + return OK if $r->header_only; + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['action','state', 'pres_marker', @@ -4408,7 +4248,8 @@ sub handler { text=>"Parameter Manager", faq=>10, bug=>'Instructor Interface', - help => 'Parameter_Manager'}); + help => + 'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); # ----------------------------------------------------- Needs to be in a course my $parm_permission = @@ -4418,12 +4259,6 @@ sub handler { my $exists = &check_for_course_info(); if ($env{'request.course.id'} && $parm_permission && $exists) { - - # Start Page - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - - # # Main switch on form.action and form.state, as appropriate # @@ -4431,66 +4266,34 @@ sub handler { # the table mode if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) && (!$env{'form.dis'})) || ($env{'form.symb'})) { - &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', - text=>"Problem Parameters"}); &assessparms($r); - } elsif (! exists($env{'form.action'})) { - $r->print(&header()); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); &print_main_menu($r,$parm_permission); - } elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', - text=>"Course Environment"}); - &crsenv($r); - } elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', - text=>"Overview Mode"}); + } elsif ($env{'form.action'} eq 'setoverview') { &overview($r); - } elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', - text=>"Add Metadata Field"}); + } elsif ($env{'form.action'} eq 'addmetadata') { &addmetafield($r); - } elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', - text=>"Add Metadata Field"}); + } elsif ($env{'form.action'} eq 'ordermetadata') { &order_meta_fields($r); - } elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', - text=>"Restrict Metadata"}); + } elsif ($env{'form.action'} eq 'setrestrictmeta') { &setrestrictmeta($r); - } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', - text=>"Overview Mode"}); + } elsif ($env{'form.action'} eq 'newoverview') { &newoverview($r); - } elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', - text=>"Set Defaults"}); + } elsif ($env{'form.action'} eq 'setdefaults') { &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'}); + } elsif ($env{'form.action'} eq 'settable') { &assessparms($r); - } elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', - text=>"Parameter Change Log"}); + } elsif ($env{'form.action'} eq 'parameterchangelog') { &parm_change_log($r); - } elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', - text=>"Clean Parameters"}); + } elsif ($env{'form.action'} eq 'cleanparameters') { &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"}); + } elsif ($env{'form.action'} eq 'dateshift1') { &date_shift_one($r); - } elsif ($env{'form.action'} eq 'dateshift2' && $parm_permission) { - &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, - text=>"Shifting Dates"}); + } elsif ($env{'form.action'} eq 'dateshift2') { &date_shift_two($r); - } elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) { + } elsif ($env{'form.action'} eq 'categorizecourse') { &assign_course_categories($r); - } + } } else { # ----------------------------- Not in a course, or not allowed to modify parms if ($exists) { @@ -4510,11 +4313,4 @@ sub handler { 1; __END__ -=pod - -=back - -=cut - -