--- loncom/interface/lonhtmlcommon.pm 2012/03/20 13:36:19 1.303 +++ loncom/interface/lonhtmlcommon.pm 2012/03/25 14:36:01 1.304 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.303 2012/03/20 13:36:19 www Exp $ +# $Id: lonhtmlcommon.pm,v 1.304 2012/03/25 14:36:01 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1111,6 +1111,7 @@ sub crumbs { if ($uri !~ m|/$|) { $output=~s|/$||; } $output.=''; + return $output; } @@ -1175,6 +1176,8 @@ ENDEDITOR + + ENDJQUERY return $s; } @@ -1306,6 +1309,19 @@ sub htmlareaselectactive { $.fn.jPicker.defaults.images.clientPath="/adm/jpicker/images/"; $(".colorchooser").jPicker(); + // Only define the countdown if a dueDate variable is defined: + + if (typeof(dueDate) != "undefined") { + $("#duedatecountdown").countdown({until: dueDate, compact: true, + layout: "Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn}", + onTick: function (periods) { + if($.countdown.periodsToSeconds(periods) < 60) { + $(this).css("color", "red"); //Highlight last minute. + } + } + }); + } + }); '; if ($dragmath_prefix ne '') { @@ -1383,6 +1399,39 @@ sub show_return_link { } +## +# Set the dueDate variable...note this is done in the timezone +# of the browser. +# +# @param epoch relative time at which the problem is due. +# +# @return the javascript fragment to set the date: +# +sub set_due_date { + my $dueStamp = shift; + my $duems = $dueStamp * 1000; # Javascript Date object needs ms not seconds. + + my $now = time()*1000; + + # This slightly obscure bit of javascript sets the dueDate variable + # to the time in the browser at which the problem was due. + # The code should correct for gross differences between the server + # and client's time setting + + my $js = " + +"; + +} + ############################################################ ############################################################ @@ -1501,9 +1550,12 @@ returns: nothing # last breadcrumb is the first order heading of a page # for course breadcrumbs it's just bold + $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1', $lasttext), {title => $lasttext}); + $links .= '
  • '; + my $icons = ''; $faq = $last->{'faq'} if (exists($last->{'faq'})); $bug = $last->{'bug'} if (exists($last->{'bug'})); @@ -1521,6 +1573,7 @@ returns: nothing $faq,$bug); } # + unless ($CourseBreadcrumbs) { @@ -1529,12 +1582,14 @@ returns: nothing $links = &htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" }); } + if ($component) { $links = &htmltag('span', ( $no_mt ? $component : mt($component) ). ( $icons ? $icons : '' ), { class => 'LC_breadcrumbs_component' } ) - .$links; + .$links +; } &render_tools(\$links); @@ -1545,7 +1600,12 @@ returns: nothing # Return the @Crumbs stack to what we started with push(@Crumbs,$last); shift(@Crumbs); + + # Return the breadcrumb's line + + + return "$links"; }