--- loncom/interface/lonhtmlcommon.pm 2012/10/08 10:47:34 1.327
+++ loncom/interface/lonhtmlcommon.pm 2012/11/08 18:37:44 1.330
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.327 2012/10/08 10:47:34 foxr Exp $
+# $Id: lonhtmlcommon.pm,v 1.330 2012/11/08 18:37:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@ use Time::HiRes;
use Apache::lonlocal;
use Apache::lonnet;
use HTML::Entities();
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub java_not_enabled {
return "\n".''.
@@ -1651,6 +1651,14 @@ returns: nothing
$description =
$env{'course.'.$env{'request.course.id'}.'.description'};
$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',
title =>'Go to main menu',
@@ -1666,7 +1674,7 @@ returns: nothing
}
}
my $links;
- if ((&show_return_link) && (!$CourseBreadcrumbs)) {
+ if ((&show_return_link) && (!$CourseBreadcrumbs) && (ref($last) eq 'HASH')) {
my $alttext = &mt('Go Back');
$links=&htmltag( 'a','
',
{ href => '/adm/flip?postdata=return:',
@@ -1701,8 +1709,10 @@ returns: nothing
# last breadcrumb is the first order heading of a page
# for course breadcrumbs it's just bold
- $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
- $lasttext), {title => $lasttext});
+ if ($lasttext ne '') {
+ $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
+ $lasttext), {title => $lasttext});
+ }
my $icons = '';
$faq = $last->{'faq'} if (exists($last->{'faq'}));
@@ -1723,11 +1733,12 @@ returns: nothing
#
-
- unless ($CourseBreadcrumbs) {
- $links = &htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" });
- } else {
- $links = &htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" });
+ if ($links ne '') {
+ unless ($CourseBreadcrumbs) {
+ $links = &htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" });
+ } else {
+ $links = &htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" });
+ }
}
@@ -2925,29 +2936,6 @@ PARAMSONE
if (itemid.offsetWidth != itemwstart) {
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)) {
var primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
@@ -3007,10 +2995,71 @@ function callResize() {
timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500);
}
-FOURTH
+THIRD
return $output;
}
+##############################################
+##############################################
+
+sub javascript_jumpto_resource {
+ my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
+ &mt('Switch server?');
+ return (<&').
+ '&symb='.&HTML::Entities::encode($symb,'"<>&');
+ if ($forceedit) {
+ $cfile .= '&forceedit=1';
+ }
+ if ($forcereg) {
+ $cfile .= '®ister=1';
+ }
+ $jscall = "need_switchserver('$cfile');";
+ }
+ } else {
+ unless ($cfile =~ m{^/priv/}) {
+ if ($symb) {
+ $cfile .= (($cfile=~/\?/)?'&':'?')."symb=$symb";
+ }
+ if ($forceedit) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'forceedit=1';
+ }
+ if ($forcereg) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'register=1';
+ }
+ }
+ $jscall = "go('$cfile')";
+ }
+ return $jscall;
+}
##############################################
##############################################