Diff for /loncom/interface/londocs.pm between versions 1.388 and 1.408

version 1.388, 2009/10/04 10:27:55 version 1.408, 2009/10/31 19:54:51
Line 117  sub authorhosts { Line 117  sub authorhosts {
   
 sub dumpbutton {  sub dumpbutton {
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     if ($home+$other==0) { return ''; }      if ($home+$other==0) { return ''; }
     if ($home) {      if ($home) {
  my $link = "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"dumpcourse\", \"".&mt('Dump '.$type.' DOCS to Construction Space')."\")'>".&mt('Dump '.$type.' DOCS to Construction Space')."</a>";   my $link = "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"dumpcourse\", \"".&mt('Dump '.$crstype.' DOCS to Construction Space')."\")'>".&mt('Dump '.$crstype.' DOCS to Construction Space')."</a>";
  return $link.' '.   return $link.' '.
     &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'<br />';      &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'<br />';
     } else {      } else {
  return '<div>'.   return '<div>'.
      &mt('Dump '.$type.       &mt('Dump '.$crstype.
  ' DOCS to Construction Space: available on other servers').   ' DOCS to Construction Space: available on other servers').
  '</div>';   '</div>';
     }      }
Line 141  sub clean { Line 141  sub clean {
   
 sub dumpcourse {  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').      $r->print(&Apache::loncommon::start_page('Dump '.$crstype.' DOCS to Construction Space').
       '<form name="dumpdoc" action="" 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 '.$crstype.' DOCS to Construction Space'));
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }      unless ($home) { return ''; }
     my $origcrsid=$env{'request.course.id'};      my $origcrsid=$env{'request.course.id'};
Line 255  sub dumpcourse { Line 255  sub dumpcourse {
  $r->print(&Apache::loncommon::end_data_table());   $r->print(&Apache::loncommon::end_data_table());
  &untiehash();   &untiehash();
  $r->print(   $r->print(
   '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $type DOCS").'" /></p></form>');    '<p><input type="submit" name="dumpcourse" value="'.&mt("Dump $crstype DOCS").'" /></p></form>');
     }      }
 }  }
   
   
   
 sub exportbutton {  sub exportbutton {
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     return "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"exportcourse\", \"".&mt('IMS Export')."\")'>".&mt('IMS Export')."</a>".      return "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"exportcourse\", \"".&mt('IMS Export')."\")'>".&mt('IMS Export')."</a>".
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';      &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'<br />';
 }  }
Line 271  sub exportbutton { Line 271  sub exportbutton {
   
 sub exportcourse {  sub exportcourse {
     my $r=shift;      my $r=shift;
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',      my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                                $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});                                                 $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
     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 '.$type.' to IMS Package').          $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
                   '<h2>'.&mt('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').          if ($crstype eq 'Community') {
                   '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');              $r->print(&mt('Unable to retrieve information about community contents'));
         &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});          } else {
               $r->print(&mt('Unable to retrieve information about course contents'));
           }
           $r->print('</div><a href="/adm/coursedocs">');
           if ($crstype eq 'Community') {
               $r->print(&mt('Return to Community Editor'));
           } else {
               $r->print(&mt('Return to Course Editor'));
           }
           $r->print('</a>');
           &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
         return;          return;
     }      }
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);      my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
Line 353  sub exportcourse { Line 363  sub exportcourse {
                           .'</a></p>';                            .'</a></p>';
             }              }
         }          }
         $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'));          $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'));
  $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));   $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());
