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

www lon-capa-cvs@mail.lon-capa.org
Tue, 02 Sep 2003 21:15:59 -0000


www		Tue Sep  2 17:15:59 2003 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Working on a more straightforward way to enter dates.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.17 loncom/interface/lonannounce.pm:1.18
--- loncom/interface/lonannounce.pm:1.17	Tue Aug 12 15:46:04 2003
+++ loncom/interface/lonannounce.pm	Tue Sep  2 17:15:59 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.17 2003/08/12 19:46:04 www Exp $
+# $Id: lonannounce.pm,v 1.18 2003/09/02 21:15:59 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -185,12 +185,16 @@
     undef %showedcheck;
 # ---------------------------------------------------------- Get month and year
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['month','year']);
+                                            ['month','year','pickdate']);
 # --------------------------------------------------- Decide what month to show
     my $year=$todayhash{'year'};
     if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; }
     my $month=$todayhash{'month'};
     if ($ENV{'form.month'}) { $month=$ENV{'form.month'}; }
+
+# ---------------------------------------------- See if we are in pickdate mode
+    my $pickdatemode=($ENV{'form.pickdate'} eq 'yes');
+
 # --------------------------------------------- Find out first day of the month
 
     my %firstday=&Apache::loncommon::timehash(
@@ -219,7 +223,13 @@
 </script>
 </head>
 ENDDOCUMENT
-    $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
+    if ($pickdatemode) {
+# no big header in pickdate mode
+	$r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).
+		  '<font size="1">');
+    } else {
+       $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
+    }
 # does this user have privileges to post, etc?
     my $allowed=0;
     if ($ENV{'request.course.id'}) {
@@ -233,6 +243,11 @@
     } else {
 	$serverpost=&Apache::lonnet::allowed('psa','/');
     }
+# -------------------------------- BUT: do no fancy stuff when in pickdate mode
+    if ($pickdatemode) { 
+	$serverpost=0; 
+	$allowed=0;
+    }
 # ------------------------------------------------------------ Process commands
     if ($serverpost) {
 	if ($ENV{'form.serveraction'}) {
@@ -323,10 +338,13 @@
 	return OK;
     }
     $r->print(
- '<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '.
- '<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a>'.
+ '<a href="/adm/announcements?month='.$pm.'&year='.$py.
+ ($pickdatemode?'&pickdate=yes':'').'">Previous Month</a> '.
+ '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
+ ($pickdatemode?'&pickdate=yes':'').'">Next Month</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
- '&year='.$todayhash{'year'}.'">Current Month</a><p>'.
+ '&year='.$todayhash{'year'}.
+ ($pickdatemode?'&pickdate=yes':'').'">Current Month</a><p>'.
         '<table border="2" cols="7" rows="5"><tr><th>Sun</th><th>Mon</th>'.
         '<th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>');
 
@@ -360,10 +378,14 @@
 # --------------------------------------------------------------- Remove button
     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></form>'); }
     $r->print('<p>'.
- '<a href="/adm/announcements?month='.$pm.'&year='.$py.'">Previous Month</a> '.
- '<a href="/adm/announcements?month='.$fm.'&year='.$fy.'">Next Month</a>'.
+ '<a href="/adm/announcements?month='.$pm.'&year='.$py.
+ ($pickdatemode?'&pickdate=yes':'').'">Previous Month</a> '.
+ '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
+ ($pickdatemode?'&pickdate=yes':'').'">Next Month</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
- '&year='.$todayhash{'year'}.'">Current Month</a></p>'.
+ '&year='.$todayhash{'year'}.
+ ($pickdatemode?'&pickdate=yes':'').'">Current Month</a></p>'.
+ ($pickdatemode?'</font>':'').
  '</body></html>');
     return OK;
 }