Diff for /loncom/interface/londocs.pm between versions 1.460 and 1.474

version 1.460, 2011/09/10 19:00:07 version 1.474, 2012/01/03 01:54:39
Line 41  use Apache::lonratedt(); Line 41  use Apache::lonratedt();
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::lonclonecourse;  use Apache::lonclonecourse;
 use Apache::lonnavmaps;  use Apache::lonnavmaps;
   use Apache::lonnavdisplay();
 use HTML::Entities;  use HTML::Entities;
 use GDBM_File;  use GDBM_File;
 use Apache::lonlocal;  use Apache::lonlocal;
Line 176  sub dumpcourse { Line 177  sub dumpcourse {
     $newfilename=&clean($newfilename);      $newfilename=&clean($newfilename);
     $newfilename.='.'.$ext;      $newfilename.='.'.$ext;
     my @dirs=split(/\//,$newfilename);      my @dirs=split(/\//,$newfilename);
     my $path='/home/'.$ca.'/public_html';      my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca";
     my $makepath=$path;      my $makepath=$path;
     my $fail=0;      my $fail=0;
     for (my $i=0;$i<$#dirs;$i++) {      for (my $i=0;$i<$#dirs;$i++) {
Line 1127  sub breadcrumbs { Line 1128  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);
  if ($folderpath) {$folderpath.='&';}   if ($folderpath) {$folderpath.='&';}
  $folderpath.=$folder.'&'.$foldername;   $folderpath.=$folder.'&'.$foldername;
  my $url='/adm/coursedocs?folderpath='.          my $url;
     &escape($folderpath);          if ($allowed) {
     my $name=&unescape($foldername);              $url = '/adm/coursedocs?folderpath=';
           } else {
               $url = '/adm/supplemental?folderpath=';
           }
    $url .= &escape($folderpath);
    my $name=&unescape($foldername);
 # randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername  # randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername
      $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;    $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
     if ($1 ne '') {   if ($1 ne '') {
                $randompick=$1;             $randompick=$1;
             } else {          } else {
                $randompick=-1;             $randompick=-1;
             }          }
             if ($2) { $ishidden=1; }          if ($2) { $ishidden=1; }
             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 '.$crstype.' Documents');              $name = &mt('Supplemental '.$crstype.' Content');
             }          }
     &Apache::lonhtmlcommon::add_breadcrumb(   &Apache::lonhtmlcommon::add_breadcrumb(
       {'href'=>$url.$cpinfo,        {'href'=>$url.$cpinfo,
        'title'=>$name,         'title'=>$name,
        'text'=>$name,         'text'=>$name,
Line 1167  sub breadcrumbs { Line 1164  sub breadcrumbs {
     }      }
     $plain=~s/\&gt\;\s*$//;      $plain=~s/\&gt\;\s*$//;
     return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',      return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp',
        undef, undef, 1 ),$randompick,$ishidden,$isencrypted,$plain,$is_random_order);         undef, undef, 1 ),$randompick,$ishidden,
                                                  $isencrypted,$plain,$is_random_order);
 }  }
   
 sub log_docs {  sub log_docs {
Line 1577  sub handle_edit_cmd { Line 1575  sub handle_edit_cmd {
   
     if ($cmd eq 'del') {      if ($cmd eq 'del') {
  if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&   if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
     ($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) {      ($url!~/$LONCAPA::assess_page_seq_re/)) {
     &Apache::lonnet::removeuploadedurl($url);      &Apache::lonnet::removeuploadedurl($url);
  } else {   } else {
     &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);      &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
Line 1614  sub handle_edit_cmd { Line 1612  sub handle_edit_cmd {
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,      my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
         $supplementalflag,$orderhash)=@_;          $supplementalflag,$orderhash,$iconpath)=@_;
     my $container= ($env{'form.pagepath'}) ? 'page'      my $container= ($env{'form.pagepath'}) ? 'page'
                            : 'sequence';                             : 'sequence';
   
Line 1630  sub editor { Line 1628  sub editor {
     }      }
   
     my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =      my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
     &breadcrumbs($allowed,$crstype);          &breadcrumbs($allowed,$crstype);
         $r->print($breadcrumbtrail);      $r->print($breadcrumbtrail);
   
       my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
   
     unless ($allowed) {      unless ($allowed) {
         $randompick = -1;          $randompick = -1;
Line 1788  sub editor { Line 1788  sub editor {
         $tid = 2;          $tid = 2;
     }      }
     if ($allowed) {      if ($allowed) {
         $r->print(&generate_edit_table($tid,$orderhash,$to_show));          $r->print(&generate_edit_table($tid,$orderhash,$to_show,$iconpath,$jumpto));
         &print_paste_buffer($r,$container);          &print_paste_buffer($r,$container);
     } else {      } else {
           if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
               #Function Box for Supplemental Content for users with mdc priv.
               my $funcname = &mt('Folder Editor');
               $r->print(
                   &Apache::loncommon::head_subbox(
                       &Apache::lonhtmlcommon::start_funclist().
                       &Apache::lonhtmlcommon::add_item_funclist(
                           '<a href="/adm/coursedocs?command=direct&forcesupplement=1&'.
                           'supppath='.&HTML::Entities::encode($env{'form.folderpath'}).'">'.
                           '<img src="/res/adm/pages/docs.png" alt="'.$funcname.'" class="LC_icon" />'.
                           '<span class="LC_menubuttons_inline_text">'.$funcname.'</span></a>').
                             &Apache::lonhtmlcommon::end_funclist()));
           }
         $r->print($to_show);          $r->print($to_show);
     }      }
     return;      return;
Line 1970  sub entryline { Line 1983  sub entryline {
     if ($allowed) {      if ($allowed) {
  my $incindex=$index+1;   my $incindex=$index+1;
  my $selectbox='';   my $selectbox='';
  if (($folder!~/^supplemental/) &&   if (($#LONCAPA::map::order>0) &&
     ($#LONCAPA::map::order>0) &&  
     ((split(/\:/,      ((split(/\:/,
      $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]       $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]
      ne '') &&       ne '') &&
Line 2087  END Line 2099  END
     my $pagearg;      my $pagearg;
     my $pagefile;      my $pagefile;
     if ($uploaded) {      if ($uploaded) {
  if ($extension eq 'sequence') {          if (($extension eq 'sequence') || ($extension eq 'page')) {
     $icon=$iconpath.'/navmap.folder.closed.gif';              $url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/;
     $url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/;              my $containerarg = $1;
     $url='/adm/coursedocs?';      if ($extension eq 'sequence') {
     $folderarg=$1;          $icon=$iconpath.'navmap.folder.closed.gif';
     $isfolder=1;                  $folderarg=$containerarg;
         } elsif ($extension eq 'page') {                  $isfolder=1;
             $icon=$iconpath.'/page.gif';              } else {
             $url=~/\Q$coursenum\E\/([\/\w]+)\.page$/;                  $icon=$iconpath.'page.gif';
             $pagearg=$1;                  $pagearg=$containerarg;
             $url='/adm/coursedocs?';                  $ispage=1;
             $ispage=1;              }
               if ($allowed) {
                   $url='/adm/coursedocs?';
               } else {
                   $url='/adm/supplemental?';
               }
  } else {   } else {
     &Apache::lonnet::allowuploaded('/adm/coursedoc',$url);      &Apache::lonnet::allowuploaded('/adm/coursedoc',$url);
  }   }
Line 2200  END Line 2217  END
     } else {      } else {
         $reinit = &mt('(re-initialize course to access)');          $reinit = &mt('(re-initialize course to access)');
     }        }  
     $line.='      $line.='<td>';
   <td>      if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
     '.($url?'<a href="'.$url.'">':'').'<img src="'.$icon.'" alt="" class="LC_icon" />'.($url?'</a>':'').'         $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
   </td>      } elsif ($url) {
   <td>         $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes',
     '.($url?"<a href=\"$url\">":'').$title.($url?'</a>':' <span class="LC_docs_reinit_warn">'.$reinit.'</span>').$external."                                               '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);
   </td>";      } else {
          $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
       }
       $line.='</td><td>';
       if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
          $line.='<a href="'.$url.'">'.$title.'</a>';
       } elsif ($url) {
          $line.=&Apache::loncommon::modal_link($url.(($url=~/\?/)?'&':'?').'inhibitmenu=yes',
                                                $title,600,500);
       } else {
          $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
       }
       $line.=$external."</td>";
     if (($allowed) && ($folder!~/^supplemental/)) {      if (($allowed) && ($folder!~/^supplemental/)) {
   my %lt=&Apache::lonlocal::texthash(    my %lt=&Apache::lonlocal::texthash(
        'hd' => 'Hidden',         'hd' => 'Hidden',
Line 2631  ENDHEADERS Line 2660  ENDHEADERS
                     $r->print(' <a href="/adm/diff?filename='.                      $r->print(' <a href="/adm/diff?filename='.
       &Apache::lonnet::clutter($root.'.'.$extension).        &Apache::lonnet::clutter($root.'.'.$extension).
       '&versionone='.$prevvers.        '&versionone='.$prevvers.
       '">'.&mt('Diffs').'</a>');        '" target="diffs">'.&mt('Diffs').'</a>');
  }   }
  $r->print('</span><br />');   $r->print('</span><br />');
                 if (++$entries_count % $entries_per_col == 0) {                  if (++$entries_count % $entries_per_col == 0) {
Line 2750  sub create_form_ul { Line 2779  sub create_form_ul {
 sub startContentScreen {  sub startContentScreen {
     my ($r,$mode)=@_;      my ($r,$mode)=@_;
     $r->print('<ul class="LC_TabContentBigger" id="mainnav">');      $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
     $r->print('<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');      if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
           $r->print('<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n");
     my $active = '';          $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n");
 # does this user have privileges to modify docs?          $r->print('<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n");
     my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});          $r->print('<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>');
       } else {
     my $onclick;  
     my $href;  
   
     if ($allowed) {  
         $r->print('<li '.(($mode eq 'docs')?' class="active"':'').          $r->print('<li '.(($mode eq 'docs')?' class="active"':'').
                ' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');                 ' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
           $r->print('<li '.(($mode eq 'suppdocs')?' class="active"':'').
                     '><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Content Editor').'</b></a></li>');
     }      }
     $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');      $r->print("\n".'</ul>'."\n");
     $r->print('<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');      $r->print('<div class="LC_DocsBox" style="clear:both;margin:0;" id="contenteditor">'.
     $r->print('<li '.(($mode eq 'supdocs')?' class="active"':'').                '<div id="maincoursedoc" style="margin:0 0;padding:0 0;">'.
            '><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Documents').'</b></a></li>');                '<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
     $r->print('</ul>');  
     $r->print('<div class="LC_DocsBox" style="clear:both;margin:0;" id="contenteditor">'  
              .'<div id="maincoursedoc" style="margin:0 0;padding:0 0">');  
     $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');  
 }  }
   
 #  #
Line 2783  sub endContentScreen { Line 2806  sub endContentScreen {
 }  }
   
 sub supplemental_base {  sub supplemental_base {
     return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Documents'));      return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content'));
 }  }
   
 sub handler {  sub handler {
Line 2817  sub handler { Line 2840  sub handler {
     $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');      $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');      $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
   
 # does this user have privileges to modify docs      
     my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});      my $allowed;
   # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
       unless ($r->uri eq '/adm/supplemental') {
           # does this user have privileges to modify content.  
           $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
       }
   
   if ($allowed && $env{'form.verify'}) {    if ($allowed && $env{'form.verify'}) {
       &init_breadcrumbs('verify','Verify Content');        &init_breadcrumbs('verify','Verify Content');
       &verifycontent($r);        &verifycontent($r);
Line 2845  sub handler { Line 2874  sub handler {
 #  #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['folderpath','pagepath',                                              ['folderpath','pagepath',
                                              'pagesymb','forcesupplement','forcestandard']);                                               'pagesymb','forcesupplement','forcestandard',
                                                'symb','command']);
   
 # standard=1: this is a "new-style" course with an uploaded map as top level  # standard=1: this is a "new-style" course with an uploaded map as top level
 # standard=2: this is a "old-style" course, and there is nothing we can do  # standard=2: this is a "old-style" course, and there is nothing we can do
Line 2872  sub handler { Line 2902  sub handler {
     my $containertag;      my $containertag;
     my $uploadtag;      my $uploadtag;
   
   # Do we directly jump somewhere?
   
      if ($env{'form.command'} eq 'direct') {
          my ($mapurl,$id,$resurl);
          if ($env{'form.symb'} ne '') {
              ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
              if ($resurl=~/\.(sequence|page)$/) {
                  $mapurl=$resurl;
              } elsif ($resurl eq 'adm/navmaps') {
                  $mapurl=$env{'course.'.$env{'request.course.id'}.'.url'};
              }
              my $mapresobj;
              my $navmap = Apache::lonnavmaps::navmap->new();
              if (ref($navmap)) {
                  $mapresobj = $navmap->getResourceByUrl($mapurl);
              }
              $mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1};
              my $type=$2;
              my $path;
              if (ref($mapresobj)) {
                  my $pcslist = $mapresobj->map_hierarchy();
                  if ($pcslist ne '') {
                      foreach my $pc (split(/,/,$pcslist)) {
                          next if ($pc <= 1);
                          my $res = $navmap->getByMapPc($pc);
                          if (ref($res)) {
                              my $thisurl = $res->src();
                              $thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; 
                              my $thistitle = $res->title();
                              $path .= '&'.
                                       &Apache::lonhtmlcommon::entity_encode($thisurl).'&'.
                                       &Apache::lonhtmlcommon::entity_encode($thistitle).
                                       ':'.$res->randompick().
                                       ':'.$res->randomout().
                                       ':'.$res->encrypted().
                                       ':'.$res->randomorder();
                          }
                      }
                  }
                  $path .= '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
                       &Apache::lonhtmlcommon::entity_encode($mapresobj->title()).
                       ':'.$mapresobj->randompick().
                       ':'.$mapresobj->randomout().
                       ':'.$mapresobj->encrypted().
                       ':'.$mapresobj->randomorder();
              } else {
                  my $maptitle = &Apache::lonnet::gettitle($mapurl);
                  $path = '&default&...::::'.
                      '&'.&Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
                      &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
              }
              $path = 'default&'.
                      &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
                      $path;
              if ($type eq 'sequence') {
                  $env{'form.folderpath'}=$path;
                  $env{'form.pagepath'}='';
              } else {
                  $env{'form.pagepath'}=$path;
                  $env{'form.folderpath'}='';
              }
          } elsif ($env{'form.supppath'} ne '') {
              $env{'form.folderpath'}=$env{'form.supppath'};
          }
      } elsif ($env{'form.command'} eq 'editdocs') {
           $env{'form.folderpath'} = 'default&'.
                                     &Apache::lonhtmlcommon::entity_encode('Main Course Content');
           $env{'form.pagepath'}='';
      } elsif ($env{'form.command'} eq 'editsupp') {
           $env{'form.folderpath'} = 'default&'.
                                     &Apache::lonhtmlcommon::entity_encode('Supplemental Content');
           $env{'form.pagepath'}='';
      }
   
 # Where do we store these for when we come back?  # Where do we store these for when we come back?
     my $stored_folderpath='docs_folderpath';      my $stored_folderpath='docs_folderpath';
     if ($supplementalflag) {      if ($supplementalflag) {
        $stored_folderpath='docs_sup_folderpath';         $stored_folderpath='docs_sup_folderpath';
     }      }
          
 # No folderpath, no pagepath, see if we have something stored  # No folderpath, no pagepath, see if we have something stored
     if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {      if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) {
         &Apache::loncommon::restore_course_settings($stored_folderpath,          &Apache::loncommon::restore_course_settings($stored_folderpath,
Line 2909  sub handler { Line 3013  sub handler {
        } else {         } else {
           $env{'form.folderpath'}='default';            $env{'form.folderpath'}='default';
        }         }
     }       }
   
 # Store this  # Store this
     &Apache::loncommon::store_course_settings($stored_folderpath,      &Apache::loncommon::store_course_settings($stored_folderpath,
Line 2980  sub handler { Line 3084  sub handler {
             }              }
         }          }
         my $tabidstr = join("','",@tabids);          my $tabidstr = join("','",@tabids);
  $script .= &editing_js($udom,$uname).   $script .= &editing_js($udom,$uname,$supplementalflag).
                    &resize_contentdiv_js($tabidstr);                     &resize_contentdiv_js($tabidstr);
         $addentries = {          $addentries = {
                         onload   => "javascript:resize_contentdiv('contentscroll','1','1');",                          onload   => "javascript:resize_contentdiv('contentscroll','1','1');",
Line 3183  HIDDENFORM Line 3287  HIDDENFORM
     }      }
   
 # Generate the tabs  # Generate the tabs
     &startContentScreen($r,($supplementalflag?'supdocs':'docs'));      my $mode;
       if (($supplementalflag) && (!$allowed)) {
           &Apache::lonnavdisplay::startContentScreen($r,'supplemental');
       } else {
           &startContentScreen($r,($supplementalflag?'suppdocs':'docs'));
       }
   
 #  #
   
Line 3434  unless ($env{'form.pagepath'}) { Line 3542  unless ($env{'form.pagepath'}) {
  $hadchanges=0;   $hadchanges=0;
        unless ($supplementalflag) {         unless ($supplementalflag) {
           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                               $supplementalflag,\%orderhash);                                $supplementalflag,\%orderhash,$iconpath);
           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 3546  my %suporderhash = ( Line 3654  my %suporderhash = (
                 );                  );
         if ($supplementalflag) {          if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,             my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                                $supplementalflag,\%suporderhash);                                 $supplementalflag,\%suporderhash,$iconpath);
            if ($error) {             if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');                $r->print('<p><span class="LC_error">'.$error.'</span></p>');
            }             }
         }          }
     } elsif ($supplementalflag) {      } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                             $supplementalflag);                              $supplementalflag,'',$iconpath);
         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 3656  sub generate_admin_options { Line 3764  sub generate_admin_options {
   
   
 sub generate_edit_table {  sub generate_edit_table {
     my ($tid,$orderhash_ref,$to_show) = @_;      my ($tid,$orderhash_ref,$to_show,$iconpath,$jumpto) = @_;
     return unless(ref($orderhash_ref) eq 'HASH');      return unless(ref($orderhash_ref) eq 'HASH');
     my %orderhash = %{$orderhash_ref};      my %orderhash = %{$orderhash_ref};
     my $form;      my $form;
Line 3665  sub generate_edit_table { Line 3773  sub generate_edit_table {
     if($env{'form.active'} ne ''){      if($env{'form.active'} ne ''){
         $activetab = $env{'form.active'};          $activetab = $env{'form.active'};
     }      }
       my $backicon = $iconpath.'clickhere.gif';
       my $backtext = &mt('Back to Overview');
     $form = '<div class="LC_Box" style="margin:0;">'.      $form = '<div class="LC_Box" style="margin:0;">'.
              '<ul id="navigation'.$tid.'" class="LC_TabContent">';               '<ul id="navigation'.$tid.'" class="LC_TabContent">'.
                '<li class="goback">'.
                '<a href="javascript:toContents('."'$jumpto'".');">'.
                '<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'.
                '  alt="'.$backtext.'" />'.$backtext.'</a></li>';
     foreach my $name (reverse(sort(keys(%orderhash)))) {      foreach my $name (reverse(sort(keys(%orderhash)))) {
         if($name ne '00'){          if($name ne '00'){
             if($activetab eq '' || $activetab ne $name){              if($activetab eq '' || $activetab ne $name){
Line 3706  sub generate_edit_table { Line 3820  sub generate_edit_table {
 }  }
   
 sub editing_js {  sub editing_js {
     my ($udom,$uname) = @_;      my ($udom,$uname,$supplementalflag) = @_;
     my $now = time();      my $now = time();
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                                           p_mnf => 'Name of New Folder',                                            p_mnf => 'Name of New Folder',
Line 3744  sub editing_js { Line 3858  sub editing_js {
     my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents';      my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents';
     my $toplevelsupp = &supplemental_base();      my $toplevelsupp = &supplemental_base();
   
       my $backtourl = '/adm/navmaps';
       if ($supplementalflag) {
           $backtourl = '/adm/supplemental';
       }
   
     return <<ENDNEWSCRIPT;      return <<ENDNEWSCRIPT;
 function makenewfolder(targetform,folderseq) {  function makenewfolder(targetform,folderseq) {
     var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}');      var foldername=prompt('$lt{"p_mnf"}','$lt{"t_mnf"}');
Line 3922  function unselectInactive(nav) { Line 4041  function unselectInactive(nav) {
 currentNav = document.getElementById(nav);  currentNav = document.getElementById(nav);
 currentLis = currentNav.getElementsByTagName('LI');  currentLis = currentNav.getElementsByTagName('LI');
 for (i = 0; i < currentLis.length; i++) {  for (i = 0; i < currentLis.length; i++) {
  if(currentLis[i].className == 'right active' || currentLis[i].className == 'right'){          if (currentLis[i].className == 'goback') {
               currentLis[i].className = 'goback';
           } else {
       if (currentLis[i].className == 'right active' || currentLis[i].className == 'right') {
  currentLis[i].className = 'right';   currentLis[i].className = 'right';
  }else{      } else {
  currentLis[i].className = 'i';   currentLis[i].className = 'i';
  }      }
           }
 }  }
 }  }
   
Line 4018  function injectData(current, hiddenField Line 4141  function injectData(current, hiddenField
  current.submit();   current.submit();
 }  }
   
   function toContents(jumpto) {
       var newurl = '$backtourl';
       if (jumpto != '') {
           newurl = newurl+'?postdata='+jumpto;
   ;
       }
       location.href=newurl;
   }
   
 ENDNEWSCRIPT  ENDNEWSCRIPT
 }  }
   

Removed from v.1.460  
changed lines
  Added in v.1.474


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