Diff for /loncom/interface/lonparmset.pm between versions 1.509 and 1.513

version 1.509, 2011/01/15 16:21:42 version 1.513, 2011/05/23 09:29:27
Line 137  javascript function 'pjump'. Line 137  javascript function 'pjump'.
   
 =item extractResourceInformation() :   =item extractResourceInformation() : 
   
 Given the course data hash, extractResourceInformation extracts lots of information about 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:
   
 =item * B<ids> : An array that will contain all of the ids in the course.  =item * B<env{'user.name'}> : Current username
   
 =item * B<typep> : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.  =item * B<env{'user.domain'}> : Domain of current user.
   
 =item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id  =item * b<env{"request.course.fn"} : Course
   
 =item * B<allparms> : hash, name of parameter->display value (what is the display value?)  Outputs: See list below:
   
 =item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]"  =item * B<ids> (out) : An array that will contain all of the ids in the course.
   
 =item * B<allkeys> : hash, full key to part->display value (what's display value?)  =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<allmaps> : hash, ???  =item * B<keyp> (out) : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
   
 =item * B<fcat> : ???  =item * B<allparms> (out) : hash, name of parameter->display value (what is the display value?)
   
 =item * B<defp> : hash, ???  =item * B<allparts> (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]"
   
   =item * B<allmaps> (out) : hash, ???
   
 =item * B<mapp> : ??  =item * B<mapp> : ??
   
 =item * B<symbp> : hash, id->full sym?  =item * B<symbp> : hash, id->full sym?
   
   =item * B<maptitles>
   
   =item * B<uris>
   
   =item * B<keyorder>
   
   =item * B<defkeytype>
   
 =item isdateparm()  =item isdateparm()
   
Line 196  Input: See list below: Line 204  Input: See list below:
 Show assessment data and parameters.  This is a large routine that should  Show assessment data and parameters.  This is a large routine that should
 be simplified and shortened... someday.  be simplified and shortened... someday.
   
 Inputs: $r  Inputs: $r - the Apache request object.
     
 Returns: nothing  Returns: nothing
   
 Variables used (guessed by Jeremy):  Variables used (guessed by Jeremy):
Line 1165  sub extractResourceInformation { Line 1173  sub extractResourceInformation {
         $$typep{$id}=$1;          $$typep{$id}=$1;
         $$keyp{$id}='';          $$keyp{$id}='';
         $$uris{$id}=$srcf;          $$uris{$id}=$srcf;
   
         foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {          foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
             next if ($key!~/^parameter_/);              next if ($key!~/^parameter_/);
   
Line 1264  sub parmmenu { Line 1273  sub parmmenu {
             ele = document.forms.parmform.elements[i];              ele = document.forms.parmform.elements[i];
             if (ele.name == checkName) {              if (ele.name == checkName) {
                 document.forms.parmform.elements[i].checked=value;                  document.forms.parmform.elements[i].checked=value;
                 document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview;  
             }              }
         }          }
     }      }
   
     function checkthis(thisvalue, checkName) {      function checkthis(thisvalue, checkName) {
   
         document.getElementById(thisvalue.concat("_li")).style.display = "";          
   
     for (i=0; i<document.forms.parmform.elements.length; i++) {      for (i=0; i<document.forms.parmform.elements.length; i++) {
             ele = document.forms.parmform.elements[i];              ele = document.forms.parmform.elements[i];
Line 1322  sub parmmenu { Line 1329  sub parmmenu {
     checkthis('problemstatus','pscat');      checkthis('problemstatus','pscat');
     }      }
   
     function hideParms() {  
         document.getElementById('LC_parm_overview_parm_menu').style.display = "none";  
     }  
   
     function showParms() {  
         document.getElementById('LC_parm_overview_parm_menu').style.display = "";  
     }  
   
     function checkboxChecked(id) {  
         var li = "_li";  
         var id_li = id.concat(li);  
         if (document.getElementById(id_li).style.display == "none") {  
             document.getElementById(id_li).style.display = "";  
         }  
         else {  
             document.getElementById(id_li).style.display = "none";  
         }  
     }  
 // ]]>  // ]]>
 </script>  </script>
 ENDSCRIPT  ENDSCRIPT
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));  
   
     #part to print selected parms overview  
     $r->print(&mt('Selected Parameters:').'<br />');  
   
     #print out all possible parms and hide them by default  
     $r->print('<ul class="LC_parm_parmlist">');  
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {  
         $r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"');  
         if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) {  
             $r->print(' style="display:none"');  
         }  
         $r->print('>'  
                  .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey)  
                  .'</li>'  
         );  
     }  
     $r->print('</ul>');  
   
     $r->print('<hr />');      $r->print('<hr />');
     &shortCuts($r,$allparms,$pscat,$keyorder);      &shortCuts($r,$allparms,$pscat,$keyorder);
     $r->print('<hr />');      $r->print('<hr />');
   
     $r->print(  
         '<p><a href="javascript:showParms()">'  
        .&mt('Show detailed Parameter Selection')  
        .'</a></p>'  
     );  
   
     $r->print(&Apache::lonhtmlcommon::row_closure(1));  
 }  }
 # return a hash  # return a hash
 sub categories {  sub categories {
Line 1399  sub lookUpTableParameter { Line 1362  sub lookUpTableParameter {
         'contentopen' => 'time_settings',          'contentopen' => 'time_settings',
         'contentclose' => 'time_settings',          'contentclose' => 'time_settings',
         'discussend' => 'time_settings',          'discussend' => 'time_settings',
    'printopendate' => 'time_settings',
    'printclosedate' => 'time_settings',
         'weight' => 'grading',          'weight' => 'grading',
         'handgrade' => 'grading',          'handgrade' => 'grading',
         'maxtries' => 'tries',          'maxtries' => 'tries',
Line 1498  sub parmboxes { Line 1463  sub parmboxes {
         'file_submission' => [],          'file_submission' => [],
         'misc' => [],          'misc' => [],
     );      );
     my $hidelink =  
         '<p>'  
        .'<a href="javascript:hideParms()">'  
        .&mt('Hide detailed Parameter Selection')  
        .'</a>'  
        .'</p>'  
        ."\n";  
 ;  
     foreach $tempparameter (keys %$allparms) {      foreach $tempparameter (keys %$allparms) {
         &whatIsMyCategory($tempparameter, \%categoryList);          &whatIsMyCategory($tempparameter, \%categoryList);
     }      }
     #part to print the parm-list      #part to print the parm-list
     $r->print(      $r->print('<div class="LC_columnSection">'."\n");
         '<div id="LC_parm_overview_parm_menu" class="LC_Box" style="display:none">'."\n"  
        .'<h3>'.&mt('Parameter').'</h3>'."\n"  
        .$hidelink  
        .'<div class="LC_columnSection">'."\n"  
     );  
   
     #Print parameters      #Print parameters
     for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {      for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
Line 1530  sub parmboxes { Line 1483  sub parmboxes {
                     $r->print('<span class="LC_nobreak">'                      $r->print('<span class="LC_nobreak">'
                              .'<label><input type="checkbox" name="pscat" ');                               .'<label><input type="checkbox" name="pscat" ');
                 $r->print('value="'.$tempkey.'" ');                  $r->print('value="'.$tempkey.'" ');
                 $r->print('onclick="checkboxChecked(\''.$tempkey.'\')"');  
                 if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {                  if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
                     $r->print(' checked="checked"');                      $r->print(' checked="checked"');
                 }                  }
Line 1542  sub parmboxes { Line 1494  sub parmboxes {
         }          }
     }      }
   
     #&shortCuts($r,$allparms,$pscat,$keyorder);      $r->print("</div>\n");
     $r->print(  
         "</div>\n"  
        .$hidelink  
        ."</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 1708  function group_or_section(caller) { Line 1655  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,$allparts,$pscat,$psprt,$keyorder)=@_;      my ($r,$allparms,$pscat,$psprt,$keyorder)=@_;
   
     $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')));
   
     &parmmenu($r,$allparms,$pscat,$keyorder);      &parmmenu($r,$allparms,$pscat,$keyorder);
     $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::loncommon::start_scrollbox());
     &parmboxes($r,$allparms,$pscat,$keyorder);      &parmboxes($r,$allparms,$pscat,$keyorder);
       $r->print(&Apache::loncommon::end_scrollbox());
   
       $r->print(&Apache::lonhtmlcommon::row_closure(1));
       $r->print(&Apache::lonhtmlcommon::end_pick_box());
    
 }  }
   
 sub mapmenu {  sub mapmenu {
Line 1988  sub standardkeyorder { Line 1943  sub standardkeyorder {
         'parameter_0_sig' => 17,          'parameter_0_sig' => 17,
         'parameter_0_turnoffunit' => 18,          'parameter_0_turnoffunit' => 18,
             'parameter_0_discussend' => 19,              'parameter_0_discussend' => 19,
             'parameter_0_discusshide' => 20);              'parameter_0_discusshide' => 20,
    'parameter_0_printopendate'  =>  21,
    'parameter_0_printclosedate' =>  22);
 }  }
   
   
Line 1996  sub assessparms { Line 1953  sub assessparms {
   
     my $r=shift;      my $r=shift;
   
   
   
   # -------------------------------------------------------- Variable declaration
     my @ids=();      my @ids=();
     my %symbp=();      my %symbp=();
     my %mapp=();      my %mapp=();
Line 2003  sub assessparms { Line 1963  sub assessparms {
     my %keyp=();      my %keyp=();
     my %uris=();      my %uris=();
     my %maptitles=();      my %maptitles=();
   
 # -------------------------------------------------------- Variable declaration  
   
     my %allmaps=();      my %allmaps=();
     my %alllevs=();      my %alllevs=();
   
Line 2024  sub assessparms { Line 1981  sub assessparms {
   
     my %allparms;      my %allparms;
     my %allparts;      my %allparts;
   # ------------------------------------------------------------------------------
   
 #  #
 # Order in which these parameters will be displayed  # Order in which these parameters will be displayed
 #  #
     my %keyorder=&standardkeyorder();      my %keyorder=&standardkeyorder();
   
     @ids=();  #    @ids=();
     %symbp=();  #    %symbp=();       # These seem defined above already.
     %typep=();  #    %typep=();
   
     my $message='';      my $message='';
   
Line 2153  sub assessparms { Line 2112  sub assessparms {
         my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};          my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
         my ($got_chostname,$chostname,$cmajor,$cminor);          my ($got_chostname,$chostname,$cmajor,$cminor);
         my $totalstored = 0;          my $totalstored = 0;
   
   
         for (my $i=0;$i<=$#markers;$i++) {          for (my $i=0;$i<=$#markers;$i++) {
             my ($needsrelease,$needsnewer);              my ($needsrelease,$needsnewer);
             if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {              if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
Line 2288  COURSECONTENTSCRIPT Line 2249  COURSECONTENTSCRIPT
   
         # Step 2          # Step 2
         $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification')));          $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification')));
         &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);          &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);
   
         # Step 3          # Step 3
         $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)')));          $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)')));
Line 2300  COURSECONTENTSCRIPT Line 2261  COURSECONTENTSCRIPT
         # Update Display Button          # Update Display Button
         $r->print('<p>'          $r->print('<p>'
              .'<input type="submit" name="dis"'               .'<input type="submit" name="dis"'
              .' value="'.&mt('Update Parameter Display').'" />'               .' value="'.&mt('Update Display').'" />'
              .'<input type="hidden" name="hideparmsel" value="hidden" />'               .'<input type="hidden" name="hideparmsel" value="hidden" />'
              .'</p>');               .'</p>');
         $r->print('</div>');          $r->print('</div>');
Line 2336  COURSECONTENTSCRIPT Line 2297  COURSECONTENTSCRIPT
         $r->print(&Apache::lonhtmlcommon::end_pick_box());          $r->print(&Apache::lonhtmlcommon::end_pick_box());
         $r->print('<p>'          $r->print('<p>'
              .'<input type="submit" name="dis"'               .'<input type="submit" name="dis"'
              .' value="'.&mt('Update Parameter Display').'" />'               .' value="'.&mt('Update Display').'" />'
              .'<input type="hidden" name="hideparmsel" value="hidden" />'               .'<input type="hidden" name="hideparmsel" value="hidden" />'
              .'</p>');               .'</p>');
     }      }
