Diff for /loncom/interface/londocs.pm between versions 1.394 and 1.421

version 1.394, 2009/10/17 00:09:26 version 1.421, 2010/03/17 16:30:26
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 =
  return $link.' '.              "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"dumpcourse\", \""
     &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').'<br />';             .&mt('Dump '.$crstype.' Documents to Construction Space')
     } else {             ."\")'>"
  return '<div>'.             .&mt('Dump '.$crstype.' Documents to Construction Space')
      &mt('Dump '.$type.             .'</a>';
  ' DOCS to Construction Space: available on other servers').          return
  '</div>';              $link.' '
              .&Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs')
              .'<br />';
       } else {
           return
               &mt('Dump '.$crstype.' Documents to Construction Space: available on other servers');
     }      }
 }  }
   
Line 141  sub clean { Line 146  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.' Documents 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.' Documents 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 260  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 Documents").'" /></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 276  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 331  sub exportcourse { Line 346  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 .= '<p>'
                              .&mt('[_1]Your IMS package[_2] is ready for download.'
                                  ,'<a href="'.$imszipfile.'">','</a>')
                              .'</p>';
                 if ($copyresult) {                  if ($copyresult) {
                     $outcome .= '<p class="LC_error">'                      $outcome .= '<p class="LC_error">'
                                .&mt('The following errors occurred during export - [_1]'                                 .&mt('The following errors occurred during export - [_1]'
                                    ,$copyresult)                                     ,$copyresult)
                                .'</p>';                                 .'</p>';
                 }                  }
                 $outcome .= '<p>'  
                            .&mt('[_1]Your IMS package[_2] is ready for download.'  
                                ,'<a href="'.$imszipfile.'">','</a>')  
                            .'</p>';  
             } else {              } else {
                 $outcome = '<p class="LC_error">'                  $outcome = '<p class="LC_error">'
                           .&mt('Unfortunately you will not be able to retrieve'                            .&mt('Unfortunately you will not be able to retrieve'
                               .' an IMS archive of this posts at this time,'                                .' an IMS archive of your course at this time,'
                               .' because there was a problem creating a'                                .' because there was a problem creating a'
                               .' manifest file.')                                .' manifest file.')
                           .'</p>'                            .'</p>'
Line 353  sub exportcourse { Line 368  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());
     } else {      } else {
         my $display;          my $display='<form name="exportdoc" action="" method="post">'."\n".
         $display = '<form name="exportdoc" action="" method="post">'."\n";                      '<p>'.
         $display .= '<p>'                      &mt('Choose which items you wish to export from your '.$crstype.'.').
                    .&mt('Choose which items you wish to export from your '.$type.'.')                      '</p>'.
                    .'</p>';                      '<div class="LC_columnSection"><fieldset>'.
         $display .= '<div class="LC_columnSection"><fieldset>'.  
                     '<legend>'.&mt('Content items').'</legend>'.                      '<legend>'.&mt('Content items').'</legend>'.
                     '<input type="button" value="'.&mt('check all').'" '.                      '<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="'.&mt('uncheck all').'"'.                      '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
                     ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset>'.                      ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset>';
                     '<fieldset>'.          if ($numdisc > 0) {
                     '<legend>'.&mt('Discussion posts').'</legend>'.              $display .= '<fieldset>'.
                     '<input type="button" value="'.&mt('check all').'"'.                          '<legend>'.&mt('Discussion posts').'</legend>'.
                     ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.                          '<input type="button" value="'.&mt('check all').'"'.
                     '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.                          ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
                     ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" />'.                          '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
                     '</fieldset></div>';                          ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" />'.
                           '</fieldset>';
           }
           $display .= '</div>';
         my $curRes;          my $curRes;
         my $depth = 0;          my $depth = 0;
         my $count = 0;          my $count = 0;
Line 386  sub exportcourse { Line 403  sub exportcourse {
         my $lastcontainer = $startcount;          my $lastcontainer = $startcount;
         $display .= &Apache::loncommon::start_data_table()          $display .= &Apache::loncommon::start_data_table()
                    .&Apache::loncommon::start_data_table_header_row()                     .&Apache::loncommon::start_data_table_header_row()
                    .'<th>'.&mt('Export content item?').'</th>'                     .'<th>'.&mt('Export content item?').'</th>';
                    .'<th>';  
         if ($numdisc > 0) {          if ($numdisc > 0) {
             $display .= &mt('Export discussion posts?');              $display .= '<th>'.&mt('Export discussion posts?').'</th>';
         } else {  
              $display .= '&nbsp;';  
         }          }
         $display .= '</th>'          $display .= &Apache::loncommon::end_data_table_header_row();
                    .&Apache::loncommon::end_data_table_header_row();  
         while ($curRes = $it->next()) {          while ($curRes = $it->next()) {
             if (ref($curRes)) {              if (ref($curRes)) {
                 $count ++;                  $count ++;
Line 415  sub exportcourse { Line 428  sub exportcourse {
                         $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';                          $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
                     }                      }
                 }                  }
                   my $currelem = $count+$boards+$startcount;
                 $display .= &Apache::loncommon::start_data_table_row()                  $display .= &Apache::loncommon::start_data_table_row()
                            .'<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;                      $lastcontainer = $currelem;
                     $display .= 'onclick="javascript:propagateCheck('."'$checkitem'".')"';                      $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"';
                 }                  }
                 $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" alt="" />'                      $display .= ('<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" alt="" />' x2)."\n";
                                .'<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";
                     $lastcontainer = $count + $startcount + $boards;  
                 } elsif ($curRes->is_page()) {                  } elsif ($curRes->is_page()) {
                     $display .= '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />&nbsp;'."\n";                      $display .= '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />&nbsp;'."\n";
                     $lastcontainer = $count + $startcount + $boards;  
                 }                  }
                 my $currelem = $count+$boards+$startcount;  
                 $children{$parent{$depth}} .= $currelem.':';                  $children{$parent{$depth}} .= $currelem.':';
                 $display .= '&nbsp;'.$curRes->title().'</td>'."\n";                  $display .= '&nbsp;'.$curRes->title().'</td>'."\n";
   
                 # Existing discussion posts?                  # Existing discussion posts?
                 if ($discussiontime{$ressymb} > 0) {                  if ($discussiontime{$ressymb} > 0) {
                     $boards ++;                      $boards ++;
                     $currelem = $count+$boards+$startcount;  
                     $display .= '<td align="right">'                      $display .= '<td align="right">'
                                .'<input type="checkbox" name="discussion" value="'.$count.'" />'                                 .'<input type="checkbox" name="discussion" value="'.$count.'" />'
                                .'</td>'."\n";                                 .'</td>'."\n";
                 } else {                  } elsif ($numdisc > 0) {
                     $display .= '<td>&nbsp;</td>'."\n";                      $display .= '<td>&nbsp;</td>'."\n";
                 }                  }
                 $display .= &Apache::loncommon::end_data_table_row();                  $display .= &Apache::loncommon::end_data_table_row();
Line 507  function containerCheck(item) { Line 516  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 1007  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 1022  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 1050  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') {
                 $name = &mt('Supplemental '.$type.' Documents');                  $name = &mt('Supplemental '.$crstype.' Documents');
             }              }
     &Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
       {'href'=>$url.$cpinfo,        {'href'=>$url.$cpinfo,
Line 1488  sub handle_edit_cmd { Line 1506  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 1503  sub editor { Line 1521  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 1622  sub editor { Line 1645  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++;
     }      }
Line 1778  sub parse_supplemental_title { Line 1801  sub parse_supplemental_title {
  $foldertitle=&Apache::lontexconvert::msgtexconverted($4);   $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
  my $name =  &Apache::loncommon::plainname($uname,$udom);   my $name =  &Apache::loncommon::plainname($uname,$udom);
  $name = &HTML::Entities::encode($name,'"<>&\'');   $name = &HTML::Entities::encode($name,'"<>&\'');
           $renametitle = &HTML::Entities::encode($renametitle,'"<>&\'');
  $title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.   $title='<i>'.&Apache::lonlocal::locallocaltime($time).'</i> '.
     $name.': <br />'.$foldertitle;      $name.': <br />'.$foldertitle;
     }      }
Line 1790  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 2047  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 2206  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 2215  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()) {
     $r->print($res->compTitle()."\t".$res->symb()."\n");              $r->print($res->compTitle()."\t".$res->symb()."\n");
         }          }
         $r->print("\n</pre>\n");          $r->print("\n</pre>\n");
     }      }
     $r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');      $r->print('<hr /><a href="/adm/coursedocs">'.&mt('Back to Course Editor').'</a>');
 }  }
   
   
 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 2242  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 />');
    }     }
        }         }
        if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {         if (($key=~/^src\_(.+)$/) && (!$alreadyseen{&unescape($hash{$key})})) {
Line 2252  sub verifycontent { Line 2282  sub verifycontent {
        }         }
    }     }
    &untiehash();     &untiehash();
    $r->print('<h1>'.&mt('Done').'.</h1>'.'<a href="/adm/coursedocs">'.     $r->print(
      &mt('Return to DOCS').'</a>');         '<p class="LC_success">'.&mt('Done').'</p>'
         .'<hr />'
         .'<p><a href="/adm/coursedocs">'
     .&mt('Back to Course Editor')
         .'</a></p>'
      );
 }  }
   
   
