Diff for /loncom/interface/lonparmset.pm between versions 1.534 and 1.545

version 1.534, 2013/06/27 18:12:22 version 1.545, 2014/06/12 22:29:42
Line 46  This module sets coursewide and assessme Line 46  This module sets coursewide and assessme
   
 =over  =over
   
 =pod  
   
 =item parmval()  =item parmval()
   
 Figure out a cascading parameter.  Figure out a cascading parameter.
Line 139  javascript function 'pjump'. Line 137  javascript function 'pjump'.
   
  extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.   extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.
   
 Input: See list below:  Input: See list below
   
   =over 4
   
 =item * B<env{'user.name'}> : Current username  =item * B<env{'user.name'}> : Current username
   
 =item * B<env{'user.domain'}> : Domain of current user.  =item * B<env{'user.domain'}> : Domain of current user.
   
 =item * b<env{"request.course.fn"} : Course  =item * B<env{"request.course.fn"}> : Course
   
   =back
   
 Outputs: See list below:  Outputs: See list below:
   
   =over 4
   
 =item * B<ids> (out) : An array that will contain all of the ids in the course.  =item * B<ids> (out) : An array that will contain all of the ids in the course.
   
 =item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.  =item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
Line 173  Outputs: See list below: Line 177  Outputs: See list below:
   
 =item * B<defkeytype>  =item * B<defkeytype>
   
   =back
   
 =item isdateparm()  =item isdateparm()
   
 =item parmmenu()  =item parmmenu()
Line 210  Returns: nothing Line 216  Returns: nothing
   
 Variables used (guessed by Jeremy):  Variables used (guessed by Jeremy):
   
   =over
   
 =item * B<pscat>: 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<pscat>: 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<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?  =item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
Line 222  Variables used (guessed by Jeremy): Line 230  Variables used (guessed by Jeremy):
         When storing information, store as part 0          When storing information, store as part 0
         When requesting information, request from full part          When requesting information, request from full part
   
   =back
   
 =item tablestart()  =item tablestart()
   
 =item tableend()  =item tableend()
Line 288  Set portfolio metadata Line 298  Set portfolio metadata
   
 Main handler.  Calls &assessparms subroutine.  Main handler.  Calls &assessparms subroutine.
   
   
 =back  =back
   
 =cut  =cut
Line 776  sub valout { Line 785  sub valout {
             $result =              $result =
                 '<img src="/res/adm/pages/editmap.png"'                  '<img src="/res/adm/pages/editmap.png"'
                .' alt="'.&mt('Change').'"'                 .' alt="'.&mt('Change').'"'
                .' title="'.&mt('Change').'" />';                 .' title="'.&mt('Change').'" style="border:0;" />';
         } else {          } else {
             $result='&nbsp;';              $result='&nbsp;';
         }          }
Line 1401  sub lookUpTableParameter { Line 1410  sub lookUpTableParameter {
         'contentopen' => 'time_settings',          'contentopen' => 'time_settings',
         'contentclose' => 'time_settings',          'contentclose' => 'time_settings',
         'discussend' => 'time_settings',          'discussend' => 'time_settings',
  'printopendate' => 'time_settings',   'printstartdate' => 'time_settings',
  'printclosedate' => 'time_settings',   'printenddate' => 'time_settings',
         'weight' => 'grading',          'weight' => 'grading',
         'handgrade' => 'grading',          'handgrade' => 'grading',
         'maxtries' => 'tries',          'maxtries' => 'tries',
Line 1510  sub parmboxes { Line 1519  sub parmboxes {
         &whatIsMyCategory($tempparameter, \%categoryList);          &whatIsMyCategory($tempparameter, \%categoryList);
     }      }
     #part to print the parm-list      #part to print the parm-list
     $r->print('<div class="LC_columnSection">'."\n");      foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) {
           next if (@{$categoryList{$key}} == 0);
     #Print parameters          next if ($key eq '');
     for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {          $r->print('<div class="LC_Box LC_400Box">'
         if(@{$categoryList{$key}} == 0) {                   .'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n");
             next;          foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
         } else {               $r->print('<span class="LC_nobreak">'
             $r->print('<div class="LC_Box LC_400Box">'                       .'<label><input type="checkbox" name="pscat" '
                      .'<h4 class="LC_hcell">'                       .'value="'.$tempkey.'" ');
                      .&mt($categories{$key})              if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
                      .'</h4>'."\n");                  $r->print( ' checked="checked"');
             foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {  
                     $r->print('<span class="LC_nobreak">'  
                              .'<label><input type="checkbox" name="pscat" ');  
                 $r->print('value="'.$tempkey.'" ');  
                 if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {  
                     $r->print(' checked="checked"');  
                 }  
                 $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}  
                                                       : $tempkey)  
                         .'</label></span><br />'."\n");  
             }              }
             $r->print("</div>\n");              $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
                                                         : $tempkey)
                        .'</label></span><br />'."\n");
         }          }
           $r->print('</div>');
     }      }
       $r->print("\n");
     $r->print("</div>\n");  
 }  }
 #  #
 # This function offers some links on the parameter section to get with one click a group a parameters  # This function offers some links on the parameter section to get with one click a group a parameters
