Diff for /loncom/interface/londocs.pm between versions 1.367 and 1.381

version 1.367, 2009/05/16 21:01:07 version 1.381, 2009/07/14 17:33:43
Line 142  sub dumpcourse { Line 142  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
     my $type = &Apache::loncommon::course_type();      my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').      $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
       '<form name="dumpdoc" method="post">');        '<form name="dumpdoc" action="" method="post">');
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }      unless ($home) { return ''; }
Line 262  sub dumpcourse { Line 262  sub dumpcourse {
   
 sub exportbutton {  sub exportbutton {
     my $type = &Apache::loncommon::course_type();      my $type = &Apache::loncommon::course_type();
     return '<input type="submit" name="exportcourse" value="'.      return '<input type="submit" name="exportcourse"'
             &mt('Export '.$type.' to IMS').'" />'.            .' value="'.&mt('IMS Export').'"'
             .' title="'.&mt('Export '.$type.' to IMS Package').'" />'.
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';      &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';
 }  }
   
Line 277  sub exportcourse { Line 278  sub exportcourse {
     my $numdisc = keys(%discussiontime);      my $numdisc = keys(%discussiontime);
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {      if (!defined($navmap)) {
         $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package').          $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package').
                   '<h2>IMS Export Failed</h2>'.                    '<h2>'.&mt('IMS Export Failed').'</h2>'.
                   '<div class="LC_error">'.                    '<div class="LC_error">'.
                   &mt('Unable to retrieve information about course contents').                    &mt('Unable to retrieve information about course contents').
                   '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');                    '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
Line 298  sub exportcourse { Line 299  sub exportcourse {
         my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');          my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
         my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');          my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
         if (@exportitems == 0 && @discussions == 0) {          if (@exportitems == 0 && @discussions == 0) {
             $outcome = '<br />As you did not select any content items or discussions for export, an IMS package has not been created.  Please <a href="javascript:history.go(-1)">go back</a> to select either content items or discussions for export';              $outcome = 
                   '<p class="LC_warning">'
                  .&mt('As you did not select any content items or discussions'
                      .' for export, an IMS package has not been created.')
                  .'</p>'
                  .'<p>'
                  .&mt('Please [_1]go back[_2] to select either content items'
                      .' or discussions for export.'
                          ,'<a href="javascript:history.go(-1)">'
                          ,'</a>')
                  .'</p>';
         } else {          } else {
             my $now = time;              my $now = time;
             my %symbs;              my %symbs;
Line 321  sub exportcourse { Line 332  sub exportcourse {
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");                  open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);                  close(OUTPUT);
                 chdir $cwd;                  chdir $cwd;
                 $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);  
                 if ($copyresult) {                  if ($copyresult) {
                     $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult);                      $outcome .= '<p class="LC_error">'
                                  .&mt('The following errors occurred during export - [_1]'
                                      ,$copyresult)
                                  .'</p>';
                 }                  }
                   $outcome .= '<p>'
                              .&mt('[_1]Your IMS package[_2] is ready for download.'
                                  ,'<a href="'.$imszipfile.'">','</a>')
                              .'</p>';
             } else {              } else {
                 $outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'<br />';                  $outcome = '<p class="LC_error">'
                             .&mt('Unfortunately you will not be able to retrieve'
                                 .' an IMS archive of this posts at this time,'
                                 .' because there was a problem creating a'
                                 .' manifest file.')
                             .'</p>'
                             .'<p><a href="javascript:history.go(-1)">'
                             .&mt('Go Back')
                             .'</a></p>';
             }              }
         }          }
         $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));          $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'));
  $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));   $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
         $r->print($outcome);          $r->print($outcome);
         $r->print(&Apache::loncommon::end_page());          $r->print(&Apache::loncommon::end_page());
     } else {      } else {
         my $display;          my $display;
         $display = '<form name="exportdoc" method="post">'."\n";          $display = '<form name="exportdoc" action="" method="post">'."\n";
         $display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');          $display .= '<p>'
         $display .= '<table border="0" cellspacing="0" cellpadding="3">'.                     .&mt('Choose which items you wish to export from your '.$type.'.')
                     '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.                     .'</p>';
                     '<input type="button" value="check all" '.          $display .= '<div class="LC_columnSection"><fieldset>'.
                       '<legend>'.&mt('Content items').'</legend>'.
                       '<input type="button" value="'.&mt('check all').'" '.
                     'onclick="javascript:checkAll(document.exportdoc.archive)" />'.                      'onclick="javascript:checkAll(document.exportdoc.archive)" />'.
                     '&nbsp;&nbsp;<input type="button" value="uncheck all"'.                      '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
                     ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'.                      ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset>'.
                     '<td>&nbsp;</td><td>&nbsp;</td>'.                      '<fieldset>'.
                     '<td align="right"><fieldset><legend>&nbsp;<b>Discussion posts'.                      '<legend>'.&mt('Discussion posts').'</legend>'.
                     '</b></legend><input type="button" value="check all"'.                      '<input type="button" value="'.&mt('check all').'"'.
                     ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.                      ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
                     '&nbsp;&nbsp;<input type="button" value="uncheck all"'.                      '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
                     ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'.                      ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" />'.
                     '</tr></table>';                      '</fieldset></div>';
         my $curRes;          my $curRes;
         my $depth = 0;          my $depth = 0;
         my $count = 0;          my $count = 0;
Line 358  sub exportcourse { Line 385  sub exportcourse {
         my %parent = ();          my %parent = ();
         my %children = ();          my %children = ();
         my $lastcontainer = $startcount;          my $lastcontainer = $startcount;
         my @bgcolors = ('#F6F6F6','#FFFFFF');          $display .= &Apache::loncommon::start_data_table()
         $display .= '<table cellspacing="0"><tr>'.                     .&Apache::loncommon::start_data_table_header_row()
             '<td><b>Export content item?<br /></b></td><td>&nbsp;</td><td align="right">'."\n";                     .'<th>'.&mt('Export content item?').'</th>'
                      .'<th>';
         if ($numdisc > 0) {          if ($numdisc > 0) {
             $display.='<b>Export&nbsp;discussion posts?</b>'."\n";              $display .= &mt('Export discussion posts?');
           } else {
                $display .= '&nbsp;';
         }          }
         $display.='&nbsp;</td></tr>';          $display .= '</th>'
                      .&Apache::loncommon::end_data_table_header_row();
         while ($curRes = $it->next()) {          while ($curRes = $it->next()) {
             if (ref($curRes)) {              if (ref($curRes)) {
                 $count ++;                  $count ++;
Line 385  sub exportcourse { Line 416  sub exportcourse {
                         $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';                          $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
                     }                      }
                 }                  }
                 my $color = $count%2;                  $display .= &Apache::loncommon::start_data_table_row()
                 $display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n".                             .'<td>'."\n"
                     '<input type="checkbox" name="archive" value="'.$count.'" ';                             .'<input type="checkbox" name="archive" value="'.$count.'" ';
                 if (($curRes->is_sequence()) || ($curRes->is_page())) {                  if (($curRes->is_sequence()) || ($curRes->is_page())) {
                     my $checkitem = $count + $boards + $startcount;                      my $checkitem = $count + $boards + $startcount;
                     $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"';                      $display .= 'onclick="javascript:propagateCheck('."'$checkitem'".')"';
                 }                  }
                 $display .= ' />'."\n";                  $display .= ' />'."\n";
                 for (my $i=0; $i<$depth; $i++) {                  for (my $i=0; $i<$depth; $i++) {
                     $display .= '<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" /><img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />'."\n";                      $display .= '<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" alt="" />'
                                  .'<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" alt="" />'."\n";
                 }                  }
                 if ($curRes->is_sequence()) {                  if ($curRes->is_sequence()) {
                     $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />&nbsp;'."\n";                      $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />&nbsp;'."\n";
Line 405  sub exportcourse { Line 437  sub exportcourse {
                 }                  }
                 my $currelem = $count+$boards+$startcount;                  my $currelem = $count+$boards+$startcount;
                 $children{$parent{$depth}} .= $currelem.':';                  $children{$parent{$depth}} .= $currelem.':';
                 $display .= '&nbsp;'.$curRes->title().'</td>';                  $display .= '&nbsp;'.$curRes->title().'</td>'."\n";
   
                   # Existing discussion posts?
                 if ($discussiontime{$ressymb} > 0) {                  if ($discussiontime{$ressymb} > 0) {
                     $boards ++;                      $boards ++;
                     $currelem = $count+$boards+$startcount;                      $currelem = $count+$boards+$startcount;
                     $display .= '<td>&nbsp;</td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" />&nbsp;</td>'."\n";                      $display .= '<td align="right">'
                                  .'<input type="checkbox" name="discussion" value="'.$count.'" />'
                                  .'</td>'."\n";
                 } else {                  } else {
                     $display .= '<td colspan="2">&nbsp;</td>'."\n";                      $display .= '<td>&nbsp;</td>'."\n";
                 }                  }
                   $display .= &Apache::loncommon::end_data_table_row();
             }              }
         }          }
           $display .= &Apache::loncommon::end_data_table();
         my $scripttag = qq|          my $scripttag = qq|
 <script>  <script type="text/javascript">
   // <![CDATA[
 function checkAll(field) {  function checkAll(field) {
     if (field.length > 0) {      if (field.length > 0) {
         for (i = 0; i < field.length; i++) {          for (i = 0; i < field.length; i++) {
Line 467  function containerCheck(item) { Line 505  function containerCheck(item) {
         }          }
      }       }
 }  }
   // ]]>
 </script>  </script>
         |;          |;
  $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package',   $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package',
  $scripttag));   $scripttag));
  $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));   $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
  $r->print($display.'</table>'.   $r->print($display.
                   '<p><input type="hidden" name="finishexport" value="1" />'.                    '<p><input type="hidden" name="finishexport" value="1" />'.
                   '<input type="submit" name="exportcourse" value="'.                    '<input type="submit" name="exportcourse" value="'.
                   &mt('Export '.$type.' DOCS').'" /></p></form>');                    &mt('Export').'" /></p></form>');
     }      }
 }  }
   
