--- loncom/interface/lonmenu.pm 2012/05/24 23:30:16 1.376
+++ loncom/interface/lonmenu.pm 2012/05/29 19:40:44 1.381
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.376 2012/05/24 23:30:16 raeburn Exp $
+# $Id: lonmenu.pm,v 1.381 2012/05/29 19:40:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -260,7 +260,7 @@ sub primary_menu {
if (@primsub > 0) {
$menu .= &create_submenu($link,$target,$title,\@primsub);
} elsif ($link) {
- $menu .= '
'.$title.'';
+ $menu .= ''.&mt($title).'';
}
}
} elsif ($$menuitem[3] eq 'Help') { # special treatment for helplink
@@ -402,9 +402,13 @@ sub secondary_menu {
sub create_submenu {
my ($link,$target,$title,$submenu) = @_;
return unless (ref($submenu) eq 'ARRAY');
+ my $disptarget;
+ if ($target ne '') {
+ $disptarget = ' target="'.$target.'"';
+ }
my $menu = ''.
- ''.
- ''.$title.
+ ''.
+ ''.&mt($title).
''.
' ▼'.
'';
@@ -419,7 +423,7 @@ sub create_submenu {
}
$menu .= '- '.
- $item->[1].'
';
+ &mt($item->[1]).'
';
}
}
$menu .= '';
@@ -778,9 +782,18 @@ ENDMENUITEMS
&Apache::lonhtmlcommon::add_breadcrumb_tool(
'navigation', @inlineremote[21,23]);
- if(hidden_button_check() ne 'yes') {
+ my $countdown = &countdown_timer();
+ if (&hidden_button_check() eq 'yes') {
+ if ($countdown) {
+ &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
+ }
+ } else {
+ my @tools = @inlineremote[93,91,81,82,83];
+ if ($countdown) {
+ unshift(@tools,$countdown);
+ }
&Apache::lonhtmlcommon::add_breadcrumb_tool(
- 'tools', @inlineremote[93,91,81,82,83]);
+ 'tools',@tools);
#publish button in construction space
if ($env{'request.state'} eq 'construct'){
@@ -891,9 +904,19 @@ sub switch {
}
} else {
# Inline Menu
- $inlineremote[$idx]=
+ my @tools = (93,91,81,82,83);
+ unless ($env{'request.state'} eq 'construct') {
+ push(@tools,63);
+ }
+ if (($env{'environment.icons'} eq 'iconsonly') &&
+ (grep(/^$idx$/,@tools))) {
+ $inlineremote[$idx] =
+ '';
+ } else {
+ $inlineremote[$idx] =
'';
+ }
}
return '';
}
@@ -1179,6 +1202,27 @@ END
}
+sub countdown_toggle_js {
+ return <<"END";
+
+function toggleCountdown() {
+ var countdownid = document.getElementById('duedatecountdown');
+ var currstyle = countdownid.style.display;
+ if (currstyle == 'inline') {
+ countdownid.style.display = 'none';
+ document.getElementById('ddcountcollapse').innerHTML='';
+ document.getElementById('ddcountexpand').innerHTML='◄ ';
+ } else {
+ countdownid.style.display = 'inline';
+ document.getElementById('ddcountcollapse').innerHTML='► ';
+ document.getElementById('ddcountexpand').innerHTML='';
+ }
+ return;
+}
+
+END
+}
+
sub utilityfunctions {
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
if ($currenturl =~ m{^/adm/wrapper/ext/}
@@ -1213,6 +1257,8 @@ sub utilityfunctions {
my $esc_url=&escape($currenturl);
my $esc_symb=&escape($currentsymb);
+ my $countdown = &countdown_toggle_js();
+
return (< 1) {
+ my $first_access=&Apache::lonnet::get_first_access($interval[1]);
+ if ($first_access > 0) {
+ if ($first_access+$interval[0] > time) {
+ $hastimeleft = 1;
+ }
+ }
+ }
+ if (($duedate && $duedate > time) ||
+ (!$duedate && $hastimeleft)) {
+ my ($collapse,$expand,$alttxt,$title,$currdisp);
+ if (@interval > 1 && $hastimeleft) {
+ $currdisp = 'inline';
+ $collapse = '► ';
+ } else {
+ $currdisp = 'none';
+ $expand = '◄ ';
+ }
+ unless ($env{'environment.icons'} eq 'iconsonly') {
+ $alttxt = &mt('Timer');
+ $title = $alttxt.' ';
+ }
+ my $desc = &mt('Countdown to due date/time');
+ return <