Diff for /loncom/interface/lonhelper.pm between versions 1.65 and 1.71

version 1.65, 2004/03/08 17:31:37 version 1.71, 2004/04/21 17:29:57
Line 263  sub real_handler { Line 263  sub real_handler {
   
   
     # Send header, don't cache this page      # Send header, don't cache this page
     if ($r->header_only) {  
         if ($ENV{'browser.mathml'}) {  
             $r->content_type('text/xml; charset=UTF-8');  
         } else {  
             $r->content_type('text/html; charset=UTF-8');  
         }  
         $r->send_http_header;  
         return OK;  
     }  
     if ($ENV{'browser.mathml'}) {      if ($ENV{'browser.mathml'}) {
         $r->content_type('text/xml');   &Apache::loncommon::content_type($r,'text/xml');
     } else {      } else {
         $r->content_type('text/html');   &Apache::loncommon::content_type($r,'text/html');
     }      }
     $r->send_http_header;      $r->send_http_header;
       return OK if $r->header_only;
     $r->rflush();      $r->rflush();
   
     # Discard result, we just want the objects that get created by the      # Discard result, we just want the objects that get created by the
Line 462  sub _saveVars { Line 454  sub _saveVars {
     my $self = shift;      my $self = shift;
     my $result = "";      my $result = "";
     $result .= '<input type="hidden" name="CURRENT_STATE" value="' .      $result .= '<input type="hidden" name="CURRENT_STATE" value="' .
         HTML::Entities::encode($self->{STATE}) . "\" />\n";          HTML::Entities::encode($self->{STATE},'<>&"') . "\" />\n";
     $result .= '<input type="hidden" name="TOKEN" value="' .      $result .= '<input type="hidden" name="TOKEN" value="' .
         $self->{TOKEN} . "\" />\n";          $self->{TOKEN} . "\" />\n";
     $result .= '<input type="hidden" name="RETURN_PAGE" value="' .      $result .= '<input type="hidden" name="RETURN_PAGE" value="' .
         HTML::Entities::encode($self->{RETURN_PAGE}) . "\" />\n";          HTML::Entities::encode($self->{RETURN_PAGE},'<>&"') . "\" />\n";
   
     return $result;      return $result;
 }  }
Line 583  sub display { Line 575  sub display {
     }      }
   
     # Phase 4: Display.      # Phase 4: Display.
     my $stateTitle = &mt($state->title());      my $stateTitle=&mt($state->title());
     my $helperTitle = &mt($self->{TITLE});      my $helperTitle = &mt($self->{TITLE});
     my $bodytag = &Apache::loncommon::bodytag($helperTitle,'','');      my $bodytag = &Apache::loncommon::bodytag($helperTitle,'','');
     my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"');      my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"');
Line 593  sub display { Line 585  sub display {
   
     $result .= <<HEADER;      $result .= <<HEADER;
 <html>  <html>
   <script type="text/javascript" language="Javascript" >
       var editbrowser;
       function openbrowser(formname,elementname,only,omit) {
           var url = '/res/?';
           if (editbrowser == null) {
               url += 'launch=1&';
           }
           url += 'catalogmode=interactive&';
           url += 'mode=parmset&';
           url += 'form=' + formname + '&';
           if (only != null) {
               url += 'only=' + only + '&';
           } 
           if (omit != null) {
               url += 'omit=' + omit + '&';
           }
           url += 'element=' + elementname + '';
           var title = 'Browser';
           var options = 'scrollbars=1,resizable=1,menubar=0';
           options += ',width=700,height=600';
           editbrowser = open(url,title,options,'1');
           editbrowser.focus();
       }
   </script>
     <head>      <head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
         <title>$loncapaHelper: $helperTitle</title>          <title>$loncapaHelper: $helperTitle</title>
Line 998  sub start_message { Line 1014  sub start_message {
         return '';          return '';
     }      }
   
     $paramHash->{MESSAGE_TEXT} = &Apache::lonxml::get_all_text('/message',      $paramHash->{MESSAGE_TEXT} = &mtn(&Apache::lonxml::get_all_text('/message',
                                                                $parser);                                                                 $parser));
   
     if (defined($token->[2]{'nextstate'})) {      if (defined($token->[2]{'nextstate'})) {
         $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};          $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
Line 1169  sub start_choice { Line 1185  sub start_choice {
     }      }
   
     my $computer = $token->[2]{'computer'};      my $computer = $token->[2]{'computer'};
     my $human = &Apache::lonxml::get_all_text('/choice',      my $human = &mt(&Apache::lonxml::get_all_text('/choice',
                                               $parser);                                                $parser));
     my $nextstate = $token->[2]{'nextstate'};      my $nextstate = $token->[2]{'nextstate'};
     my $evalFlag = $token->[2]{'eval'};      my $evalFlag = $token->[2]{'eval'};
     push @{$paramHash->{CHOICES}}, [$human, $computer, $nextstate,       push @{$paramHash->{CHOICES}}, [$human, $computer, $nextstate, 
Line 1206  SCRIPT Line 1222  SCRIPT
     # Only print "select all" and "unselect all" if there are five or      # Only print "select all" and "unselect all" if there are five or
     # more choices; fewer then that and it looks silly.      # more choices; fewer then that and it looks silly.
     if ($self->{'multichoice'} && scalar(@{$self->{CHOICES}}) > 4) {      if ($self->{'multichoice'} && scalar(@{$self->{CHOICES}}) > 4) {
           my %lt=&Apache::lonlocal::texthash(
    'sa'  => "Select All",
           'ua'  => "Unselect All");
         $buttons = <<BUTTONS;          $buttons = <<BUTTONS;
 <br />  <br />
 <input type="button" onclick="checkall(true, '$var')" value="Select All" />  <input type="button" onclick="checkall(true, '$var')" value="$lt{'sa'}" />
 <input type="button" onclick="checkall(false, '$var')" value="Unselect All" />  <input type="button" onclick="checkall(false, '$var')" value="$lt{'ua'}" />
 <br />&nbsp;  <br />&nbsp;
 BUTTONS  BUTTONS
     }      }
Line 1264  BUTTONS Line 1283  BUTTONS
         $result .= "<tr>\n<td width='20'>&nbsp;</td>\n";          $result .= "<tr>\n<td width='20'>&nbsp;</td>\n";
         $result .= "<td valign='top'><input type='$type' name='$var.forminput'"          $result .= "<td valign='top'><input type='$type' name='$var.forminput'"
             . "' value='" .               . "' value='" . 
             HTML::Entities::encode($choice->[1])               HTML::Entities::encode($choice->[1],'<>&"') 
             . "'";              . "'";
         if ($checkedChoices{$choice->[1]}) {          if ($checkedChoices{$choice->[1]}) {
             $result .= " checked ";              $result .= " checked ";
Line 1276  BUTTONS Line 1295  BUTTONS
             $choiceLabel = eval($choiceLabel);              $choiceLabel = eval($choiceLabel);
             $choiceLabel = &$choiceLabel($helper, $self);              $choiceLabel = &$choiceLabel($helper, $self);
         }          }
    &Apache::lonnet::logthis("TITLE TRANSLATION >$choiceLabel<");
         $result .= "/></td><td> " . &mtn($choiceLabel) . "</td></tr>\n";          $result .= "/></td><td> " . &mtn($choiceLabel) . "</td></tr>\n";
     }      }
     $result .= "</table>\n\n\n";      $result .= "</table>\n\n\n";
Line 1419  sub render { Line 1439  sub render {
     $result .= "<select name='${var}.forminput'>\n";      $result .= "<select name='${var}.forminput'>\n";
     foreach my $choice (@{$self->{CHOICES}}) {      foreach my $choice (@{$self->{CHOICES}}) {
         $result .= "<option value='" .           $result .= "<option value='" . 
             HTML::Entities::encode($choice->[1])               HTML::Entities::encode($choice->[1],'<>&"') 
             . "'";              . "'";
         if ($checkedChoices{$choice->[1]}) {          if ($checkedChoices{$choice->[1]}) {
             $result .= " selected";              $result .= " selected";
Line 1777  sub start_resource { Line 1797  sub start_resource {
     $paramHash->{'suppressEmptySequences'} = $token->[2]{'suppressEmptySequences'};      $paramHash->{'suppressEmptySequences'} = $token->[2]{'suppressEmptySequences'};
     $paramHash->{'toponly'} = $token->[2]{'toponly'};      $paramHash->{'toponly'} = $token->[2]{'toponly'};
     $paramHash->{'addstatus'} = $token->[2]{'addstatus'};      $paramHash->{'addstatus'} = $token->[2]{'addstatus'};
       $paramHash->{'closeallpages'} = $token->[2]{'closeallpages'};
     return '';      return '';
 }  }
   
Line 1892  sub render { Line 1913  sub render {
     }      }
 </script>  </script>
 SCRIPT  SCRIPT
           my %lt=&Apache::lonlocal::texthash(
    'sar'  => "Select All Resources",
           'uar'  => "Unselect All Resources");
   
         $buttons = <<BUTTONS;          $buttons = <<BUTTONS;
 <br /> &nbsp;  <br /> &nbsp;
 <input type="button" onclick="checkall(true, '$var')" value="Select All Resources" />  <input type="button" onclick="checkall(true, '$var')" value="$lt{'sar'}" />
 <input type="button" onclick="checkall(false, '$var')" value="Unselect All Resources" />  <input type="button" onclick="checkall(false, '$var')" value="$lt{'uar'}" />
 <br /> &nbsp;  <br /> &nbsp;
 BUTTONS  BUTTONS
     }      }
Line 1945  BUTTONS Line 1970  BUTTONS
  $checked = 1;   $checked = 1;
     }      }
             $col .= "value='" .               $col .= "value='" . 
                 HTML::Entities::encode(&$valueFunc($resource))                   HTML::Entities::encode(&$valueFunc($resource),'<>&"') 
                 . "' /></td>";                  . "' /></td>";
             return $col;              return $col;
         }          }
Line 1962  BUTTONS Line 1987  BUTTONS
                                        'showParts' => 0,                                         'showParts' => 0,
                                        'filterFunc' => $filterFunc,                                         'filterFunc' => $filterFunc,
                                        'resource_no_folder_link' => 1,                                         'resource_no_folder_link' => 1,
          'closeAllPages' => $self->{'closeallpages'},
                                        'suppressEmptySequences' => $self->{'suppressEmptySequences'},                                         'suppressEmptySequences' => $self->{'suppressEmptySequences'},
                                        'iterator_map' => $mapUrl }                                         'iterator_map' => $mapUrl }
                                        );                                         );
Line 2102  sub render { Line 2128  sub render {
 </script>  </script>
 SCRIPT  SCRIPT
   
         my $selectAllStudents = &mt('Select All Students');           my %lt=&Apache::lonlocal::texthash(
  my $unselectAllStudents = &mt('Unselect All Students');                      'ocs'  => "Select Only Current Students",
                       'sas'  => "Select All Students",
                       'uas'  => "Unselect All Students",
                       'sfsg' => "Select for Section/Group",
       'ufsg' => "Unselect for Section/Group");
    
         $buttons = <<BUTTONS;          $buttons = <<BUTTONS;
 <br />  <br />
 <input type="button" onclick="checkactive()" value="Select Only Current Students" />  <input type="button" onclick="checkactive()" value="$lt{'ocs'}" />
 <input type="button" onclick="checkall(true, '$var')" value="$selectAllStudents" />  <input type="button" onclick="checkall(true, '$var')" value="$lt{'sas'}" />
 <input type="button" onclick="checkall(false, '$var')" value="$unselectAllStudents" />  <input type="button" onclick="checkall(false, '$var')" value="$lt{'uas'}" />
 <input type="button" onclick="checksec(true)" value="Select for Section/Group">  <input type="button" onclick="checksec(true)" value="$lt{'sfsg'}">
 <input type="text" size="5" name="chksec">&nbsp;  <input type="text" size="5" name="chksec">&nbsp;
 <input type="button" onclick="checksec(false)" value="Unselect for Section/Group">  <input type="button" onclick="checksec(false)" value="$lt{'ufsg'}">
 <br />  <br />
 BUTTONS  BUTTONS
     }      }
Line 2170  BUTTONS Line 2201  BUTTONS
  }   }
     }      }
   
     my $name = &mt($self->{'coursepersonnel'} ? 'Name' : 'Student Name');      my $name = $self->{'coursepersonnel'} ? &mt('Name') : &mt('Student Name');
       &Apache::lonnet::logthis("THE NAME IS >$name<");
     my $type = 'radio';      my $type = 'radio';
     if ($self->{'multichoice'}) { $type = 'checkbox'; }      if ($self->{'multichoice'}) { $type = 'checkbox'; }
     $result .= "<table cellspacing='2' cellpadding='2' border='0'>\n";      $result .= "<table cellspacing='2' cellpadding='2' border='0'>\n";
     $result .= "<tr><td></td><td align='center'><b>$name</b></td>".      $result .= "<tr><td></td><td align='center'><b>$name</b></td>".
         "<td align='center'><b>" . &mt('Section') . "</b></td>" .           "<td align='center'><b>" . &mt('Section') . "</b></td>" . 
  "<td align='center'><b>Status</b></td>" .    "<td align='center'><b>".&mt('Status')."</b></td>" . 
  "<td align='center'><b>" . &mt("Role") . "</b></td></tr>" .   "<td align='center'><b>" . &mt("Role") . "</b></td>" .
  "<td align='center'><b>Username:Domain</b></td></tr>";   "<td align='center'><b>".&mt('Username').":".&mt('Domain')."</b></td></tr>";
   
     my $checked = 0;      my $checked = 0;
     for my $choice (@$choices) {      for my $choice (@$choices) {
Line 2190  BUTTONS Line 2222  BUTTONS
             $checked = 1;              $checked = 1;
         }          }
         $result .=          $result .=
             " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3])              " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3],'<>&"')
             . "' /></td><td>"              . "' /></td><td>"
             . HTML::Entities::encode($choice->[1])              . HTML::Entities::encode($choice->[1],'<>&"')
             . "</td><td align='center'>"               . "</td><td align='center'>" 
             . HTML::Entities::encode($choice->[2])              . HTML::Entities::encode($choice->[2],'<>&"')
             . "</td>\n<td>"               . "</td>\n<td>" 
     . HTML::Entities::encode($choice->[3])      . HTML::Entities::encode($choice->[3],'<>&"')
             . "</td>\n<td>"               . "</td>\n<td>" 
     . HTML::Entities::encode($choice->[4])      . HTML::Entities::encode($choice->[4],'<>&"')
             . "</td>\n<td>"               . "</td>\n<td>" 
     . HTML::Entities::encode($choice->[0])      . HTML::Entities::encode($choice->[0],'<>&"')
     . "</td></tr>\n";      . "</td></tr>\n";
     }      }
   