Line 1011  sub breadcrumbs { Line 1049  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', undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order);         undef, undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
 }  }
   
 sub log_docs {  sub log_docs {
Line 1235  sub print_paste_buffer { Line 1273  sub print_paste_buffer {
     my ($r,$container) = @_;      my ($r,$container) = @_;
     return if (!defined($env{'docs.markedcopy_url'}));      return if (!defined($env{'docs.markedcopy_url'}));
   
     $r->print(<<ENDPASTE);      $r->print('<fieldset>'
 <form name="pasteform" action="/adm/coursedocs" method="post"><p>               .'<legend>'.&mt('Clipboard').'</legend>'
 ENDPASTE               .'<form name="pasteform" action="/adm/coursedocs" method="post">'
     $r->print('<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> ');               .'<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> '
       );
   
     my $type;      my $type;
     if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?:&colon;|:))//} ) {      if ($env{'docs.markedcopy_url'} =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?:&colon;|:))//} ) {
Line 1252  ENDPASTE Line 1291  ENDPASTE
  if ($extension eq 'sequence' &&   if ($extension eq 'sequence' &&
     $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) {      $env{'docs.markedcopy_url'} =~ m{/default_\d+\.sequence$ }x) {
     $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));      $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
     $icon .= '/folder_closed.gif';      $icon .= '/navmap.folder.closed.gif';
  }   }
  $icon = '<img src="'.$icon.'" alt="" class="LC_icon" />';   $icon = '<img src="'.$icon.'" alt="" class="LC_icon" />';
  $r->print($icon.$type.': '.  &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'})));   $r->print($icon.$type.': '.  &parse_supplemental_title(&LONCAPA::map::qtescape($env{'docs.markedcopy_title'})));
Line 1267  ENDPASTE Line 1306  ENDPASTE
         <input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />          <input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
 ');  ');
     }      }
     $r->print('</p></form>');      $r->print('</form></fieldset>');
 }  }
   
 sub do_paste_from_buffer {  sub do_paste_from_buffer {
Line 1550  sub editor { Line 1589  sub editor {
     my $idx=0;      my $idx=0;
     my $shown=0;      my $shown=0;
     if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {      if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {
  $r->print('<p>'.&mt('Parameters').':<ul>'.   $r->print('<div class="LC_Box">'.
   ($randompick>=0?'<li>'.&mt('randomly pick [_1] resources',$randompick).'</li>':'').            '<p>'.&mt('Parameters:').
             '<ul>'.
     ($randompick>=0?'<li>'.&mt('randomly pick [quant,_1,resource]',$randompick).'</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>':'').
     ($is_random_order?'<li>'.&mt('random order').'</li>':'').
   '</ul></p>');    '</ul></p>');
           if ($randompick>=0) {
               $r->print('<p class="LC_warning">'
                    .&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 class="LC_warning">'
                    .&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.')
                    .'</p>'
               );
           }
           $r->print('</div>');
     }      }
     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>');      my $output;
     }  
     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.').'</p>');  
     }  
     $r->print('<table class="LC_docs_editor">');  
     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]);
  $name=&LONCAPA::map::qtescape($name);          $name=&LONCAPA::map::qtescape($name);
  $url=&LONCAPA::map::qtescape($url);          $url=&LONCAPA::map::qtescape($url);
  unless ($name) {  $name=(split(/\//,$url))[-1]; }          unless ($name) {  $name=(split(/\//,$url))[-1]; }
  unless ($name) { $idx++; next; }          unless ($name) { $idx++; next; }
  $r->print(&entryline($idx,$name,$url,$folder,$allowed,$res,          $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
      $coursenum));                                $coursenum);
  $idx++;          $idx++;
  $shown++;          $shown++;
     }      }
     unless ($shown) {      if ($shown) {
  $r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>');      $r->print(&Apache::loncommon::start_data_table()
                .&Apache::loncommon::start_data_table_header_row()
                .'<th colspan="2">'.&mt('Move').'</th>'
                .'<th>'.&mt('Actions').'</th>'
                .'<th colspan="2">'.&mt('Document').'</th>'
                .'<th colspan="4">'.&mt('Settings').'</th>'
                .&Apache::loncommon::end_data_table_header_row()
                .$output
                .&Apache::loncommon::end_data_table()
       )
       } else {
           $r->print('<p class="LC_info">'
                    .&mt('Currently no documents.')
                    .'</p>'
           );
     }      }
     $r->print("\n</table>\n");  
     if ($allowed) {      if ($allowed) {
         &print_paste_buffer($r,$container);          &print_paste_buffer($r,$container);
     }      }
