--- loncom/interface/lonmenu.pm 2016/04/05 02:02:28 1.445 +++ loncom/interface/lonmenu.pm 2016/05/13 22:48:05 1.448 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.445 2016/04/05 02:02:28 raeburn Exp $ +# $Id: lonmenu.pm,v 1.448 2016/05/13 22:48:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -124,9 +124,13 @@ dropdown list when mouse hovers over top (no hover psuedo class) via LC_hoverable class for
  • tag for top- level item, which employs jQuery to handle behavior on mouseover. -Inputs: 4 - (a) link and (b) target for anchor href in top level item, - (c) title for text wrapped by anchor tag in top level item. - (d) reference to array of arrays of sub-menu items. +Inputs: 6 - (a) link and (b) target for anchor href in top level item, + (c) title for text wrapped by anchor tag in top level item, + (d) reference to array of arrays of sub-menu items, + (e) boolean to indicate whether to call &mt() to translate + name of menu item, + (f) optional class for
  • element in primary menu, for which + sub menu is being generated. The underlying datastructure used in (d) contains data from mydesk.tab. It consists of an array which has an array for each item appearing in @@ -534,13 +538,13 @@ sub secondary_menu { } sub create_submenu { - my ($link,$target,$title,$submenu,$translate) = @_; + my ($link,$target,$title,$submenu,$translate,$addclass) = @_; return unless (ref($submenu) eq 'ARRAY'); my $disptarget; if ($target ne '') { $disptarget = ' target="'.$target.'"'; } - my $menu = '
  • '. + my $menu = '
  • '. ''. ''.$title. ''. @@ -560,7 +564,7 @@ sub create_submenu { # see perldoc create_submenu documentation for further information sub build_submenu { my ($target, $submenu, $translate, $first_level) = @_; - if (!defined(@{$submenu})) { + unless (@{$submenu}) { return ''; } @@ -1630,11 +1634,10 @@ END # LC_interval_done is true. # sub done_button_js { - my ($type,$width,$height,$proctor) = @_; + my ($type,$width,$height,$proctor,$donebuttontext) = @_; return unless (($type eq 'map') || ($type eq 'resource')); my %lt = &Apache::lonlocal::texthash( title => 'WARNING!', - button => 'Done', 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).', @@ -1711,7 +1714,7 @@ sub done_button_js {
    - +
    @@ -2497,9 +2500,17 @@ sub countdown_timer { } my $duedate = &Apache::lonnet::EXT("resource.0.duedate"); my @interval=&Apache::lonnet::EXT("resource.0.interval"); - my ($timelimit,$usesdone,$proctor,$secret); + my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret); if (@interval > 1) { - ($timelimit,$usesdone,$proctor,$secret) = split(/_/,$interval[0]); + ($timelimit,my $donesuffix) = split(/_/,$interval[0],2); + if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) { + $usesdone = 'done'; + $donebuttontext = $1; + (undef,$proctor,$secret) = split(/_/,$2); + } elsif ($donesuffix =~ /^done(|_.+)$/) { + $donebuttontext = &mt('Done'); + ($usesdone,$proctor,$secret) = split(/_/,$donesuffix); + } my $first_access=&Apache::lonnet::get_first_access($interval[1]); if ($first_access > 0) { if ($first_access+$timelimit > time) { @@ -2517,7 +2528,7 @@ sub countdown_timer { $collapse = '► '; if ((@interval > 1) && ($hastimeleft)) { if ($usesdone eq 'done') { - $donebutton = &done_button_js($interval[1],'','',$proctor); + $donebutton = &done_button_js($interval[1],'','',$proctor,$donebuttontext); } } } else {