Diff for /loncom/interface/londocs.pm between versions 1.521 and 1.525

version 1.521, 2012/12/05 13:50:32 version 1.525, 2012/12/29 17:37:21
Line 1694  sub editor { Line 1694  sub editor {
         $container = 'sequence';          $container = 'sequence';
     }      }
   
     my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";      my $jumpto;
   
       unless ($supplementalflag) {
           $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'";
       }
   
     unless ($allowed) {      unless ($allowed) {
         $randompick = -1;          $randompick = -1;
Line 1867  sub editor { Line 1871  sub editor {
                                                            'Navigation_Screen',undef,'RAT')                                                             'Navigation_Screen',undef,'RAT')
                        .'</td><td class="LC_middle">'.&mt('Tools:').'</td>'                         .'</td><td class="LC_middle">'.&mt('Tools:').'</td>'
                        .'<td align="left"><ul id="LC_toolbar">'                         .'<td align="left"><ul id="LC_toolbar">'
                        .'<li><a href="/adm/coursedocs?forcesupplement=1" '                         .'<li><a href="/adm/coursedocs?forcesupplement=1&amp;command=editsupp" '
                        .'id="LC_content_toolbar_edittoplevel" '                         .'id="LC_content_toolbar_edittoplevel" '
                        .'class="LC_toolbarItem" '                         .'class="LC_toolbarItem" '
                        .'title="'.&mt('Supplemental Content Editor').'">'                         .'title="'.&mt('Supplemental Content Editor').'">'
Line 2443  $form_common.' Line 2447  $form_common.'
                                                             $forceedit,                                                              $forceedit,
                                                             undef,$symb,                                                              undef,$symb,
                                                             &escape($env{'form.folderpath'}),                                                              &escape($env{'form.folderpath'}),
                                                             $renametitle);                                                              $renametitle,'','',1);
                 if ($jscall) {                  if ($jscall) {
                     $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.                      $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.
                                 $jscall.'" >'.&mt('Edit').'</a>&nbsp;'."\n";                                  $jscall.'" >'.&mt('Edit').'</a>&nbsp;'."\n";
Line 3211  sub handler { Line 3215  sub handler {
   
 # Do we directly jump somewhere?  # Do we directly jump somewhere?
   
    if ($env{'form.command'} eq 'direct') {     if (($env{'form.command'} eq 'direct') || ($env{'form.command'} eq 'directnav')) {
        my ($mapurl,$id,$resurl);  
        if ($env{'form.symb'} ne '') {         if ($env{'form.symb'} ne '') {
            ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});             $env{'form.folderpath'}=
            if ($resurl=~/\.(sequence|page)$/) {                 &Apache::loncommon::symb_to_docspath($env{'form.symb'});
                $mapurl=$resurl;             &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => 
            } elsif ($resurl eq 'adm/navmaps') {                 $env{'form.command'}.'_'.$env{'form.symb'}});
                $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().  
                                     ':'.$res->is_page();  
                        }  
                    }  
                }  
                $path =~ s/^\&//;  
                my $maptitle = $mapresobj->title();  
                if ($mapurl eq 'default') {  
                    $maptitle = 'Main Course Documents';  
                }  
                $path .= (($path ne '')? '&' : '').  
                     &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.  
                     &Apache::lonhtmlcommon::entity_encode($maptitle).  
                     ':'.$mapresobj->randompick().  
                     ':'.$mapresobj->randomout().  
                     ':'.$mapresobj->encrypted().  
                     ':'.$mapresobj->randomorder().  
                     ':'.$mapresobj->is_page();   
            } else {  
                my $maptitle = &Apache::lonnet::gettitle($mapurl);  
                my $ispage = (($type eq 'page')? 1 : '');  
                if ($mapurl eq 'default') {  
                    $maptitle = 'Main Course Documents';  
                }  
                $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.  
                        &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage;  
            }  
            unless ($mapurl eq 'default') {  
                $path = 'default&'.  
                        &Apache::lonhtmlcommon::entity_encode('Main Course Documents').  
                        ':::::&'.$path;  
            }  
            $env{'form.folderpath'}=$path;  
        } elsif ($env{'form.supppath'} ne '') {         } elsif ($env{'form.supppath'} ne '') {
            $env{'form.folderpath'}=$env{'form.supppath'};             $env{'form.folderpath'}=$env{'form.supppath'};
              &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => 
                  $env{'form.command'}.'_'.$env{'form.supppath'}});
        }         }
    } elsif ($env{'form.command'} eq 'editdocs') {     } elsif ($env{'form.command'} eq 'editdocs') {
         $env{'form.folderpath'} = 'default&'.         $env{'form.folderpath'} = 'default&'.
                                   &Apache::lonhtmlcommon::entity_encode('Main Course Content').                                   &Apache::lonhtmlcommon::entity_encode('Main Course Content').
                                   ':::::';                                   ':::::';
          &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}});
    } elsif ($env{'form.command'} eq 'editsupp') {     } elsif ($env{'form.command'} eq 'editsupp') {
         $env{'form.folderpath'} = 'default&'.         $env{'form.folderpath'} = 'supplemental&'.
                                   &Apache::lonhtmlcommon::entity_encode('Supplemental Content');                                    &Apache::lonhtmlcommon::entity_encode('Supplemental Content');
          &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/supplemental'});
      } elsif ($env{'form.command'} eq 'contents') {
          &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/navmaps'});
      } elsif ($env{'form.command'} eq 'home') {
          &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => '/adm/menu'});
    }     }
   
   
 # 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) {