Line 1740  sub entryline { Line 1811  sub entryline {
     $renametitle=~s/\\/\\\\/g;      $renametitle=~s/\\/\\\\/g;
     $renametitle=~s/\&quot\;/\\\"/g;      $renametitle=~s/\&quot\;/\\\"/g;
     $renametitle=~s/ /%20/g;      $renametitle=~s/ /%20/g;
     my $line='<tr>';      my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end);      my ($form_start,$form_end);
 # Edit commands  # Edit commands
     my ($container, $type, $esc_path, $path, $symb);      my ($container, $type, $esc_path, $path, $symb);
Line 1771  sub entryline { Line 1842  sub entryline {
      ne '')) {       ne '')) {
     $selectbox=      $selectbox=
  '<input type="hidden" name="currentpos" value="'.$incindex.'" />'.   '<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
  '<select name="newpos" onChange="this.form.submit()">';   '<select name="newpos" onchange="this.form.submit()">';
     for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) {      for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) {
  if ($i==$incindex) {   if ($i==$incindex) {
     $selectbox.='<option value="" selected="selected">('.$i.')</option>';      $selectbox.='<option value="" selected="selected">('.$i.')</option>';
Line 1843  END Line 1914  END
         $form_end = '</form>';          $form_end = '</form>';
  $line.=(<<END);   $line.=(<<END);
 <td>  <td>
    <table class="LC_docs_entry_move">  <div class="LC_docs_entry_move">
       <tr>    <a href='/adm/coursedocs?cmd=up_$index&amp;${type}path=$esc_path&amp;${type}symb=$symb$cpinfo'>
          <td>      <img src="${iconpath}move_up.gif" alt='$lt{'up'}' class="LC_icon" />
             <a href='/adm/coursedocs?cmd=up_$index&amp;${type}path=$esc_path&amp;${type}symb=$symb$cpinfo'><img src="${iconpath}move_up.gif" alt='$lt{'up'}' class="LC_icon" /></a>    </a>
          </td>  </div>
       </tr>  <div class="LC_docs_entry_move">
       <tr>    <a href='/adm/coursedocs?cmd=down_$index&amp;${type}path=$esc_path&amp;${type}symb=$symb$cpinfo'>
         <td>      <img src="${iconpath}move_down.gif" alt='$lt{'dw'}' class="LC_icon" />
            <a href='/adm/coursedocs?cmd=down_$index&amp;${type}path=$esc_path&amp;${type}symb=$symb$cpinfo'><img src="${iconpath}move_down.gif" alt='$lt{'dw'}' class="LC_icon" /></a>    </a>
         </td>  </div>
       </tr>  
     </table>  
 </td>  </td>
 <td>  <td>
    $form_start     $form_start
Line 1881  END Line 1950  END
     my $pagefile;      my $pagefile;
     if ($uploaded) {      if ($uploaded) {
  if ($extension eq 'sequence') {   if ($extension eq 'sequence') {
     $icon=$iconpath.'/folder_closed.gif';      $icon=$iconpath.'/navmap.folder.closed.gif';
     $url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/;      $url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/;
     $url='/adm/coursedocs?';      $url='/adm/coursedocs?';
     $folderarg=$1;      $folderarg=$1;
Line 1953  END Line 2022  END
                                               'parameter_randomorder'))[0]=~/^yes$/i);                                                '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="randompick_'.$orderidx.'" value="'.      '<input type="text" size="4" onchange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randompick_'.$orderidx.'" value="'.
     (&LONCAPA::map::getparameter($orderidx,      (&LONCAPA::map::getparameter($orderidx,
                                               'parameter_randompick'))[0].                                                'parameter_randompick'))[0].
                                               '" />'.                                                '" />'.
Line 1961  END Line 2030  END
     my $ro_set=      my $ro_set=
     ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');      ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
  $rand_order_text ='   $rand_order_text ='
 <span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';  <span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';
     }      }
     if ($ispage) {      if ($ispage) {
         my $pagename=&escape($pagetitle);          my $pagename=&escape($pagetitle);
Line 1988  END Line 2057  END
  undef($external);   undef($external);
     }      }
     $line.='      $line.='
   <td class="LC_docs_entry_icon">    <td>
     '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'      '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'
   </td>    </td>
   <td class="LC_docs_entry_title">    <td>
     '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.&mt('(re-initialize course to access)').'</span>').$external."      '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.&mt('(re-initialize course to access)').'</span>').$external."
   </td>";    </td>";
     if (($allowed) && ($folder!~/^supplemental/)) {      if (($allowed) && ($folder!~/^supplemental/)) {
Line 2005  END Line 2074  END
  $line.=(<<ENDPARMS);   $line.=(<<ENDPARMS);
   <td class="LC_docs_entry_parameter">    <td class="LC_docs_entry_parameter">
     $form_start      $form_start
     <label><input type="checkbox" name="hiddenresource_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>      <label><input type="checkbox" name="hiddenresource_$orderidx" onclick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
     $form_end      $form_end
   </td>    </td>
   <td class="LC_docs_entry_parameter">    <td class="LC_docs_entry_parameter">
     $form_start      $form_start
     <label><input type="checkbox" name="encrypturl_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>      <label><input type="checkbox" name="encrypturl_$orderidx" onclick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
     $form_end      $form_end
   </td>    </td>
   <td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td>    <td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td>
   <td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td>    <td class="LC_docs_entry_parameter">$form_start $parameterset $form_end</td>
 ENDPARMS  ENDPARMS
     }      }
     $line.="</tr>";      $line.=&Apache::loncommon::end_data_table_row();
     return $line;      return $line;
 }  }
   
