Diff for /loncom/interface/lonhelper.pm between versions 1.94 and 1.95

version 1.94, 2005/01/20 20:20:35 version 1.95, 2005/01/21 22:59:54
Line 1715  to false. The "suppressEmptySequences" a Line 1715  to false. The "suppressEmptySequences" a
 suppressEmptySequences argument to the render routine, which will cause  suppressEmptySequences argument to the render routine, which will cause
 folders that have all of their contained resources filtered out to also  folders that have all of their contained resources filtered out to also
 be filtered out. The 'addstatus' attribute, if true, will add the icon  be filtered out. The 'addstatus' attribute, if true, will add the icon
 and long status display columns to the display.  and long status display columns to the display. The 'addparts'
   attribute will add in a part selector beside problems that have more
   than 1 part.
   
 =head3 SUB-TAGS  =head3 SUB-TAGS
   
Line 1782  sub start_resource { Line 1784  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->{'addparts'} = $token->[2]{'addparts'};
       if ($paramHash->{'addparts'}) {
    $helper->declareVar($paramHash->{'variable'}.'_part');
       }
     $paramHash->{'closeallpages'} = $token->[2]{'closeallpages'};      $paramHash->{'closeallpages'} = $token->[2]{'closeallpages'};
     return '';      return '';
 }  }
Line 1955  BUTTONS Line 1961  BUTTONS
     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 $multichoice   = $self->{'multichoice'};      my $multichoice    = $self->{'multichoice'};
     my $option_vars    = $self->{OPTION_VARS};      my $option_vars    = $self->{OPTION_VARS};
     my $option_texts   = $self->{OPTION_TEXTS};      my $option_texts   = $self->{OPTION_TEXTS};
       my $addparts       = $self->{'addparts'};
     my $headings_done  = 0;      my $headings_done  = 0;
   
     # Evaluate the map url as needed      # Evaluate the map url as needed
Line 2019  BUTTONS Line 2026  BUTTONS
  $checked = 1;   $checked = 1;
     }      }
             $col .= "value='" . $resource_name  . "' /></td>";              $col .= "value='" . $resource_name  . "' /></td>";
   
             return $result.$col;              return $result.$col;
         }          }
     };      };
       my $renderPartsFunc = sub {
           my ($resource, $part, $params) = @_;
    my $col= "<td>";
    my $id=$resource->{ID};
    my $resource_name =   
       &HTML::Entities::encode(&$valueFunc($resource),"<>&\"'");
    if ($addparts && (scalar(@{$resource->parts}) > 1)) {
       $col .= "<select onclick=\"javascript:updateRadio(this.form,'${var}.forminput','$resource_name');updateHidden(this.form,'$id','${var}');\" name='part_$id.forminput'>\n";
       $col .= "<option value=\"$part\">All Parts</option>\n";
       foreach my $part (@{$resource->parts}) {
    $col .= "<option value=\"$part\">Part: $part</option>\n";
       }
       $col .= "</select>";
    }
    $col .= "</td>";
       };
       $result.=(<<RADIO);
   <script type="text/javascript">
       function updateRadio(form,name,value) {
    var radiobutton=form[name];
    for (var i=0; i<radiobutton.length; i++) {
       if (radiobutton[i].value == value) {
    radiobutton[i].checked = true;
    break;
       }
    }
       }
       function updateHidden(form,id,name) {
    var select=form['part_'+id+'.forminput'];
    var hidden=form[name+'_part.forminput'];
    var which=select.selectedIndex;
    hidden.value=select.options[which].value;
       }
   </script>
   <input type="hidden" name="${var}_part.forminput" />;
   
   RADIO
     $ENV{'form.condition'} = !$self->{'toponly'};      $ENV{'form.condition'} = !$self->{'toponly'};
     my $cols = [$renderColFunc, Apache::lonnavmaps::resource()];      my $cols = [$renderColFunc];
       if ($self->{'addparts'}) { push(@$cols, $renderPartsFunc); }
       push(@$cols, Apache::lonnavmaps::resource());
     if ($self->{'addstatus'}) {      if ($self->{'addstatus'}) {
  push @$cols, (Apache::lonnavmaps::part_status_summary());   push @$cols, (Apache::lonnavmaps::part_status_summary());
   
Line 3217  sub render { Line 3263  sub render {
     my $resourceString;      my $resourceString;
     my $symb;      my $symb;
     my $paramlevel;      my $paramlevel;
       
     # Print the granularity, depending on the action      # Print the granularity, depending on the action
     if ($vars->{GRANULARITY} eq 'whole_course') {      if ($vars->{GRANULARITY} eq 'whole_course') {
         $resourceString .= '<li>'.&mt('for <b>all resources in the course</b>').'</li>';          $resourceString .= '<li>'.&mt('for <b>all resources in the course</b>').'</li>';
Line 3237  sub render { Line 3283  sub render {
     } else {      } else {
         my $navmap = Apache::lonnavmaps::navmap->new();          my $navmap = Apache::lonnavmaps::navmap->new();
         my $res = $navmap->getById($vars->{RESOURCE_ID});          my $res = $navmap->getById($vars->{RESOURCE_ID});
           my $part = $vars->{RESOURCE_ID_part};
    if ($part ne 'All Parts' && $part) { $parm_name=~s/^0/$part/; } else { $part=&mt('All Parts'); }
         $symb = $res->symb();          $symb = $res->symb();
         my $title = $res->compTitle();          my $title = $res->compTitle();
         $resourceString .= '<li>'.&mt('for the resource named [_1]',"<b>$title</b>").'</li>';          $resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>';
         $level = 7;          $level = 7;
         $affectedResourceId = $vars->{RESOURCE_ID};          $affectedResourceId = $vars->{RESOURCE_ID};
         $paramlevel = 'full';          $paramlevel = 'full';
     }      }
   
     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";
       if ($vars->{GRANULARITY} eq 'resource') {
    $result .= "<input type='hidden' name='symb' value='".
       HTML::Entities::encode($symb,"'<>&\"") . "' />\n";
    $result .= "<input type='hidden' name='pscat' value='".
       HTML::Entities::encode($vars->{ACTION_TYPE},"'<>&\"") . "' />\n";
    my $part = $vars->{RESOURCE_ID_part};
    if ($part eq 'All Parts' || !$part) { $part=0; }
    $result .= "<input type='hidden' name='psprt' value='".
       HTML::Entities::encode($part,"'<>&\"") . "' />\n";
       }
     $result .= '<p>'.&mt('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:

Removed from v.1.94  
changed lines
  Added in v.1.95


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