version 1.389, 2017/11/06 03:08:40
|
version 1.392, 2018/04/14 02:29:44
|
Line 78 sub java_not_enabled {
|
Line 78 sub java_not_enabled {
|
sub coursepreflink { |
sub coursepreflink { |
my ($text,$category)=@_; |
my ($text,$category)=@_; |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
return '<a target="_top" href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; |
my $target =' target="_top"'; |
|
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
|
$target =''; |
|
} |
|
return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; |
} else { |
} else { |
return ''; |
return ''; |
} |
} |
Line 1025 data structure used for bookkeeping.
|
Line 1029 data structure used for bookkeeping.
|
|
|
=item $number_to_do The total number of items being processed. |
=item $number_to_do The total number of items being processed. |
|
|
|
=item $preamble Optional HTML to display before the progress bar. |
|
|
=back |
=back |
|
|
=back |
=back |
|
|
Returns a hash containing the progress state data structure. |
Returns a hash containing the progress state data structure. |
|
If $number_to_do is zero or null, an indeterminate progress bar will |
|
be used. |
|
|
=item &Update_PrgWin() |
=item &Update_PrgWin() |
|
|
Line 1118 Returns: none
|
Line 1126 Returns: none
|
|
|
# Create progress |
# Create progress |
sub Create_PrgWin { |
sub Create_PrgWin { |
my ($r,$number_to_do)=@_; |
my ($r,$number_to_do,$preamble)=@_; |
my %prog_state; |
my %prog_state; |
$prog_state{'done'}=0; |
$prog_state{'done'}=0; |
$prog_state{'firststart'}=&Time::HiRes::time(); |
$prog_state{'firststart'}=&Time::HiRes::time(); |
$prog_state{'laststart'}=&Time::HiRes::time(); |
$prog_state{'laststart'}=&Time::HiRes::time(); |
$prog_state{'max'}=$number_to_do; |
$prog_state{'max'}=$number_to_do; |
&Apache::loncommon::LCprogressbar($r); |
&Apache::loncommon::LCprogressbar($r,$prog_state{'max'},$preamble); |
return %prog_state; |
return %prog_state; |
} |
} |
|
|
# update progress |
# update progress |
sub Update_PrgWin { |
sub Update_PrgWin { |
my ($r,$prog_state,$displayString)=@_; |
my ($r,$prog_state,$displayString)=@_; |
&Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString); |
&Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString,$$prog_state{'max'}); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
} |
} |
|
|
Line 1181 sub Increment_PrgWin {
|
Line 1189 sub Increment_PrgWin {
|
if ($$prog_state{'max'}) { |
if ($$prog_state{'max'}) { |
$percent=int(100.*$current/$$prog_state{'max'}); |
$percent=int(100.*$current/$$prog_state{'max'}); |
} |
} |
&Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo); |
&Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo,$$prog_state{'max'}); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
} |
} |
|
|
Line 1340 $(document).ready(function(){
|
Line 1348 $(document).ready(function(){
|
});'; |
});'; |
} |
} |
|
|
|
sub countdown { |
|
|
|
# Code to put a due date countdown in 'duedatecountdown' span. |
|
# This is currently located in the breadcrumb headers. |
|
# note that the dueDateLayout is internatinoalized below. |
|
# Here document is used to support the substitution into the javascript below. |
|
# ..which unforunately necessitates escaping the $'s in the javascript. |
|
# There are several times of importance |
|
# |
|
# serverDueDate - The absolute time at which the problem expires. |
|
# serverTime - The server's time when the problem finished computing. |
|
# clientTime - The client's time...as close to serverTime as possible. |
|
# The clientTime will be slightly later due to |
|
# 1. The latency between problem computation and |
|
# the first network action. |
|
# 2. The time required between the page load-start and the actual |
|
# initial javascript execution that got clientTime. |
|
# These are used as follows: |
|
# The difference between clientTime and serverTime are used to |
|
# correct for differences in clock settings between the browser's system and the |
|
# server's. |
|
# |
|
# The difference between clientTime and the time at which the ready() method |
|
# starts executing is used to estimate latencies for page load and submission. |
|
# Since this is an estimate, it is doubled. The latency estimate + one minute |
|
# is used to determine when the countdown timer turns red to warn the user |
|
# to think about submitting. |
|
|
|
|
|
my $dueDateLayout = &mt('Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn} [_1]', |
|
"<span id='submitearly'></span>"); |
|
my $early = '- <b>'.&mt('Submit Early').'</b>'; |
|
my $pastdue = '- <b>'.&mt('Past Due').'</b>'; |
|
return <<"JAVASCRIPT"; |
|
|
|
var documentReadyTime; |
|
|
|
\$(document).ready(function() { |
|
if (typeof(dueDate) != "undefined") { |
|
documentReadyTime = (new Date()).getTime(); |
|
\$("#duedatecountdown").countdown({until: dueDate, compact: true, |
|
layout: "$dueDateLayout", |
|
onTick: function (periods) { |
|
var latencyEstimate = (documentReadyTime - clientTime) * 2; |
|
if(\$.countdown.periodsToSeconds(periods) < (300 + latencyEstimate)) { |
|
\$("#submitearly").html("$early"); |
|
if (\$.countdown.periodsToSeconds(periods) < 1) { |
|
\$("#submitearly").html("$pastdue"); |
|
} |
|
} |
|
if(\$.countdown.periodsToSeconds(periods) < (60 + latencyEstimate)) { |
|
\$(this).css("color", "red"); //Highlight last minute. |
|
} |
|
} |
|
}); |
|
} |
|
}); |
|
|
|
JAVASCRIPT |
|
|
|
} |
|
|
# ----------------------------------------- Script to activate only some fields |
# ----------------------------------------- Script to activate only some fields |
|
|
sub htmlareaselectactive { |
sub htmlareaselectactive { |
Line 1563 sub htmlareaselectactive {
|
Line 1633 sub htmlareaselectactive {
|
|
|
}); |
}); |
'; |
'; |
$output .= &color_picker; |
$output .= &color_picker(); |
|
|
# Code to put a due date countdown in 'duedatecountdown' span. |
$output .= &countdown(); |
# This is currently located in the breadcrumb headers. |
|
# note that the dueDateLayout is internatinoalized below. |
|
# Here document is used to support the substitution into the javascript below. |
|
# ..which unforunately necessitates escaping the $'s in the javascript. |
|
# There are several times of importance |
|
# |
|
# serverDueDate - The absolute time at which the problem expires. |
|
# serverTime - The server's time when the problem finished computing. |
|
# clientTime - The client's time...as close to serverTime as possible. |
|
# The clientTime will be slightly later due to |
|
# 1. The latency between problem computation and |
|
# the first network action. |
|
# 2. The time required between the page load-start and the actual |
|
# initial javascript execution that got clientTime. |
|
# These are used as follows: |
|
# The difference between clientTime and serverTime are used to |
|
# correct for differences in clock settings between the browser's system and the |
|
# server's. |
|
# |
|
# The difference between clientTime and the time at which the ready() method |
|
# starts executing is used to estimate latencies for page load and submission. |
|
# Since this is an estimate, it is doubled. The latency estimate + one minute |
|
# is used to determine when the countdown timer turns red to warn the user |
|
# to think about submitting. |
|
|
|
my $dueDateLayout = &mt('Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn} [_1]', |
$output .= <<"JAVASCRIPT"; |
"<span id='submitearly'></span>"); |
|
my $early = '- <b>'.&mt('Submit Early').'</b>'; |
|
my $pastdue = '- <b>'.&mt('Past Due').'</b>'; |
|
$output .= <<JAVASCRIPT; |
|
|
|
var documentReadyTime; |
|
|
|
\$(document).ready(function() { |
|
if (typeof(dueDate) != "undefined") { |
|
documentReadyTime = (new Date()).getTime(); |
|
\$("#duedatecountdown").countdown({until: dueDate, compact: true, |
|
layout: "$dueDateLayout", |
|
onTick: function (periods) { |
|
var latencyEstimate = (documentReadyTime - clientTime) * 2; |
|
if(\$.countdown.periodsToSeconds(periods) < (300 + latencyEstimate)) { |
|
\$("#submitearly").html("$early"); |
|
if (\$.countdown.periodsToSeconds(periods) < 1) { |
|
\$("#submitearly").html("$pastdue"); |
|
} |
|
} |
|
if(\$.countdown.periodsToSeconds(periods) < (60 + latencyEstimate)) { |
|
\$(this).css("color", "red"); //Highlight last minute. |
|
} |
|
} |
|
}); |
|
} |
|
}); |
|
|
|
/* This code describes the spellcheck options that will be used for |
/* This code describes the spellcheck options that will be used for |
items with class 'spellchecked'. It is necessary for those objects' |
items with class 'spellchecked'. It is necessary for those objects' |
Line 1910 returns: nothing
|
Line 1929 returns: nothing
|
} |
} |
} |
} |
} |
} |
|
my $target; |
|
unless (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
|
$target='_top'; |
|
} |
$menulink = { href =>'/adm/menu', |
$menulink = { href =>'/adm/menu', |
title =>'Go to main menu', |
title =>'Go to main menu', |
target =>'_top', |
target =>$target, |
text =>$description, |
text =>$description, |
no_mt =>$no_mt_descr, }; |
no_mt =>$no_mt_descr, }; |
if($last) { |
if($last) { |