Line 2093  sub checkonthis { Line 2162  sub checkonthis {
                  if (($errorcount) ||                   if (($errorcount) ||
                      ($warningcount)) {                       ($warningcount)) {
      if ($errorcount) {       if ($errorcount) {
                         $r->print('<img src="/adm/lonMisc/bomb.gif" alt="" /><span class="LC_error">'.                          $r->print('<img src="/adm/lonMisc/bomb.gif" alt="'.&mt('bomb').'" /><span class="LC_error">'.
                           &mt('[quant,_1,error]',$errorcount).'</span>');                            &mt('[quant,_1,error]',$errorcount).'</span>');
                      }                       }
      if ($warningcount) {       if ($warningcount) {
Line 2483  sub changewarning { Line 2552  sub changewarning {
  $message='Changes will become active for your current session after [_1], or the next time you log in.';   $message='Changes will become active for your current session after [_1], or the next time you log in.';
     }      }
     $r->print("\n\n".      $r->print("\n\n".
 '<script type="text/javascript">function reinit(tf) { tf.submit();'.$postexec.' }</script>'."\n".  '<script type="text/javascript">'."\n".
   '// <![CDATA['."\n".
   'function reinit(tf) { tf.submit();'.$postexec.' }'."\n".
   '// ]]>'."\n".
   '</script>'."\n".
 '<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'.  '<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'.
 '<input type="hidden" name="orgurl" value="'.$url.  '<input type="hidden" name="orgurl" value="'.$url.
 '" /><input type="hidden" name="selectrole" value="1" /><h3><span class="LC_warning">'.  '" /><input type="hidden" name="selectrole" value="1" /><p class="LC_warning">'.
 &mt($message,' <input type="hidden" name="'.  &mt($message,' <input type="hidden" name="'.
     $env{'request.role'}.'" value="1" /><input type="button" value="'.      $env{'request.role'}.'" value="1" /><input type="button" value="'.
     &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').      &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />').
 $help{'Caching'}.'</span></h3></form>'."\n\n");  $help{'Caching'}.'</p></form>'."\n\n");
 }  }
   
   
Line 2560  sub handler { Line 2633  sub handler {
       &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');        &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
       &dumpcourse($r);        &dumpcourse($r);
   } elsif ($allowed && $env{'form.exportcourse'}) {    } elsif ($allowed && $env{'form.exportcourse'}) {
       &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS');        &init_breadcrumbs('exportcourse','IMS Export');
       &exportcourse($r);        &exportcourse($r);
   } else {    } else {
 # is this a standard course?  # is this a standard course?
Line 2646  sub handler { Line 2719  sub handler {
  $script .= &editing_js($udom,$uname);   $script .= &editing_js($udom,$uname);
     }      }
 # -------------------------------------------------------------------- Body tag  # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';      $script = '<script type="text/javascript">'."\n"
                 .'// <![CDATA['."\n"
                 .$script."\n"
                 .'// ]]>'."\n"
                 .'</script>'."\n";
     my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];      my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
     $r->print(&Apache::loncommon::start_page("$type Documents", $script,      $r->print(&Apache::loncommon::start_page("$type Documents", $script,
     {'force_register' => $showdoc,      {'force_register' => $showdoc,
Line 2746  sub handler { Line 2823  sub handler {
                 'uplm' => 'Upload a new main '.lc($type).' document',                  'uplm' => 'Upload a new main '.lc($type).' document',
                 'upls' => 'Upload a new supplemental '.lc($type).' document',                  'upls' => 'Upload a new supplemental '.lc($type).' document',
                 'impp' => 'Import a document',                  'impp' => 'Import a document',
                 'pubd' => 'Published Documents',  
  'copm' => 'All documents out of a published map into this folder',   'copm' => 'All documents out of a published map into this folder',
                 'upld' => 'Upload Document',                  'upld' => 'Upload Document',
                 'srch' => 'Search',                  'srch' => 'Search',
Line 2769  sub handler { Line 2845  sub handler {
                 'grpo' => 'Group Portfolio',                  'grpo' => 'Group Portfolio',
                 'rost' => 'Course Roster',                  'rost' => 'Course Roster',
  'abou' => 'Personal Information Page for a User',   'abou' => 'Personal Information Page for a User',
                 'imsf' => 'Import IMS package',                  'imsf' => 'IMS Import',
                   'imsl' => 'Import IMS package',
                 'file' =>  'File',                  'file' =>  'File',
                 'title' => 'Title',                  'title' => 'Title',
                 'comment' => 'Comment',                  'comment' => 'Comment',
                 'parse' => 'Upload embedded images/multimedia files if HTML file!',                  'parse' => 'Upload embedded images/multimedia files if HTML file!',
  'nd' => 'New Document',   'nd' => 'Upload Document',
  'pm' => 'Published Map',   'pm' => 'Published Map',
  'sd' => 'Special Document',   'sd' => 'Special Document',
  'mo' => 'More Options',   'mo' => 'More Options',
  'hao' => 'Hide all Options'  
   );    );
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
  my $fileupload=(<<FIUP);   my $fileupload=(<<FIUP);
Line 2797  CHBO Line 2873  CHBO
   
  my $fileuploadform=(<<FUFORM);   my $fileuploadform=(<<FUFORM);
  <form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">   <form name="uploaddocument" action="/adm/coursedocs" method="post" enctype="multipart/form-data">
    <input type="hidden" name="active" value="aa" />
  $fileupload   $fileupload
  <br />   <br />
  $lt{'title'}:<br />   $lt{'title'}:<br />
Line 2818  FUFORM Line 2895  FUFORM
   
  my $simpleeditdefaultform=(<<SEDFFORM);   my $simpleeditdefaultform=(<<SEDFFORM);
  <form action="/adm/coursedocs" method="post" name="simpleeditdefault">   <form action="/adm/coursedocs" method="post" name="simpleeditdefault">
  $lt{'pubd'}<br />   <input type="hidden" name="active" value="bb" />
  $uploadtag   $uploadtag
  <input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" />   <input type="button" onclick="javascript:groupsearch()" value="$lt{'srch'}" />
  <br />   <br />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" />   <input type="button" onclick="javascript:groupimport();" value="$lt{'impo'}" />
  $help{'Importing_LON-CAPA_Resource'}   $help{'Importing_LON-CAPA_Resource'}
  </span>   </span>
  <br />   <br />
  <input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />   <input type="button" onclick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
  <hr />   <hr />
  <p>   <p>
  $lt{'copm'}<br />   $lt{'copm'}<br />
  <input type="text" size="40" name="importmap" /><br />   <input type="text" size="40" name="importmap" /><br />
  <span class="LC_nobreak"><input type="button"   <span class="LC_nobreak"><input type="button"
  onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"   onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
  value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />   value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
  $help{'Load_Map'}</span>   $help{'Load_Map'}</span>
  </p>   </p>
Line 2845  SEDFFORM Line 2922  SEDFFORM
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newext" type="button" onClick="javascript:makenewext('newext');"   <input name="newext" type="button" onclick="javascript:makenewext('newext');"
  value="$lt{'extr'}" /> $help{'Adding_External_Resource'}   value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
  </span>   </span>
  </form>   </form>
Line 2890  HIDDENFORM Line 2967  HIDDENFORM
     my $activeClass = 1;      my $activeClass = 1;
     my $active = '';      my $active = '';
     $r->print('<ul class="LC_TabContentBigger" id="mainnav">');      $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
     if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || ($env{'form.pagepath'}))) {      if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
         if($activeClass == 1){          if($activeClass == 1){
            $active = 'class="active"';             $active = 'class="active"';
    $activeClass = 0;     $activeClass = 0;
  }   }
     }      }
     $r->print('<li '.$active.'onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');      $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');
     $active = '';      $active = '';
     if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {      if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
         if($activeClass == 1){          if($activeClass == 1){
            $active = 'class="active"';             $active = 'class="active"';
         }          }
     }      }
     $r->print('<li '.$active.'onclick="javascript:showPage(this,\'Supplemental Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');      $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');
     $r->print('</ul><div class="LC_ContentBoxSpecial" style="margin:0 0;padding:0 0;"><div id="maincoursedoc" style="margin:0 0;padding:0 0;">');      $r->print('</ul>'
                .'<div class="LC_Box" style="clear:both;margin:0;">'
                .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
 # --------------------------------------------------------- Standard documents  # --------------------------------------------------------- Standard documents
        my $savefolderpath;         my $savefolderpath;
        my $active = 'style="display: none;"';         my $active = 'style="display: none;"';
Line 2912  HIDDENFORM Line 2991  HIDDENFORM
           $active = 'style="display: block;"';            $active = 'style="display: block;"';
        }         }
        $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');         $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');
         $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',  
                      &mt('Editing the Table of Contents for your '.$type)));  
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder=~/^supplemental/) {         if ($folder eq '' || $folder=~/^supplemental/) {
            $folder='default';             $folder='default';
Line 2924  HIDDENFORM Line 3001  HIDDENFORM
        }         }
        my $postexec='';         my $postexec='';
        if ($folder eq 'default') {         if ($folder eq 'default') {
    $r->print('<script type="text/javascript">this.window.name="loncapaclient";</script>');             $r->print('<script type="text/javascript">'."\n"
                       .'// <![CDATA['."\n"
                       .'this.window.name="loncapaclient";'."\n"
                       .'// ]]>'."\n"
                       .'</script>'."\n"
          );
        } else {         } else {
            #$postexec='self.close();';             #$postexec='self.close();';
        }         }
Line 2942  HIDDENFORM Line 3024  HIDDENFORM
   
  my $recoverform=(<<RFORM);   my $recoverform=(<<RFORM);
  <form action="/adm/groupsort" method="post" name="recover">   <form action="/adm/groupsort" method="post" name="recover">
  <input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />   <input type="button" name="recovermap" onclick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
  </form>   </form>
 RFORM  RFORM
   
  my $imspform=(<<IMSPFORM);   my $imspform=(<<IMSPFORM);
  <form action="/adm/imsimportdocs" method="post" name="ims">   <form action="/adm/imsimportdocs" method="post" name="ims">
  <input type="hidden" name="folder" value="$folder" />   <input type="hidden" name="folder" value="$folder" />
  <input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" />   <input name="imsimport" type="button" value="$lt{'imsf'}" title="$lt{imsl}"  onclick="javascript:makeims();" />
  </form>   </form>
 IMSPFORM  IMSPFORM
   
  my $newnavform=(<<NNFORM);   my $newnavform=(<<NNFORM);
  <form action="/adm/coursedocs" method="post" name="newnav">   <form action="/adm/coursedocs" method="post" name="newnav">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$lt{'navc'}=/adm/navmaps" />   value="$lt{'navc'}=/adm/navmaps" />
Line 2966  IMSPFORM Line 3049  IMSPFORM
 NNFORM  NNFORM
  my $newsmppageform=(<<NSPFORM);   my $newsmppageform=(<<NSPFORM);
  <form action="/adm/coursedocs" method="post" name="newsmppg">   <form action="/adm/coursedocs" method="post" name="newsmppg">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newsmppg" type="button" value="$lt{'sipa'}"   <input name="newsmppg" type="button" value="$lt{'sipa'}"
  onClick="javascript:makesmppage();" /> $help{'Simple Page'}   onclick="javascript:makesmppage();" /> $help{'Simple Page'}
  </span>   </span>
  </form>   </form>
 NSPFORM  NSPFORM
   
  my $newsmpproblemform=(<<NSPROBFORM);   my $newsmpproblemform=(<<NSPROBFORM);
  <form action="/adm/coursedocs" method="post" name="newsmpproblem">   <form action="/adm/coursedocs" method="post" name="newsmpproblem">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newsmpproblem" type="button" value="$lt{'sipr'}"   <input name="newsmpproblem" type="button" value="$lt{'sipr'}"
  onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}   onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
  </span>   </span>
  </form>   </form>
   
Line 2989  NSPROBFORM Line 3074  NSPROBFORM
   
  my $newdropboxform=(<<NDBFORM);   my $newdropboxform=(<<NDBFORM);
  <form action="/adm/coursedocs" method="post" name="newdropbox">   <form action="/adm/coursedocs" method="post" name="newdropbox">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newdropbox" type="button" value="$lt{'drbx'}"   <input name="newdropbox" type="button" value="$lt{'drbx'}"
  onClick="javascript:makedropbox();" />   onclick="javascript:makedropbox();" />
  </span>   </span>
  </form>   </form>
 NDBFORM  NDBFORM
   
  my $newexuploadform=(<<NEXUFORM);   my $newexuploadform=(<<NEXUFORM);
  <form action="/adm/coursedocs" method="post" name="newexamupload">   <form action="/adm/coursedocs" method="post" name="newexamupload">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newexamupload" type="button" value="$lt{'scuf'}"   <input name="newexamupload" type="button" value="$lt{'scuf'}"
  onClick="javascript:makeexamupload();" />   onclick="javascript:makeexamupload();" />
  $help{'Score_Upload_Form'}   $help{'Score_Upload_Form'}
  </span>   </span>
  </form>   </form>
Line 3012  NEXUFORM Line 3099  NEXUFORM
   
  my $newbulform=(<<NBFORM);   my $newbulform=(<<NBFORM);
  <form action="/adm/coursedocs" method="post" name="newbul">   <form action="/adm/coursedocs" method="post" name="newbul">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newbulletin" type="button" value="$lt{'bull'}"   <input name="newbulletin" type="button" value="$lt{'bull'}"
  onClick="javascript:makebulboard();" />   onclick="javascript:makebulboard();" />
  $help{'Bulletin Board'}   $help{'Bulletin Board'}
  </span>   </span>
  </form>   </form>
Line 3024  NBFORM Line 3112  NBFORM
   
  my $newaboutmeform=(<<NAMFORM);   my $newaboutmeform=(<<NAMFORM);
  <form action="/adm/coursedocs" method="post" name="newaboutme">   <form action="/adm/coursedocs" method="post" name="newaboutme">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$plainname=/adm/$udom/$uname/aboutme" />   value="$plainname=/adm/$udom/$uname/aboutme" />
Line 3036  NAMFORM Line 3125  NAMFORM
   
  my $newaboutsomeoneform=(<<NASOFORM);   my $newaboutsomeoneform=(<<NASOFORM);
  <form action="/adm/coursedocs" method="post" name="newaboutsomeone">   <form action="/adm/coursedocs" method="post" name="newaboutsomeone">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newaboutsomeone" type="button" value="$lt{'abou'}"    <input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
  onClick="javascript:makeabout();" />   onclick="javascript:makeabout();" />
  </span>   </span>
  </form>   </form>
 NASOFORM  NASOFORM
Line 3048  NASOFORM Line 3138  NASOFORM
   
  my $newrosterform=(<<NROSTFORM);   my $newrosterform=(<<NROSTFORM);
  <form action="/adm/coursedocs" method="post" name="newroster">   <form action="/adm/coursedocs" method="post" name="newroster">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$lt{'rost'}=/adm/viewclasslist" />   value="$lt{'rost'}=/adm/viewclasslist" />
Line 3068  my $newfolderform; Line 3159  my $newfolderform;
  <form action="/adm/coursedocs" method="post" name="newpage">   <form action="/adm/coursedocs" method="post" name="newpage">
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
    <input type="hidden" name="active" value="cc" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newpage" type="button"   <input name="newpage" type="button"
  onClick="javascript:makenewpage(this.form,'$pageseq');"   onclick="javascript:makenewpage(this.form,'$pageseq');"
  value="$lt{'newp'}" />$help{'Adding_Pages'}   value="$lt{'newp'}" />$help{'Adding_Pages'}
  </span>   </span>
  </form>   </form>
Line 3080  NPFORM Line 3172  NPFORM
  <form action="/adm/coursedocs" method="post" name="newfolder">   <form action="/adm/coursedocs" method="post" name="newfolder">
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
    <input type="hidden" name="active" value="aa" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newfolder" type="button"   <input name="newfolder" type="button"
  onClick="javascript:makenewfolder(this.form,'$folderseq');"   onclick="javascript:makenewfolder(this.form,'$folderseq');"
  value="$lt{'newf'}" />$help{'Adding_Folders'}   value="$lt{'newf'}" />$help{'Adding_Folders'}
  </span>   </span>
  </form>   </form>
Line 3090  NFFORM Line 3183  NFFORM
   
  my $newsylform=(<<NSYLFORM);   my $newsylform=(<<NSYLFORM);
  <form action="/adm/coursedocs" method="post" name="newsyl">   <form action="/adm/coursedocs" method="post" name="newsyl">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />   value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
Line 3102  NSYLFORM Line 3196  NSYLFORM
   
  my $newgroupfileform=(<<NGFFORM);   my $newgroupfileform=(<<NGFFORM);
  <form action="/adm/coursedocs" method="post" name="newgroupfiles">   <form action="/adm/coursedocs" method="post" name="newgroupfiles">
    <input type="hidden" name="active" value="cc" />
  $uploadtag   $uploadtag
  <input type="hidden" name="importdetail"   <input type="hidden" name="importdetail"
  value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />   value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
Line 3124  if($env{'form.pagepath'}) { Line 3219  if($env{'form.pagepath'}) {
 }  }
   
 my %orderhash = (  my %orderhash = (
                 'aa' => ['New Document',$fileuploadform.'<br />'.$newfolderform],                  'aa' => ['Upload Document',$fileuploadform.'<br />'.$newfolderform],
                 'bb' => ['Published Documents',$simpleeditdefaultform],                  'bb' => ['Published Resources',$simpleeditdefaultform],
                 'cc' => ['Special Documents',$specialdocumentsform],                  'cc' => ['Special Documents',$specialdocumentsform],
  'dd' => ['Tools',$extresourcesform.'<br />'.$imspform.'<br />'.$recoverform.'<br />'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],   'dd' => ['Tools',$extresourcesform.'<br />'.$imspform.'<br />'.$recoverform.'<br />'.&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
                 'zz' => ['Hide all Options'],                  'zz' => ['Hide'],
                 );                  );
 my $tid='1';  my $tid='1';
 my $varcd = 'Main Course Documents';  my $varcd = 'Main Course Documents';
Line 3143  $r->print(&generate_edit_table($tid,$var Line 3238  $r->print(&generate_edit_table($tid,$var
        }         }
   
        &changewarning($r,'');         &changewarning($r,'');
    $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
                        &mt('Editing the Table of Contents for your '.$type)));
 $r->print('</div>');  $r->print('</div>');
        if ($env{'form.pagepath'}) {         if ($env{'form.pagepath'}) {
        }         }
Line 3151  $r->print('</div>'); Line 3248  $r->print('</div>');
        if($activeClass == 1){         if($activeClass == 1){
           $active = 'style="display: block;"';            $active = 'style="display: block;"';
        }         }
        $r->print('<div class="LC_ContentBox" id="Supplemental Course Documents" '.$active.'>');         $r->print('<div class="LC_ContentBox" id="supplCourseDocuments" '.$active.'>');
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        unless ($folder=~/^supplemental/) {         unless ($folder=~/^supplemental/) {
    $folder='supplemental';     $folder='supplemental';
Line 3173  $r->print('</div>'); Line 3270  $r->print('</div>');
   
  my $supupdocform=(<<SUPDOCFORM);   my $supupdocform=(<<SUPDOCFORM);
  <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">   <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
    <input type="hidden" name="active" value="ee" />
  $fileupload   $fileupload
  <br />   <br />
  <br />   <br />
Line 3195  SUPDOCFORM Line 3293  SUPDOCFORM
   
  my $supnewfolderform=(<<SNFFORM);   my $supnewfolderform=(<<SNFFORM);
  <form action="/adm/coursedocs" method="post" name="supnewfolder">   <form action="/adm/coursedocs" method="post" name="supnewfolder">
    <input type="hidden" name="active" value="ee" />
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newfolder" type="button"   <input name="newfolder" type="button"
  onClick="javascript:makenewfolder(this.form,'$folderseq');"   onclick="javascript:makenewfolder(this.form,'$folderseq');"
  value="$lt{'newf'}" /> $help{'Adding_Folders'}   value="$lt{'newf'}" /> $help{'Adding_Folders'}
  </span>   </span>
  </form>   </form>
Line 3208  SNFFORM Line 3307  SNFFORM
   
  my $supnewextform=(<<SNEFORM);   my $supnewextform=(<<SNEFORM);
  <form action="/adm/coursedocs" method="post" name="supnewext">   <form action="/adm/coursedocs" method="post" name="supnewext">
    <input type="hidden" name="active" value="ff" />
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <span class="LC_nobreak">   <span class="LC_nobreak">
  <input name="newext" type="button"    <input name="newext" type="button" 
  onClick="javascript:makenewext('supnewext');"   onclick="javascript:makenewext('supnewext');"
  value="$lt{'extr'}" /> $help{'Adding_External_Resource'}   value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
  </span>   </span>
  </form>   </form>
Line 3220  SNEFORM Line 3320  SNEFORM
   
  my $supnewsylform=(<<SNSFORM);   my $supnewsylform=(<<SNSFORM);
  <form action="/adm/coursedocs" method="post" name="supnewsyl">   <form action="/adm/coursedocs" method="post" name="supnewsyl">
    <input type="hidden" name="active" value="ff" />
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="Syllabus=/public/$coursedom/$coursenum/syllabus" />   value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
Line 3232  SNSFORM Line 3333  SNSFORM
   
  my $supnewaboutmeform=(<<SNAMFORM);   my $supnewaboutmeform=(<<SNAMFORM);
  <form action="/adm/coursedocs" method="post" name="subnewaboutme">   <form action="/adm/coursedocs" method="post" name="subnewaboutme">
    <input type="hidden" name="active" value="ff" />
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$plainname=/adm/$udom/$uname/aboutme" />   value="$plainname=/adm/$udom/$uname/aboutme" />
Line 3245  SNAMFORM Line 3347  SNAMFORM
   
   
 my %suporderhash = (  my %suporderhash = (
                 'ee' => ['New Document',$supupdocform.'<br />'.$supnewfolderform],                  'ee' => ['Upload Document',$supupdocform.'<br />'.$supnewfolderform],
                 'ff' => ['Special Documents',$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform],                  'ff' => ['Special Documents',$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform],
                 'zz' => ['Hide all Options'],                  'zz' => ['Hide'],
                 );                  );
   
 my $tid='2';  my $tid='2';
Line 3315  sub generate_edit_table { Line 3417  sub generate_edit_table {
     my ($tid,$varcd,$orderhash_ref) = @_;      my ($tid,$varcd,$orderhash_ref) = @_;
     my %orderhash = %{$orderhash_ref};      my %orderhash = %{$orderhash_ref};
     my $form;      my $form;
       my $activetab;
     $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';      my $active;
       if($env{'form.active'} ne ''){
           $activetab = $env{'form.active'};
       }
       $form = '<div class="LC_Box"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';
     $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';      $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';
     foreach my $name (sort(keys(%orderhash))){      foreach my $name (sort(keys(%orderhash))){
         if($name eq 'zz'){          if($name eq 'zz'){
             $form .= '<span class="LC_Right"><li onclick="javascript:hideAll(this, \'navigation'.$tid.'\' ,\'content'.$tid.'\');" class="active">'.&mt(${$orderhash{$name}}[0]).'</li></span>';              if($activetab ne ''){
                  $active = 'class="right"';
               }else{
                  $active = 'class="right active"';
               }
               $form .= '<li onclick="javascript:hideAll(this, \'navigation'.$tid.'\' ,\'content'.$tid.'\');" '.$active.'>'.&mt(${$orderhash{$name}}[0]).'</li>';
         }else{          }else{
             $form .= '<li onclick="javascript:showPage(this, \''.substr(${$orderhash{$name}}[0],0,3).$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';              if($activetab eq '' || $activetab ne $name){
                  $active = '';
               }elsif($activetab eq $name){
                  $active = 'class="active"';
               }
               $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';
         }          }
     }      }
     $form .= '</ul>';      $form .= '</ul>';
     $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';      $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';
     foreach my $field (keys(%orderhash)){      foreach my $field (keys(%orderhash)){
  if($field ne 'zz'){   if($field ne 'zz'){
            $form .= '<div id="'.substr(${$orderhash{$field}}[0],0,3).$tid.'" class="LC_ContentBox" style="display: none;">'.${$orderhash{$field}}[1].'</div>';          if($activetab eq '' || $activetab ne $field){
                   $active = 'style="display: none;"';
           }elsif($activetab eq $field){
                   $active = 'style="display:block;"';
           }
              $form .= '<div id="'.$field.$tid.'"'
                      .' class="LC_ContentBox" '.$active.'>'.${$orderhash{$field}}[1]
                      .'</div>';
         }          }
     }      }
     $form .= '</div></div>';      $form .= '</div></div>';
Line 3542  function unselectInactive(nav) { Line 3665  function unselectInactive(nav) {
 currentNav = document.getElementById(nav);  currentNav = document.getElementById(nav);
 currentLis = currentNav.getElementsByTagName('LI');  currentLis = currentNav.getElementsByTagName('LI');
 for (i = 0; i < currentLis.length; i++) {  for (i = 0; i < currentLis.length; i++) {
  currentLis[i].className = 'i';   if(currentLis[i].className == 'right active' || currentLis[i].className == 'right'){
    currentLis[i].className = 'right';
    }else{
    currentLis[i].className = 'i';
    }
 }  }
 }  }
   
 function hideAll(current, nav, data) {  function hideAll(current, nav, data) {
 unselectInactive(nav);  unselectInactive(nav);
 current.className = 'active';  if(current.className == 'right'){
    current.className = 'right active'
    }else{
    current.className = 'active';
   }
 currentData = document.getElementById(data);  currentData = document.getElementById(data);
 currentDivs = currentData.getElementsByTagName('DIV');  currentDivs = currentData.getElementsByTagName('DIV');
 for (i = 0; i < currentDivs.length; i++) {  for (i = 0; i < currentDivs.length; i++) {
Line 3558  for (i = 0; i < currentDivs.length; i++) Line 3689  for (i = 0; i < currentDivs.length; i++)
 }  }
 }  }
   
   function openTabs(pageId) {
    tabnav = document.getElementById(pageId).getElementsByTagName('UL');
    if(tabnav.length > 0 ){
    currentNav = document.getElementById(tabnav[0].id);
    currentLis = currentNav.getElementsByTagName('LI');
    for(i = 0; i< currentLis.length; i++){
    if(currentLis[i].className == 'active') {
    funcString = currentLis[i].onclick.toString();
    tab = funcString.split('"');
    currentData = document.getElementById(tab[1]);
           currentData.style.display = 'block';
    }
    }
    }
   }
   
 function showPage(current, pageId, nav, data) {  function showPage(current, pageId, nav, data) {
  hideAll(current, nav, data);   hideAll(current, nav, data);
    openTabs(pageId);
  unselectInactive(nav);   unselectInactive(nav);
  current.className = 'active';   current.className = 'active';
  currentData = document.getElementById(pageId);   currentData = document.getElementById(pageId);

Removed from v.1.367  
changed lines
  Added in v.1.381


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