Line 1701  function group_or_section(caller) { Line 1702  function group_or_section(caller) {
 # This function shows on table Mode the available Parameters for the selected Resources  # This function shows on table Mode the available Parameters for the selected Resources
 #  #
 sub displaymenu {  sub displaymenu {
     my ($r,$allparms,$pscat,$psprt,$keyorder)=@_;      my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_;
   
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
   
     &parmmenu($r,$allparms,$pscat,$keyorder);      &parmmenu($r,$allparms,$pscat,$keyorder);
     $r->print(&Apache::loncommon::start_scrollbox());      $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid));
     &parmboxes($r,$allparms,$pscat,$keyorder);      &parmboxes($r,$allparms,$pscat,$keyorder);
     $r->print(&Apache::loncommon::end_scrollbox());      $r->print(&Apache::loncommon::end_scrollbox());
   
Line 1781  sub mapmenu { Line 1782  sub mapmenu {
            .'</div>'             .'</div>'
         );          );
   
         $r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll'));          $r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll'));
         $r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));          $r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));
   
         # Display row: "All Maps or Folders"          # Display row: "All Maps or Folders"
Line 1992  sub standardkeyorder { Line 1993  sub standardkeyorder {
         'parameter_0_discussend' => 19,          'parameter_0_discussend' => 19,
         'parameter_0_discusshide' => 20,          'parameter_0_discusshide' => 20,
         'parameter_0_discussvote' => 21,          'parameter_0_discussvote' => 21,
  'parameter_0_printopendate'  =>  22,   'parameter_0_printstartdate'  =>  22,
  'parameter_0_printclosedate' =>  23);   'parameter_0_printenddate' =>  23);
 }  }
   
   