Line 2401  sub render { Line 2433  sub render {
     }      }
 </script>  </script>
 SCRIPT  SCRIPT
         my $selectAllFiles = &mt("Select All Files");         my %lt=&Apache::lonlocal::texthash(
  my $unselectAllFiles = &mt("Unselect All Files");   'saf'  => "Select All Files",
         $buttons = <<BUTTONS;          'uaf'  => "Unselect All Files");
          $buttons = <<BUTTONS;
 <br /> &nbsp;  <br /> &nbsp;
 <input type="button" onclick="checkall(true, '$var')" value="$selectAllFiles" />  <input type="button" onclick="checkall(true, '$var')" value="$lt{'saf'}" />
 <input type="button" onclick="checkall(false, '$var')" value="$unselectAllFiles" />  <input type="button" onclick="checkall(false, '$var')" value="$lt{'uaf'}" />
 BUTTONS  BUTTONS
   
         my $selectAllPublished = &mt("Select All Published");         %lt=&Apache::lonlocal::texthash(
  my $unselectAllPublished= &mt("UnselectAllPublished");   'sap'  => "Select All Published",
           'uap'  => "Unselect All Published");
         if ($helper->{VARS}->{'construction'}) {          if ($helper->{VARS}->{'construction'}) {
             $buttons .= <<BUTTONS;         $buttons .= <<BUTTONS;
 <input type="button" onclick="checkallclass(true, 'Published')" value="$selectAllPublished" />  <input type="button" onclick="checkallclass(true, 'Published')" value="$lt{'sap'}" />
 <input type="button" onclick="checkallclass(false, 'Published')" value="$unselectAllPublished" />  <input type="button" onclick="checkallclass(false, 'Published')" value="$lt{'uap'}" />
 <br /> &nbsp;  <br /> &nbsp;
 BUTTONS  BUTTONS
        }         }
