Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.328 and 1.332

version 1.328, 2012/10/31 12:54:13 version 1.332, 2012/11/27 23:45:08
Line 61  use Time::HiRes; Line 61  use Time::HiRes;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
 use HTML::Entities();  use HTML::Entities();
 use LONCAPA;  use LONCAPA qw(:DEFAULT :match);
   
 sub java_not_enabled {  sub java_not_enabled {
    return "\n".'<span class="LC_error">'.     return "\n".'<span class="LC_error">'.
Line 1505  sub show_return_link { Line 1505  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 1651  returns: nothing Line 1652  returns: nothing
                 $description =                   $description = 
                     $env{'course.'.$env{'request.course.id'}.'.description'};                      $env{'course.'.$env{'request.course.id'}.'.description'};
                 $no_mt_descr = 1;                  $no_mt_descr = 1;
                   if ($env{'request.noversionuri'} =~ 
                       m{^/public/($match_domain)/($match_courseid)/syllabus$}) {
                       unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
                               ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
                           $description = 'Menu';
                           $no_mt_descr = 0;
                       }
                   }
             }              }
             $menulink =  {  href   =>'/adm/menu',              $menulink =  {  href   =>'/adm/menu',
                             title  =>'Go to main menu',                              title  =>'Go to main menu',
Line 1666  returns: nothing Line 1675  returns: nothing
             }              }
         }          }
         my $links;          my $links;
         if ((&show_return_link) && (!$CourseBreadcrumbs)) {          if ((&show_return_link) && (!$CourseBreadcrumbs) && (ref($last) eq 'HASH')) {
             my $alttext = &mt('Go Back');              my $alttext = &mt('Go Back');
             $links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />',              $links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />',
                             { href => '/adm/flip?postdata=return:',                              { href => '/adm/flip?postdata=return:',
Line 1701  returns: nothing Line 1710  returns: nothing
         # last breadcrumb is the first order heading of a page          # last breadcrumb is the first order heading of a page
         # for course breadcrumbs it's just bold          # for course breadcrumbs it's just bold
   
         $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',          if ($lasttext ne '') {
                 $lasttext), {title => $lasttext});              $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
                       $lasttext), {title => $lasttext});
           }
   
         my $icons = '';          my $icons = '';
         $faq  = $last->{'faq'}  if (exists($last->{'faq'}));          $faq  = $last->{'faq'}  if (exists($last->{'faq'}));
Line 1723  returns: nothing Line 1734  returns: nothing
         #          #
   
   
           if ($links ne '') {
         unless ($CourseBreadcrumbs) {              unless ($CourseBreadcrumbs) {
             $links = &htmltag('ol',  $links, { id => "LC_MenuBreadcrumbs"   });                  $links = &htmltag('ol',  $links, { id => "LC_MenuBreadcrumbs"   });
         } else {              } else {
             $links = &htmltag('ul',  $links, { class => "LC_CourseBreadcrumbs" });                  $links = &htmltag('ul',  $links, { class => "LC_CourseBreadcrumbs" });
               }
         }          }
   
   
