--- loncom/interface/lonparmset.pm 2008/11/17 16:57:06 1.415 +++ loncom/interface/lonparmset.pm 2008/11/19 21:14:42 1.416 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.415 2008/11/17 16:57:06 schafran Exp $ +# $Id: lonparmset.pm,v 1.416 2008/11/19 21:14:42 jms 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; @@ -371,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)=@_; @@ -536,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 = ''; @@ -611,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; @@ -936,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; @@ -1062,8 +1235,6 @@ sub extractResourceInformation { } -################################################## -################################################## sub isdateparm { my $type=shift; @@ -1464,36 +1635,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; @@ -2066,24 +2208,7 @@ ENDMAPONE } # 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=''; @@ -3492,41 +3617,7 @@ sub parse_key { return %data; } -################################################## -################################################## - -=pod - -=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. - -=cut - -################################################## -################################################## sub extract_cloners { my ($clonelist,$allowclone) = @_; @@ -3643,24 +3734,13 @@ sub change_clone { } -################################################## -################################################## - -=pod - -=item * header - -Output html header for page - -=cut -################################################## -################################################## sub header { return &Apache::loncommon::start_page('Parameter Manager'); } -################################################## -################################################## + + + sub print_main_menu { my ($r,$parm_permission)=@_; # @@ -3759,7 +3839,8 @@ ENDMAINFORMHEAD return; } -### Set portfolio metadata + + sub output_row { my ($r, $field_name, $field_text, $added_flag) = @_; my $output; @@ -3814,6 +3895,9 @@ sub output_row { } return ($output); } + + + sub order_meta_fields { my ($r)=@_; my $idx = 1; @@ -3898,6 +3982,8 @@ sub order_meta_fields { $r->print(''); return 'ok'; } + + sub continue { my $output; $output .= '
'; @@ -3905,6 +3991,8 @@ sub continue { $output .= ''; return ($output); } + + sub addmetafield { my ($r)=@_; &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', @@ -3953,6 +4041,9 @@ sub addmetafield { } $r->print('
'); } + + + sub setrestrictmeta { my ($r)=@_; my $next_meta; @@ -4038,7 +4129,9 @@ ENDenv $r->print(&Apache::loncommon::end_page()); return 'ok'; } -################################################## + + + sub get_added_meta_fieldnames { my ($cid) = @_; my %fields; @@ -4051,6 +4144,9 @@ sub get_added_meta_fieldnames { } return \%fields; } + + + sub get_deleted_meta_fieldnames { my ($cid) = @_; my %fields; @@ -4266,6 +4362,8 @@ sub components { } my %standard_parms; + + sub load_parameter_names { open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); while (my $configline=<$config>) { @@ -4295,9 +4393,6 @@ sub standard_parameter_names { } } -# -# Parameter Change Log -# sub parm_change_log { @@ -4465,19 +4560,6 @@ sub check_for_course_info { return 0; } -################################################## -################################################## - -=pod - -=item * handler - -Main handler. Calls &assessparms and &crsenv subroutines. - -=cut - -################################################## -################################################## sub handler { my $r=shift; @@ -4567,11 +4649,4 @@ sub handler { 1; __END__ -=pod - -=back - -=cut - -