[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Sat Jul 27 12:25:42 EDT 2019
raeburn Sat Jul 27 16:25:42 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonmenu.pm
Log:
- For 2.11
Backport 1.443 (part), 1.467, 1.468, 1.493, 1.494, 1.495
-------------- next part --------------
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.74 loncom/interface/lonmenu.pm:1.369.2.75
--- loncom/interface/lonmenu.pm:1.369.2.74 Fri Feb 22 01:57:36 2019
+++ loncom/interface/lonmenu.pm Sat Jul 27 16:25:41 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369.2.74 2019/02/22 01:57:36 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.75 2019/07/27 16:25:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -525,11 +525,23 @@
my $url = $$menuitem[0];
$url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};
if (&Apache::lonnet::is_on_map($url)) {
- unless ($$menuitem[0] =~ /\?register=1/) {
- $$menuitem[0] .= '?register=1';
+ unless ($$menuitem[0] =~ /(\?|\&)register=1/) {
+ $$menuitem[0] .= (($$menuitem[0]=~/\?/)? '&' : '?').'register=1';
}
} else {
- $$menuitem[0] =~ s{\?register=1}{};
+ $$menuitem[0] =~ s{\&?register=1}{};
+ }
+ if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) {
+ if (($ENV{'SERVER_PORT'} == 443) || ($env{'request.use_absolute'} =~ m{^https://})) {
+ unless (&Apache::lonnet::uses_sts()) {
+ unless ($$menuitem[0] =~ m{^https?://}) {
+ $$menuitem[0] = 'http://'.$ENV{'SERVER_NAME'}.$$menuitem[0];
+ }
+ unless ($$menuitem[0] =~ /(\&|\?)usehttp=1/) {
+ $$menuitem[0] .= (($$menuitem[0]=~/\?/) ? '&' : '?').'usehttp=1';
+ }
+ }
+ }
}
$$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"');
}
@@ -696,7 +708,7 @@
}
sub innerregister {
- my ($forcereg,$bread_crumbs,$group,$pagebuttonshide) = @_;
+ my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname) = @_;
my $const_space = ($env{'request.state'} eq 'construct');
my $is_const_dir = 0;
@@ -717,9 +729,13 @@
$newmail= 'swmenu.setstatus("you have","messages");';
}
- my ($mapurl,$resurl);
+ my ($mapurl,$resurl,$crstype);
if ($env{'request.course.id'}) {
+#
+#course_type: Course or Community
+#
+ $crstype = &Apache::loncommon::course_type();
if ($env{'request.symb'}) {
($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
@@ -727,16 +743,11 @@
my $maptitle = &Apache::lonnet::gettitle($mapurl);
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
-
-#SD
-#course_type only Course and Community?
-#
my @crumbs;
unless (($forcereg) &&
($env{'request.noversionuri'} eq '/adm/navmaps') &&
($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
- @crumbs = ({text => Apache::loncommon::course_type()
- . ' Contents',
+ @crumbs = ({text => $crstype.' Contents',
href => "Javascript:gopost('/adm/navmaps','')"});
}
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
@@ -764,7 +775,6 @@
} else {
$resurl = $env{'request.noversionuri'};
my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
- my $crstype = &Apache::loncommon::course_type();
my $title = &mt('View Resource');
if ($resurl =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folderpath','title']);
@@ -774,7 +784,7 @@
}
my $trail;
if ($env{'form.folderpath'}) {
- &prepare_functions($resurl,$forcereg,$group,undef,undef,1);
+ &prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname);
($trail) =
&Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
} else {
@@ -789,10 +799,10 @@
} elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
&Apache::lonhtmlcommon::clear_breadcrumbs();
&prepare_functions('/public'.$courseurl."/syllabus",
- $forcereg,$group,undef,undef,1);
+ $forcereg,$group,undef,undef,1,$hostname);
$title = &mt('Syllabus File');
my ($trail) =
- &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname);
return $trail;
}
unless ($env{'request.state'} eq 'construct') {
@@ -829,7 +839,7 @@
if (($env{'environment.remote'} eq 'on') && ($env{'request.symb'})) {
&Apache::lonhtmlcommon::clear_breadcrumbs();
}
- $editbutton = &prepare_functions($resurl,$forcereg,$group);
+ $editbutton = &prepare_functions($resurl,$forcereg,$group,'','','',$hostname);
}
if ($editbutton eq '') {
$editbutton = &clear(6,1);
@@ -1418,7 +1428,7 @@
}
sub get_editbutton {
- my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;
+ my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg,$hostname) = @_;
my $jscall;
if (($forceview) && ($env{'form.todocs'})) {
my ($folderpath,$command,$navmap);
@@ -1438,9 +1448,9 @@
$jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
$forceedit,$forcereg,$env{'request.symb'},
&escape($env{'form.folderpath'}),
- &escape($env{'form.title'}),$env{'form.idx'},
- &escape($env{'form.suppurl'}),$env{'form.todocs'},
- $suppanchor);
+ &escape($env{'form.title'}),$hostname,
+ $env{'form.idx'},&escape($env{'form.suppurl'}),
+ $env{'form.todocs'},$suppanchor);
}
if ($jscall) {
my $icon = 'pcstr.png';
@@ -1473,7 +1483,7 @@
}
sub prepare_functions {
- my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs,$forbodytag) = @_;
+ my ($resurl,$forcereg,$group,$bread_crumbs,$advtools,$docscrumbs,$hostname,$forbodytag) = @_;
unless ($env{'request.registered'}) {
undef(@inlineremote);
}
@@ -1534,7 +1544,8 @@
$forceedit = 1;
}
$editbutton = &get_editbutton($cfile,$home,$switchserver,
- $forceedit,$forceview,$forcereg);
+ $forceedit,$forceview,$forcereg,
+ $hostname);
} elsif (($resurl eq '/adm/extresedit') &&
(($env{'form.symb'}) || ($env{'form.folderpath'}))) {
($cfile,$home,$switchserver,$forceedit,$forceview) =
@@ -1645,9 +1656,13 @@
$suppanchor = $env{'form.anchor'};
}
my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
+ my $link = '/adm/coursedocs?command=direct&forcesupplement=1&supppath='.
+ "$esc_path&anchor=$suppanchor";
+ if ($env{'request.use_absolute'} ne '') {
+ $link = $env{'request.use_absolute'}.$link;
+ }
&switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
- "location.href='/adm/coursedocs?command=direct&forcesupplement=1&supppath=$esc_path&anchor=$suppanchor'",
- 'Folder/Page Content','','',1);
+ "location.href='$link'",'Folder/Page Content');
}
}
}
@@ -2143,14 +2158,18 @@
sub utilityfunctions {
my ($httphost) = @_;
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
- if ($currenturl =~ m{^/adm/wrapper/ext/}
- && $env{'request.external.querystring'} ) {
+ my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
+ if ($currenturl =~ m{^/adm/wrapper/ext/}) {
+ if ($env{'request.external.querystring'}) {
$currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
+ }
+ my ($anchor) = ($env{'request.symb'} =~ /(\#[^\#]+)$/);
+ if (($anchor) && ($currenturl !~ /\Q$anchor\E$/)) {
+ $currenturl .= $1;
+ }
}
$currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
- my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
-
my $dc_popup_cid;
if ($env{'user.adv'} && exists($env{'user.role.dc./'.
$env{'course.'.$env{'request.course.id'}.
@@ -2176,6 +2195,10 @@
my $countdown = &countdown_toggle_js();
+ my $annotateurl = '/adm/annotation';
+ if ($httphost) {
+ $annotateurl = '/adm/annotations';
+ }
my $hostvar = '
function setLCHost() {
var lcHostname="";
@@ -2304,7 +2327,7 @@
annotator.document.write(
'$start_page_annotate'
+"<form name='goannotate' target='Annotator' method='post' "
- +"action='/adm/annotations'>"
+ +"action='$annotateurl'>"
+"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
+"<\\/form>"
+'$end_page_annotate');
@@ -2408,11 +2431,11 @@
}
my ($privref,$gotsymb,$destsymb);
my $destinationurl = $ENV{'REQUEST_URI'};
- if ($destinationurl =~ /\?symb=/) {
+ if ($destinationurl =~ /(\?|\&)symb=/) {
$gotsymb = 1;
} elsif ($destinationurl =~ m{^/enc/}) {
my $plainurl = &Apache::lonenc::unencrypted($destinationurl);
- if ($plainurl =~ /\?symb=/) {
+ if ($plainurl =~ /(\?|\&)symb=/) {
$gotsymb = 1;
}
}
More information about the LON-CAPA-cvs
mailing list