[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm lonnavmaps.pm lonprintout.pm
raeburn
raeburn at source.lon-capa.org
Sun Jan 14 19:51:42 EST 2018
raeburn Mon Jan 15 00:51:42 2018 EDT
Modified files:
/loncom/interface lonnavmaps.pm lonhelper.pm lonprintout.pm
Log:
- Bug 6791. Links launched as modal pop-ups for resources listing in
"Select Resource(s)" to print UI.
-------------- next part --------------
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.539 loncom/interface/lonnavmaps.pm:1.540
--- loncom/interface/lonnavmaps.pm:1.539 Thu Jan 4 12:07:53 2018
+++ loncom/interface/lonnavmaps.pm Mon Jan 15 00:51:42 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.539 2018/01/04 12:07:53 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.540 2018/01/15 00:51:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -966,7 +966,28 @@
# links to open and close the folder
my $whitespace = $location.'/whitespace_21.gif';
- my $linkopen = "<img src='$whitespace' alt='' />"."<a href=\"$link\">";
+ my $linkopen = "<img src='$whitespace' alt='' />";
+ my $nomodal;
+ if (($params->{'modalLink'}) && (!$resource->is_sequence())) {
+ if ($link =~m{^(?:|/adm/wrapper)/ext/([^#]+)}) {
+ my $exturl = $1;
+ if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
+ $nomodal = 1;
+ }
+ } elsif (($link eq "/public/$LONCAPA::match_domain/$LONCAPA::match_courseid/syllabus") &&
+ ($env{'request.course.id'}) && ($ENV{'SERVER_PORT'} == 443) &&
+ ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
+ $nomodal = 1;
+ }
+ my $esclink = &js_escape($link);
+ if ($nomodal) {
+ $linkopen .= "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />";
+ } else {
+ $linkopen .= "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">";
+ }
+ } else {
+ $linkopen .= "<a href=\"$link\">";
+ }
my $linkclose = "</a>";
# Default icon: unknown page
@@ -1094,10 +1115,19 @@
}
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) {
- $result .= "$curMarkerBegin<a href=\"$link\">$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>";
- } else {
- $result .= "$curMarkerBegin$linkopen$title$partLabel</a>$curMarkerEnd$editmapLink$nonLinkedText</td>";
+ $linkclose = '</a>';
+ if ($params->{'modalLink'}) {
+ my $esclink = &js_escape($link);
+ if ($nomodal) {
+ $linkopen = "<a href=\"#\" onclick=\"javascript:window.open('$esclink','resourcepreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1'); return false;\" />";
+ } else {
+ $linkopen = "<a href=\"$link\" onclick=\"javascript:openMyModal('$esclink',600,500,'yes','true'); return false;\">";
+ }
+ } else {
+ $linkopen = "<a href=\"$link\">";
+ }
}
+ $result .= "$curMarkerBegin$linkopen$title$partLabel$linkclose$curMarkerEnd$editmapLink$nonLinkedText</td>";
return $result;
}
@@ -1735,6 +1765,11 @@
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
}
+ my $inhibitmenu;
+ if ($args->{'modalLink'}) {
+ $inhibitmenu = '&inhibitmenu=yes';
+ }
+
while (1) {
if ($args->{'sort'}) {
$curRes = shift(@resources);
@@ -1888,7 +1923,7 @@
} else {
$args->{"resourceLink"} = $src.
($srcHasQuestion?'&':'?') .
- 'symb=' . &escape($symb).$anchor;
+ 'symb=' . &escape($symb).$inhibitmenu.$anchor;
}
}
# Now, we've decided what parts to show. Loop through them and
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.199 loncom/interface/lonhelper.pm:1.200
--- loncom/interface/lonhelper.pm:1.199 Sun Jan 14 22:02:06 2018
+++ loncom/interface/lonhelper.pm Mon Jan 15 00:51:42 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.199 2018/01/14 22:02:06 raeburn Exp $
+# $Id: lonhelper.pm,v 1.200 2018/01/15 00:51:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2047,7 +2047,9 @@
and long status display columns to the display. The 'addparts'
attribute will add in a part selector beside problems that have more
than 1 part. The 'includecourse' attribute if true, will include
-the toplevel default.sequence in the results.
+the toplevel default.sequence in the results. The 'modalLink' attribute,
+if true, will cause links to be launched as modal pop-ups, instead of
+replacing the resource selection listing, currently being displayed.
=head3 SUB-TAGS
@@ -2159,6 +2161,7 @@
$paramHash->{'toponly'} = $token->[2]{'toponly'};
$paramHash->{'addstatus'} = $token->[2]{'addstatus'};
$paramHash->{'addparts'} = $token->[2]{'addparts'};
+ $paramHash->{'modalLink'} = $token->[2]{'modallink'};
if ($paramHash->{'addparts'}) {
$helper->declareVar($paramHash->{'variable'}.'_part');
}
@@ -2365,6 +2368,7 @@
my $option_texts = $self->{OPTION_TEXTS};
my $option_types = $self->{OPTION_TYPES};
my $addparts = $self->{'addparts'};
+ my $modalLink = $self->{'modalLink'};
my $headings_done = 0;
# Evaluate the map url as needed
@@ -2549,7 +2553,8 @@
'suppressEmptySequences' => $self->{'suppressEmptySequences'},
'include_top_level_map' => $self->{'include_top_level_map'},
'iterator_map' => $mapUrl,
- 'map_no_edit_link' => 1, }
+ 'map_no_edit_link' => 1,
+ 'modalLink' => $modalLink, }
);
$result .= $buttons;
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.660 loncom/interface/lonprintout.pm:1.661
--- loncom/interface/lonprintout.pm:1.660 Sat Dec 30 19:51:30 2017
+++ loncom/interface/lonprintout.pm Mon Jan 15 00:51:42 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.660 2017/12/30 19:51:30 raeburn Exp $
+# $Id: lonprintout.pm,v 1.661 2018/01/15 00:51:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,7 +157,7 @@
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_PEOPLE_SEQ',
'Select problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'CHOOSE_STUDENTS_INCOMPLETE',
$map,
@@ -206,7 +206,7 @@
my $resource_chooser = &generate_resource_chooser('INCOMPLETE_PROBLEMS_COURSE_RESOURCES',
'Select problem(s) to print',
- 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1"',
+ 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1" modallink="1"',
'RESOURCES',
'INCOMPLETE_PROBLEMS_COURSE_STUDENTS',
'',
@@ -252,7 +252,7 @@
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_SEQ',
'Select problem(s) to print',
- 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1"',
+ 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -306,7 +306,8 @@
# this_state - State name of the chooser.
# prompt_text - Text to use to prompt user.
# resource_options - Resource tag options e.g.
-# "multichoice='1', toponly='1', addstatus='1'"
+# "multichoice='1', toponly='1', addstatus='1',
+# modallink='1'"
# that control the selection and appearance of the
# resource selector.
# variable - Name of the variable to hold the choice
@@ -4214,7 +4215,7 @@
}
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' toponly='1' addstatus='1' closeallpages='1'",
+ "multichoice='1' toponly='1' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
$url,
@@ -4224,7 +4225,7 @@
$helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$url,
@@ -4289,7 +4290,7 @@
'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4298,7 +4299,7 @@
$start_new_option);
$helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4346,7 +4347,7 @@
&Apache::lonxml::xmlparse($r, 'helper',
&generate_resource_chooser('ALL_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
'',
@@ -4355,7 +4356,7 @@
$start_new_option) .
&generate_resource_chooser('ALL_RESOURCES',
'Select Resource(s) to print',
- " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1'",
+ " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
'',
@@ -4363,7 +4364,7 @@
$start_new_option) .
&generate_resource_chooser('ALL_PROBLEMS_STUDENTS',
'Select Problem(s) to print',
- 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'STUDENTS1',
'',
@@ -4407,7 +4408,7 @@
#
my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS',
'Select resources to print',
- 'multichoice="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PRINT_FORMATTING',
$map,
@@ -4418,7 +4419,7 @@
'PRINT_FORMATTING').
&generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4517,7 +4518,7 @@
$namechoice) .
&generate_resource_chooser('SELECT_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4541,7 +4542,7 @@
<nextstate>PRINT_FORMATTING</nextstate>
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
<resource variable="RESOURCES" multichoice="1" addstatus="1"
- closeallpages="1">
+ closeallpages="1" modallink="1">
<filterfunc>return $isNotMap;</filterfunc>
<mapurl>$map</mapurl>
<valuefunc>return $symbFilter;</valuefunc>
@@ -4686,7 +4687,7 @@
<state name="CHOOSE_FROM_ANY_SEQUENCE" title="Select Resources To Print">
<message>(mark desired resources then click "next" button) <br /></message>
<resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1"
- closeallpages="1">
+ closeallpages="1" modallink="1">
<nextstate>PAGESIZE</nextstate>
<filterfunc>return $isNotMap</filterfunc>
<mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>
More information about the LON-CAPA-cvs
mailing list