Annotation of loncom/interface/lonannounce.pm, revision 1.27

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

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