Diff for /loncom/interface/londocs.pm between versions 1.463 and 1.470

version 1.463, 2011/11/07 20:05:55 version 1.470, 2011/12/25 18:19:38
Line 2200  END Line 2200  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}) {
     '.($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}) {
          $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 2845  sub handler { Line 2857  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 2885  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'} eq '') {
              $mapurl = $env{'course.'.$env{'request.course.id'}.'.url'};
          } else {
              ($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'}='';
          }
      }
   
 # 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,

Removed from v.1.463  
changed lines
  Added in v.1.470


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