Diff for /loncom/interface/londocs.pm between versions 1.278 and 1.278.2.1

version 1.278, 2007/06/16 17:42:24 version 1.278.2.1, 2007/06/28 23:26:46
Line 967  sub breadcrumbs { Line 967  sub breadcrumbs {
     my $randompick=-1;      my $randompick=-1;
     my $isencrypted=0;      my $isencrypted=0;
     my $ishidden=0;      my $ishidden=0;
       my $is_random_order=0;
     while (@folders) {      while (@folders) {
  my $folder=shift(@folders);   my $folder=shift(@folders);
  my $foldername=shift(@folders);   my $foldername=shift(@folders);
Line 976  sub breadcrumbs { Line 977  sub breadcrumbs {
     &escape($folderpath);      &escape($folderpath);
             my $name=&unescape($foldername);              my $name=&unescape($foldername);
 # randompick number, hidden, encrypted is appended with ":"s to the foldername  # randompick number, hidden, encrypted is appended with ":"s to the foldername
             $name=~s/\:(\d*)\:(\w*)\:(\w*)$//;              $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
             if ($1 ne '') {               if ($1 ne '') { 
                $randompick=$1;                 $randompick=$1;
             } else {              } else {
Line 984  sub breadcrumbs { Line 985  sub breadcrumbs {
             }              }
             if ($2) { $ishidden=1; }              if ($2) { $ishidden=1; }
             if ($3) { $isencrypted=1; }              if ($3) { $isencrypted=1; }
               if ($4 ne '') { $is_random_order = 1; }
     &Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
       {'href'=>$url.$cpinfo,        {'href'=>$url.$cpinfo,
        'title'=>$name,         'title'=>$name,
Line 995  sub breadcrumbs { Line 997  sub breadcrumbs {
     }      }
     $plain=~s/\&gt\;\s*$//;      $plain=~s/\&gt\;\s*$//;
     return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',      return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
        'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain);         'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
 }  }
   
 sub log_docs {  sub log_docs {
Line 1086  sub docs_change_log { Line 1088  sub docs_change_log {
     my %lt=('hiddenresource' => 'Resources hidden',      my %lt=('hiddenresource' => 'Resources hidden',
     'encrypturl'     => 'URL hidden',      'encrypturl'     => 'URL hidden',
     'randompick'     => 'Randomly pick',      'randompick'     => 'Randomly pick',
       'randomorder'    => 'Randomly ordered',
     'set'            => 'set to',      'set'            => 'set to',
     'del'            => 'deleted');      'del'            => 'deleted');
     $r->print(&Apache::loncommon::display_filter().      $r->print(&Apache::loncommon::display_filter().
Line 1168  sub docs_change_log { Line 1171  sub docs_change_log {
  $r->print('</ul>');   $r->print('</ul>');
  if ($docslog{$id}{'logentry'}{'parameter_res'}) {   if ($docslog{$id}{'logentry'}{'parameter_res'}) {
     $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>');      $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>');
     foreach my $parameter ('randompick','hiddenresource','encrypturl') {      foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') {
  if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {   if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {
     $r->print('<li>'.      $r->print('<li>'.
       &mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]',        &mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]',
Line 1210  sub editor { Line 1213  sub editor {
  $env{'form.markedcopy_title'}=$title;   $env{'form.markedcopy_title'}=$title;
  $env{'form.markedcopy_url'}=$url;   $env{'form.markedcopy_url'}=$url;
     }      }
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder);      my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=&breadcrumbs($folder);
     $r->print($breadcrumbtrail);      $r->print($breadcrumbtrail);
     if ($fatal) {      if ($fatal) {
    $r->print('<p><font color="red">'.$errtext.'</font></p>');     $r->print('<p><font color="red">'.$errtext.'</font></p>');
Line 1251  sub editor { Line 1254  sub editor {
  &remember_parms($idx,'encrypturl','del');   &remember_parms($idx,'encrypturl','del');
     }      }
  }   }
    if ($env{'form.changeparms'} eq 'randomorder') {
       if ($env{'form.randorder_'.$idx}) {
    &LONCAPA::map::storeparameter($idx,'parameter_randomorder','yes','string_yesno');
    &remember_parms($idx,'randomorder','set',$env{'form.randorder_'.$idx});
       } else {
    &LONCAPA::map::delparameter($idx,'parameter_randomorder');
    &remember_parms($idx,'randomorder','del');
       }
    }
 # store the changed version  # store the changed version
  ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);   ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
  if ($fatal) {   if ($fatal) {
Line 1435  sub editor { Line 1447  sub editor {
 # ---------------------------------------------------------------- Print screen  # ---------------------------------------------------------------- Print screen
         my $idx=0;          my $idx=0;
  my $shown=0;   my $shown=0;
         if (($ishidden) || ($isencrypted) || ($randompick>=0)) {          if (($ishidden) || ($isencrypted) || ($randompick>=0) 
       || ($is_random_order)) {
            $r->print('<p>'.&mt('Parameters').':<ul>'.             $r->print('<p>'.&mt('Parameters').':<ul>'.
                      ($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':'').                       ($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':'').
                        ($is_random_order?'<li>'.&mt('contents randomly ordered').'</li>':'').
                      ($ishidden?'<li>'.&mt('contents hidden').'</li>':'').                       ($ishidden?'<li>'.&mt('contents hidden').'</li>':'').
                      ($isencrypted?'<li>'.&mt('URLs hidden').'</li>':'').                       ($isencrypted?'<li>'.&mt('URLs hidden').'</li>':'').
                      '</ul></p>');                       '</ul></p>');
         }                                                                                                               }
         if ($randompick>=0) {          if ($randompick>=0) {
            $r->print('<p>'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'</p>');             $r->print('<p>'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'</p>');
         }          }
           if ($is_random_order) {
              $r->print('<p>'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown. Do not modify the contents of this folder if it is in active student use.').'</p>');
           }
         $r->print('<table>');          $r->print('<table>');
         foreach my $res (@LONCAPA::map::order) {          foreach my $res (@LONCAPA::map::order) {
            my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);             my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
Line 1889  END Line 1906  END
                                                .':'.((&LONCAPA::map::getparameter($orderidx,                                                 .':'.((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_hiddenresource'))[0]=~/^yes$/i)                                                'parameter_hiddenresource'))[0]=~/^yes$/i)
                                                .':'.((&LONCAPA::map::getparameter($orderidx,                                                 .':'.((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_encrypturl'))[0]=~/^yes$/i);                                                'parameter_encrypturl'))[0]=~/^yes$/i)
                                                  .':'.((&LONCAPA::map::getparameter($orderidx,
                                                 'parameter_randomorder'))[0]=~/^yes$/i);
  $url.='folderpath='.&escape($folderpath).$cpinfo;   $url.='folderpath='.&escape($folderpath).$cpinfo;
  $parameterset='<label>'.&mt('Randomly Pick: ').   $parameterset='<label>'.&mt('Randomly Pick: ').
     '<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'.      '<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'.
Line 1924  END Line 1943  END
     if (($allowed) && ($folder!~/^supplemental/)) {      if (($allowed) && ($folder!~/^supplemental/)) {
   my %lt=&Apache::lonlocal::texthash(    my %lt=&Apache::lonlocal::texthash(
        'hd' => 'Hidden',         'hd' => 'Hidden',
        'ec' => 'URL hidden');         'ec' => 'URL hidden',
          'ro' => 'Random Order',);
  my $enctext=   my $enctext=
     ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');      ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':'');
  my $hidtext=   my $hidtext=
     ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');      ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':'');
    my $rotext=
       ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
  $line.=(<<ENDPARMS);   $line.=(<<ENDPARMS);
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td>  <nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td>  <nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td>
   <td bgcolor="#BBBBFF"><font size='-2'>
   <nobr><label><input type="checkbox" name="randorder_$orderidx" onClick="this.form.changeparms.value='randomorder';this.form.submit()" $rotext /> $lt{'ro'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>  <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
 ENDPARMS  ENDPARMS
     }      }

Removed from v.1.278  
changed lines
  Added in v.1.278.2.1


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