Line 2265  sub devalidateversioncache { Line 2300  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 2328  sub checkversions { Line 2363  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 2373  sub checkversions { Line 2408  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 2382  sub checkversions { Line 2417  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 2431  ENDHEADERS Line 2466  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 2448  ENDHEADERS Line 2483  ENDHEADERS
       ('select_form_order' =>        ('select_form_order' =>
        ['',1..$currentversion,'mostrecent'],         ['',1..$currentversion,'mostrecent'],
        '' => '',         '' => '',
        'mostrecent' => 'most recent',         'mostrecent' => &mt('most recent'),
        map {$_,$_} (1..$currentversion))));         map {$_,$_} (1..$currentversion))));
     $r->print('</span></td></tr><tr><td></td>');      $r->print('</span></td></tr><tr><td></td>');
     my $lastold=1;      my $lastold=1;
Line 2503  ENDHEADERS Line 2538  ENDHEADERS
  }   }
     }      }
     $r->print('</table></form>');      $r->print('</table></form>');
     $r->print('<h1>'.&mt('Done').'.</h1>');      $r->print('<p class="LC_success">'.&mt('Done').'</p>');
   
     &untiehash();      &untiehash();
 }  }
Line 2568  sub init_breadcrumbs { Line 2603  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 2586  sub handler { Line 2621  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 2627  sub handler { Line 2662  sub handler {
       &init_breadcrumbs('versions','Check/Set Resource Versions');        &init_breadcrumbs('versions','Check/Set Resource Versions');
       &checkversions($r);        &checkversions($r);
   } elsif ($allowed && $env{'form.dumpcourse'}) {    } elsif ($allowed && $env{'form.dumpcourse'}) {
       &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');        &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Documents to Construction Space');
       &dumpcourse($r);        &dumpcourse($r);
   } elsif ($allowed && $env{'form.exportcourse'}) {    } elsif ($allowed && $env{'form.exportcourse'}) {
       &init_breadcrumbs('exportcourse','IMS Export');        &init_breadcrumbs('exportcourse','IMS Export');
Line 2652  sub handler { Line 2687  sub handler {
         &Apache::loncommon::restore_course_settings('docs_folderpath',          &Apache::loncommon::restore_course_settings('docs_folderpath',
                                               {'folderpath' => 'scalar'});                                                {'folderpath' => 'scalar'});
     }      }
     if (!$env{'form.folderpath'}) {      if (!$allowed) {
           unless($env{'form.folderpath'} =~ /^supplemental/) {
               $env{'form.folderpath'} = '';
           }
       }
       if (!$env{'form.folderpath'} && $allowed) {
         &Apache::loncommon::restore_course_settings('docs_folderpath',          &Apache::loncommon::restore_course_settings('docs_folderpath',
                                               {'pagepath' => 'scalar'});                                                {'pagepath' => 'scalar'});
     }      }
Line 2661  sub handler { Line 2701  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 2684  sub handler { Line 2724  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 2695  sub handler { Line 2737  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 2746  sub create_form_ul { Line 2786  sub create_form_ul {
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     if ($allowed) {      if ($allowed) {
         &Apache::lonhtmlcommon::add_breadcrumb({          &Apache::lonhtmlcommon::add_breadcrumb({
             href=>"/adm/coursedocs",text=>"$type Editor"});              href=>"/adm/coursedocs",text=>"$crstype Editor"});
   
         $r->print(&Apache::loncommon::start_page("$type Editor", $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')
         );          );
     } else {      } elsif ($showdoc) {
         my $lc_type = lc($type);          $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
         &Apache::lonhtmlcommon::add_breadcrumb({                                                  {'force_register' => $showdoc,}));
             href=>"/adm/coursedocs",text=>"Supplemental $lc_type documents"});      } 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").          $r->print(&Apache::loncommon::start_page("Supplemental documents").
                   &Apache::lonhtmlcommon::breadcrumbs());                    $breadcrumbtrail);
     }      }
   
   my %allfiles = ();    my %allfiles = ();
Line 2854  sub create_form_ul { Line 2899  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' => 'Import Document',
                 'srch' => 'Search',                  'srch' => 'Search',
                 'impo' => 'Import',                  'impo' => 'Import',
  'book' => 'Import Bookmarks',   'book' => 'Import Bookmarks',
                 'selm' => 'Select Map',                  'selm' => 'Select Map',
                 'load' => 'Load Map',                  'load' => 'Load Map',
                 'reco' => 'Recover Deleted Resources',                  'reco' => 'Recover Deleted Documents',
                 'newf' => 'New Folder',                  'newf' => 'New Folder',
                 'newp' => 'New Composite Page',                  'newp' => 'New Composite Page',
                 'extr' => 'External Resource',                  'extr' => 'External Resource',
Line 2884  sub create_form_ul { Line 2929  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 2932  FUFORM Line 2977  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/src.png" alt="pic03" />' => "$uploadtag<a onclick='javascript:groupsearch()'>$lt{'srch'}</a>" },   { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'"  onclick="javascript:groupsearch()" />' => "$uploadtag<a onclick='javascript:groupsearch()'>$lt{'srch'}</a>" },
  { '<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" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'"  onclick="javascript:groupimport();"/>' => "<a onclick='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
  { '<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>" },   { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/vbkm.png" alt="'.$lt{book}.'" onclick="javascript:groupopen(0,1,1);" />' => "<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 2972  ERFORM Line 3017  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 2994  ERFORM Line 3039  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 ($allowed){                                 },
         $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;"';
        }         }
Line 3030  HIDDENFORM Line 3086  HIDDENFORM
        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 3213  NSYLFORM Line 3269  NSYLFORM
  </form>   </form>
 NGFFORM  NGFFORM
  @specialdocumentsforma=(   @specialdocumentsforma=(
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/sequence.png" alt="pic06" />'=>$newpageform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/page.png" alt="'.$lt{newp}.'"  onclick="javascript:makenewpage(document.newpage,\''.$pageseq.'\');" />'=>$newpageform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/syllabus.png" alt="pic07" />'=>$newsylform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.newsyl.submit()" />'=>$newsylform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/groupportfolio.png" alt="pic08" />'=>$newgroupfileform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/groupportfolio.png" alt="'.$lt{grpo}.'" onclick="document.newgroupfiles.submit()" />'=>$newgroupfileform},
  );    ); 
   
       }        }
  push @specialdocumentsforma, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/navigation.png" alt="pic09" />'=>$newnavform},   push @specialdocumentsforma, ({'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="document.newnav.submit()" />'=>$newnavform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/simple.png" alt="pic10" />'=>$newsmppageform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simple.png" alt="'.$lt{sipa}.'" onclick="javascript:makesmppage();" />'=>$newsmppageform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/simpprob.png" alt="pic11" />'=>$newsmpproblemform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{sipr}.'" onclick="javascript:makesmpproblem();" />'=>$newsmpproblemform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/dropbox.png" alt="pic12" />'=>$newdropboxform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/dropbox.png" alt="'.$lt{drbx}.'" onclick="javascript:makedropbox();" />'=>$newdropboxform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/scoreupfrm.png" alt="pic13" />'=>$newexuploadform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/scoreupfrm.png" alt="'.$lt{scuf}.'" onclick="javascript:makeexamupload();" />'=>$newexuploadform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/bchat.png" alt="pic14" />'=>$newbulform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/bchat.png" alt="'.$lt{bull}.'" onclick="javascript:makebulboard();" />'=>$newbulform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/myaboutme.png" alt="pic15" />'=>$newaboutmeform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="javascript:makebulboard();" />'=>$newaboutmeform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/aboutme.png" alt="pic16" />'=>$newaboutsomeoneform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/aboutme.png" alt="'.$lt{abou}.'" onclick="javascript:makeabout();" />'=>$newaboutsomeoneform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/chrt.png" alt="pic17" />'=>$newrosterform},);   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/chrt.png" alt="'.$lt{rost}.'" onclick="document.newroster.submit()" />'=>$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" src="/res/adm/pages/simpprob.png" alt="'.&mt('Simple Problem').'" onclick="javascript:makesmpproblem();" />'=>$newsmpproblemform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic33" />'=>$newexuploadform}   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/scoreupfrm.png" alt="'.&mt('Score Upload Form').'" onclick="javascript:makeexamupload();" />'=>$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/extres.png" alt="pic18" />'=>$extresourcesform},  # {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" />'=>$extresourcesform},
  {'<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/ims.png" alt="'.$lt{imsf}.'" />'=>$imspform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/recover.png" alt="pic20" />'=>$recoverform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/recover.png" alt="'.$lt{reco}.'" onclick="javascript:groupopen(\''.$readfile.'\',1,0)" />'=>$recoverform},
  );   );
   
   my @importdoc = (
       {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'newext\');" />'=>$extresourcesform},
       {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:makeims();" />'=>$imspform}, 
   );
   $fileuploadform =  create_form_ul(create_list_elements(@importdoc)) . '<hr/>' . $fileuploadform;
 my %orderhash = (  my %orderhash = (
  '00' => ['Newfolder',$newfolderform],   '00' => ['Newfolder',$newfolderform],
                 'aa' => ['Upload Document',$fileuploadform],                  'aa' => ['Import Documents',$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)],
                 );                  );
 my $tid='1';  my $tid='1';
 my $varcd = 'Main Course Documents';  
  $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 3265  my $varcd = 'Main Course Documents'; Line 3325  my $varcd = 'Main Course Documents';
        }         }
   
        &changewarning($r,'');         &changewarning($r,'');
 $r->print(&generate_edit_table($tid,$varcd,\%orderhash));  $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 3284  $r->print('</div>'); Line 3344  $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'));
        } elsif ($allowed) {         } elsif ($allowed) {
   $env{'form.folderpath'} = $savefolderpath;    $env{'form.folderpath'} = $savefolderpath;
        }         }