Line 3299  sub handler { Line 3252  sub handler {
     if ((!$env{'form.folderpath'}) && $allowed) {      if ((!$env{'form.folderpath'}) && $allowed) {
         &Apache::loncommon::restore_course_settings($stored_folderpath,          &Apache::loncommon::restore_course_settings($stored_folderpath,
                                           {'folderpath' => 'scalar'});                                            {'folderpath' => 'scalar'});
           unless (&unescape($env{'form.folderpath'}) =~ m{^(default|supplemental)&}) {
               undef($env{'form.folderpath'});
           }
     }      }
         
 # If we are not allowed to make changes, all we can see are supplemental docs  # If we are not allowed to make changes, all we can see are supplemental docs
Line 4282  sub generate_edit_table { Line 4238  sub generate_edit_table {
         $activetab = $env{'form.active'};          $activetab = $env{'form.active'};
     }      }
     my $backicon = $iconpath.'clickhere.gif';      my $backicon = $iconpath.'clickhere.gif';
     my $backtext = &mt('Exit');      my $backtext = &mt('Exit Editor');
     $form = '<div class="LC_Box" style="margin:0;">'.      $form = '<div class="LC_Box" style="margin:0;">'.
             '<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n".              '<ul id="navigation'.$tid.'" class="LC_TabContent">'."\n".
             '<li class="goback">'.              '<li class="goback">'.
             '<a href="javascript:toContents('."'$jumpto'".');">'.              '<a href="javascript:toContents('.$jumpto.');">'.
             '<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'.              '<img src="'.$backicon.'" class="LC_icon" style="border: none; vertical-align: top;"'.
             '  alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n".              '  alt="'.$backtext.'" />'.$backtext.'</a></li>'."\n".
             '<li>'.              '<li>'.
Line 4382  sub editing_js { Line 4338  sub editing_js {
     my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A';      my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A';
     my $toplevelsupp = &supplemental_base();      my $toplevelsupp = &supplemental_base();
   
     my $backtourl = '/adm/navmaps';      my $backtourl;
     if ($supplementalflag) {      if ($env{'docs.exit.'.$env{'request.course.id'}} =~ /^direct_(.+)$/) {   
           my $caller = $1; 
           if ($caller =~ /^supplemental/) {
               $backtourl = '/adm/supplemental?folderpath='.&escape($caller);
           } else {
               my ($map,$id,$res)=&Apache::lonnet::decode_symb($caller);
               $res = &Apache::lonnet::clutter($res);
               if (&Apache::lonnet::is_on_map($res)) {
                   $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
                                &HTML::Entities::encode($caller,'<>&"');
               }
           }
       } elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') {
           $backtourl = '/adm/menu';
       } elsif ($supplementalflag) {
         $backtourl = '/adm/supplemental';          $backtourl = '/adm/supplemental';
       } else {
           $backtourl = '/adm/navmaps';
     }      }
   
     my $fieldsets = "'ext','doc'";      my $fieldsets = "'ext','doc'";
Line 4686  function showPage(current, pageId, nav, Line 4658  function showPage(current, pageId, nav,
   
 function toContents(jumpto) {  function toContents(jumpto) {
     var newurl = '$backtourl';      var newurl = '$backtourl';
     if (jumpto != '') {      if ((newurl == '/adm/navmaps') && (jumpto != '')) {
         newurl = newurl+'?postdata='+jumpto;          newurl = newurl+'?postdata='+jumpto;
 ;  
     }      }
     location.href=newurl;      location.href=newurl;
 }  }

Removed from v.1.521  
changed lines
  Added in v.1.525


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