Diff for /loncom/interface/lonhelper.pm between versions 1.13 and 1.14

version 1.13, 2003/04/30 15:18:36 version 1.14, 2003/04/30 18:40:49
Line 202  sub handler { Line 202  sub handler {
     my $file;      my $file;
     read $fh, $file, 100000000;      read $fh, $file, 100000000;
   
     Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});  
   
     # Send header, don't cache this page      # Send header, don't cache this page
     if ($r->header_only) {      if ($r->header_only) {
         if ($ENV{'browser.mathml'}) {          if ($ENV{'browser.mathml'}) {
Line 324  sub new { Line 322  sub new {
  $self->{STATE} = "START";   $self->{STATE} = "START";
     }      }
   
       Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
   
     $self->{TOKEN} = $ENV{'form.TOKEN'};      $self->{TOKEN} = $ENV{'form.TOKEN'};
     # If a token was passed, we load that in. Otherwise, we need to create a       # If a token was passed, we load that in. Otherwise, we need to create a 
     # new storage file      # new storage file
Line 506  sub display { Line 506  sub display {
     </head>      </head>
     $bodytag      $bodytag
 HEADER  HEADER
     if (!$state->overrideForm()) { $result.="<form name='wizform' method='GET'>"; }      if (!$state->overrideForm()) { $result.="<form name='helpform' method='GET'>"; }
     $result .= <<HEADER;      $result .= <<HEADER;
         <table border="0"><tr><td>          <table border="0"><tr><td>
         <h2><i>$stateTitle</i></h2>          <h2><i>$stateTitle</i></h2>
Line 740  sub process_multiple_choices { Line 740  sub process_multiple_choices {
     my $formname = shift;      my $formname = shift;
     my $var = shift;      my $var = shift;
   
     my $formvalue = $ENV{'form.' . $formname};      # Must extract values from data directly, as there
     if ($formvalue) {      # may be more then one.
         # Must extract values from querystring directly, as there      my @values;
         # may be more then one.      for my $formparam (split (/&/, $ENV{QUERY_STRING})) {
         my @values;          my ($name, $value) = split(/=/, $formparam);
         for my $formparam (split (/&/, $ENV{QUERY_STRING})) {          if ($name ne $formname) {
             my ($name, $value) = split(/=/, $formparam);              next;
             if ($name ne $formname) {  
                 next;  
             }  
             $value =~ tr/+/ /;  
             $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;  
             push @values, $value;  
         }          }
         $helper->{VARS}->{$var} = join('|||', @values);          $value =~ tr/+/ /;
           $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
           push @values, $value;
     }      }
       $helper->{VARS}->{$var} = join('|||', @values);
           
     return;      return;
 }  }
Line 1005  SCRIPT Line 1002  SCRIPT
 BUTTONS  BUTTONS
     }      }
   
     if (defined $self->{ERROR_MSG}) {      if (defined $self->{ERRO_MSG}) {
         $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />';          $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />';
     }      }
   
Line 1358  sub start_resource { Line 1355  sub start_resource {
   
     $paramHash->{'variable'} = $token->[2]{'variable'};      $paramHash->{'variable'} = $token->[2]{'variable'};
     $helper->declareVar($paramHash->{'variable'});      $helper->declareVar($paramHash->{'variable'});
       $paramHash->{'multichoice'} = $token->[2]{'multichoice'};
     return '';      return '';
 }  }
   
Line 1434  sub start_mapurl { Line 1432  sub start_mapurl {
   
     my $contents = Apache::lonxml::get_all_text('/mapurl',      my $contents = Apache::lonxml::get_all_text('/mapurl',
                                                 $parser);                                                  $parser);
     $paramHash->{MAP_URL} = eval $contents;      $paramHash->{MAP_URL} = $contents;
 }  }
   
 sub end_mapurl { return ''; }  sub end_mapurl { return ''; }
Line 1458  sub render { Line 1456  sub render {
     my $curVal = $helper->{VARS}->{$var};      my $curVal = $helper->{VARS}->{$var};
   
     if (defined $self->{ERROR_MSG}) {      if (defined $self->{ERROR_MSG}) {
         $result .= '<font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />';          $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />';
     }      }
   
     my $filterFunc = $self->{FILTER_FUNC};      my $filterFunc = $self->{FILTER_FUNC};
     my $choiceFunc = $self->{CHOICE_FUNC};      my $choiceFunc = $self->{CHOICE_FUNC};
     my $valueFunc = $self->{VALUE_FUNC};      my $valueFunc = $self->{VALUE_FUNC};
     my $mapUrl = $self->{MAP_URL};      my $mapUrl = $self->{MAP_URL};
       my $multichoice = $self->{'multichoice'};
   
     # Create the composite function that renders the column on the nav map      # Create the composite function that renders the column on the nav map
     # have to admit any language that lets me do this can't be all bad      # have to admit any language that lets me do this can't be all bad
Line 1472  sub render { Line 1471  sub render {
     my $checked = 0;      my $checked = 0;
     my $renderColFunc = sub {      my $renderColFunc = sub {
         my ($resource, $part, $params) = @_;          my ($resource, $part, $params) = @_;
           
           my $inputType;
           if ($multichoice) { $inputType = 'checkbox'; }
           else {$inputType = 'radio'; }
   
         if (!&$choiceFunc($resource)) {          if (!&$choiceFunc($resource)) {
             return '<td>&nbsp;</td>';              return '<td>&nbsp;</td>';
         } else {          } else {
             my $col = "<td><input type='radio' name='${var}.forminput' ";              my $col = "<td><input type='$inputType' name='${var}.forminput' ";
             if (!$checked) {              if (!$checked && !$multichoice) {
                 $col .= "checked ";                  $col .= "checked ";
                 $checked = 1;                  $checked = 1;
             }              }
Line 1503  sub render { Line 1506  sub render {
           
 sub postprocess {  sub postprocess {
     my $self = shift;      my $self = shift;
   
       if ($self->{'multichoice'}) {
           $self->process_multiple_choices($self->{'variable'}.'.forminput',
                                           $self->{'variable'});
       }
   
       if ($self->{'multichoice'} && !$helper->{VARS}->{$self->{'variable'}}) {
           $self->{ERROR_MSG} = 'You must choose at least one resource to continue.';
           return 0;
       }
   
     if (defined($self->{NEXTSTATE})) {      if (defined($self->{NEXTSTATE})) {
         $helper->changeState($self->{NEXTSTATE});          $helper->changeState($self->{NEXTSTATE});
     }      }
Line 2130  sub render { Line 2144  sub render {
                         'due_date' => "0_duedate",                          'due_date' => "0_duedate",
                         'answer_date' => "0_answerdate");                          'answer_date' => "0_answerdate");
           
     my $result = "<form name='wizform' method='get' action='/adm/parmset'>\n";      my $result = "<form name='helpform' method='get' action='/adm/parmset'>\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 Wizard&quot; to complete setting the parameter.<ul>';
     my $affectedResourceId = "";      my $affectedResourceId = "";
     my $parm_name = $parmTypeHash{$vars->{ACTION_TYPE}};      my $parm_name = $parmTypeHash{$vars->{ACTION_TYPE}};

Removed from v.1.13  
changed lines
  Added in v.1.14


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