Line 361  sub exportcourse { Line 371  sub exportcourse {
         my $display;          my $display;
         $display = '<form name="exportdoc" action="" method="post">'."\n";          $display = '<form name="exportdoc" action="" method="post">'."\n";
         $display .= '<p>'          $display .= '<p>'
                    .&mt('Choose which items you wish to export from your '.$type.'.')                     .&mt('Choose which items you wish to export from your '.$crstype.'.')
                    .'</p>';                     .'</p>';
         $display .= '<div class="LC_columnSection"><fieldset>'.          $display .= '<div class="LC_columnSection"><fieldset>'.
                     '<legend>'.&mt('Content items').'</legend>'.                      '<legend>'.&mt('Content items').'</legend>'.
Line 507  function containerCheck(item) { Line 517  function containerCheck(item) {
 // ]]>  // ]]>
 </script>  </script>
         |;          |;
  $r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package',   $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package',
  $scripttag));   $scripttag));
  $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));   $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
  $r->print($display.   $r->print($display.
Line 998  sub group_import { Line 1008  sub group_import {
 }  }
   
 sub breadcrumbs {  sub breadcrumbs {
     my ($where,$allowed,$type)=@_;      my ($allowed,$crstype)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     my (@folders);      my (@folders);
     if ($env{'form.pagepath'}) {      if ($env{'form.pagepath'}) {
Line 1013  sub breadcrumbs { Line 1023  sub breadcrumbs {
     my $isencrypted=0;      my $isencrypted=0;
     my $ishidden=0;      my $ishidden=0;
     my $is_random_order=0;      my $is_random_order=0;
       if (!$allowed) {
           my $description = $env{'course.'.$env{'request.course.id'}.'.description'};
           &Apache::lonhtmlcommon::add_breadcrumb(
                                                  {'href' => '/adm/menu',
                                                   'title'=> 'Go to main menu',
                                                   'text' => $description,
                                                  });
           $plain .= $description.' &gt;';
       }
     while (@folders) {      while (@folders) {
  my $folder=shift(@folders);   my $folder=shift(@folders);
     my $foldername=shift(@folders);      my $foldername=shift(@folders);
Line 1032  sub breadcrumbs { Line 1051  sub breadcrumbs {
             if ($3) { $isencrypted=1; }              if ($3) { $isencrypted=1; }
     if ($4 ne '') { $is_random_order = 1; }      if ($4 ne '') { $is_random_order = 1; }
             if ($folder eq 'supplemental') {              if ($folder eq 'supplemental') {
                 if ($allowed) {                  $name = &mt('Supplemental '.$crstype.' Documents');
                     $name = &mt('Supplemental '.$type.' Documents');  
                 } else {  
                     $name = &mt($type.' Documents');  
                 }  
             }              }
     &Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
       {'href'=>$url.$cpinfo,        {'href'=>$url.$cpinfo,
Line 1492  sub handle_edit_cmd { Line 1507  sub handle_edit_cmd {
 }  }
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;      my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_;
   
     my $container= ($env{'form.pagepath'}) ? 'page'      my $container= ($env{'form.pagepath'}) ? 'page'
                            : 'sequence';                             : 'sequence';
   
Line 1508  sub editor { Line 1522  sub editor {
         $LONCAPA::map::resources[$idx]='';          $LONCAPA::map::resources[$idx]='';
     }      }
   
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=      my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order);
  &breadcrumbs($folder,$allowed,$type);      if ($allowed) {
     $r->print($breadcrumbtrail);          ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
       &breadcrumbs($allowed,$crstype);
           $r->print($breadcrumbtrail);
       } else {
           $randompick = -1;
       }
   
 # ------------------------------------------------------------ Process commands  # ------------------------------------------------------------ Process commands
   
Line 1627  sub editor { Line 1646  sub editor {
         unless ($name) {  $name=(split(/\//,$url))[-1]; }          unless ($name) {  $name=(split(/\//,$url))[-1]; }
         unless ($name) { $idx++; next; }          unless ($name) { $idx++; next; }
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,          $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum);                                $coursenum,$crstype);
         $idx++;          $idx++;
         $shown++;          $shown++;
     }      }
     if ($shown) {      if ($shown) {
     $r->print(&Apache::loncommon::start_data_table()          $r->print(&Apache::loncommon::start_data_table());
              .&Apache::loncommon::start_data_table_header_row()          if ($allowed) {
              .'<th colspan="2">'.&mt('Move').'</th>'              $r->print(&Apache::loncommon::start_data_table_header_row()
              .'<th>'.&mt('Actions').'</th>'                       .'<th colspan="2">'.&mt('Move').'</th>'
              .'<th colspan="2">'.&mt('Document').'</th>'                       .'<th>'.&mt('Actions').'</th>'
              .'<th colspan="4">'.&mt('Settings').'</th>'                       .'<th colspan="2">'.&mt('Document').'</th>');
              .&Apache::loncommon::end_data_table_header_row()              if ($folder !~ /^supplemental/) {
              .$output                  $->print('<th colspan="4">'.&mt('Settings').'</th>');
              .&Apache::loncommon::end_data_table()              }
     )              $r->print(&Apache::loncommon::end_data_table_header_row());
     }           }
     unless($shown) {          $r->print($output
                    .&Apache::loncommon::end_data_table()
           );
       } else {
         $r->print('<p class="LC_info">'          $r->print('<p class="LC_info">'
                  .&mt('Currently no documents.')                   .&mt('Currently no documents.')
                  .'</p>'                   .'</p>'
Line 1792  sub parse_supplemental_title { Line 1814  sub parse_supplemental_title {
 # --------------------------------------------------------------- An entry line  # --------------------------------------------------------------- An entry line
   
 sub entryline {  sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;      my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$crstype)=@_;
   
     my ($foldertitle,$pagetitle,$renametitle);      my ($foldertitle,$pagetitle,$renametitle);
     if (&is_supplemental_title($title)) {      if (&is_supplemental_title($title)) {
  ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);   ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);
Line 2050  END Line 2071  END
  $url.='pagepath='.&escape($pagepath).   $url.='pagepath='.&escape($pagepath).
     '&amp;pagesymb='.&escape($symb).$cpinfo;      '&amp;pagesymb='.&escape($symb).$cpinfo;
     }      }
     if ($external) {      if (($external) && ($allowed)) {
  my $form = ($folder =~ /^default/)? 'newext' : 'supnewext';   my $form = ($folder =~ /^default/)? 'newext' : 'supnewext';
  $external = '&nbsp;<a class="LC_docs_ext_edit" href="javascript:edittext(\''.$form.'\',\''.$residx.'\',\''.&escape($title).'\',\''.&escape($orig_url).'\');" >'.&mt('Edit').'</a>';   $external = '&nbsp;<a class="LC_docs_ext_edit" href="javascript:edittext(\''.$form.'\',\''.$residx.'\',\''.&escape($title).'\',\''.&escape($orig_url).'\');" >'.&mt('Edit').'</a>';
     } else {      } else {
  undef($external);   undef($external);
     }      }
       my $reinit;
       if ($crstype eq 'Community') {
           $reinit = &mt('(re-initialize community to access)');
       } else {
           $reinit = &mt('(re-initialize course to access)');
       }  
     $line.='      $line.='
   <td>    <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>    <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">'.$reinit.'</span>').$external."
   </td>";    </td>";
     if (($allowed) && ($folder!~/^supplemental/)) {      if (($allowed) && ($folder!~/^supplemental/)) {
   my %lt=&Apache::lonlocal::texthash(    my %lt=&Apache::lonlocal::texthash(
Line 2209  List Symbs Line 2236  List Symbs
 sub list_symbs {  sub list_symbs {
     my ($r) = @_;      my ($r) = @_;
   
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Symb List'));      $r->print(&Apache::loncommon::start_page('Symb List'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
Line 2218  sub list_symbs { Line 2245  sub list_symbs {
                   '<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>');                    '</div>');
         &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});          &Apache::lonnet::logthis('Symb list failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
     } else {      } else {
         $r->print("<pre>\n");          $r->print("<pre>\n");
         foreach my $res ($navmap->retrieveResources()) {          foreach my $res ($navmap->retrieveResources()) {
Line 2232  sub list_symbs { Line 2259  sub list_symbs {
   
 sub verifycontent {  sub verifycontent {
     my ($r) = @_;      my ($r) = @_;
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
    my $loaderror=&Apache::lonnet::overloaderror($r);     my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }     if ($loaderror) { return $loaderror; }
    $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));     $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents'));     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
    $hashtied=0;     $hashtied=0;
    undef %alreadyseen;     undef %alreadyseen;
    %alreadyseen=();     %alreadyseen=();
Line 2245  sub verifycontent { Line 2272  sub verifycontent {
        if ($hash{$key}=~/\.(page|sequence)$/) {         if ($hash{$key}=~/\.(page|sequence)$/) {
    if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {     if (($key=~/^src_/) && ($alreadyseen{&unescape($hash{$key})})) {
        $r->print('<hr /><span class="LC_error">'.         $r->print('<hr /><span class="LC_error">'.
  &mt('The following sequence or page is included more than once in your '.$type.': ').   &mt('The following sequence or page is included more than once in your '.$crstype.': ').
  &unescape($hash{$key}).'</span><br />'.   &unescape($hash{$key}).'</span><br />'.
  &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));   &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
    }     }
Line 2268  sub devalidateversioncache { Line 2295  sub devalidateversioncache {
   
 sub checkversions {  sub checkversions {
     my ($r) = @_;      my ($r) = @_;
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));      $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions"));      $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
     my $monthsel='';      my $monthsel='';
Line 2331  sub checkversions { Line 2358  sub checkversions {
     &changewarning($r,'');      &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {      if ($env{'form.timerange'} eq 'all') {
 # show all documents  # show all documents
  $header=&mt('All Documents in '.$type);   $header=&mt('All Documents in '.$crstype);
  $allsel=1;   $allsel=1;
  foreach my $key (keys(%hash)) {   foreach my $key (keys(%hash)) {
     if ($key=~/^ids\_(\/res\/.+)$/) {      if ($key=~/^ids\_(\/res\/.+)$/) {
Line 2376  sub checkversions { Line 2403  sub checkversions {
   $env{'course.'.$env{'request.course.id'}.'.domain'},    $env{'course.'.$env{'request.course.id'}.'.domain'},
   $env{'course.'.$env{'request.course.id'}.'.num'});    $env{'course.'.$env{'request.course.id'}.'.num'});
     my %lt=&Apache::lonlocal::texthash      my %lt=&Apache::lonlocal::texthash
       ('st' => 'Version changes since start of '.$type,        ('st' => 'Version changes since start of '.$crstype,
        'lm' => 'Version changes since last Month',         'lm' => 'Version changes since last Month',
        'lw' => 'Version changes since last Week',         'lw' => 'Version changes since last Week',
        'sy' => 'Version changes since Yesterday',         'sy' => 'Version changes since Yesterday',
Line 2385  sub checkversions { Line 2412  sub checkversions {
        'fi' => 'File',         'fi' => 'File',
        'md' => 'Modification Date',         'md' => 'Modification Date',
                'mr' => 'Most recently published Version',                 'mr' => 'Most recently published Version',
        've' => 'Version used in '.$type,         've' => 'Version used in '.$crstype,
                'vu' => 'Set Version to be used in '.$type,                 'vu' => 'Set Version to be used in '.$crstype,
 'sv' => 'Set Versions to be used in '.$type.' according to Selections below',  'sv' => 'Set Versions to be used in '.$crstype.' according to Selections below',
 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',  'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',  'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
        'di' => 'Differences');         'di' => 'Differences');
Line 2434  ENDHEADERS Line 2461  ENDHEADERS
                       '<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.                        '<td title="'.$lt{'mr'}.'"><span class="LC_nobreak">Most Recent: '.
                       '<font size="+1">'.$currentversion.'</font>'.                        '<font size="+1">'.$currentversion.'</font>'.
                       '</span></td>'.                        '</span></td>'.
                       '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$type.': '.                        '<td title="'.$lt{'ve'}.'"><span class="LC_nobreak">In '.$crstype.': '.
                       '<font size="+1">');                        '<font size="+1">');
 # Used in course  # Used in course
     my $usedversion=$hash{'version_'.$linkurl};      my $usedversion=$hash{'version_'.$linkurl};
Line 2571  sub init_breadcrumbs { Line 2598  sub init_breadcrumbs {
     my ($form,$text)=@_;      my ($form,$text)=@_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",      &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
     text=>"Edit ".&Apache::loncommon::course_type(),      text=>&Apache::loncommon::course_type().' Editor',
     faq=>273,      faq=>273,
     bug=>'Instructor Interface',      bug=>'Instructor Interface',
                                             help => 'Docs_Adding_Course_Doc'});                                              help => 'Docs_Adding_Course_Doc'});
Line 2589  sub handler { Line 2616  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     my $type = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
   
   
 # --------------------------------------------- Initialize help topics for this  # --------------------------------------------- Initialize help topics for this
Line 2664  sub handler { Line 2691  sub handler {
     }      }
     if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {      if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
         $env{'form.folderpath'} = 'supplemental&'.          $env{'form.folderpath'} = 'supplemental&'.
                                   &escape(&mt('Supplemental '.$type.' Documents')).'&'.                                    &escape(&mt('Supplemental '.$crstype.' Documents')).'&'.
                                   $env{'form.folderpath'};                                    $env{'form.folderpath'};
     }      }
     &Apache::loncommon::store_course_settings('docs_folderpath',      &Apache::loncommon::store_course_settings('docs_folderpath',
Line 2687  sub handler { Line 2714  sub handler {
     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {      if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
        $showdoc='/'.$1;         $showdoc='/'.$1;
     }      }
     unless ($showdoc) { # got called from remote      if ($showdoc) { # got called in sequence from course
    $allowed=0; 
       } else {
        if (($env{'form.folder'}=~/^(?:group|default)_/) ||         if (($env{'form.folder'}=~/^(?:group|default)_/) ||
           ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {            ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
            $forcestandard = 1;             $forcestandard = 1;
Line 2698  sub handler { Line 2727  sub handler {
          &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);           &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
          $script=&Apache::lonratedt::editscript('simple');           $script=&Apache::lonratedt::editscript('simple');
        }         }
     } else { # got called in sequence from course  
        $allowed=0;  
     }      }
   
 # subroutine to list form elements  # subroutine to list form elements
Line 2747  sub create_form_ul { Line 2774  sub create_form_ul {
   
     # Breadcrumbs      # Breadcrumbs
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({      if ($allowed) {
         href=>"/adm/createuser",text=>"$type Documents"});          &Apache::lonhtmlcommon::add_breadcrumb({
               href=>"/adm/coursedocs",text=>"$crstype Editor"});
   
     $r->print(&Apache::loncommon::start_page("$type Documents", $script,          $r->print(&Apache::loncommon::start_page("$crstype Editor", $script,
     {'force_register' => $showdoc,})                                                   {'force_register' => $showdoc,})
              .&Apache::loncommon::help_open_menu('','',273,'RAT')                   .&Apache::loncommon::help_open_menu('','',273,'RAT')
              .&Apache::lonhtmlcommon::breadcrumbs(                   .&Apache::lonhtmlcommon::breadcrumbs(
                   'Editing the Table of Contents for your '.$type,                       'Editing the Table of Contents for your '.$crstype,
                   'Docs_Adding_Course_Doc')                       'Docs_Adding_Course_Doc')
     );          );
       } elsif ($showdoc) {
           $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
                                                   {'force_register' => $showdoc,}));
       } else {
           my $folder=$env{'form.folder'};
           if ($folder eq '' || $folder eq 'supplemental') {
               $env{'form.folderpath'} = 'supplemental&'.
                                         &escape(&mt('Supplemental '.$crstype.' Documents'));
           }
           my ($breadcrumbtrail) = &breadcrumbs($allowed,$crstype);
           $r->print(&Apache::loncommon::start_page("Supplemental documents").
                     $breadcrumbtrail);
       }
   
   my %allfiles = ();    my %allfiles = ();
   my %codebase = ();    my %codebase = ();
Line 2848  sub create_form_ul { Line 2889  sub create_form_ul {
   unless ($showdoc ||  $upload_result eq 'phasetwo') {    unless ($showdoc ||  $upload_result eq 'phasetwo') {
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
        my %lt=&Apache::lonlocal::texthash(         my %lt=&Apache::lonlocal::texthash(
                 'uplm' => 'Upload a new main '.lc($type).' document',                  'uplm' => 'Upload a new main '.lc($crstype).' document',
                 'upls' => 'Upload a new supplemental '.lc($type).' document',                  'upls' => 'Upload a new supplemental '.lc($crstype).' document',
                 'impp' => 'Import a document',                  'impp' => 'Import a document',
  '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',
Line 2878  sub create_form_ul { Line 2919  sub create_form_ul {
                 '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' => 'Upload Document',   'nd' => 'Upload Document',
  'pm' => 'Published Map',   'pm' => 'Published Map',
  'sd' => 'Special Document',   'sd' => 'Special Document',
Line 2899  FIUP Line 2940  FIUP
  </label>   </label>
 CHBO  CHBO
   
         my @fileuploada = (      my $fileuploada = "<input type='submit' value='".$lt{'upld'}."' /> $help{'Uploading_From_Harddrive'}";
         { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic01" />' => "<input type='submit' value='".$lt{'upld'}."' /> $help{'Uploading_From_Harddrive'}" },  
         );  
  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" />   <input type="hidden" name="active" value="aa" />
Line 2916  CHBO Line 2955  CHBO
  $checkbox   $checkbox
  </span>   </span>
 FUFORM  FUFORM
  $fileuploadform .= create_form_ul(create_list_elements(@fileuploada));      #$list .= Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'});
       #$fileuploadform .= create_form_ul(create_list_elements(@fileuploada));
       $fileuploadform .= create_form_ul(Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'}));
  $fileuploadform .= (<<FUFORM);   $fileuploadform .= (<<FUFORM);
  </form>   </form>
 FUFORM  FUFORM
Line 2926  FUFORM Line 2967  FUFORM
  <input type="hidden" name="active" value="bb" />   <input type="hidden" name="active" value="bb" />
 SEDFFORM  SEDFFORM
  my @simpleeditdefaultforma = (    my @simpleeditdefaultforma = ( 
  { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic03" />' => "$uploadtag<a onclick='javascript:groupsearch()'>$lt{'srch'}</a>" },   { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/src.png" alt="pic03" />' => "$uploadtag<a onclick='javascript:groupsearch()'>$lt{'srch'}</a>" },
  { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic04" />' => "<a onclick='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },   { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/res.png" alt="pic04" />' => "<a onclick='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
  { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic05" />' => "<a onclick='javascript:groupopen(0,1,1);'>$lt{'book'}</a>" },   { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/vbkm.png" alt="pic05" />' => "<a onclick='javascript:groupopen(0,1,1);'>$lt{'book'}</a>" },
  );   );
  $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma));   $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma));
  $simpleeditdefaultform .=(<<SEDFFORM);   $simpleeditdefaultform .=(<<SEDFFORM);
Line 2966  ERFORM Line 3007  ERFORM
    if ($env{'form.folder'} eq '' ||     if ($env{'form.folder'} eq '' ||
        $env{'form.folder'} eq 'supplemental') {         $env{'form.folder'} eq 'supplemental') {
        $folderpath='default&'.         $folderpath='default&'.
    &escape(&mt('Main '.$type.' Documents'));     &escape(&mt('Main '.$crstype.' Documents'));
    }     }
        }         }
        unless ($env{'form.pagepath'}) {         unless ($env{'form.pagepath'}) {
Line 2988  ERFORM Line 3029  ERFORM
 HIDDENFORM  HIDDENFORM
     }      }
 # --------------------------------------------------------- Main tab structure  # --------------------------------------------------------- Main tab structure
        
     my $activeClass = 1;      my $activeClass = 1;
     my $active = '';      my $active = '';
       my %tabtitles = (
     $r->print('<ul class="LC_TabContentBigger" id="mainnav">');                         main => {
     if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {                                   Course => &mt('Main Course Documents'),
         if($activeClass == 1){                                   Community => &mt('Main Community Documents'),
            $active = 'class="active"';                                 },
    $activeClass = 0;                         supplemental => {
  }                                   Course => &mt('Supplemental Course Documents'),        
     }                                   Community => &mt('Supplemental Community Documents'),
     if($env{'request.role'}=~/^cc/){                                 },
     $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.&mt('Main Course Documents').'</b></a></li>');                      );
     }      if ($allowed) {
     $active = '';          $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
     if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {          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;
       }
           }
           $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'main'}{$crstype}.'</b></a></li>');
           $active = '';
           if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
               if($activeClass == 1){
                   $active = 'class="active"';
               }
         }          }
           $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'supplemental'}{$crstype}.'</b></a></li>');
           $r->print('</ul>');
       } else {
           $r->print('<br />');
     }      }
     $r->print('<li '.$active.' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.&mt('Supplemental Course Documents').'</b></a></li>');      $r->print('<div class="LC_Box" style="clear:both;margin:0;">'
     $r->print('</ul>'  
              .'<div class="LC_Box" style="clear:both;margin:0;">'  
              .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');               .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
 # --------------------------------------------------------- Standard documents  # --------------------------------------------------------- Standard documents
        my $savefolderpath;         my $savefolderpath;
        my $active = 'style="display: none;"';         $active = 'style="display: none;"';
        if($activeClass == 0){         if($activeClass == 0){
           $active = 'style="display: block;"';            $active = 'style="display: block;"';
        }         }
        if($env{'request.role'}=~/^cc/){         if ($allowed) {
        $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');         $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder=~/^supplemental/) {         if ($folder eq '' || $folder=~/^supplemental/) {
            $folder='default';             $folder='default';
    $savefolderpath = $env{'form.folderpath'};     $savefolderpath = $env{'form.folderpath'};
    $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));     $env{'form.folderpath'}='default&'.&escape($tabtitles{'main'}{$crstype});
            $uploadtag = '<input type="hidden" name="folderpath" value="'.             $uploadtag = '<input type="hidden" name="folderpath" value="'.
        &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';         &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }         }
Line 3159  NROSTFORM Line 3211  NROSTFORM
 my $specialdocumentsform;  my $specialdocumentsform;
 my @specialdocumentsforma;  my @specialdocumentsforma;
 my $newfolderform;  my $newfolderform;
   my $newfolderb;
   
        unless ($env{'form.pagepath'}) {         unless ($env{'form.pagepath'}) {
    my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');     my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
Line 3172  my $newfolderform; Line 3225  my $newfolderform;
  $help{'Adding_Pages'}   $help{'Adding_Pages'}
  </form>   </form>
 NPFORM  NPFORM
   
   
  $newfolderform=(<<NFFORM);   $newfolderform=(<<NFFORM);
  <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" />
Line 3181  NPFORM Line 3235  NPFORM
  <a onclick="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}   <a onclick="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}
  </form>   </form>
 NFFORM  NFFORM
  my @newfolderforma= (  
  { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic02" />' => "$newfolderform" }  
         );  
   
   
  $newfolderform = create_form_ul(create_list_elements(@newfolderforma));  
   
  my $newsylform=(<<NSYLFORM);   my $newsylform=(<<NSYLFORM);
  <form action="/adm/coursedocs" method="post" name="newsyl">   <form action="/adm/coursedocs" method="post" name="newsyl">
Line 3211  NSYLFORM Line 3259  NSYLFORM
  </form>   </form>
 NGFFORM  NGFFORM
  @specialdocumentsforma=(   @specialdocumentsforma=(
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic06" />'=>$newpageform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/page.png" alt="pic06" />'=>$newpageform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic07" />'=>$newsylform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/syllabus.png" alt="pic07" />'=>$newsylform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic08" />'=>$newgroupfileform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/groupportfolio.png" alt="pic08" />'=>$newgroupfileform},
  );    ); 
   
       }        }
  push @specialdocumentsforma, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic09" />'=>$newnavform},   push @specialdocumentsforma, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/navigation.png" alt="pic09" />'=>$newnavform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic10" />'=>$newsmppageform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/simple.png" alt="pic10" />'=>$newsmppageform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic11" />'=>$newsmpproblemform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/simpprob.png" alt="pic11" />'=>$newsmpproblemform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic12" />'=>$newdropboxform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/dropbox.png" alt="pic12" />'=>$newdropboxform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic13" />'=>$newexuploadform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/scoreupfrm.png" alt="pic13" />'=>$newexuploadform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic14" />'=>$newbulform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/bchat.png" alt="pic14" />'=>$newbulform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic15" />'=>$newaboutmeform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/myaboutme.png" alt="pic15" />'=>$newaboutmeform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic16" />'=>$newaboutsomeoneform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/aboutme.png" alt="pic16" />'=>$newaboutsomeoneform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic17" />'=>$newrosterform},);   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/chrt.png" alt="pic17" />'=>$newrosterform},);
   
  $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma));   $specialdocumentsform = create_form_ul(create_list_elements(@specialdocumentsforma));
   
 if($env{'form.pagepath'}) {  if($env{'form.pagepath'}) {
   
  @specialdocumentsforma=(   @specialdocumentsforma=(
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic32" />'=>$newsmpproblemform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/simpprob.png" alt="pic32" />'=>$newsmpproblemform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic33" />'=>$newexuploadform}   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/scoreupfrm.png" alt="pic33" />'=>$newexuploadform}
  );   );
  $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma));   $specialdocumentsform= create_form_ul(create_list_elements(@specialdocumentsforma));
 }  }
   
 my @tools = (  my @tools = (
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic18" />'=>$extresourcesform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/extres.png" alt="pic18" />'=>$extresourcesform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic19" />'=>$imspform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/ims.png" alt="pic19" />'=>$imspform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic20" />'=>$recoverform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/recover.png" alt="pic20" />'=>$recoverform},
  );   );
   
 my %orderhash = (  my %orderhash = (
                 'aa' => ['Upload Document',$fileuploadform.''.$newfolderform],   '00' => ['Newfolder',$newfolderform],
                   'aa' => ['Upload Document',$fileuploadform],
                 'bb' => ['Published Resources',$simpleeditdefaultform],                  'bb' => ['Published Resources',$simpleeditdefaultform],
                 'cc' => ['Special Documents',$specialdocumentsform],                  'cc' => ['Special Documents',$specialdocumentsform],
  'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)],   'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
                 'zz' => ['Hide'],  
                 );                  );
 my $tid='1';  my $tid='1';
 my $varcd = 'Main Course Documents';  
 $r->print(&generate_edit_table($tid,$varcd,\%orderhash));  
  $hadchanges=0;   $hadchanges=0;
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
        if ($error) {         if ($error) {
            $r->print('<p><span class="LC_error">'.$error.'</span></p>');             $r->print('<p><span class="LC_error">'.$error.'</span></p>');
        }         }
Line 3264  $r->print(&generate_edit_table($tid,$var Line 3310  $r->print(&generate_edit_table($tid,$var
        }         }
   
        &changewarning($r,'');         &changewarning($r,'');
   $r->print(&generate_edit_table($tid,\%orderhash));
   
 $r->print('</div>');  $r->print('</div>');
  }   }
        if ($env{'form.pagepath'}) {         if ($env{'form.pagepath'}) {
        }         }
 # ----------------------------------------------------- Supplemental documents  # ----------------------------------------------------- Supplemental documents
        my $active = 'style="display: none;"';         $active = 'style="display: none;"';
        if($activeClass == 1){         if($activeClass == 1){
           $active = 'style="display: block;"';            $active = 'style="display: block;"';
        }         }
Line 3281  $r->print('</div>'); Line 3329  $r->print('</div>');
        if ($folder =~ /^supplemental$/ &&         if ($folder =~ /^supplemental$/ &&
    (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {     (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.            $env{'form.folderpath'} = 'supplemental&'.
                                     &escape(&mt('Supplemental '.$type.' Documents'));                                      &escape(&mt('Supplemental '.$crstype.' Documents'));
        }else{         } elsif ($allowed) {
   $env{'form.folderpath'} = $savefolderpath;    $env{'form.folderpath'} = $savefolderpath;
        }         }
        $env{'form.pagepath'} = '';         $env{'form.pagepath'} = '';
Line 3293  $r->print('</div>'); Line 3341  $r->print('</div>');
   
    my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');     my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
   
  my @supupdocform = (   my $supupdocformbtn = "<input type='submit' value='".$lt{'upld'}."' />$help{'Uploading_From_Harddrive'}";
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic27" />'=>"<input type='submit' value='".$lt{'upld'}."' />$help{'Uploading_From_Harddrive'}"},  
  );  
  my $supupdocform=(<<SUPDOCFORM);   my $supupdocform=(<<SUPDOCFORM);
  <form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data">   <form action="/adm/coursedocs" method="post" name="supuploaddocument" enctype="multipart/form-data">
  <input type="hidden" name="active" value="ee" />   <input type="hidden" name="active" value="ee" />
Line 3312  $r->print('</div>'); Line 3358  $r->print('</div>');
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
  <input type="hidden" name="cmd" value="upload_supplemental" />   <input type="hidden" name="cmd" value="upload_supplemental" />
 SUPDOCFORM  SUPDOCFORM
  $supupdocform .=  create_form_ul(create_list_elements(@supupdocform))."</form>";   $supupdocform .=  create_form_ul(Apache::lonhtmlcommon::htmltag('li',$supupdocformbtn,{class => 'LC_menubuttons_inline_text'}))."</form>";
   
  my $supnewfolderform=(<<SNFFORM);   my $supnewfolderform=(<<SNFFORM);
  <form action="/adm/coursedocs" method="post" name="supnewfolder">   <form action="/adm/coursedocs" method="post" name="supnewfolder">
Line 3324  SUPDOCFORM Line 3370  SUPDOCFORM
  </form>   </form>
 SNFFORM  SNFFORM
   
  my @supnewfolderforma = ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic28" />'=>$supnewfolderform});  
  $supnewfolderform = create_form_ul(create_list_elements(@supnewfolderforma));  
   
   
  my $supnewextform=(<<SNEFORM);   my $supnewextform=(<<SNEFORM);
  <form action="/adm/coursedocs" method="post" name="supnewext">   <form action="/adm/coursedocs" method="post" name="supnewext">
Line 3361  SNAMFORM Line 3404  SNAMFORM
   
   
 my @specialdocs = (  my @specialdocs = (
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic29" />'=>$supnewextform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/extres.png" alt="pic29" />'=>$supnewextform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic30" />'=>$supnewsylform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/syllabus.png" alt="pic30" />'=>$supnewsylform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic31" />'=>$supnewaboutmeform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/myaboutme.png" alt="pic31" />'=>$supnewaboutmeform},
  );   );
 my %suporderhash = (  my %suporderhash = (
                 'ee' => ['Upload Document',$supupdocform.' '.$supnewfolderform],   '00' => ['Supnewfolder', $supnewfolderform],
                 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))],                  'ee' => ['Upload Document',$supupdocform],
                 'zz' => ['Hide'],                  'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))]
                 );                  );
   
 my $tid='2';          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
 my $varscd = 'Supplemental Course Documents';          if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
           my $tid='2';
           $r->print(&generate_edit_table($tid,\%suporderhash));
       } else {
           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype);
           if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
       }
   
 $r->print(&generate_edit_table($tid,$varscd,\%suporderhash));  
 }  
   
 my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);  
        if ($error) {  
            $r->print('<p><span class="LC_error">'.$error.'</span></p>');  
         }  
 $r->print('</div>');  $r->print('</div>');
 $r->print('</div></div>');  $r->print('</div></div>');
   
Line 3421  sub generate_admin_options { Line 3468  sub generate_admin_options {
   my $dumpbut=&dumpbutton();    my $dumpbut=&dumpbutton();
   my $exportbut=&exportbutton();    my $exportbut=&exportbutton();
   my @list = (    my @list = (
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic21" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"verify\", \"$lt{'vc'}\")'>$lt{'vc'}</a>$help{'Verify_Content'}"},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/verify.png" alt="pic21" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"verify\", \"$lt{'vc'}\")'>$lt{'vc'}</a>$help{'Verify_Content'}"},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic22" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"versions\", \"$lt{'cv'}\")'>$lt{'cv'}</a>$help{'Check_Resource_Versions'}"},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/resversion.png" alt="pic22" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"versions\", \"$lt{'cv'}\")'>$lt{'cv'}</a>$help{'Check_Resource_Versions'}"},
  );   );
   if($dumpbut ne ''){    if($dumpbut ne ''){
   push @list, {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic23" />'=>$dumpbut};    push @list, {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/dump.png" alt="pic23" />'=>$dumpbut};
   }    }
   push @list, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic24" />'=>$exportbut},    push @list, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/imsexport.png" alt="pic24" />'=>$exportbut},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic25" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"listsymbs\", \"$lt{'ls'}\")'>$lt{'ls'}</a><input type='hidden' name='folder' value='$env{'form.folder'}' />"},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/symbs.png" alt="pic25" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"listsymbs\", \"$lt{'ls'}\")'>$lt{'ls'}</a><input type='hidden' name='folder' value='$env{'form.folder'}' />"},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic26" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"docslog\", \"$lt{'sl'}\")'>$lt{'sl'}</a>"},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/log.png" alt="pic26" />'=>"<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"docslog\", \"$lt{'sl'}\")'>$lt{'sl'}</a>"},
  );   );
   return '<form action="/adm/coursedocs" method="post" name="courseverify"><input type="hidden" id="dummy" />'.create_form_ul(create_list_elements(@list)).'</form>';    return '<form action="/adm/coursedocs" method="post" name="courseverify"><input type="hidden" id="dummy" />'.create_form_ul(create_list_elements(@list)).'</form>';
   
Line 3437  sub generate_admin_options { Line 3484  sub generate_admin_options {
   
   
 sub generate_edit_table {  sub generate_edit_table {
     my ($tid,$varcd,$orderhash_ref) = @_;      my ($tid,$orderhash_ref) = @_;
       return unless(ref($orderhash_ref) eq 'HASH');
     my %orderhash = %{$orderhash_ref};      my %orderhash = %{$orderhash_ref};
     my $form;      my $form;
     my $activetab;      my $activetab;
Line 3448  sub generate_edit_table { Line 3496  sub generate_edit_table {
     $form = '<div class="LC_Box">';      $form = '<div class="LC_Box">';
     $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 ne 'zz'){          if($name ne '00'){
             if($activetab eq '' || $activetab ne $name){              if($activetab eq '' || $activetab ne $name){
                $active = '';                 $active = '';
             }elsif($activetab eq $name){              }elsif($activetab eq $name){
                $active = 'class="active"';                 $active = 'class="active"';
             }              }
             $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';              $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';
         }          } else {
       $form .= '<li '.$active.'>'.${$orderhash{$name}}[1].'</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; clear: both;">';
     foreach my $field (keys(%orderhash)){      foreach my $field (keys(%orderhash)){
  if($field ne 'zz'){   if($field ne '00'){
         if($activetab eq '' || $activetab ne $field){          if($activetab eq '' || $activetab ne $field){
                 $active = 'style="display: none;"';                  $active = 'style="display: none;"';
         }elsif($activetab eq $field){          }elsif($activetab eq $field){
Line 3708  for (i = 0; i < currentDivs.length; i++) Line 3759  for (i = 0; i < currentDivs.length; i++)
 function openTabs(pageId) {  function openTabs(pageId) {
  tabnav = document.getElementById(pageId).getElementsByTagName('UL');   tabnav = document.getElementById(pageId).getElementsByTagName('UL');
  if(tabnav.length > 2 ){   if(tabnav.length > 2 ){
  currentNav = document.getElementById(tabnav[0].id);   currentNav = document.getElementById(tabnav[1].id);
  currentLis = currentNav.getElementsByTagName('LI');   currentLis = currentNav.getElementsByTagName('LI');
  for(i = 0; i< currentLis.length; i++){   for(i = 0; i< currentLis.length; i++){
  if(currentLis[i].className == 'active') {   if(currentLis[i].className == 'active') {

Removed from v.1.388  
changed lines
  Added in v.1.408


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