Line 3296  $r->print('</div>'); Line 3356  $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 3315  $r->print('</div>'); Line 3373  $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 3361  SNAMFORM Line 3419  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" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.supnewsyl.submit()" />'
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic30" />'=>$supnewsylform},              =>$supnewsylform},
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic31" />'=>$supnewaboutmeform},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="document.supnewaboutme.submit()" />'
               =>$supnewaboutmeform},
  );   );
   my @supimportdoc = (
    {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:makenewext(\'supnewext\');" />'
               =>$supnewextform},
           );
   $supupdocform =  create_form_ul(create_list_elements(@supimportdoc)) . '<hr/>' . $supupdocform;
 my %suporderhash = (  my %suporderhash = (
  '00' => ['Supnewfolder', $supnewfolderform],   '00' => ['Supnewfolder', $supnewfolderform],
                 'ee' => ['Upload Document',$supupdocform],                  'ee' => ['Import Documents',$supupdocform],
                 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))]                  'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))]
                 );                  );
   
         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>');
         }          }
         my $tid='2';          my $tid='2';
         my $varscd = 'Supplemental Course Documents';          $r->print(&generate_edit_table($tid,\%suporderhash));
         $r->print(&generate_edit_table($tid,$varscd,\%suporderhash));  
     } else {      } else {
         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 3419  sub generate_admin_options { Line 3482  sub generate_admin_options {
                                          'vc' => 'Verify Content',                                           'vc' => 'Verify Content',
                                          'cv' => 'Check/Set Resource Versions',                                           'cv' => 'Check/Set Resource Versions',
                                          'ls' => 'List Symbs',                                           'ls' => 'List Symbs',
                                          'sl' => 'Show Log'                                           'sl' => 'Show Log',
                                            'imse' => 'IMS Export',
                                            'dcd' => 'Dump Course Documents to Construction Space: available on other servers'
                                           );                                            );
   my %help = %{$help_ref};    my %help = %{$help_ref};
   my %env = %{$env_ref};    my %env = %{$env_ref};
   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/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" src="/res/adm/pages/verify.png" alt="'.$lt{vc}.'"  onclick=\'javascript:injectData(document.courseverify, "dummy", "verify", "'.$lt{'vc'}.'")\' />' 
  {'<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'}"},          => "<a onclick='javascript:injectData(document.courseverify, \"dummy\", \"verify\", \"$lt{'vc'}\")'>$lt{'vc'}</a>$help{'Verify_Content'}"},
    {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/resversion.png" alt="'.$lt{cv}.'"  onclick=\'javascript:injectData(document.courseverify, "dummy", "versions", "'.$lt{'cv'}.'")\' />'
           =>"<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/dump.png" alt="pic23" />'=>$dumpbut};    push @list, {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/dump.png" alt="'.$lt{dcd}.'" />'=>$dumpbut};
   }    }
   push @list, ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/imsexport.png" alt="pic24" />'=>$exportbut},    push @list, ({'<img class="LC_noBorder LC_middle" src="/res/adm/pages/imsexport.png" alt="'.$lt{imse}.'" onclick=\'javascript:injectData(document.courseverify, "dummy", "exportcourse", "'.&mt('IMS Export').'")\' />'
  {'<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'}' />"},            =>$exportbut},
  {'<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>"},   {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/symbs.png" alt="'.$lt{ls}.'"  onclick=\'javascript:injectData(document.courseverify, "dummy", "listsymbs", "'.$lt{'ls'}.'")\'  />'
           =>"<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" src="/res/adm/pages/log.png" alt="'.$lt{sl}.'"  onclick=\'javascript:injectData(document.courseverify, "dummy", "docslog", "'.$lt{'sl'}.'")\'  />'
           =>"<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 3442  sub generate_admin_options { Line 3512  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 3450  sub generate_edit_table { Line 3521  sub generate_edit_table {
     if($env{'form.active'} ne ''){      if($env{'form.active'} ne ''){
         $activetab = $env{'form.active'};          $activetab = $env{'form.active'};
     }      }
     $form = '<div class="LC_Box">';      $form = '<div class="LC_Box" style="margin-right:0">';
     $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 '00'){          if($name ne '00'){
Line 3466  sub generate_edit_table { Line 3537  sub generate_edit_table {
  }   }
     }      }
     $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 '00'){   if($field ne '00'){
         if($activetab eq '' || $activetab ne $field){          if($activetab eq '' || $activetab ne $field){
Line 3722  function openTabs(pageId) { Line 3793  function openTabs(pageId) {
  if(currentLis[i].className == 'active') {   if(currentLis[i].className == 'active') {
  funcString = currentLis[i].onclick.toString();   funcString = currentLis[i].onclick.toString();
  tab = funcString.split('"');   tab = funcString.split('"');
                                   if(tab.length < 2) {
                                      tab = funcString.split("'");
                                   }
  currentData = document.getElementById(tab[1]);   currentData = document.getElementById(tab[1]);
         currentData.style.display = 'block';          currentData.style.display = 'block';
  }   }

Removed from v.1.394  
changed lines
  Added in v.1.421


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