1: # The LearningOnline Network
2: # Announce
3: #
4: # $Id: lonannounce.pm,v 1.55 2006/06/26 22:31:56 albertel Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
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.
14: #
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:
29: package Apache::lonannounce;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use Apache::loncommon;
34: use Apache::lonhtmlcommon();
35: use Apache::lonlocal;
36: use Apache::lonnavmaps();
37: use Apache::lonrss();
38: use Apache::lonnet;
39: use HTML::Entities();
40:
41: my %todayhash;
42: my %showedcheck;
43:
44: sub editfield {
45: my ($r,$start,$end,$text)=@_;
46: # Deal with date forms
47: my $startdateform = &Apache::lonhtmlcommon::date_setter('anno',
48: 'startdate',
49: $start);
50: my $enddateform = &Apache::lonhtmlcommon::date_setter('anno',
51: 'enddate',
52: $end);
53: my $help=&Apache::loncommon::help_open_menu('Calendar Add Announcement','Calendar_Add_Announcement',274,'Communication Tools');
54: my %lt=&Apache::lonlocal::texthash('post' => 'Post Announcement',
55: 'start' => 'Starting date',
56: 'end' => 'Ending date',
57: 'incrss' => 'Include in course RSS newsfeed');
58:
59: $r->print(<<ENDFORM);
60: $help
61: <form name="anno" method="post">
62: <input type="hidden" value='' name="action" />
63: <table><tr><td>$lt{'start'}:</td><td>$startdateform</td></tr>
64: <tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table>
65: <textarea name="msg" rows="4" cols="60">$text</textarea>
66: <br />
67: <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label>
68: <br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />
69: ENDFORM
70: }
71:
72: sub readcalendar {
73: my $courseid=shift;
74: my $coursenum=$env{'course.'.$courseid.'.num'};
75: my $coursedom=$env{'course.'.$courseid.'.domain'};
76: my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum);
77: my %returnhash=();
78: foreach my $item (keys(%thiscal)) {
79: unless (($item=~/^error\:/) || ($thiscal{$item}=~/^error\:/)) {
80: $returnhash{$courseid.'@'.$item}=$thiscal{$item};
81: }
82: }
83:
84: my $can_see_hidden = $env{'request.role.adv'};
85: my $navmap;# = Apache::lonnavmaps::navmap->new();
86: my %resourcedata=
87: &Apache::lonnet::dump('resourcedata',$coursedom,$coursenum);
88: foreach my $thiskey (sort keys %resourcedata) {
89: if ($resourcedata{$thiskey.'.type'}=~/^date/) {
90: my ($course,$middle,$part,$name)=
91: ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
92: my $section=&mt('All Students');
93: if ($middle=~/^\[(.*)\]\./) {
94: my $sec=$1;
95: # if we have a section don't show ones that aren't ours
96: if ($env{'request.course.sec'} &&
97: $env{'request.course.sec'} ne $sec) { next; }
98: # if a student without a section don't show any section ones
99: if (!$env{'request.role.adv'} &&
100: !$env{'request.course.sec'}) { next; }
101: $section=&mt('Group/Section').': '.$1;
102: $middle=~s/^\[(.*)\]\.//;
103: }
104: $middle=~s/\.$//;
105: my $realm=&mt('All Resources');
106: if ($middle eq '___(all)') {
107: if (!$can_see_hidden && !$navmap) {
108: next;
109: }
110: } elsif ($middle=~/^(.+)\_\_\_\(all\)$/) {
111: my $map_url=$1;
112: if (!$can_see_hidden && !$navmap) {
113: next;
114: }
115: if (!$can_see_hidden) {
116: my $res = $navmap->getResourceByUrl($map_url);
117: if ($res && $res->randomout()) { next; }
118: }
119: # need to do this looks up in showday or /*cell for speed resaons
120: #$realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($map_url);
121: $realm=&mt('Folder/Map').': '.$map_url;
122: } elsif ($middle) {
123: if (!$can_see_hidden && !$navmap) {
124: next;
125: }
126: if (!$can_see_hidden) {
127: my $res = $navmap->getBySymb($middle);
128: if ($res && $res->randomout()) { next; }
129: }
130: #$realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle);
131: $realm=&mt('Resource').': '.$middle;
132: }
133: my $datetype='';
134: if ($name eq 'duedate') {
135: $datetype=&mt('Due');
136: # see if accidentally answerdate is before duedate
137: my $answerkey=$thiskey;
138: $answerkey=~s/duedate$/answerdate/;
139: if ($resourcedata{$thiskey}>$resourcedata{$answerkey}) {
140: $datetype=&mt('Due and Answer Available');
141: }
142: }
143: if ($name eq 'opendate') { $datetype=&mt('Opening'); }
144: if ($name eq 'answerdate') {
145: # see if accidentally answerdate is before duedate
146: my $duekey=$thiskey;
147: $duekey=~s/answerdate$/duedate/;
148: if ($resourcedata{$duekey}>$resourcedata{$thiskey}) {
149: # forget it
150: next;
151: }
152: $datetype=&mt('Answer Available');
153: }
154: $returnhash{$courseid.'@'.$resourcedata{$thiskey}.'_'.
155: $resourcedata{$thiskey}}=
156: 'INTERNAL:'.$datetype.': '.$realm.' ('.$section.')';
157: }
158: }
159: return %returnhash;
160: }
161:
162: sub emptycell {
163: return '<td class="LC_calendar_day_empty"> </td>';
164: }
165:
166: sub normalcell {
167: my ($day,$month,$year,$text)=@_;
168: my $output;
169: my @items=&order($text);
170: foreach my $item (@items) {
171: if ($item) {
172: my $internalflag=0;
173: my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
174: if ($msg=~/INTERNAL\:/) {
175: $msg=~s/INTERNAL\://gs;
176: $internalflag=1;
177: }
178: my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
179: '\n'.&Apache::lonlocal::locallocaltime($start);
180: if ($start!=$end) {
181: $fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
182: }
183: $fullmsg.=':\n'.$msg;
184: if ($courseid eq $env{'request.course.id'}) {
185: if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'}))
186: && (!$showedcheck{$start.'_'.$end})
187: && ($env{'form.pickdate'} ne 'yes')
188: && (!$internalflag)) {
189: $output.='<input type="checkbox" name="remove_'.$start.'_'.
190: $end.'">';
191: $showedcheck{$start.'_'.$end}=1;
192: }
193: }
194: $fullmsg=~s/[\n\r]/\\n/gs;
195: $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
196: $fullmsg=~s/&/\\&/g;
197: my $short_msg = substr($msg,0,20).((length($msg) > 20)?'...':'');
198: if (defined($output)) { $output.='<br />'; }
199: $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
200: $short_msg.'</a>';
201: }
202: }
203: return '<td class="LC_calendar_day'.
204: ((($day eq $todayhash{'day'}) &&
205: ($month eq $todayhash{'month'}) &&
206: ($year eq $todayhash{'year'}))?'_current':'').
207: '" ><b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output.'</td>';
208: }
209:
210: sub plaincell {
211: my ($text)=@_;
212: my $output;
213: my @items=&order($text);
214: foreach my $item (@items) {
215: if ($item) {
216: my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
217: my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
218: '\n'.&Apache::lonlocal::locallocaltime($start);
219: if ($start!=$end) {
220: $fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
221: }
222: $msg=~s/INTERNAL\://gs;
223: $fullmsg.=':\n'.$msg;
224: $fullmsg=~s/[\n\r]/\\n/gs;
225: $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
226: $fullmsg=~s/&/\\&/g;
227: my $short_msg = substr($msg,0,80).((length($msg) > 80)?'...':'');
228: if (defined($output)) { $output.='<br />'; }
229: $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
230: $short_msg.'</a>';
231: }
232: }
233: return $output;
234: }
235:
236: sub listcell {
237: my ($text)=@_;
238: my $output='';
239: my @items=&order($text);
240: foreach my $item (@items) {
241: if ($item) {
242: my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
243: $msg=~s/INTERNAL\://gs;
244: my $fullmsg=&Apache::lonlocal::locallocaltime($start);
245: if ($start!=$end) {
246: $fullmsg.=&mt(' to ').
247: &Apache::lonlocal::locallocaltime($end);
248: }
249: $fullmsg.=':<br /><b>'.
250: $msg.'</b>';
251: $output.='<li>'.$fullmsg.'</li>';
252: }
253: }
254: return $output;
255: }
256:
257: sub order {
258: my ($text)=@_;
259: my @items = split(/___&&&___/,$text);
260: sort {
261: my (undef,$astart,$aend)=split(/\@/,$a);
262: my (undef,$bstart,$bend)=split(/\@/,$b);
263: if ($astart != $bstart) {
264: return $astart <=> $bstart;
265: }
266: return $aend <=> $bend;
267: } @items;
268: }
269:
270: sub nextday {
271: my %th=@_;
272: $th{'day'}++;
273: return (&Apache::loncommon::maketime(%th),$th{'month'});
274: }
275:
276: sub showday {
277: my ($tk,$mode,%allcal)=@_;
278: my %th=&Apache::loncommon::timehash($tk);
279: my ($nextday,$nextmonth)=&nextday(%th);
280: my $outp='';
281: if ($mode) {
282: my $oneday=24*3600;
283: $tk-=$oneday;
284: $nextday+=$oneday;
285: }
286: foreach my $item (keys(%allcal)) {
287: my ($course,$startdate,$enddate)=($item=~/^(\w+)\@(\d+)\_(\d+)$/);
288: if (($startdate<$nextday) && ($enddate>=$tk)) {
289: $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
290: $allcal{$item};
291: }
292: }
293: unless ($mode) {
294: return ($nextday,$nextmonth,&normalcell(
295: $th{'day'},$th{'month'},$th{'year'},$outp));
296: } elsif ($outp) {
297: if ($mode==1) {
298: return '<br />'.&plaincell($outp);
299: } else {
300: return '<ul>'.&listcell($outp).'</ul>';
301: }
302: } else {
303: return '';
304: }
305: }
306:
307: sub picklink {
308: my ($text,$day,$month,$year)=@_;
309: if ($env{'form.pickdate'} eq 'yes') {
310: return '<a href="javascript:dialin('.$day.','.$month.','.$year.')">'.
311: $text.'</a>';
312: } else {
313: return $text;
314: }
315: }
316:
317: sub dialscript {
318: return (<<ENDDIA);
319: <script language="Javascript">
320: function dialin(day,month,year) {
321: opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;
322: var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;
323: var i;
324: for (i=0;i<slct.length;i++) {
325: if (slct.options[i].value==month) { slct.selectedIndex=i; }
326: }
327: opener.document.$env{'form.formname'}.$env{'form.element'}\_day.value=day;
328: opener.$env{'form.element'}\_checkday();
329: self.close();
330: }
331: </script>
332: ENDDIA
333: }
334: # ----------------------------------------------------- Summarize all calendars
335: sub get_all_calendars {
336: my %allcal=();
337: foreach my $course (sort(&Apache::loncommon::findallcourses())) {
338: %allcal=(%allcal,&readcalendar($course));
339: }
340: return %allcal;
341: }
342:
343: sub output_ics_file {
344: my ($r)=@_;
345: # RFC 2445 wants CRLF
346: my $crlf="\015\012";
347: # Header
348: $r->print("BEGIN:VCALENDAR$crlf");
349: $r->print("VERSION:2.0$crlf");
350: $r->print("PRODID:-//LONCAPA//LONCAPA Calendar Output//EN$crlf");
351: my %allcal=&get_all_calendars();
352: foreach my $event (keys(%allcal)) {
353: my ($courseid,$startdate,$enddate)=($event=~/^(\w+)\@(\d+)\_(\d+)$/);
354: my $uid=$event;
355: $uid=~s/[\W\_]/-/gs;
356: $uid.='@loncapa';
357: my $summary=$allcal{$event};
358: $summary=~s/^INTERNAL\://;
359: $summary=~s/\s+/ /gs;
360: $summary=$env{'course.'.$courseid.'.description'}.': '.$summary;
361: $r->print("BEGIN:VEVENT$crlf");
362: $r->print("DTSTART:".&Apache::loncommon::utc_string($startdate).$crlf);
363: $r->print("DTEND:".&Apache::loncommon::utc_string($enddate).$crlf);
364: $r->print("SUMMARY:$summary$crlf");
365: $r->print("UID:$uid$crlf");
366: $r->print("END:VEVENT$crlf");
367: }
368: # Footer
369: $r->print("END:VCALENDAR$crlf");
370: }
371:
372: sub handler {
373: my $r = shift;
374: if ($r->uri=~/\.(ics|ical)$/) {
375: &Apache::loncommon::content_type($r,'text/calendar');
376: &output_ics_file($r);
377: return OK;
378: }
379: &Apache::loncommon::content_type($r,'text/html');
380: $r->send_http_header;
381: return OK if $r->header_only;
382:
383: # ---------------------------------------------------------- Get time right now
384: my $today=time;
385: %todayhash=&Apache::loncommon::timehash($today);
386: # ----------------------------------------------------------------- Check marks
387: undef(%showedcheck);
388: # ---------------------------------------------------------- Get month and year
389: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
390: ['month','year','pickdate','formname','element']);
391: # --------------------------------------------------- Decide what month to show
392: my $year=$todayhash{'year'};
393: if ($env{'form.year'}) { $year=$env{'form.year'}; }
394: my $month=$todayhash{'month'};
395: if ($env{'form.month'}) { $month=$env{'form.month'}; }
396:
397: # ---------------------------------------------- See if we are in pickdate mode
398: my $pickdatemode=($env{'form.pickdate'} eq 'yes');
399: my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}.
400: '&element='.$env{'form.element'};
401: # --------------------------------------------- Find out first day of the month
402:
403: my %firstday=&Apache::loncommon::timehash(
404: &Apache::loncommon::maketime( 'day' => 1, 'month'=> $month,
405: 'year' => $year, 'hours' => 0,
406: 'minutes' => 0, 'seconds' => 0,
407: 'dlsav' => -1 ));
408: my $weekday=$firstday{'weekday'};
409: # ------------------------------------------------------------ Print the screen
410: my $js = <<ENDDOCUMENT;
411: <script type="text/javascript">
412:
413: function trysubmit() {
414: document.anno.action.value="new";
415: document.anno.submit();
416: }
417:
418: function removesub() {
419: document.anno.action.value="del";
420: document.anno.submit();
421: }
422: </script>
423: ENDDOCUMENT
424:
425: if ($pickdatemode) {
426: # no big header in pickdate mode
427: $r->print(&Apache::loncommon::start_page("Pick a Date",$js,
428: {'only_body' => 1,}).
429: &dialscript().
430: '<font size="1">');
431: } else {
432: $r->print(&Apache::loncommon::start_page("Announcements and Calendar",
433: $js));
434: }
435: # does this user have privileges to post, etc?
436: my $allowed=0;
437: if ($env{'request.course.id'}) {
438: $allowed=&Apache::lonnet::allowed('srm',$env{'request.course.id'});
439: }
440: # does this user have privileges to post to servers?
441: my $serverpost=0;
442: if ($env{'request.role.domain'}) {
443: $serverpost=&Apache::lonnet::allowed('psa',
444: $env{'request.role.domain'});
445: } else {
446: $serverpost=&Apache::lonnet::allowed('psa','/');
447: }
448: # -------------------------------- BUT: do no fancy stuff when in pickdate mode
449: if ($pickdatemode) {
450: $serverpost=0;
451: $allowed=0;
452: }
453: # ------------------------------------------------------------ Process commands
454: if ($serverpost) {
455: if ($env{'form.serveraction'}) {
456: foreach my $key (keys(%env)) {
457: if ($key=~/^form\.postto\_(\w+)/) {
458: $r->print(
459: '<br />Posting '.$1.': '.&Apache::lonnet::postannounce
460: ($1,$env{'form.serverannnounce'}));
461: }
462: }
463: }
464: $r->print(<<SERVERANNOUNCE);
465: <form name="serveranno" method="post">
466: <h3>Post Server Announcements</h3>
467: Post announcements to the system login and roles screen<br />
468: <i>(leave blank to delete announcement)</i><br />
469: <textarea name="serverannnounce" cols="60" rows="5"></textarea><br />
470: Check machines:<br />
471: SERVERANNOUNCE
472: # list servers
473: foreach my $host (sort(keys(%Apache::lonnet::hostname))) {
474: if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$host})) {
475: $r->print ('<br /><input type="checkbox" name="postto_'.$host.'" /> '.
476: $host.' <tt>'.$Apache::lonnet::hostname{$host}.'</tt> '.
477: '<a href="http://'.$Apache::lonnet::hostname{$host}.
478: '/announcement.txt" target="annowin">current</a>');
479: }
480: }
481: $r->print(
482: '<br /><input type="submit" name="serveraction" value="Post"></form><hr />');
483: }
484: if ($allowed) {
485: my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
486: my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
487: # ----------------------------------------------------- Store new submitted one
488: if ($env{'form.action'} eq 'new') {
489: my $startdate =
490: &Apache::lonhtmlcommon::get_date_from_form('startdate');
491: my $enddate =
492: &Apache::lonhtmlcommon::get_date_from_form('enddate');
493: unless ($startdate=~/^\d+$/) { $startdate=time; }
494: unless ($enddate=~/^\d+$/) { $enddate=$startdate+1; }
495: if ($startdate>$enddate) {
496: my $buffer=$startdate;
497: $startdate=$enddate;
498: $enddate=$buffer;
499: }
500: &Apache::lonnet::put('calendar',{
501: $startdate.'_'.$enddate =>
502: $env{'form.msg'} },$coursedom,$coursenum);
503: if ($env{'form.rsspost'}) {
504: &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',
505: &mt('Event from [_1] to [_2]',
506: &Apache::lonlocal::locallocaltime($startdate),
507: &Apache::lonlocal::locallocaltime($enddate)),
508: $env{'form.msg'},'/adm/announcements','public');
509: }
510: }
511: # ---------------------------------------------------------------- Remove items
512: if ($env{'form.action'} eq 'del') {
513: my @delwhich=();
514: foreach my $key (keys(%env)) {
515: if ($key=~/^form\.remove\_(.+)$/) {
516: push(@delwhich,$1);
517: }
518: }
519: &Apache::lonnet::del('calendar',\@delwhich,$coursedom,$coursenum);
520: }
521: # -------------------------------------------------------- Form to post new one
522: my %tomorrowhash=%todayhash;
523: $tomorrowhash{'day'}++;
524: my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
525:
526: &editfield($r,$today,$tomorrow,'');
527: }
528: # ----------------------------------------------------- Summarize all calendars
529: my %allcal=&get_all_calendars();
530: # ------------------------------- Initialize table and forward backward buttons
531: my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year);
532: if ($pm<1) { ($pm,$py)=(12,$year-1); }
533: if ($fm>12){ ($fm,$fy)=(1,$year+1); }
534:
535: $r->print('<h1>'.('',&mt('January'),&mt('February'),&mt('March'),
536: &mt('April'),&mt('May'),
537: &mt('June'),&mt('July'),&mt('August'),
538: &mt('September'),&mt('October'),
539: &mt('November'),&mt('December'))[$month].' '.
540: $year.'</h1>');
541: # Reached the end of times, give up
542: if (($year<1970) || ($year>2037)) {
543: $r->print('<h3>No calendar available for this date.</h3>'.
544: '<a href="/adm/announcements?month='.$todayhash{'month'}.
545: '&year='.$todayhash{'year'}.'">Current Month</a>'.
546: &Apache::loncommon::end_page());
547: return OK;
548: }
549:
550: my $class = "LC_calendar";
551: if ($env{'form.pickdate'} eq 'yes') {
552: $class .= " LC_calendar_pickdate";
553: }
554: $r->print(
555: '<a href="/adm/announcements?month='.$pm.'&year='.$py.
556: ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
557: '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
558: ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
559: ' <a href="/adm/announcements?month='.$todayhash{'month'}.
560: '&year='.$todayhash{'year'}.
561: ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.
562: '<table class="'.$class.'" cols="7" rows="5"><tr>
563: <th>'.&mt('Sun').'</th>
564: <th>'.&mt('Mon').'</th>
565: <th>'.&mt('Tue').'</th>
566: <th>'.&mt('Wed').'</th>
567: <th>'.&mt('Thu').'</th>
568: <th>'.&mt('Fri').'</th>
569: <th>'.&mt('Sat').'</th></tr>');
570:
571: my $tk=&Apache::loncommon::maketime(%firstday);
572: my $outp;
573: my $nm;
574:
575: # ---------------------------------------------------------------- Actual table
576: $r->print('<tr>');
577: for (my $i=0;$i<$weekday;$i++) { $r->print(&emptycell); }
578: for (my $i=$weekday;$i<=6;$i++) {
579: ($tk,$nm,$outp)=&showday($tk,0,%allcal);
580: $r->print($outp);
581: }
582: $r->print('</tr>');
583:
584: for (my $k=0;$k<=4;$k++) {
585: $r->print('<tr>');
586: for (my $i=0;$i<=6;$i++) {
587: ($tk,$nm,$outp)=&showday($tk,0,%allcal);
588: if ($month!=$nm) { $outp=&emptycell; }
589: $r->print($outp);
590: }
591: $r->print('</tr>');
592: }
593: # ------------------------------------------------------------------- End table
594: $r->print('</table>');
595: # ----------------------------------------------------------------- Check marks
596: undef(%showedcheck);
597: # --------------------------------------------------------------- Remove button
598: if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.
599: &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }
600: $r->print('<p>'.
601: '<a href="/adm/announcements?month='.$pm.'&year='.$py.
602: ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
603: '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
604: ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
605: ' <a href="/adm/announcements?month='.$todayhash{'month'}.
606: '&year='.$todayhash{'year'}.
607: ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.
608: ($pickdatemode?'</font>':'').&Apache::loncommon::end_page());
609: $r->print('<a href="/adm/announcements.ics">'.&mt('Download your Calendar as iCalendar File').'</a>');
610: return OK;
611: }
612:
613: 1;
614: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>