--- loncom/interface/lonparmset.pm 2010/01/30 17:37:47 1.413.4.5 +++ loncom/interface/lonparmset.pm 2009/01/28 17:13:03 1.427 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.413.4.5 2010/01/30 17:37:47 raeburn Exp $ +# $Id: lonparmset.pm,v 1.427 2009/01/28 17:13:03 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,7 +44,9 @@ This module sets coursewide and assessme =head1 INTERNAL SUBROUTINES -=over 4 +=over + +=pod =item parmval() @@ -56,26 +58,26 @@ Inputs: $what - a parameter spec (inclu Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels - 14- General Course - 13- Map or Folder level in course - 12- resource default - 11- map default - 10- resource level in course - 9 - General for section - 8 - Map or Folder level for section - 7 - resource level in section - 6 - General for group - 5 - Map or Folder level for group - 4 - resource level in group - 3 - General for specific student - 2 - Map or Folder level for specific student - 1 - resource level for specific student +14- General Course +13- Map or Folder level in course +12- resource default +11- map default +10- resource level in course +9 - General for section +8 - Map or Folder level for section +7 - resource level in section +6 - General for group +5 - Map or Folder level for group +4 - resource level in group +3 - General for specific student +2 - Map or Folder level for specific student +1 - resource level for specific student =item parmval_by_symb() =item reset_caches() -=item cacheparmhash() +=item cacheparmhash() =item parmhash() @@ -118,7 +120,7 @@ Produces a link anchor. Inputs: $type,$dis,$value,$marker,$return,$call -Returns: scalar with html code for a link which will envoke the +Returns: scalar with html code for a link which will envoke the javascript function 'pjump'. =item page_js() @@ -133,7 +135,7 @@ javascript function 'pjump'. =item parm_control_group() -=item extractResourceInformation() : +=item extractResourceInformation() : Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes. @@ -145,7 +147,6 @@ Input: See list below: =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]" @@ -190,7 +191,7 @@ Input: See list below: =item standardkeyorder() -=item assessparms() : +=item assessparms() : Show assessment data and parameters. This is a large routine that should be simplified and shortened... someday. @@ -213,6 +214,19 @@ Variables used (guessed by Jeremy): 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() @@ -250,11 +264,11 @@ Variables used (guessed by Jeremy): =item check_cloners() : Checks if new users included in list of allowed cloners -are valid users. Replaces supplied list with +are valid users. Replaces supplied list with cleaned list containing only users with valid usernames and domains. -Inputs: $clonelist, $oldcloner +Inputs: $clonelist, $oldcloner where $clonelist is ref to array of requested cloners, and $oldcloner is ref to array of currently allowed cloners. @@ -270,8 +284,8 @@ change is made to the list of users allo 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. +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() @@ -306,16 +320,15 @@ Set portfolio metadata =item parm_change_log() -=item handler() : +=item handler() : -Main handler. Calls &assessparms subroutine. +Main handler. Calls &assessparms and &crsenv subroutines. =back =cut - ################################################################### ################################################################### @@ -335,6 +348,7 @@ 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, @@ -537,6 +551,7 @@ sub reset_caches { } + sub preset_defaults { my $type=shift; if (&rulescache($type.'_action') eq 'default') { @@ -552,6 +567,8 @@ sub preset_defaults { } + + sub date_sanity_info { my $checkdate=shift; unless ($checkdate) { return ''; } @@ -759,6 +776,7 @@ sub storeparm_by_symb_inner { return ''; } + sub valout { my ($value,$type,$editable)=@_; my $result = ''; @@ -815,6 +833,7 @@ sub valout { return $result; } + sub plink { my ($type,$dis,$value,$marker,$return,$call)=@_; my $winvalue=$value; @@ -829,7 +848,6 @@ 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,'"<>&'); @@ -837,7 +855,7 @@ sub plink { } return '
'. ''. + .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. $valout.'
'; } @@ -898,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(), @@ -947,6 +974,7 @@ sub print_row { .$$part{$which}.''); } else { $parm=~s|\[.*\]\s||g; + $parm=&mt($parm); } my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); if ($automatic) { @@ -1040,26 +1068,20 @@ sub print_row { &valout($sessionval,$sessionvaltype).' '. ''); } + $r->print(''); + $r->print("\n"); } sub print_td { my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; $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])); + if ($which<11 || $which > 12) { + $r->print(&plink($$typeoutpar[$which], + $$display{$value},$$outpar[$which], + $mprefix."$which",'parmform.pres','psub')); } else { - $r->print(&plink($$typeoutpar[$which], - $$display{$value},$$outpar[$which], - $mprefix."$which",'parmform.pres','psub')); + $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); } $r->print(''."\n"); } @@ -1120,6 +1142,8 @@ sub parm_control_group { return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype); } + + sub extractResourceInformation { my $ids = shift; my $typep = shift; @@ -1158,15 +1182,9 @@ sub extractResourceInformation { # my $name=&Apache::lonnet::metadata($srcf,$key.'.name'); if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) { - 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 = &mt($display); - } + my $display= &Apache::lonnet::metadata($srcf,$key.'.display'); + my $parmdis = $display; + $parmdis =~ s/\s*\[Part.*$//g; $$allparms{$name}=$parmdis; if (ref($defkeytype)) { $$defkeytype{$name}= @@ -1218,8 +1236,6 @@ sub extractResourceInformation { } -################################################## -################################################## sub isdateparm { my $type=shift; @@ -1300,9 +1316,9 @@ ENDSCRIPT if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { $r->print(' checked="checked"'); } - $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} - : $tempkey). - ''); + $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey}) + : &mt($tempkey)) + .''); $cnt++; if ($cnt==3) { $r->print("\n"); @@ -1517,7 +1533,7 @@ sub sectionmenu { my %sectionhash = &Apache::loncommon::get_sections(); return if (!%sectionhash); - $r->print(''); foreach my $s ('all',sort keys %sectionhash) { $r->print('