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

www lon-capa-cvs@mail.lon-capa.org
Wed, 21 May 2003 19:15:41 -0000


www		Wed May 21 15:15:41 2003 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Toward bug #1478: separate out editing field routine.
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.9 loncom/interface/lonannounce.pm:1.10
--- loncom/interface/lonannounce.pm:1.9	Wed May 21 12:26:46 2003
+++ loncom/interface/lonannounce.pm	Wed May 21 15:15:41 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.9 2003/05/21 16:26:46 www Exp $
+# $Id: lonannounce.pm,v 1.10 2003/05/21 19:15:41 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,26 @@
 use Apache::loncommon;
 use Apache::lonhtmlcommon();
 
+sub editfield {
+    my ($r,$start,$end,$text)=@_;
+    # Deal with date forms
+    my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
+                                                            'startdate',
+                                                            $start);
+    my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',
+                                                          'enddate',
+                                                          $end);
+
+    $r->print(<<ENDFORM);
+<form name="anno" method="post">
+<input type="hidden" value=''          name="action"      >
+<table><tr><td>Starting date:</td><td>$startdateform</td></tr>
+<tr><td>Ending date:</td><td>$enddateform</td></tr></table>
+<textarea name="msg" rows="4" cols="60">$text</textarea>
+<input type="button" onClick="trysubmit()" value="Post Announcement"><hr>
+ENDFORM
+}
+
 sub readcalendar {
     my $courseid=shift;
     my $coursenum=$ENV{'course.'.$courseid.'.num'};
@@ -182,24 +202,7 @@
         $tomorrowhash{'day'}++;
         my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
         
-    # Deal with date forms
-	my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
-                                                            'startdate',
-                                                            $today);
-	my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',
-                                                          'enddate',
-                                                          $tomorrow);
-    #
-
-	$r->print(<<ENDFORM);
-<form name="anno" method="post">
-<input type="hidden" value=''          name="action"      >
-<table><tr><td>Starting date:</td><td>$startdateform</td></tr>
-<tr><td>Ending date:</td><td>$enddateform</td></tr></table>
-<textarea name="msg" rows="4" cols="60">
-</textarea>
-<input type="button" onClick="trysubmit()" value="Post Announcement"><hr>
-ENDFORM
+        &editfield($r,$today,$tomorrow,'');
     }
 # ----------------------------------------------------- Summarize all calendars
     my %allcal=();