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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 29 Sep 2005 17:14:16 -0000


albertel		Thu Sep 29 13:14:16 2005 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - BUG#4395
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.340 loncom/interface/lonnavmaps.pm:1.341
--- loncom/interface/lonnavmaps.pm:1.340	Fri Sep 23 18:21:51 2005
+++ loncom/interface/lonnavmaps.pm	Thu Sep 29 13:14:14 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.340 2005/09/23 22:21:51 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.341 2005/09/29 17:14:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -514,20 +514,20 @@
         return &mt("Not currently assigned.");
     }
     if ($status == $res->OPEN_LATER) {
-        return "Open " . timeToHumanString($res->opendate($part));
+        return "Open " . timeToHumanString($res->opendate($part),'start');
     }
     if ($status == $res->OPEN) {
         if ($res->duedate($part)) {
-            return &mt("Due")."  " .timeToHumanString($res->duedate($part));
+            return &mt("Due")."  " .timeToHumanString($res->duedate($part),'end');
         } else {
             return &mt("Open, no due date");
         }
     }
     if ($status == $res->PAST_DUE_ANSWER_LATER) {
-        return &mt("Answer open")." " . timeToHumanString($res->answerdate($part));
+        return &mt("Answer open")." " . timeToHumanString($res->answerdate($part),'start');
     }
     if ($status == $res->PAST_DUE_NO_ANSWER) {
-        return &mt("Was due")." " . timeToHumanString($res->duedate($part));
+        return &mt("Was due")." " . timeToHumanString($res->duedate($part),'end');
     }
     if ($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT) {
         return &mt("Answer available");
@@ -549,7 +549,7 @@
             }
         }
         if ($res->duedate($part)) {
-            return &mt("Due")." " . timeToHumanString($res->duedate($part)) .
+            return &mt("Due")." " . timeToHumanString($res->duedate($part),'end') .
                 " $triesString";
         } else {
             return &mt("No due date")." $triesString";
@@ -603,7 +603,7 @@
 # Very, very, very, VERY English-only... goodness help a localizer on
 # this func...
 sub timeToHumanString {
-    my ($time) = @_;
+    my ($time,$type) = @_;
     # zero, '0' and blank are bad times
     if (!$time) {
         return &mt('never');
@@ -684,17 +684,24 @@
                 $timeStr;
         }
         
+	my $conjunction='on';
+	if ($type eq 'start') {
+	    $conjunction='at';
+	} elsif ($type eq 'end') {
+	    $conjunction='by';
+	}
+	&Apache::lonnet::logthis("<p>$conjunction $type</p>");
         # Is it this year?
         if ( $time[5] == $now[5]) {
             # Return on Month Day, HH:MM meridian
-            my $timeStr = strftime("on %A, %b %e at %I:%M %P", localtime($time));
+            my $timeStr = strftime("$conjunction %A, %b %e at %I:%M %P", localtime($time));
             $timeStr =~ s/12:00 am/00:00/;
             $timeStr =~ s/12:00 pm/noon/;
             return $timeStr;
         }
 
         # Not this year, so show the year
-        my $timeStr = strftime("on %A, %b %e %Y at %I:%M %P", localtime($time));
+        my $timeStr = strftime("$conjunction %A, %b %e %Y at %I:%M %P", localtime($time));
         $timeStr =~ s/12:00 am/00:00/;
         $timeStr =~ s/12:00 pm/noon/;
         return $timeStr;