Line 2096  sub assessparms { Line 2097  sub assessparms {
             $id='';              $id='';
         } else {          } else {
             $message=              $message=
             '<span class="LC_error">'.&mt("Unknown ID")." '$id' ".                  '<p class="LC_warning">'.
             &mt('at domain')." '$udom'</span>";                  &mt('Unknown ID [_1] at domain [_2]',
                       "'".$id."'","'".$udom."'").
                   '</p>';
         }          }
     } else {      } else {
         $uname=$env{'form.uname'};          $uname=$env{'form.uname'};
Line 2108  sub assessparms { Line 2111  sub assessparms {
         $uhome=&Apache::lonnet::homeserver($uname,$udom);          $uhome=&Apache::lonnet::homeserver($uname,$udom);
         if ($uhome eq 'no_host') {          if ($uhome eq 'no_host') {
             $message=              $message=
             '<span class="LC_error">'.&mt("Unknown user")." '$uname' ".                  '<p class="LC_warning">'.
             &mt("at domain")." '$udom'</span>";                  &mt('Unknown user [_1] at domain [_2]',
                       "'".$uname."'","'".$udom."'").
                   '</p>';
             $uname='';              $uname='';
         } else {          } else {
             $csec=&Apache::lonnet::getsection($udom,$uname,              $csec=&Apache::lonnet::getsection($udom,$uname,
                           $env{'request.course.id'});                            $env{'request.course.id'});
             if ($csec eq '-1') {              if ($csec eq '-1') {
                 $message='<span class="LC_error">'.                  $message=
                 &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".                      '<p class="LC_warning">'.
                 &mt("not in this course")."</span>";                      &mt('User [_1] at domain [_2] not in this course',
                           "'".$uname."'","'".$udom."'").
                       '</p>';
                 $uname='';                  $uname='';
                 $csec=$env{'form.csec'};                  $csec=$env{'form.csec'};
                 $cgroup=$env{'form.cgroup'};                  $cgroup=$env{'form.cgroup'};
Line 2198  sub assessparms { Line 2205  sub assessparms {
                 $name = $1;                  $name = $1;
                 my $val = $values[$i];                  my $val = $values[$i];
                 if ($name eq 'examcode') {                  if ($name eq 'examcode') {
                    if (&Apache::lonnet::validCODE($values[$i])) {                      if (&Apache::lonnet::validCODE($values[$i])) {
                        $val = 'valid';                              $val = 'valid';
                    }                      }
                 }                  }
                 $needsrelease =                  $needsrelease =
                     $Apache::lonnet::needsrelease{"parameter:$name:$val"};                      $Apache::lonnet::needsrelease{"parameter:$name:$val"};
Line 2211  sub assessparms { Line 2218  sub assessparms {
                     }                      }
                     $needsnewer = &parameter_releasecheck($name,$val,                      $needsnewer = &parameter_releasecheck($name,$val,
                                                           $needsrelease,                                                            $needsrelease,
                                                           $chostname,  
                                                           $cmajor,$cminor);                                                            $cmajor,$cminor);
                 }                  }
             }              }
Line 2293  ENDPARMSELSCRIPT Line 2299  ENDPARMSELSCRIPT
   
         # Step 2          # Step 2
         $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));          $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
         &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);          &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
   
         # Step 3          # Step 3
         $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));          $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
Line 2381  ENDPARMSELSCRIPT Line 2387  ENDPARMSELSCRIPT
                        $userspan ++;                         $userspan ++;
                    }                     }
                    $r->print('<th colspan="'.$userspan.'" rowspan="2">');                     $r->print('<th colspan="'.$userspan.'" rowspan="2">');
                    $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>");                     $r->print(&mt('User [_1] at Domain [_2]',"'".$uname."'","'".$udom."'").'</th>');
                }                 }
                my %lt=&Apache::lonlocal::texthash(                 my %lt=&Apache::lonlocal::texthash(
                 'pie'    => "Parameter in Effect",                  'pie'    => "Parameter in Effect",
Line 2868  sub storedata { Line 2874  sub storedata {
                     }                      }
                     $needsnewer = &parameter_releasecheck($name,$data,                      $needsnewer = &parameter_releasecheck($name,$data,
                                                           $needsrelease,                                                            $needsrelease,
                                                           $chostname,$cmajor,                                                            $cmajor,$cminor);
                                                           $cminor);  
                 }                  }
                 if ($needsnewer) {                  if ($needsnewer) {
                     $r->print('<br />'.&oldversion_warning($name,$data,                      $r->print('<br />'.&oldversion_warning($name,$data,
Line 3223  sub string_selector { Line 3228  sub string_selector {
                     $got_chostname = 1;                      $got_chostname = 1;
                 }                  }
                 my $needsnewer=&parameter_releasecheck($name,$parmval,$needsrelease,                  my $needsnewer=&parameter_releasecheck($name,$parmval,$needsrelease,
                                                        $chostname,$cmajor,                                                         $cmajor,$cminor);
                                                        $cminor);  
                 if ($needsnewer) {                  if ($needsnewer) {
                     $skiptype{$parmval} = 1;                      $skiptype{$parmval} = 1;
                 }                  }
Line 3643  sub date_shift_one { Line 3647  sub date_shift_one {
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
     $r->print($start_page.$breadcrumbs);      $r->print($start_page.$breadcrumbs);
     &startSettingsScreen($r,'parmset',$crstype);      &startSettingsScreen($r,'parmset',$crstype);
     $r->print('<form name="shiftform" method="post">'.      $r->print('<form name="shiftform" method="post" action="">'.
               '<table><tr><td>'.&mt('Currently set date:').'</td><td>'.                '<table><tr><td>'.&mt('Currently set date:').'</td><td>'.
               &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'.                &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'.
               '<tr><td>'.&mt('Shifted date:').'</td><td>'.                '<tr><td>'.&mt('Shifted date:').'</td><td>'.
                     &Apache::lonhtmlcommon::dshowerfuck.net                      &Apache::lonhtmlcommon::date_setter('shiftform',
 ate_setter('shiftform',  
                                                         'timeshifted',                                                          'timeshifted',
                                                         $env{'form.timebase'},,                                                          $env{'form.timebase'},,
                                                         '').                                                          '').
Line 3672  sub date_shift_two { Line 3675  sub date_shift_two {
     $r->print($start_page.$breadcrumbs);      $r->print($start_page.$breadcrumbs);
     &startSettingsScreen($r,'parmset',$crstype);      &startSettingsScreen($r,'parmset',$crstype);
     my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');      my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
     $r->print(&mt('Shifting all dates such that [_1] becomes [_2]',      $r->print('<h2>'.&mt('Shift Dates').'</h2>'.
                 '<p>'.&mt('Shifting all dates such that [_1] becomes [_2]',
               &Apache::lonlocal::locallocaltime($env{'form.timebase'}),                &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
               &Apache::lonlocal::locallocaltime($timeshifted)));                &Apache::lonlocal::locallocaltime($timeshifted)).'</p>');
     my $delta=$timeshifted-$env{'form.timebase'};      my $delta=$timeshifted-$env{'form.timebase'};
     &dateshift($delta);      &dateshift($delta);
       $r->print(
           &Apache::lonhtmlcommon::confirm_success(&mt('Done')).
           '<br /><br />'.
           &Apache::lonhtmlcommon::actionbox(
               ['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>']));
     &endSettingsScreen($r);      &endSettingsScreen($r);
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
 }  }
Line 3818  ENDMAINFORMHEAD Line 3827  ENDMAINFORMHEAD
             }]}              }]}
           );            );
     $r->print(&Apache::lonhtmlcommon::generate_menu(@menu));      $r->print(&Apache::lonhtmlcommon::generate_menu(@menu));
       $r->print('</form>');
     &endSettingsScreen($r);      &endSettingsScreen($r);
       $r->print(&Apache::loncommon::end_page());
     return;      return;
 }  }
   