Line 1871  returns: nothing Line 1883  returns: nothing
   
 } # End of scope for @Crumbs  } # End of scope for @Crumbs
   
   sub docs_breadcrumbs {
       my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_;
       my ($folderpath,@folders);
       if ($env{'form.pagepath'}) {
           @folders = split('&',$env{'form.pagepath'});
       } else {
           @folders = split('&',$env{'form.folderpath'});
       }
       my $plain='';
       my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
       my @docs_crumbs;
       while (@folders) {
           my $folder=shift(@folders);
           my $foldername=shift(@folders);
           if ($folderpath) {$folderpath.='&';}
           $folderpath.=$folder.'&'.$foldername;
           my $url;
           if ($allowed) {
               $url = '/adm/coursedocs?folderpath=';
           } else {
               $url = '/adm/supplemental?folderpath=';
           }
           $url .= &escape($folderpath);
           my $name=&unescape($foldername);
   # each of randompick number, hidden, encrypted, random order are 
   # appended with ":"s to the foldername
           $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
           if ($contenteditor) { 
               if ($1 ne '') {
                   $randompick=$1;
               } else {
                  $randompick=-1;
               }
               if ($2) { $ishidden=1; }
               if ($3) { $isencrypted=1; }
               if ($4 ne '') { $is_random_order = 1; }
           }
           if ($folder eq 'supplemental') {
               $name = &mt('Supplemental '.$crstype.' Contents');
           }
           if ($contenteditor) {
               $plain.=$name.' &gt; ';
           }
           push(@docs_crumbs,
                             {'href'  => $url,
                              'title' => $name,
                              'text'  => $name,
                              'no_mt' => 1,
                             });
       }
       if (wantarray) {
           unless ($precleared) {
               &clear_breadcrumbs();
           }
           &add_breadcrumb(@docs_crumbs);
           if ($title) {
               &add_breadcrumb({text => $title});
           }
           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);
       } else {
           return \@docs_crumbs;
       }
   }
   
 ############################################################  ############################################################
 ############################################################  ############################################################
   
Line 2925  PARAMSONE Line 3011  PARAMSONE
         if (itemid.offsetWidth != itemwstart) {          if (itemid.offsetWidth != itemwstart) {
             listwchange = 1;              listwchange = 1;
         }          }
 THIRD  
     if ($context eq 'docs') {  
         $output .= <<"DOCSTWO";  
         if (activeTab == 'cc1') {  
             if (document.getElementById('cc_hrule') != null) {  
                 document.getElementById('cc_hrule').style.width=actabw+"px";  
             }  
         } else {  
             if (activeTab == 'bb1') {  
                 if (document.getElementById('bb_hrule') != null) {  
                     document.getElementById('bb_hrule').style.width=actabw+"px";  
                 }  
             } else {  
                 if (activeTab == 'ee2') {  
                     if (document.getElementById('ee_hrule') != null) {  
                         document.getElementById('ee_hrule').style.width=actabw+"px";  
                     }  
                 }  
             }  
         }  
 DOCSTWO  
     }  
     $output .= <<"FOURTH";  
     }      }
     if ((chkh == 1) || (listwchange)) {      if ((chkh == 1) || (listwchange)) {
         var primaryheight = document.getElementById('LC_nav_bar').offsetHeight;          var primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
Line 3007  function callResize() { Line 3070  function callResize() {
     timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500);      timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500);
 }  }
   
 FOURTH  THIRD
     return $output;      return $output;
 }  }
   
Line 3041  ENDUTILITY Line 3104  ENDUTILITY
 }  }
   
 sub jump_to_editres {  sub jump_to_editres {
     my ($cfile,$home,$switchserver,$uploaded,$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'},'"<>&').'&amp;'.                       &HTML::Entities::encode($env{'request.role'},'"<>&');
                     'symb='.&HTML::Entities::encode($env{'request.symb'},'"<>&');              if ($symb) {
             if ($uploaded) {                  $cfile .= '&amp;symb='.&HTML::Entities::encode($symb,'"<>&');
               } elsif ($folderpath) {
                   $cfile .= '&amp;folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
               }
               if ($forceedit) {
                 $cfile .= '&amp;forceedit=1';                  $cfile .= '&amp;forceedit=1';
             }              }
               if ($forcereg) {
                   $cfile .= '&amp;register=1';
               }
             $jscall = "need_switchserver('$cfile');";              $jscall = "need_switchserver('$cfile');";
         }          }
     } else {      } else {
         if ($uploaded) {          unless ($cfile =~ m{^/priv/}) {
             $cfile .= '?forceedit=1';              if ($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) {
                   $cfile .= (($cfile=~/\?/)?'&amp;':'?').'forceedit=1';
               }
               if ($forcereg) {
                   $cfile .= (($cfile=~/\?/)?'&amp;':'?').'register=1';
               }
         }          }
         $jscall = "go('$cfile')";          $jscall = "go('$cfile')";
     }      }

Removed from v.1.328  
changed lines
  Added in v.1.332


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