Annotation of loncom/interface/lonannounce.pm, revision 1.38
1.1 www 1: # The LearningOnline Network
1.2 www 2: # Announce
1.1 www 3: #
1.38 ! albertel 4: # $Id: lonannounce.pm,v 1.37 2005/11/18 13:35:30 www Exp $
1.1 www 5: #
1.3 www 6: # Copyright Michigan State University Board of Trustees
1.1 www 7: #
1.3 www 8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
1.1 www 9: #
1.3 www 10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
1.1 www 14: #
1.3 www 15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28:
1.2 www 29: package Apache::lonannounce;
1.1 www 30:
31: use strict;
32: use Apache::Constants qw(:common);
1.3 www 33: use Apache::loncommon;
1.8 matthew 34: use Apache::lonhtmlcommon();
1.20 www 35: use Apache::lonlocal;
1.36 www 36: use Apache::lonrss();
1.34 albertel 37: use Apache::lonnet;
1.15 www 38: use HTML::Entities();
1.3 www 39:
1.12 www 40: my %todayhash;
1.16 www 41: my %showedcheck;
1.12 www 42:
1.10 www 43: sub editfield {
44: my ($r,$start,$end,$text)=@_;
45: # Deal with date forms
46: my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
47: 'startdate',
48: $start);
49: my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',
50: 'enddate',
51: $end);
1.29 albertel 52: my $help=&Apache::loncommon::help_open_menu('','Calendar Add Announcement','Calendar_Add_Announcement','',274,'Communication Tools');
1.36 www 53: my %lt=&Apache::lonlocal::texthash('post' => 'Post Announcement',
54: 'start' => 'Starting date',
55: 'end' => 'Ending date',
1.37 www 56: 'incrss' => 'Include in course RSS newsfeed');
1.36 www 57:
1.10 www 58: $r->print(<<ENDFORM);
1.25 www 59: $help
1.10 www 60: <form name="anno" method="post">
1.36 www 61: <input type="hidden" value='' name="action" />
62: <table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr>
63: <tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table>
1.10 www 64: <textarea name="msg" rows="4" cols="60">$text</textarea>
1.36 www 65: <br />
1.38 ! albertel 66: <!-- <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> -->
1.36 www 67: <br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />
1.10 www 68: ENDFORM
69: }
70:
1.3 www 71: sub readcalendar {
72: my $courseid=shift;
1.34 albertel 73: my $coursenum=$env{'course.'.$courseid.'.num'};
74: my $coursedom=$env{'course.'.$courseid.'.domain'};
1.3 www 75: my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum);
76: my %returnhash=();
77: foreach (keys %thiscal) {
78: unless (($_=~/^error\:/) || ($thiscal{$_}=~/^error\:/)) {
79: $returnhash{$courseid.'@'.$_}=$thiscal{$_};
80: }
81: }
1.34 albertel 82: if ($courseid eq $env{'request.course.id'}) {
1.26 www 83: my %resourcedata=
84: &Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);
85: foreach my $thiskey (sort keys %resourcedata) {
86: if ($resourcedata{$thiskey.'.type'}=~/^date/) {
87: my ($course,$middle,$part,$name)=
88: ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
89: my $section=&mt('All Students');
90: if ($middle=~/^\[(.*)\]\./) {
1.31 albertel 91: my $sec=$1;
92: # if we have a section don't show ones that aren't ours
1.34 albertel 93: if ($env{'request.course.sec'} &&
94: $env{'request.course.sec'} ne $sec) { next; }
1.31 albertel 95: # if a student without a section don't show any section ones
1.34 albertel 96: if (!$env{'request.role.adv'} &&
97: !$env{'request.course.sec'}) { next; }
1.26 www 98: $section=&mt('Group/Section').': '.$1;
99: $middle=~s/^\[(.*)\]\.//;
100: }
101: $middle=~s/\.$//;
102: my $realm=&mt('All Resources');
103: if ($middle=~/^(.+)\_\_\_\(all\)$/) {
104: $realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1);
105: } elsif ($middle) {
106: $realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);
107: }
108: my $datetype='';
1.28 www 109: if ($name eq 'duedate') {
110: $datetype=&mt('Due');
111: # see if accidentally answerdate is before duedate
112: my $answerkey=$thiskey;
113: $answerkey=~s/duedate$/answerdate/;
114: if ($resourcedata{$thiskey}>$resourcedata{$answerkey}) {
115: $datetype='Due and Answer Available';
116: }
117: }
1.26 www 118: if ($name eq 'opendate') { $datetype=&mt('Opening'); }
1.28 www 119: if ($name eq 'answerdate') {
120: # see if accidentally answerdate is before duedate
121: my $duekey=$thiskey;
122: $duekey=~s/answerdate$/duedate/;
123: if ($resourcedata{$duekey}>$resourcedata{$thiskey}) {
124: # forget it
125: next;
126: }
127: $datetype=&mt('Answer Available');
128: }
1.26 www 129: $returnhash{$courseid.'@'.$resourcedata{$thiskey}.'_'.
130: $resourcedata{$thiskey}}=
131: 'INTERNAL:'.$datetype.': '.$realm.' ('.$section.')';
132: }
133: }
134: }
1.3 www 135: return %returnhash;
136: }
137:
138: sub emptycell {
139: return '<td bgcolor="#AAAAAA"> </td>';
140: }
141:
142: sub normalcell {
1.12 www 143: my ($day,$month,$year,$text)=@_;
1.4 www 144: my $output='';
145: foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
146: if ($_) {
1.26 www 147: my $internalflag=0;
1.5 www 148: my ($courseid,$start,$end,@msg)=split(/\@/,$_);
149: my $msg=join('@',@msg);
1.26 www 150: if ($msg=~/INTERNAL\:/) {
151: $msg=~s/INTERNAL\://gs;
152: $internalflag=1;
153: }
1.34 albertel 154: my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
1.32 www 155: '\n'.&Apache::lonlocal::locallocaltime($start);
1.26 www 156: if ($start!=$end) {
157: $fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
158: }
1.32 www 159: $fullmsg.=':\n'.$msg;
1.34 albertel 160: if ($courseid eq $env{'request.course.id'}) {
161: if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'}))
1.19 www 162: && (!$showedcheck{$start.'_'.$end})
1.34 albertel 163: && ($env{'form.pickdate'} ne 'yes')
1.26 www 164: && (!$internalflag)) {
1.5 www 165: $output.='<input type="checkbox" name="remove_'.$start.'_'.
166: $end.'">';
1.16 www 167: $showedcheck{$start.'_'.$end}=1;
1.5 www 168: }
169: }
1.32 www 170: $fullmsg=~s/[\n\r]/\\n/gs;
1.15 www 171: $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
172: $fullmsg=~s/&/\\&/g;
1.5 www 173: $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
1.11 www 174: substr($msg,0,20).'...</a><br />';
1.4 www 175: }
176: }
1.30 www 177: return '<td valign="top"'.
1.12 www 178: ((($day eq $todayhash{'day'}) &&
179: ($month eq $todayhash{'month'}) &&
180: ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').
1.30 www 181: '>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output).'</td>';
1.3 www 182: }
183:
1.11 www 184: sub plaincell {
185: my ($text)=@_;
186: my $output='';
187: foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
188: if ($_) {
189: my ($courseid,$start,$end,@msg)=split(/\@/,$_);
190: my $msg=join('@',@msg);
1.34 albertel 191: my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
1.32 www 192: '\n'.&Apache::lonlocal::locallocaltime($start);
1.26 www 193: if ($start!=$end) {
194: $fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
195: }
1.27 www 196: $msg=~s/INTERNAL\://gs;
1.32 www 197: $fullmsg.=':\n'.$msg;
198: $fullmsg=~s/[\n\r]/\\n/gs;
1.15 www 199: $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
200: $fullmsg=~s/&/\\&/g;
1.11 www 201: $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
1.35 www 202: substr($msg,0,80).'...</a><br />';
1.11 www 203: }
204: }
205: return $output;
206: }
207:
208: sub listcell {
209: my ($text)=@_;
210: my $output='';
211: foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
212: if ($_) {
213: my ($courseid,$start,$end,@msg)=split(/\@/,$_);
214: my $msg=join('@',@msg);
1.27 www 215: $msg=~s/INTERNAL\://gs;
1.26 www 216: my $fullmsg=&Apache::lonlocal::locallocaltime($start);
217: if ($start!=$end) {
218: $fullmsg.=&mt(' to ').
219: &Apache::lonlocal::locallocaltime($end);
220: }
221: $fullmsg.=':<br /><b>'.
1.11 www 222: $msg.'</b>';
223: $output.='<li>'.$fullmsg.'</li>';
224: }
225: }
226: return $output;
227: }
228:
1.3 www 229: sub nextday {
230: my %th=@_;
231: $th{'day'}++;
232: return (&Apache::loncommon::maketime(%th),$th{'month'});
233: }
234:
235: sub showday {
1.11 www 236: my ($tk,$mode,%allcal)=@_;
1.3 www 237: my %th=&Apache::loncommon::timehash($tk);
238: my ($nextday,$nextmonth)=&nextday(%th);
239: my $outp='';
1.27 www 240: if ($mode) {
241: my $oneday=24*3600;
242: $tk-=$oneday;
243: $nextday+=$oneday;
244: }
1.3 www 245: foreach (keys %allcal) {
246: my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);
1.4 www 247: if (($startdate<$nextday) && ($enddate>$tk)) {
1.5 www 248: $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
249: $allcal{$_};
1.3 www 250: }
251: }
1.11 www 252: unless ($mode) {
1.12 www 253: return ($nextday,$nextmonth,&normalcell(
254: $th{'day'},$th{'month'},$th{'year'},$outp));
1.11 www 255: } elsif ($outp) {
256: if ($mode==1) {
257: return '<br />'.&plaincell($outp);
258: } else {
259: return '<ul>'.&listcell($outp).'</ul>';
260: }
261: } else {
262: return '';
263: }
1.3 www 264: }
1.1 www 265:
1.19 www 266: sub tfont {
267: my $text=shift;
1.34 albertel 268: if ($env{'form.pickdate'} eq 'yes') {
1.19 www 269: return '<font size="1">'.$text.'</font>';
270: } else {
271: return $text;
272: }
273: }
274:
275: sub picklink {
276: my ($text,$day,$month,$year)=@_;
1.34 albertel 277: if ($env{'form.pickdate'} eq 'yes') {
1.19 www 278: return '<a href="javascript:dialin('.$day.','.$month.','.$year.')">'.
279: $text.'</a>';
280: } else {
281: return $text;
282: }
283: }
284:
285: sub dialscript {
286: return (<<ENDDIA);
287: <script language="Javascript">
288: function dialin(day,month,year) {
1.34 albertel 289: opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;
290: var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;
1.19 www 291: var i;
292: for (i=0;i<slct.length;i++) {
293: if (slct.options[i].value==month) { slct.selectedIndex=i; }
294: }
1.34 albertel 295: opener.document.$env{'form.formname'}.$env{'form.element'}\_day.value=day;
296: opener.$env{'form.element'}\_checkday();
1.19 www 297: self.close();
298: }
299: </script>
300: ENDDIA
301: }
302:
1.1 www 303: sub handler {
304: my $r = shift;
1.21 www 305: &Apache::loncommon::content_type($r,'text/html');
1.1 www 306: $r->send_http_header;
307: return OK if $r->header_only;
308:
1.3 www 309: # ---------------------------------------------------------- Get time right now
310: my $today=time;
1.12 www 311: %todayhash=&Apache::loncommon::timehash($today);
1.16 www 312: # ----------------------------------------------------------------- Check marks
313: %showedcheck=();
314: undef %showedcheck;
1.3 www 315: # ---------------------------------------------------------- Get month and year
316: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.19 www 317: ['month','year','pickdate','formname','element']);
1.3 www 318: # --------------------------------------------------- Decide what month to show
319: my $year=$todayhash{'year'};
1.34 albertel 320: if ($env{'form.year'}) { $year=$env{'form.year'}; }
1.3 www 321: my $month=$todayhash{'month'};
1.34 albertel 322: if ($env{'form.month'}) { $month=$env{'form.month'}; }
1.18 www 323:
324: # ---------------------------------------------- See if we are in pickdate mode
1.34 albertel 325: my $pickdatemode=($env{'form.pickdate'} eq 'yes');
326: my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}.
327: '&element='.$env{'form.element'};
1.3 www 328: # --------------------------------------------- Find out first day of the month
329:
330: my %firstday=&Apache::loncommon::timehash(
331: &Apache::loncommon::maketime( 'day' => 1, 'month'=> $month,
332: 'year' => $year, 'hours' => 0,
333: 'minutes' => 0, 'seconds' => 0,
1.30 www 334: 'dlsav' => -1 ));
1.3 www 335: my $weekday=$firstday{'weekday'};
336: # ------------------------------------------------------------ Print the screen
1.33 albertel 337: my $html=&Apache::lonxml::xmlbegin();
1.1 www 338: $r->print(<<ENDDOCUMENT);
1.33 albertel 339: $html
1.1 www 340: <head>
341: <title>The LearningOnline Network with CAPA</title>
1.3 www 342: <script>
343:
344: function trysubmit() {
345: document.anno.action.value="new";
346: document.anno.submit();
347: }
348:
349: function removesub() {
350: document.anno.action.value="del";
351: document.anno.submit();
352: }
353: </script>
1.1 www 354: </head>
355: ENDDOCUMENT
1.18 www 356: if ($pickdatemode) {
357: # no big header in pickdate mode
358: $r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).
1.19 www 359: &dialscript().
1.18 www 360: '<font size="1">');
361: } else {
362: $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
363: }
1.3 www 364: # does this user have privileges to post, etc?
365: my $allowed=0;
1.34 albertel 366: if ($env{'request.course.id'}) {
367: $allowed=&Apache::lonnet::allowed('srm',$env{'request.course.id'});
1.3 www 368: }
1.17 www 369: # does this user have privileges to post to servers?
370: my $serverpost=0;
1.34 albertel 371: if ($env{'request.role.domain'}) {
1.17 www 372: $serverpost=&Apache::lonnet::allowed('psa',
1.34 albertel 373: $env{'request.role.domain'});
1.17 www 374: } else {
375: $serverpost=&Apache::lonnet::allowed('psa','/');
376: }
1.18 www 377: # -------------------------------- BUT: do no fancy stuff when in pickdate mode
378: if ($pickdatemode) {
379: $serverpost=0;
380: $allowed=0;
381: }
1.17 www 382: # ------------------------------------------------------------ Process commands
383: if ($serverpost) {
1.34 albertel 384: if ($env{'form.serveraction'}) {
385: foreach (keys %env) {
1.17 www 386: if ($_=~/^form\.postto\_(\w+)/) {
387: $r->print(
388: '<br />Posting '.$1.': '.&Apache::lonnet::postannounce
1.34 albertel 389: ($1,$env{'form.serverannnounce'}));
1.17 www 390: }
391: }
392: }
393: $r->print(<<SERVERANNOUNCE);
394: <form name="serveranno" method="post">
395: <h3>Post Server Announcements</h3>
396: Post announcements to the system login and roles screen<br />
397: <i>(leave blank to delete announcement)</i><br />
398: <textarea name="serverannnounce" cols="60" rows="5"></textarea><br />
399: Check machines:<br />
400: SERVERANNOUNCE
401: # list servers
402: foreach (sort keys %Apache::lonnet::hostname) {
403: if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$_})) {
404: $r->print ('<br /><input type="checkbox" name="postto_'.$_.'" /> '.
405: $_.' <tt>'.$Apache::lonnet::hostname{$_}.'</tt> '.
406: '<a href="http://'.$Apache::lonnet::hostname{$_}.
407: '/announcement.txt" target="annowin">current</a>');
408: }
409: }
410: $r->print(
411: '<br /><input type="submit" name="serveraction" value="Post"></form><hr />');
412: }
1.3 www 413: if ($allowed) {
1.34 albertel 414: my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
415: my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
1.3 www 416: # ----------------------------------------------------- Store new submitted one
1.34 albertel 417: if ($env{'form.action'} eq 'new') {
1.9 www 418: my $startdate =
419: &Apache::lonhtmlcommon::get_date_from_form('startdate');
420: my $enddate =
421: &Apache::lonhtmlcommon::get_date_from_form('enddate');
422: unless ($startdate=~/^\d+$/) { $startdate=time; }
423: unless ($enddate=~/^\d+$/) { $enddate=$startdate+1; }
424: if ($startdate>$enddate) {
425: my $buffer=$startdate;
426: $startdate=$enddate;
427: $enddate=$buffer;
428: }
1.3 www 429: &Apache::lonnet::put('calendar',{
1.9 www 430: $startdate.'_'.$enddate =>
1.34 albertel 431: $env{'form.msg'} },$coursedom,$coursenum);
1.36 www 432: if ($env{'form.rsspost'}) {
433: &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',
434: &mt('Event from [_1] to [_2]',
435: &Apache::lonlocal::locallocaltime($startdate),
436: &Apache::lonlocal::locallocaltime($enddate)),
437: $env{'form.msg'},'/adm/announcements','public');
438: }
1.3 www 439: }
440: # ---------------------------------------------------------------- Remove items
1.34 albertel 441: if ($env{'form.action'} eq 'del') {
1.3 www 442: my @delwhich=();
1.34 albertel 443: foreach (keys %env) {
1.3 www 444: if ($_=~/^form\.remove\_(.+)$/) {
445: push(@delwhich,$1);
446: }
447: }
448: &Apache::lonnet::del('calendar',\@delwhich,$coursedom,$coursenum);
449: }
450: # -------------------------------------------------------- Form to post new one
451: my %tomorrowhash=%todayhash;
452: $tomorrowhash{'day'}++;
453: my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
454:
1.10 www 455: &editfield($r,$today,$tomorrow,'');
1.3 www 456: }
1.5 www 457: # ----------------------------------------------------- Summarize all calendars
458: my %allcal=();
459: foreach (&Apache::loncommon::findallcourses()) {
460: %allcal=(%allcal,&readcalendar($_));
461: }
462:
463: # ------------------------------- Initialize table and forward backward buttons
1.3 www 464: my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year);
465: if ($pm<1) { ($pm,$py)=(12,$year-1); }
466: if ($fm>12){ ($fm,$fy)=(1,$year+1); }
1.14 www 467:
1.20 www 468: $r->print('<h1>'.('',&mt('January'),&mt('February'),&mt('March'),
469: &mt('April'),&mt('May'),
470: &mt('June'),&mt('July'),&mt('August'),
471: &mt('September'),&mt('October'),
472: &mt('November'),&mt('December'))[$month].' '.
473: $year.'</h1>');
1.13 www 474: # Reached the end of times, give up
475: if (($year<1970) || ($year>2037)) {
476: $r->print('<h3>No calendar available for this date.</h3>'.
477: '<a href="/adm/announcements?month='.$todayhash{'month'}.
478: '&year='.$todayhash{'year'}.'">Current Month</a></body></html>');
479: return OK;
480: }
481: $r->print(
1.18 www 482: '<a href="/adm/announcements?month='.$pm.'&year='.$py.
1.20 www 483: ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
1.18 www 484: '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
1.20 www 485: ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
1.12 www 486: ' <a href="/adm/announcements?month='.$todayhash{'month'}.
1.18 www 487: '&year='.$todayhash{'year'}.
1.20 www 488: ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.
1.19 www 489: '<table border="2" cols="7" rows="5"><tr><th>'.
1.20 www 490: &tfont(&mt('Sun'))
1.19 www 491: .'</th><th>'.
1.20 www 492: &tfont(&mt('Mon'))
1.19 www 493: .'</th><th>'.
1.20 www 494: &tfont(&mt('Tue'))
1.19 www 495: .'</th><th>'.
1.20 www 496: &tfont(&mt('Wed'))
1.19 www 497: .'</th><th>'.
1.20 www 498: &tfont(&mt('Thu'))
1.19 www 499: .'</th><th>'.
1.20 www 500: &tfont(&mt('Fri'))
1.19 www 501: .'</th><th>'.
1.20 www 502: &tfont(&mt('Sat'))
1.19 www 503: .'</th></tr>');
1.3 www 504:
505: my $tk=&Apache::loncommon::maketime(%firstday);
506: my $outp;
507: my $nm;
508:
509: # ---------------------------------------------------------------- Actual table
510: $r->print('<tr>');
511: for (my $i=0;$i<$weekday;$i++) { $r->print(&emptycell); }
512: for (my $i=$weekday;$i<=6;$i++) {
1.11 www 513: ($tk,$nm,$outp)=&showday($tk,0,%allcal);
1.3 www 514: $r->print($outp);
515: }
516: $r->print('</tr>');
517:
1.23 www 518: for (my $k=0;$k<=4;$k++) {
1.3 www 519: $r->print('<tr>');
520: for (my $i=0;$i<=6;$i++) {
1.11 www 521: ($tk,$nm,$outp)=&showday($tk,0,%allcal);
1.3 www 522: if ($month!=$nm) { $outp=&emptycell; }
523: $r->print($outp);
524: }
525: $r->print('</tr>');
526: }
527: # ------------------------------------------------------------------- End table
1.7 matthew 528: $r->print('</table>');
1.16 www 529: # ----------------------------------------------------------------- Check marks
530: %showedcheck=();
531: undef %showedcheck;
532: # --------------------------------------------------------------- Remove button
1.24 www 533: if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.
534: &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }
1.7 matthew 535: $r->print('<p>'.
1.18 www 536: '<a href="/adm/announcements?month='.$pm.'&year='.$py.
1.20 www 537: ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
1.18 www 538: '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
1.20 www 539: ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
1.12 www 540: ' <a href="/adm/announcements?month='.$todayhash{'month'}.
1.18 www 541: '&year='.$todayhash{'year'}.
1.20 www 542: ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.
1.18 www 543: ($pickdatemode?'</font>':'').
1.3 www 544: '</body></html>');
1.1 www 545: return OK;
546: }
547:
548: 1;
549: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>