Line 2481  ENDTABLEHEADFOUR Line 2442  ENDTABLEHEADFOUR
                     my $uri=&Apache::lonnet::declutter($uris{$rid});                      my $uri=&Apache::lonnet::declutter($uris{$rid});
   
                     my $filter=$env{'form.filter'};                      my $filter=$env{'form.filter'};
   
                     foreach (&keysplit($keyp{$rid})) {                      foreach (&keysplit($keyp{$rid})) {
                         my $tempkeyp = $_;                          my $tempkeyp = $_;
                         if (grep $_ eq $tempkeyp, @catmarker) {                          if (grep $_ eq $tempkeyp, @catmarker) {
Line 2536  ENDTABLEHEADFOUR Line 2496  ENDTABLEHEADFOUR
                         $r->print('<td style="background-color:'.$defbgone.';"'.                          $r->print('<td style="background-color:'.$defbgone.';"'.
                                       ' rowspan='.$totalparms.                                        ' rowspan='.$totalparms.
                                       '>'.$maptitles{$mapp{$rid}}.'</td>');                                        '>'.$maptitles{$mapp{$rid}}.'</td>');
   
                         foreach (&keysinorder_bytype(\%name,\%keyorder)) {                          foreach (&keysinorder_bytype(\%name,\%keyorder)) {
   
                             unless ($firstrow) {                              unless ($firstrow) {
                                 $r->print('<tr>');                                  $r->print('<tr>');
                             } else {                              } else {
Line 3378  ENDOVER Line 3338  ENDOVER
   
     $r->print('<div class="LC_Box">');      $r->print('<div class="LC_Box">');
     $r->print('<div>');      $r->print('<div>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      &displaymenu($r,\%allparms,\@pscat,\%keyorder);
     &parmmenu($r,\%allparms,\@pscat,\%keyorder);  
     $r->print(&Apache::lonhtmlcommon::end_pick_box());  
     &parmboxes($r,\%allparms,\@pscat,\%keyorder);  
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));
     $r->print('<table>'.      $r->print('<table>'.
Line 3608  sub date_shift_one { Line 3565  sub date_shift_one {
               '<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::date_setter('shiftform',                      &Apache::lonhtmlcommon::dshowerfuck.net
   ate_setter('shiftform',
                                                         'timeshifted',                                                          'timeshifted',
                                                         $env{'form.timebase'},,                                                          $env{'form.timebase'},,
                                                         '').                                                          '').

Removed from v.1.509  
changed lines
  Added in v.1.513


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