-//
-
-ENDCLOSE
-}
-
sub dc_popup_js {
my %lt = &Apache::lonlocal::texthash(
more => '(More ...)',
@@ -2310,12 +1624,12 @@ END
}
# This creates a "done button" for timed events. The confirmation box is a jQuery
-# dialog widget. If the interval parameter requires a proctor key for the timed
-# event to be marked done, there will also be a textbox where that can be entered.
-# Clicking OK will set the value of LC_interval_done to 'true', and, if needed will
-# set the value of LC_interval_done_proctorpass to the text entered in that box,
+# dialog widget. If the interval parameter requires a proctor key for the timed
+# event to be marked done, there will also be a textbox where that can be entered.
+# Clicking OK will set the value of LC_interval_done to 'true', and, if needed will
+# set the value of LC_interval_done_proctorpass to the text entered in that box,
# and submit the corresponding form.
-#
+#
# The &zero_time() routine in lonhomework.pm is called when a page is rendered if
# LC_interval_done is true.
#
@@ -2326,27 +1640,24 @@ sub done_button_js {
title => 'WARNING!',
preamble => 'You are trying to end this timed event early.',
map => 'Confirming that you are done will cause the time to expire and prevent you from changing any answers in the current folder.',
- resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).',
+ resource => 'Confirming that you are done will cause the time to expire for this question, and prevent you from changing your answer(s).',
okdone => 'Click "OK" if you are completely finished.',
cancel => 'Click "Cancel" to continue working.',
proctor => 'Ask a proctor to enter the key, then click "OK" if you are completely finished.',
ok => 'OK',
exit => 'Cancel',
key => 'Key:',
- nokey => 'A proctor key is required',
+ nokey => 'A proctor key is required',
);
- my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}));
- my $navmap = Apache::lonnavmaps::navmap->new();
- my ($missing,$tried) = (0,0);
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my ($missing,$tried);
if (ref($navmap)) {
+ $missing=0;
+ $tried=0;
my @resources=();
if ($type eq 'map') {
my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});
- if ($env{'request.symb'} =~ /\.page$/) {
- @resources=$navmap->retrieveResources($resurl,sub { $_[0]->is_problem() });
- } else {
- @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() });
- }
+ @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() });
} else {
my $res = $navmap->getBySymb($env{'request.symb'});
if (ref($res)) {
@@ -2356,7 +1667,13 @@ sub done_button_js {
}
}
foreach my $res (@resources) {
- if (ref($res->parts()) eq 'ARRAY') {
+ if ($res->singlepart()) {
+ if (!$res->tries()) {
+ $missing++;
+ } else {
+ $tried++;
+ }
+ } else {
foreach my $part (@{$res->parts()}) {
if (!$res->tries($part)) {
$missing++;
@@ -2380,12 +1697,11 @@ sub done_button_js {
$lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'';
}
}
- $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"');
if ($proctor) {
if ($height !~ /^\d+$/) {
$height = 400;
if ($missing) {
- $height += 60;
+ $height += 60;
}
}
if ($width !~ /^\d+$/) {
@@ -2398,7 +1714,6 @@ sub done_button_js {
@@ -2406,7 +1721,7 @@ sub done_button_js {
$lt{'preamble'} $lt{$type}
$lt{'miss'}
$lt{'proctor'}
-
@@ -2429,8 +1744,8 @@ sub done_button_js {
click: function() {
var proctorkey = \$( '[name="LC_interval_done_proctorkey"]' )[0].value;
if ((proctorkey == '') || (proctorkey == null)) {
- alert("$lt{'nokey'}");
- } else {
+ alert("$lt{'nokey'}");
+ } else {
\$( '[name="LC_interval_done"]' )[0].value = 'true';
\$( '[name="LC_interval_done_proctorpass"]' )[0].value = proctorkey;
\$( '[name="LCdoneButton"]' )[0].submit();
@@ -2480,8 +1795,7 @@ END
@@ -2526,18 +1840,14 @@ END
sub utilityfunctions {
my ($httphost) = @_;
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
- my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
- if ($currenturl =~ m{^/adm/wrapper/ext/}) {
- if ($env{'request.external.querystring'}) {
+ if ($currenturl =~ m{^/adm/wrapper/ext/}
+ && $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'}.
@@ -2563,15 +1873,6 @@ sub utilityfunctions {
my $countdown = &countdown_toggle_js();
- my $deeplinktarget;
- if ($env{'request.deeplink.login'}) {
- $deeplinktarget = $env{'request.deeplink.target'};
- }
-
- my $annotateurl = '/adm/annotation';
- if ($httphost) {
- $annotateurl = '/adm/annotations';
- }
my $hostvar = '
function setLCHost() {
var lcHostname="";
@@ -2586,7 +1887,7 @@ function setLCHost() {
' }'."\n".
' }'."\n";
}
-
+
$hostvar .= ' return lcHostname;'."\n".
'}'."\n";
@@ -2668,22 +1969,17 @@ function golist(url) {
currentURL = null;
currentSymb= null;
var lcHostname = setLCHost();
- var deeplinktarget = '$deeplinktarget';
- if (deeplinktarget == '_self') {
- document.location.href=lcHostname+url;
- } else {
- top.location.href=lcHostname+url;
- }
+ top.location.href=lcHostname+url;
}
}
-function catalog_info(url,isMobile) {
+function catalog_info(isMobile) {
if (isMobile == 1) {
- openMyModal(url+'.meta?modal=1',500,400,'yes');
+ openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');
} else {
- loncatinfo=window.open(url+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
+ loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
}
}
@@ -2705,7 +2001,7 @@ function annotate() {
annotator.document.write(
'$start_page_annotate'
+"