Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.331 and 1.336

version 1.331, 2012/11/16 23:37:16 version 1.336, 2012/12/03 14:47:30
Line 209  dependencies for a web page uploaded dir Line 209  dependencies for a web page uploaded dir
 =cut  =cut
   
 sub dependencycheck_js {  sub dependencycheck_js {
     my ($symb,$title,$url) = @_;      my ($symb,$title,$url,$folderpath,$uri) = @_;
     my $link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"').      my $link;
                '&title='.&HTML::Entities::encode($title,'<>&"').      if ($symb) {
                '&url='.&HTML::Entities::encode($url,'<>&"');          $link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"');
       } elsif ($folderpath) {
           $link = '/adm/dependencies?folderpath='.&HTML::Entities::encode($folderpath,'<>&"');
            $url = $uri;
       }
       $link .= (($link=~/\?/)?'&amp;':'?').'title='.
                &HTML::Entities::encode($title,'<>&"');
       if ($url) {
           $link .= '&url='.&HTML::Entities::encode($url,'<>&"');
       }
     return <<ENDJS;      return <<ENDJS;
                 <script type="text/javascript">                  <script type="text/javascript">
                 // <![CDATA[                  // <![CDATA[
Line 1505  sub show_return_link { Line 1514  sub show_return_link {
     unless ($env{'request.course.id'}) { return 0; }      unless ($env{'request.course.id'}) { return 0; }
     if ($env{'request.noversionuri'}=~m{^/priv/} ||      if ($env{'request.noversionuri'}=~m{^/priv/} ||
         $env{'request.uri'}=~m{^/priv/}) { return 1; }          $env{'request.uri'}=~m{^/priv/}) { return 1; }
       return if ($env{'request.noversionuri'} eq '/adm/supplemental');
   
     if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})      if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {          || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
Line 1654  returns: nothing Line 1664  returns: nothing
                 if ($env{'request.noversionuri'} =~                   if ($env{'request.noversionuri'} =~ 
                     m{^/public/($match_domain)/($match_courseid)/syllabus$}) {                      m{^/public/($match_domain)/($match_courseid)/syllabus$}) {
                     unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&                      unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
                             ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {                               ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
                         $description = 'Menu';                          $description = 'Menu';
                         $no_mt_descr = 0;                          $no_mt_descr = 0;
                     }                      }
Line 1883  returns: nothing Line 1893  returns: nothing
 } # End of scope for @Crumbs  } # End of scope for @Crumbs
   
 sub docs_breadcrumbs {  sub docs_breadcrumbs {
     my ($allowed,$crstype,$contenteditor)=@_;      my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_;
     my ($folderpath,@folders);      my ($folderpath,@folders);
     if ($env{'form.pagepath'}) {      my @folders = split('&',$env{'form.folderpath'});
         @folders = split('&',$env{'form.pagepath'});  
     } else {  
         @folders=split('&',$env{'form.folderpath'});  
     }  
     my $plain='';      my $plain='';
       my $container = 'sequence';
     my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);      my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
     &clear_breadcrumbs();      my @docs_crumbs;
     while (@folders) {      while (@folders) {
         my $folder=shift(@folders);          my $folder=shift(@folders);
         my $foldername=shift(@folders);          my $foldername=shift(@folders);
Line 1906  sub docs_breadcrumbs { Line 1913  sub docs_breadcrumbs {
         }          }
         $url .= &escape($folderpath);          $url .= &escape($folderpath);
         my $name=&unescape($foldername);          my $name=&unescape($foldername);
 # each of randompick number, hidden, encrypted, random order are   # each of randompick number, hidden, encrypted, random order, is_page 
 # appended with ":"s to the foldername  # are appended with ":"s to the foldername
         $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;          $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//;
         if ($contenteditor) {           if ($contenteditor) { 
             if ($1 ne '') {              if ($1 ne '') {
                 $randompick=$1;                  $randompick=$1;
Line 1918  sub docs_breadcrumbs { Line 1925  sub docs_breadcrumbs {
             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 ($5 == 1) {$container = 'page'; }
         }          }
         if ($folder eq 'supplemental') {          if ($folder eq 'supplemental') {
             $name = &mt('Supplemental '.$crstype.' Content');              $name = &mt('Supplemental '.$crstype.' Contents');
         }          }
         if ($contenteditor) {          if ($contenteditor) {
             $plain.=$name.' &gt; ';              $plain.=$name.' &gt; ';
         }          }
         &add_breadcrumb(          push(@docs_crumbs,
                           {'href'  => $url,                            {'href'  => $url,
                            'title' => $name,                             'title' => $name,
                            'text'  => $name,                             'text'  => $name,
                            'no_mt' => 1,                             'no_mt' => 1,
                           });                            });
     }      }
     unless ($contenteditor) {      if ($title) {
         if ($env{'httpref.'.$env{'request.noversionuri'}} ne '') {          push(@docs_crumbs,
             &add_breadcrumb({text => 'View Resource'});                            {'title' => $title,
                              'text'  => $title,
                              'no_mt' => 1,}
                             );
       }
       if (wantarray) {
           unless ($precleared) {
               &clear_breadcrumbs();
           }
           &add_breadcrumb(@docs_crumbs);
           if ($contenteditor) {
               $plain=~s/\&gt\;\s*$//;
         }          }
           my $menulink = 0;
           if (!$allowed && !$contenteditor) {
               $menulink = 1;
           }
           return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef,
                                $contenteditor),
                                $randompick,$ishidden,$isencrypted,$plain,
                                $is_random_order,$container);
     } else {      } else {
         $plain=~s/\&gt\;\s*$//;          return \@docs_crumbs;
     }      }
     return (&breadcrumbs(undef,undef,0,'nohelp',undef,undef,$contenteditor),  
                          $randompick,$ishidden,$isencrypted,$plain,  
                          $is_random_order);  
 }  }
   
 ############################################################  ############################################################
Line 3091  ENDUTILITY Line 3115  ENDUTILITY
 }  }
   
 sub jump_to_editres {  sub jump_to_editres {
     my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb) = @_;      my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
           $title,$idx,$suppurl) = @_;
     my $jscall;      my $jscall;
     if ($switchserver) {      if ($switchserver) {
         if ($symb && $home) {          if ($home) {
             $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.              $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.
                      &HTML::Entities::encode($env{'request.role'},'"<>&').                       &HTML::Entities::encode($env{'request.role'},'"<>&');
                     '&amp;symb='.&HTML::Entities::encode($symb,'"<>&');              if ($symb) {
                   $cfile .= '&amp;symb='.&HTML::Entities::encode($symb,'"<>&');
               } elsif ($folderpath) {
                   $cfile .= '&amp;folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
               }
             if ($forceedit) {              if ($forceedit) {
                 $cfile .= '&amp;forceedit=1';                  $cfile .= '&amp;forceedit=1';
             }              }
Line 3109  sub jump_to_editres { Line 3138  sub jump_to_editres {
     } else {      } else {
         unless ($cfile =~ m{^/priv/}) {          unless ($cfile =~ m{^/priv/}) {
             if ($symb) {              if ($symb) {
                 $cfile .= (($cfile=~/\?/)?'&amp;':'?')."symb=$symb";                   $cfile .= (($cfile=~/\?/)?'&amp;':'?')."symb=$symb";
               } elsif ($folderpath) {
                   $cfile .= (($cfile=~/\?/)?'&amp;':'?').
                             'folderpath='.&HTML::Entities::encode(&escape($folderpath),'"<>&');
                   if ($title) {
                       $cfile .= (($cfile=~/\?/)?'&amp;':'?').
                                 'title='.&HTML::Entities::encode(&escape($title),'"<>&');
                   }
                   if ($idx) {
                       $cfile .= (($cfile=~/\?/)?'&amp;':'?').'idx='.$idx;
                   }
                   if ($suppurl) {
                       $cfile .= (($cfile=~/\?/)?'&amp;':'?').
                                 'suppurl='.&HTML::Entities::encode(&escape($suppurl));
                   }
             }              }
             if ($forceedit) {              if ($forceedit) {
                 $cfile .= (($cfile=~/\?/)?'&amp;':'?').'forceedit=1';                  $cfile .= (($cfile=~/\?/)?'&amp;':'?').'forceedit=1';
Line 3489  sub funclist_from_array { Line 3532  sub funclist_from_array {
                { listattr => {class => 'LC_funclist'} });                 { listattr => {class => 'LC_funclist'} });
 }     }   
   
   =pod
   
   =item &actionbox( \@array )
   
   Constructs a XHTML list from \@array with the first item being visually
   highlighted and set to the value 'Actions'. The list is wrapped in a division.
   
   The actionlist is used to offer contextual actions, mostly at the bottom
   of a page, on which the outcome of an processed action is shown,
   e.g. a file operation in Construction Space.
   
   =over
   
   =item \@array
   
   A reference to the array containing text. Details: sub funclist_from_array
   
   =back
    
   Returns: XHTML div as string. 
   
   =back
   
   =cut  
   
   sub actionbox {
       my ($items) = @_;
       return unless(ref($items) eq 'ARRAY');
       return
           '<div class="LC_actionbox">'
          .&funclist_from_array($items, {legend => &mt('Actions')})
          .'</div>';
   }
   
 1;  1;
   
 __END__  __END__

Removed from v.1.331  
changed lines
  Added in v.1.336


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