Diff for /loncom/interface/lonhelper.pm between versions 1.51 and 1.64

version 1.51, 2003/10/08 17:41:17 version 1.64, 2004/02/27 19:51:46
Line 1020  sub end_message { Line 1020  sub end_message {
 sub render {  sub render {
     my $self = shift;      my $self = shift;
   
     return &mt($self->{MESSAGE_TEXT});      return &mtn($self->{MESSAGE_TEXT});
 }  }
 # If a NEXTSTATE was given, switch to it  # If a NEXTSTATE was given, switch to it
 sub postprocess {  sub postprocess {
Line 1291  sub postprocess { Line 1291  sub postprocess {
     my $chosenValue = $ENV{'form.' . $self->{'variable'} . '.forminput'};      my $chosenValue = $ENV{'form.' . $self->{'variable'} . '.forminput'};
   
     if (!defined($chosenValue) && !$self->{'allowempty'}) {      if (!defined($chosenValue) && !$self->{'allowempty'}) {
         $self->{ERROR_MSG} = "You must choose one or more choices to" .          $self->{ERROR_MSG} = 
             " continue.";      &mt("You must choose one or more choices to continue.");
         return 0;          return 0;
     }      }
   
Line 1595  sub render { Line 1595  sub render {
   
     # Display Hours and Minutes if they are called for      # Display Hours and Minutes if they are called for
     if ($self->{'hoursminutes'}) {      if ($self->{'hoursminutes'}) {
    # This needs parameterization for times.
    my $am = &mt('a.m.');
    my $pm = &mt('p.m.');
         # Build hour          # Build hour
         $result .= "<select name='${var}hour'>\n";          $result .= "<select name='${var}hour'>\n";
         $result .= "<option " . ($date->hour == 0 ? 'selected ':'') .          $result .= "<option " . ($date->hour == 0 ? 'selected ':'') .
             " value='0'>midnight</option>\n";              " value='0'>" . &mt('midnight') . "</option>\n";
         for ($i = 1; $i < 12; $i++) {          for ($i = 1; $i < 12; $i++) {
             if ($date->hour == $i) {              if ($date->hour == $i) {
                 $result .= "<option selected value='$i'>$i a.m.</option>\n";                  $result .= "<option selected value='$i'>$i $am</option>\n";
             } else {              } else {
                 $result .= "<option value='$i'>$i a.m</option>\n";                  $result .= "<option value='$i'>$i $am</option>\n";
             }              }
         }          }
         $result .= "<option " . ($date->hour == 12 ? 'selected ':'') .          $result .= "<option " . ($date->hour == 12 ? 'selected ':'') .
             " value='12'>noon</option>\n";              " value='12'>" . &mt('noon') . "</option>\n";
         for ($i = 13; $i < 24; $i++) {          for ($i = 13; $i < 24; $i++) {
             my $printedHour = $i - 12;              my $printedHour = $i - 12;
             if ($date->hour == $i) {              if ($date->hour == $i) {
                 $result .= "<option selected value='$i'>$printedHour p.m.</option>\n";                  $result .= "<option selected value='$i'>$printedHour $pm</option>\n";
             } else {              } else {
                 $result .= "<option value='$i'>$printedHour p.m.</option>\n";                  $result .= "<option value='$i'>$printedHour $pm</option>\n";
             }              }
         }          }
   
Line 2024  shown. Defaults to false. Line 2027  shown. Defaults to false.
 no strict;  no strict;
 @ISA = ("Apache::lonhelper::element");  @ISA = ("Apache::lonhelper::element");
 use strict;  use strict;
   use Apache::lonlocal;
   
   
 BEGIN {  BEGIN {
Line 2081  sub render { Line 2084  sub render {
             }              }
         }          }
     }      }
       function checksec(value) {
    for (i=0; i<document.forms.helpform.elements.length; i++) {
       comp = document.forms.helpform.elements.chksec.value;
               if (document.forms.helpform.elements[i].value.indexOf(':'+comp+':') != -1) {
                   document.forms.helpform.elements[i].checked=value;
               }
           }
       }
       function checkactive() {
    for (i=0; i<document.forms.helpform.elements.length; i++) {
               if (document.forms.helpform.elements[i].value.indexOf(':Active') != -1) {
                   document.forms.helpform.elements[i].checked=true;
               }
           }
       }
 </script>  </script>
 SCRIPT  SCRIPT
   
           my $selectAllStudents = &mt('Select All Students'); 
    my $unselectAllStudents = &mt('Unselect All Students');
         $buttons = <<BUTTONS;          $buttons = <<BUTTONS;
 <br />  <br />
 <input type="button" onclick="checkall(true, '$var')" value="Select All Students" />  <input type="button" onclick="checkactive()" value="Select Only Current Students" />
 <input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" />  <input type="button" onclick="checkall(true, '$var')" value="$selectAllStudents" />
   <input type="button" onclick="checkall(false, '$var')" value="$unselectAllStudents" />
   <input type="button" onclick="checksec(true)" value="Select for Section/Group">
   <input type="text" size="5" name="chksec">&nbsp;
   <input type="button" onclick="checksec(false)" value="Unselect for Section/Group">
 <br />  <br />
 BUTTONS  BUTTONS
     }      }
Line 2140  BUTTONS Line 2165  BUTTONS
  if (!$self->{'activeonly'} || $classlist->{$_}->[$status] eq   if (!$self->{'activeonly'} || $classlist->{$_}->[$status] eq
     'Active') {      'Active') {
     push @$choices, [$_, $classlist->{$_}->[$fullname],       push @$choices, [$_, $classlist->{$_}->[$fullname], 
      $classlist->{$_}->[$section], 'Student'];       $classlist->{$_}->[$section],
        $classlist->{$_}->[$status], 'Student'];
  }   }
     }      }
   
     my $name = $self->{'coursepersonnel'} ? 'Name' : 'Student Name';      my $name = &mt($self->{'coursepersonnel'} ? 'Name' : 'Student 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>Section</b></td>" .           "<td align='center'><b>" . &mt('Section') . "</b></td>" . 
  "<td align='center'><b>Role</b></td></tr>";   "<td align='center'><b>Status</b></td>" . 
    "<td align='center'><b>" . &mt("Role") . "</b></td></tr>" .
    "<td align='center'><b>Username:Domain</b></td></tr>";
   
     my $checked = 0;      my $checked = 0;
     for my $choice (@$choices) {      for my $choice (@$choices) {
Line 2162  BUTTONS Line 2190  BUTTONS
             $checked = 1;              $checked = 1;
         }          }
         $result .=          $result .=
             " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2])              " 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]) . "</td></tr>\n";      . HTML::Entities::encode($choice->[3])
               . "</td>\n<td>" 
       . HTML::Entities::encode($choice->[4])
               . "</td>\n<td>" 
       . HTML::Entities::encode($choice->[0])
       . "</td></tr>\n";
     }      }
   
     $result .= "</table>\n\n";      $result .= "</table>\n\n";
Line 2182  sub postprocess { Line 2215  sub postprocess {
   
     my $result = $ENV{'form.' . $self->{'variable'} . '.forminput'};      my $result = $ENV{'form.' . $self->{'variable'} . '.forminput'};
     if (!$result) {      if (!$result) {
         $self->{ERROR_MSG} = 'You must choose at least one student '.          $self->{ERROR_MSG} = 
             'to continue.';      &mt('You must choose at least one student to continue.');
         return 0;          return 0;
     }      }
   
Line 2249  viewing the files. Line 2282  viewing the files.
 no strict;  no strict;
 @ISA = ("Apache::lonhelper::element");  @ISA = ("Apache::lonhelper::element");
 use strict;  use strict;
   use Apache::lonlocal;
   
 use Apache::lonpubdir; # for getTitleString  use Apache::lonpubdir; # for getTitleString
   
Line 2367  sub render { Line 2401  sub render {
     }      }
 </script>  </script>
 SCRIPT  SCRIPT
           my $selectAllFiles = &mt("Select All Files");
    my $unselectAllFiles = &mt("Unselect All Files");
         $buttons = <<BUTTONS;          $buttons = <<BUTTONS;
 <br /> &nbsp;  <br /> &nbsp;
 <input type="button" onclick="checkall(true, '$var')" value="Select All Files" />  <input type="button" onclick="checkall(true, '$var')" value="$selectAllFiles" />
 <input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" />  <input type="button" onclick="checkall(false, '$var')" value="$unselectAllFiles" />
 BUTTONS  BUTTONS
   
           my $selectAllPublished = &mt("Select All Published");
    my $unselectAllPublished= &mt("UnselectAllPublished");
         if ($helper->{VARS}->{'construction'}) {          if ($helper->{VARS}->{'construction'}) {
             $buttons .= <<BUTTONS;              $buttons .= <<BUTTONS;
 <input type="button" onclick="checkallclass(true, 'Published')" value="Select All Published" />  <input type="button" onclick="checkallclass(true, 'Published')" value="$selectAllPublished" />
 <input type="button" onclick="checkallclass(false, 'Published')" value="Unselect All Published" />  <input type="button" onclick="checkallclass(false, 'Published')" value="$unselectAllPublished" />
 <br /> &nbsp;  <br /> &nbsp;
 BUTTONS  BUTTONS
        }         }
Line 2867  the old values taking effect. Line 2905  the old values taking effect.
 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::final',      &Apache::lonhelper::register('Apache::lonhelper::final',
                                  ('final', 'exitpage'));                                   ('final', 'exitpage'));
Line 2952  sub render { Line 2990  sub render {
  }   }
   
  if (!@results) {   if (!@results) {
     $result .= '    <li>No changes were made to current settings.</li>';      $result .= '    <li>' . 
    &mt('No changes were made to current settings.') . '</li>';
  }   }
   
  $result .= '</ul>';   $result .= '</ul>';
Line 2960  sub render { Line 2999  sub render {
   
     if ($self->{'restartCourse'}) {      if ($self->{'restartCourse'}) {
  my $targetURL = '/adm/menu';   my $targetURL = '/adm/menu';
    if ($ENV{'course.'.$ENV{'request.course.id'}.'.url'}=~/^uploaded/) {
       $targetURL = '/adm/coursedocs';
    } else {
       $targetURL = '/adm/navmaps';
    }
  if ($ENV{'course.'.$ENV{'request.course.id'}.'.clonedfrom'}) {   if ($ENV{'course.'.$ENV{'request.course.id'}.'.clonedfrom'}) {
     $targetURL = '/adm/parmset?overview=1';      $targetURL = '/adm/parmset?overview=1';
  }   }
    my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"');
    my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"');
         $result .= "<center>\n" .          $result .= "<center>\n" .
             "<form action='/adm/roles' method='post' target='loncapaclient'>\n" .              "<form action='/adm/roles' method='post' target='loncapaclient'>\n" .
             "<input type='button' onclick='history.go(-1)' value='&lt;- Previous' />" .              "<input type='button' onclick='history.go(-1)' value='$previous' />" .
             "<input type='hidden' name='orgurl' value='$targetURL' />" .              "<input type='hidden' name='orgurl' value='$targetURL' />" .
             "<input type='hidden' name='selectrole' value='1' />\n" .              "<input type='hidden' name='selectrole' value='1' />\n" .
             "<input type='hidden' name='" . $ENV{'request.role'} .               "<input type='hidden' name='" . $ENV{'request.role'} . 
             "' value='1' />\n<input type='submit' value='Finish Course Initialization' />\n" .              "' value='1' />\n<input type='submit' value='" .
       &mt('Finish Course Initialization') . "' />\n" .
             "</form></center>";              "</form></center>";
     }      }
   
Line 3072  sub render { Line 3119  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 Wizard&quot; to complete setting the parameter.<ul>';      $result .= '<p>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>Setting the <b>' . $dateTypeHash{$vars->{ACTION_TYPE}} . '</b>';

Removed from v.1.51  
changed lines
  Added in v.1.64


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