Line 3949  sub order_meta_fields { Line 3960  sub order_meta_fields {
     foreach my $key (@fields_in_order) {      foreach my $key (@fields_in_order) {
         $r->print('<tr><td>');          $r->print('<tr><td>');
         $r->print('<form method="post" action="">');          $r->print('<form method="post" action="">');
         $r->print('<select name="newpos" onChange="this.form.submit()">');          $r->print('<select name="newpos" onchange="this.form.submit()">');
         for (my $i = 1;$i le $num_fields;$i ++) {          for (my $i = 1;$i le $num_fields;$i ++) {
             if ($i eq $idx) {              if ($i eq $idx) {
                 $r->print('<option value="'.$i.'"  SELECTED>('.$i.')</option>');                  $r->print('<option value="'.$i.'"  SELECTED>('.$i.')</option>');
Line 4685  sub parameter_release_vars { Line 4696  sub parameter_release_vars {
 }  }
   
 sub parameter_releasecheck {  sub parameter_releasecheck {
     my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_;      my ($name,$value,$needsrelease,$cmajor,$cminor) = @_;
     my $needsnewer;      my $needsnewer;
     my ($needsmajor,$needsminor) = split(/\./,$needsrelease);      my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
     if (($cmajor < $needsmajor) ||       if (($cmajor < $needsmajor) || 
Line 4709  sub oldversion_warning { Line 4720  sub oldversion_warning {
                       );                        );
     if (exists($stringtypes{$name})) {      if (exists($stringtypes{$name})) {
         if ($name eq 'examcode') {          if ($name eq 'examcode') {
               $desc = $value;
         } elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {          } elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
             foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {              foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {
                 next unless (ref($possibilities) eq 'ARRAY');                  next unless (ref($possibilities) eq 'ARRAY');

Removed from v.1.534  
changed lines
  Added in v.1.545


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>