--- loncom/interface/lonparmset.pm 2008/10/10 10:19:08 1.410 +++ loncom/interface/lonparmset.pm 2009/01/20 18:23:19 1.423 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.410 2008/10/10 10:19:08 bisitz Exp $ +# $Id: lonparmset.pm,v 1.423 2009/01/20 18:23:19 bisitz 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,282 @@ 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 crsenv() + +Show and set course data and parameters. This is a large routine that should +be simplified and shortened... someday. + +Inputs: $r + +Returns: nothing + +=item can_modify_catsettings() + +=item assign_course_categories() + +=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 and &crsenv subroutines. + + +=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, @@ -302,6 +550,8 @@ sub reset_caches { } } + + sub preset_defaults { my $type=shift; if (&rulescache($type.'_action') eq 'default') { @@ -316,7 +566,8 @@ sub preset_defaults { } } -################################################## + + sub date_sanity_info { my $checkdate=shift; @@ -325,14 +576,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 +622,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)=@_; @@ -519,25 +776,7 @@ sub storeparm_by_symb_inner { 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 +790,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 +833,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; @@ -683,6 +916,15 @@ sub startpage { my %loaditems = ('onunload' => "pclose()", 'onload' => "group_or_section('cgroup')",); + 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(), @@ -693,10 +935,10 @@ sub startpage { $start_page $breadcrumbs
- - - - + + + + ENDHEAD } @@ -728,7 +970,7 @@ sub print_row { my $parm=$$display{$which}; if ($parmlev eq 'full') { - $r->print('' + $r->print('' .$$part{$which}.''); } else { $parm=~s|\[.*\]\s||g; @@ -737,7 +979,7 @@ sub print_row { if ($automatic) { $parm.='
'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'
'; } - $r->print(''.$parm.''); + $r->print(''.$parm.''); my $thismarker=$which; $thismarker=~s/^parameter\_//; @@ -814,14 +1056,14 @@ sub print_row { } } # end of $parmlev if/else - $r->print(''.$effective_parm.''); + $r->print(''.$effective_parm.''); 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(''. + $r->print(''. &valout($sessionval,$sessionvaltype).' '. ''); } @@ -831,8 +1073,8 @@ sub print_row { sub print_td { my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; - $r->print(''); + $r->print(''); if ($which<11 || $which > 12) { $r->print(&plink($$typeoutpar[$which], $$display{$value},$$outpar[$which], @@ -858,11 +1100,11 @@ sub print_usergroups { my $grp_parm; if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { - $bgcolor = '"#AAFFAA"'; + $bgcolor = '#AAFFAA'; $grp_parm = &valout($coursereply,$resulttype); } $grp_parm = &valout($coursereply,$resulttype); - $output = ''; + $output = ''; if ($resultgroup && $resultlevel) { $output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm; } else { @@ -870,7 +1112,7 @@ sub print_usergroups { } $output .= ''; } else { - $output .= ' '; + $output .= ' '; } return ($coursereply,$output,$grp_parm,$resultgroup); } @@ -899,39 +1141,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; @@ -973,7 +1183,7 @@ sub extractResourceInformation { if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); my $parmdis = $display; - $parmdis =~ s/\[Part.*$//g; + $parmdis =~ s/\s*\[Part.*$//g; $$allparms{$name}=$parmdis; if (ref($defkeytype)) { $$defkeytype{$name}= @@ -1025,8 +1235,6 @@ sub extractResourceInformation { } -################################################## -################################################## sub isdateparm { my $type=shift; @@ -1099,16 +1307,16 @@ sub parmmenu { ENDSCRIPT $r->print(); - $r->print("\n"); + $r->print("\n".'
'); my $cnt=0; foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { - $r->print("\n'); $cnt++; if ($cnt==3) { @@ -1117,7 +1325,7 @@ ENDSCRIPT } } $r->print('' - .'' + .'' .''. &Apache::loncommon::end_data_table_row()."\n"; @@ -2925,7 +3105,7 @@ sub listdata { } if ($part ne $oldpart) { $r->print(&tableend(). - "\n".&mt('Part').": $part"); + "\n".''.&mt('Part').": $part"); $oldpart=$part; } # @@ -2946,8 +3126,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') { @@ -2960,7 +3140,7 @@ sub listdata { $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } $r->print(''); + $thistype.'" />'); $r->print(''.&Apache::loncommon::end_data_table_row()); } } @@ -3083,6 +3263,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(<'/adm/parmset?action=setoverview', + text=>"Overview Mode"}); my $start_page=&Apache::loncommon::start_page('Modify Parameters'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); $r->print(<'/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(). '
'. @@ -3350,7 +3536,7 @@ ENDOVER } } $r->print(&Apache::loncommon::end_data_table().'

'. - ''. + ''. '

'. &Apache::loncommon::end_page()); } @@ -3360,6 +3546,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(< @@ -3621,86 +3768,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 Environment', + url => '/adm/parmset?action=crsenv', + permission => $parm_permission, + linktitle =>'Edit environment settings for this course.' , + 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; @@ -3712,7 +3860,7 @@ 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) { @@ -3736,31 +3884,36 @@ sub output_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 .= '
'; + + '.&mt('Student may select multiple choices from list').''; $output .= &Apache::loncommon::end_data_table_row(); $output .= &Apache::loncommon::continue_data_table_row(); $output .= ''; + + '.&mt('Student may select only one choice from list').''; $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"}, @@ -3837,6 +3990,8 @@ sub order_meta_fields { $r->print('
' .'
'.&mt('Parameter Selection').'' .'' @@ -1160,7 +1368,7 @@ ENDSCRIPT sub partmenu { my ($r,$allparts,$psprt)=@_; - $r->print(''); $r->print(''); @@ -1185,21 +1393,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) { + $g_s_header='
'.&mt('Group/Section').'
'; + $g_s_footer='
'; + } + + $r->print('' + .$g_s_header + .$sections + .$groups + .$g_s_footer + .'
'.&mt('User').'
' + .&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]' + ,'' + ,' ' + ,$chooseopt) + .'
' + .'
' + ); } sub displaymenu { @@ -1281,7 +1493,7 @@ sub displaymenu { $r->print('
'.&mt('Select Parameters to View').''. &mt('Select Parts to View').'
'); &parmmenu($r,$allparms,$pscat,$keyorder); - $r->print(''); + $r->print(''); &partmenu($r,$allparts,$psprt); $r->print('
'); } @@ -1320,7 +1532,7 @@ sub sectionmenu { my %sectionhash = &Apache::loncommon::get_sections(); return if (!%sectionhash); - $r->print(''); foreach my $s ('all',sort keys %sectionhash) { $r->print('
'.&mt('Create New Environment Variable').'
'. - '
'. - ''. '
'.(' ' x 10).''.(' ' x 10).'
'); return 'ok'; } + + sub continue { my $output; $output .= '
'; @@ -3844,8 +3999,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'}; @@ -3890,12 +4049,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'}; @@ -3973,7 +4137,9 @@ ENDenv $r->print(&Apache::loncommon::end_page()); return 'ok'; } -################################################## + + + sub get_added_meta_fieldnames { my ($cid) = @_; my %fields; @@ -3986,6 +4152,9 @@ sub get_added_meta_fieldnames { } return \%fields; } + + + sub get_deleted_meta_fieldnames { my ($cid) = @_; my %fields; @@ -4003,6 +4172,8 @@ sub get_deleted_meta_fieldnames { sub defaultsetter { my ($r) = @_; + &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'); @@ -4154,8 +4325,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; } @@ -4199,6 +4370,8 @@ sub components { } my %standard_parms; + + sub load_parameter_names { open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); while (my $configline=<$config>) { @@ -4228,13 +4401,12 @@ sub standard_parameter_names { } } -# -# 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')); @@ -4396,30 +4568,16 @@ sub check_for_course_info { 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', @@ -4443,12 +4601,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 # @@ -4456,64 +4608,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"}); + } elsif ($env{'form.action'} eq 'crsenv') { &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 { @@ -4535,11 +4657,4 @@ sub handler { 1; __END__ -=pod - -=back - -=cut - -