[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

foxr foxr at source.lon-capa.org
Mon Mar 26 06:24:08 EDT 2012


foxr		Mon Mar 26 10:24:08 2012 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  BZ 5891 - internationalize the timer format.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.305 loncom/interface/lonhtmlcommon.pm:1.306
--- loncom/interface/lonhtmlcommon.pm:1.305	Mon Mar 26 02:47:46 2012
+++ loncom/interface/lonhtmlcommon.pm	Mon Mar 26 10:24:08 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.305 2012/03/26 02:47:46 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.306 2012/03/26 10:24:08 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1309,21 +1309,30 @@
                 $.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: "<b>'.&mt("Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn}").'</b>",
-                                                  onTick: function (periods) {
-                         if($.countdown.periodsToSeconds(periods) < 60) {
-                             $(this).css("color", "red");   //Highlight last minute.
-                         }
-                      }
-                  });
-               }
 
 	});
 ';
+    # 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 unfortunately necessitates escaping the $'s in the javascript.
+
+    my $dueDateLayout = '<b>' .  &mt('Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn}') . '</b>';
+    $output .= <<JAVASCRIPT;
+\$(document).ready(function() {
+   if (typeof(dueDate) != "undefined") {
+      \$("#duedatecountdown").countdown({until: dueDate, compact: true, 
+         layout: "$dueDateLayout",
+         onTick: function (periods) {
+            if(\$.countdown.periodsToSeconds(periods) < 60) {
+               \$(this).css("color", "red");   //Highlight last minute.
+            }
+         }
+      });
+   }
+});
+JAVASCRIPT
     if ($dragmath_prefix ne '') {
         $output .= '
 




More information about the LON-CAPA-cvs mailing list