Line 2496  BUTTONS Line 2530  BUTTONS
             }              }
             $result .= '<tr><td align="right"' . " bgcolor='$color'>" .              $result .= '<tr><td align="right"' . " bgcolor='$color'>" .
                 "<input $onclick type='$type' name='" . $var                  "<input $onclick type='$type' name='" . $var
             . ".forminput' value='" . HTML::Entities::encode($fileName) .              . ".forminput' value='" . HTML::Entities::encode($fileName,'<>&"').
                 "'";                  "'";
             if (!$self->{'multichoice'} && $choices == 0) {              if (!$self->{'multichoice'} && $choices == 0) {
                 $result .= ' checked';                  $result .= ' checked';
Line 3040  package Apache::lonhelper::parmwizfinal; Line 3074  package Apache::lonhelper::parmwizfinal;
 no strict;  no strict;
 @ISA = ('Apache::lonhelper::element');  @ISA = ('Apache::lonhelper::element');
 use strict;  use strict;
   use Apache::lonlocal;
   
 BEGIN {  BEGIN {
     &Apache::lonhelper::register('Apache::lonhelper::parmwizfinal',      &Apache::lonhelper::register('Apache::lonhelper::parmwizfinal',
Line 3119  sub render { Line 3154  sub render {
     }      }
   
     my $result = "<form name='helpform' method='get' action='/adm/parmset#$affectedResourceId&$parm_name&$level'>\n";      my $result = "<form name='helpform' method='get' action='/adm/parmset#$affectedResourceId&$parm_name&$level'>\n";
     $result .= '<p>Confirm that this information is correct, then click &quot;Finish Helper&quot; to complete setting the parameter.<ul>';      $result .= '<p>'.&mt('Confirm that this information is correct, then click &quot;Finish Helper&quot; to complete setting the parameter.').'<ul>';
           
     # Print the type of manipulation:      # Print the type of manipulation:
     $result .= '<li>Setting the <b>' . $dateTypeHash{$vars->{ACTION_TYPE}} . '</b>';      $result .= '<li>'.&mt('Setting the').' <b>' . &mt($dateTypeHash{$vars->{ACTION_TYPE}}) . '</b>';
     if ($vars->{ACTION_TYPE} eq 'tries') {      if ($vars->{ACTION_TYPE} eq 'tries') {
  $result .= ' to <b>' . $vars->{TRIES} . '</b>';   $result .= ' '.&mt('to').' <b>' . $vars->{TRIES} . '</b>';
     }      }
     if ($vars->{ACTION_TYPE} eq 'weight') {      if ($vars->{ACTION_TYPE} eq 'weight') {
  $result .= ' to <b>' . $vars->{WEIGHT} . '</b>';   $result .= ' '.&mt('to').' <b>' . $vars->{WEIGHT} . '</b>';
     }      }
     $result .= "</li>\n";      $result .= "</li>\n";
     if ($vars->{ACTION_TYPE} eq 'due_date' ||       if ($vars->{ACTION_TYPE} eq 'due_date' || 
Line 3158  sub render { Line 3193  sub render {
           
     # Print targets      # Print targets
     if ($vars->{TARGETS} eq 'course') {      if ($vars->{TARGETS} eq 'course') {
         $result .= '<li>for <b>all students in course</b></li>';          $result .= '<li>'.&mt('for').' <b>'.&mt('all students in course').'</b></li>';
     } elsif ($vars->{TARGETS} eq 'section') {      } elsif ($vars->{TARGETS} eq 'section') {
         my $section = $vars->{SECTION_NAME};          my $section = $vars->{SECTION_NAME};
         $result .= "<li>for section <b>$section</b></li>";          $result .= "<li>for section <b>$section</b></li>";
         $level -= 3;          $level -= 3;
         $result .= "<input type='hidden' name='csec' value='" .          $result .= "<input type='hidden' name='csec' value='" .
             HTML::Entities::encode($section) . "' />\n";              HTML::Entities::encode($section,'<>&"') . "' />\n";
     } else {      } else {
         # FIXME: This is probably wasteful! Store the name!          # FIXME: This is probably wasteful! Store the name!
         my $classlist = Apache::loncoursedata::get_classlist();          my $classlist = Apache::loncoursedata::get_classlist();
Line 3176  sub render { Line 3211  sub render {
         $level -= 6;          $level -= 6;
         my ($uname, $udom) = split /:/, $vars->{USER_NAME};          my ($uname, $udom) = split /:/, $vars->{USER_NAME};
         $result .= "<input type='hidden' name='uname' value='".          $result .= "<input type='hidden' name='uname' value='".
             HTML::Entities::encode($uname) . "' />\n";              HTML::Entities::encode($uname,'<>&"') . "' />\n";
         $result .= "<input type='hidden' name='udom' value='".          $result .= "<input type='hidden' name='udom' value='".
             HTML::Entities::encode($udom) . "' />\n";              HTML::Entities::encode($udom,'<>&"') . "' />\n";
     }      }
   
     # Print value      # Print value
Line 3198  sub render { Line 3233  sub render {
     $result .= "\n<input type='hidden' value='$symb' name='pssymb' />";      $result .= "\n<input type='hidden' value='$symb' name='pssymb' />";
     $result .= "\n<input type='hidden' value='$paramlevel' name='parmlev' />";      $result .= "\n<input type='hidden' value='$paramlevel' name='parmlev' />";
   
     $result .= "<br /><br /><center><input type='submit' value='Finish Helper' /></center></form>\n";      $result .= "<br /><br /><center><input type='submit' value='".&mt('Finish Helper')."' /></center></form>\n";
   
     return $result;      return $result;
 }  }

Removed from v.1.65  
changed lines
  Added in v.1.71


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