File:  [LON-CAPA] / loncom / interface / lonannounce.pm
Revision 1.37: download - view: text, annotated - select for diffs
Fri Nov 18 13:35:30 2005 UTC (18 years, 6 months ago) by www
Branches: MAIN
CVS tags: HEAD
Implementing Course Journals

    1: # The LearningOnline Network
    2: # Announce
    3: #
    4: # $Id: lonannounce.pm,v 1.37 2005/11/18 13:35:30 www 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::lonrss();
   37: use Apache::lonnet;
   38: use HTML::Entities();
   39: 
   40: my %todayhash;
   41: my %showedcheck;
   42: 
   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);
   52:     my $help=&Apache::loncommon::help_open_menu('','Calendar Add Announcement','Calendar_Add_Announcement','',274,'Communication Tools');
   53:     my %lt=&Apache::lonlocal::texthash('post' => 'Post Announcement',
   54: 				       'start' => 'Starting date',
   55: 				       'end' => 'Ending date',
   56: 				       'incrss' => 'Include in course RSS newsfeed');
   57: 
   58:     $r->print(<<ENDFORM);
   59: $help
   60: <form name="anno" method="post">
   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>
   64: <textarea name="msg" rows="4" cols="60">$text</textarea>
   65: <br />
   66: <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> 
   67: <br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr />
   68: ENDFORM
   69: }
   70: 
   71: sub readcalendar {
   72:     my $courseid=shift;
   73:     my $coursenum=$env{'course.'.$courseid.'.num'};
   74:     my $coursedom=$env{'course.'.$courseid.'.domain'};
   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:     }
   82:     if ($courseid eq $env{'request.course.id'}) {
   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=~/^\[(.*)\]\./) {
   91: 		    my $sec=$1;
   92: 		    # if we have a section don't show ones that aren't ours
   93: 		    if ($env{'request.course.sec'} &&
   94: 			$env{'request.course.sec'} ne $sec) { next; }
   95: 		    # if a student without a section don't show any section ones
   96: 		    if (!$env{'request.role.adv'} &&
   97: 			!$env{'request.course.sec'}) { next; }
   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='';
  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: 		}
  118: 		if ($name eq 'opendate') { $datetype=&mt('Opening'); }
  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: 		}
  129: 		$returnhash{$courseid.'@'.$resourcedata{$thiskey}.'_'.
  130: 			    $resourcedata{$thiskey}}=
  131: 			    'INTERNAL:'.$datetype.': '.$realm.' ('.$section.')';
  132: 	    }
  133: 	}
  134:     }
  135:     return %returnhash;
  136: }
  137: 
  138: sub emptycell {
  139:     return '<td bgcolor="#AAAAAA">&nbsp;</td>';
  140: }
  141: 
  142: sub normalcell {
  143:     my ($day,$month,$year,$text)=@_;
  144:     my $output='';
  145:     foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) {
  146:         if ($_) {
  147: 	    my $internalflag=0;
  148: 	    my ($courseid,$start,$end,@msg)=split(/\@/,$_);
  149:             my $msg=join('@',@msg);
  150: 	    if ($msg=~/INTERNAL\:/) {
  151: 		$msg=~s/INTERNAL\://gs;
  152: 		$internalflag=1;
  153: 	    }
  154:             my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
  155: 		'\n'.&Apache::lonlocal::locallocaltime($start);
  156: 	    if ($start!=$end) {
  157: 		$fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
  158: 	    }
  159: 	    $fullmsg.=':\n'.$msg;
  160:             if ($courseid eq $env{'request.course.id'}) {
  161:               if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'}))
  162:                && (!$showedcheck{$start.'_'.$end})
  163: 	       && ($env{'form.pickdate'} ne 'yes')
  164: 	       && (!$internalflag)) {
  165:                $output.='<input type="checkbox" name="remove_'.$start.'_'.
  166: 		   $end.'">';
  167:                $showedcheck{$start.'_'.$end}=1;
  168: 	      }
  169: 	    }
  170: 	    $fullmsg=~s/[\n\r]/\\n/gs;
  171:             $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
  172:             $fullmsg=~s/&/\\&/g;
  173:             $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
  174: 	       substr($msg,0,20).'...</a><br />';
  175:        }
  176:     }
  177:     return '<td valign="top"'.
  178: 	((($day eq $todayhash{'day'}) &&
  179:           ($month eq $todayhash{'month'}) &&
  180:           ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').
  181:            '>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br />'.$output).'</td>';
  182: }
  183: 
  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);
  191:             my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}.
  192: 		'\n'.&Apache::lonlocal::locallocaltime($start);
  193: 	    if ($start!=$end) {
  194: 		$fullmsg.=' - '.&Apache::lonlocal::locallocaltime($end);
  195: 	    }
  196: 	    $msg=~s/INTERNAL\://gs;
  197: 	    $fullmsg.=':\n'.$msg;
  198:  	    $fullmsg=~s/[\n\r]/\\n/gs;
  199:             $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
  200:             $fullmsg=~s/&/\\&/g;
  201:             $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
  202: 	       substr($msg,0,80).'...</a><br />';
  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);
  215: 	    $msg=~s/INTERNAL\://gs;
  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>'.
  222:                $msg.'</b>';
  223:             $output.='<li>'.$fullmsg.'</li>';
  224:        }
  225:     }
  226:     return $output;
  227: }
  228: 
  229: sub nextday {
  230:     my %th=@_;
  231:     $th{'day'}++;
  232:     return (&Apache::loncommon::maketime(%th),$th{'month'});
  233: }
  234: 
  235: sub showday {
  236:     my ($tk,$mode,%allcal)=@_;
  237:     my %th=&Apache::loncommon::timehash($tk);
  238:     my ($nextday,$nextmonth)=&nextday(%th);
  239:     my $outp='';
  240:     if ($mode) {
  241: 	my $oneday=24*3600;
  242: 	$tk-=$oneday;
  243: 	$nextday+=$oneday;
  244:     }
  245:     foreach (keys %allcal) {
  246: 	my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/);
  247:         if (($startdate<$nextday) && ($enddate>$tk))  {
  248: 	    $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
  249:             $allcal{$_};
  250:         }
  251:     }
  252:     unless ($mode) {
  253:        return ($nextday,$nextmonth,&normalcell(
  254:                $th{'day'},$th{'month'},$th{'year'},$outp));
  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:    }
  264: }
  265: 
  266: sub tfont {
  267:     my $text=shift;
  268:     if ($env{'form.pickdate'} eq 'yes') {
  269: 	return '<font size="1">'.$text.'</font>';
  270:     } else {
  271: 	return $text;
  272:     }
  273: }
  274: 
  275: sub picklink {
  276:     my ($text,$day,$month,$year)=@_;
  277:     if ($env{'form.pickdate'} eq 'yes') {
  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) {
  289: 	opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;
  290:     var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;
  291:     var i;
  292:     for (i=0;i<slct.length;i++) {
  293:         if (slct.options[i].value==month) { slct.selectedIndex=i; }
  294:     }
  295:     opener.document.$env{'form.formname'}.$env{'form.element'}\_day.value=day;
  296:     opener.$env{'form.element'}\_checkday();
  297:     self.close();
  298: }
  299: </script>
  300: ENDDIA
  301: }
  302: 
  303: sub handler {
  304:     my $r = shift;
  305:     &Apache::loncommon::content_type($r,'text/html');
  306:     $r->send_http_header;
  307:     return OK if $r->header_only;
  308: 
  309: # ---------------------------------------------------------- Get time right now
  310:     my $today=time;
  311:     %todayhash=&Apache::loncommon::timehash($today);
  312: # ----------------------------------------------------------------- Check marks
  313:     %showedcheck=();
  314:     undef %showedcheck;
  315: # ---------------------------------------------------------- Get month and year
  316:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  317:                              ['month','year','pickdate','formname','element']);
  318: # --------------------------------------------------- Decide what month to show
  319:     my $year=$todayhash{'year'};
  320:     if ($env{'form.year'}) { $year=$env{'form.year'}; }
  321:     my $month=$todayhash{'month'};
  322:     if ($env{'form.month'}) { $month=$env{'form.month'}; }
  323: 
  324: # ---------------------------------------------- See if we are in pickdate mode
  325:     my $pickdatemode=($env{'form.pickdate'} eq 'yes');
  326:     my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}.
  327: 	'&element='.$env{'form.element'};
  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,
  334:                                      'dlsav' => -1 ));
  335:     my $weekday=$firstday{'weekday'};
  336: # ------------------------------------------------------------ Print the screen
  337:     my $html=&Apache::lonxml::xmlbegin();
  338:     $r->print(<<ENDDOCUMENT);
  339: $html
  340: <head>
  341: <title>The LearningOnline Network with CAPA</title>
  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>
  354: </head>
  355: ENDDOCUMENT
  356:     if ($pickdatemode) {
  357: # no big header in pickdate mode
  358: 	$r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).
  359: 		  &dialscript().
  360: 		  '<font size="1">');
  361:     } else {
  362:        $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
  363:     }
  364: # does this user have privileges to post, etc?
  365:     my $allowed=0;
  366:     if ($env{'request.course.id'}) {
  367:        $allowed=&Apache::lonnet::allowed('srm',$env{'request.course.id'});
  368:     }
  369: # does this user have privileges to post to servers?
  370:     my $serverpost=0;
  371:     if ($env{'request.role.domain'}) {
  372: 	$serverpost=&Apache::lonnet::allowed('psa',
  373: 					     $env{'request.role.domain'});
  374:     } else {
  375: 	$serverpost=&Apache::lonnet::allowed('psa','/');
  376:     }
  377: # -------------------------------- BUT: do no fancy stuff when in pickdate mode
  378:     if ($pickdatemode) { 
  379: 	$serverpost=0; 
  380: 	$allowed=0;
  381:     }
  382: # ------------------------------------------------------------ Process commands
  383:     if ($serverpost) {
  384: 	if ($env{'form.serveraction'}) {
  385: 	    foreach (keys %env) {
  386: 		if ($_=~/^form\.postto\_(\w+)/) {
  387: 		    $r->print( 
  388: 			'<br />Posting '.$1.': '.&Apache::lonnet::postannounce
  389: 			($1,$env{'form.serverannnounce'}));
  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:     }
  413:     if ($allowed) {
  414:         my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
  415:         my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
  416: # ----------------------------------------------------- Store new submitted one
  417:         if ($env{'form.action'} eq 'new') {
  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:             }
  429: 	    &Apache::lonnet::put('calendar',{ 
  430: 		$startdate.'_'.$enddate => 
  431: 		    $env{'form.msg'} },$coursedom,$coursenum);
  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: 	   }
  439:         }
  440: # ---------------------------------------------------------------- Remove items
  441:         if ($env{'form.action'} eq 'del') {
  442: 	    my @delwhich=();
  443:             foreach (keys %env) {
  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:         
  455:         &editfield($r,$today,$tomorrow,'');
  456:     }
  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
  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); }
  467: 
  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>');
  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(
  482:  '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  483:  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  484:  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  485:  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  486:  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  487:  '&year='.$todayhash{'year'}.
  488:  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.
  489:         '<table border="2" cols="7" rows="5"><tr><th>'.
  490: &tfont(&mt('Sun'))
  491: .'</th><th>'.
  492: &tfont(&mt('Mon'))
  493: .'</th><th>'.
  494: &tfont(&mt('Tue'))
  495: .'</th><th>'.
  496: &tfont(&mt('Wed'))
  497: .'</th><th>'.
  498: &tfont(&mt('Thu'))
  499: .'</th><th>'.
  500: &tfont(&mt('Fri'))
  501: .'</th><th>'.
  502: &tfont(&mt('Sat'))
  503: .'</th></tr>');
  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++) { 
  513:         ($tk,$nm,$outp)=&showday($tk,0,%allcal);
  514:         $r->print($outp);
  515:     }
  516:     $r->print('</tr>');
  517: 
  518:     for (my $k=0;$k<=4;$k++) {
  519:         $r->print('<tr>');
  520:         for (my $i=0;$i<=6;$i++) {
  521:             ($tk,$nm,$outp)=&showday($tk,0,%allcal);
  522:             if ($month!=$nm) { $outp=&emptycell; }
  523:             $r->print($outp);
  524:         }
  525:         $r->print('</tr>');
  526:     }
  527: # ------------------------------------------------------------------- End table
  528:     $r->print('</table>');
  529: # ----------------------------------------------------------------- Check marks
  530:     %showedcheck=();
  531:     undef %showedcheck;
  532: # --------------------------------------------------------------- Remove button
  533:     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.
  534: 			      &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }
  535:     $r->print('<p>'.
  536:  '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  537:  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  538:  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  539:  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  540:  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  541:  '&year='.$todayhash{'year'}.
  542:  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.
  543:  ($pickdatemode?'</font>':'').
  544:  '</body></html>');
  545:     return OK;
  546: } 
  547: 
  548: 1;
  549: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>