File:  [LON-CAPA] / loncom / interface / lonannounce.pm
Revision 1.41: download - view: text, annotated - select for diffs
Thu Jan 12 23:00:08 2006 UTC (18 years, 4 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- split does have this 3rd argument...

    1: # The LearningOnline Network
    2: # Announce
    3: #
    4: # $Id: lonannounce.pm,v 1.41 2006/01/12 23:00:08 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::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:     my @items=&order($text);
  146:     foreach my $item (@items) {
  147:         if ($item) {
  148: 	    my $internalflag=0;
  149: 	    my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
  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:     my @items=&order($text);
  188:     foreach my $item (@items) {
  189:         if ($item) {
  190: 	    my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
  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:     my @items=&order($text);
  212:     foreach my $item (@items) {
  213:         if ($item) {
  214: 	    my ($courseid,$start,$end,$msg)=split(/\@/,$item,4);
  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 order {
  230:     my ($text)=@_;
  231:     my @items = split(/___&&&___/,$text);
  232:     sort {
  233: 	my (undef,$astart,$aend)=split(/\@/,$a);
  234: 	my (undef,$bstart,$bend)=split(/\@/,$b);
  235: 	if ($astart != $bstart) {
  236: 	    return $astart <=> $bstart;
  237: 	}
  238: 	return $aend <=> $bend;
  239:     } @items;
  240: }
  241: 
  242: sub nextday {
  243:     my %th=@_;
  244:     $th{'day'}++;
  245:     return (&Apache::loncommon::maketime(%th),$th{'month'});
  246: }
  247: 
  248: sub showday {
  249:     my ($tk,$mode,%allcal)=@_;
  250:     my %th=&Apache::loncommon::timehash($tk);
  251:     my ($nextday,$nextmonth)=&nextday(%th);
  252:     my $outp='';
  253:     if ($mode) {
  254: 	my $oneday=24*3600;
  255: 	$tk-=$oneday;
  256: 	$nextday+=$oneday;
  257:     }
  258:     foreach my $item (keys(%allcal)) {
  259: 	my ($course,$startdate,$enddate)=($item=~/^(\w+)\@(\d+)\_(\d+)$/);
  260:         if (($startdate<$nextday) && ($enddate>=$tk))  {
  261: 	    $outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'.
  262:             $allcal{$item};
  263:         }
  264:     }
  265:     unless ($mode) {
  266:        return ($nextday,$nextmonth,&normalcell(
  267:                $th{'day'},$th{'month'},$th{'year'},$outp));
  268:    } elsif ($outp) {
  269:        if ($mode==1) {
  270:           return '<br />'.&plaincell($outp);
  271:       } else {
  272:           return '<ul>'.&listcell($outp).'</ul>';
  273:       }
  274:    } else {
  275:        return '';
  276:    }
  277: }
  278: 
  279: sub tfont {
  280:     my $text=shift;
  281:     if ($env{'form.pickdate'} eq 'yes') {
  282: 	return '<font size="1">'.$text.'</font>';
  283:     } else {
  284: 	return $text;
  285:     }
  286: }
  287: 
  288: sub picklink {
  289:     my ($text,$day,$month,$year)=@_;
  290:     if ($env{'form.pickdate'} eq 'yes') {
  291: 	return '<a href="javascript:dialin('.$day.','.$month.','.$year.')">'.
  292: 	    $text.'</a>';
  293:     } else {
  294: 	return $text;
  295:     }
  296: }
  297: 
  298: sub dialscript {
  299:     return (<<ENDDIA);
  300: <script language="Javascript">
  301: function dialin(day,month,year) {
  302: 	opener.document.$env{'form.formname'}.$env{'form.element'}\_year.value=year;
  303:     var slct=opener.document.$env{'form.formname'}.$env{'form.element'}\_month;
  304:     var i;
  305:     for (i=0;i<slct.length;i++) {
  306:         if (slct.options[i].value==month) { slct.selectedIndex=i; }
  307:     }
  308:     opener.document.$env{'form.formname'}.$env{'form.element'}\_day.value=day;
  309:     opener.$env{'form.element'}\_checkday();
  310:     self.close();
  311: }
  312: </script>
  313: ENDDIA
  314: }
  315: 
  316: sub handler {
  317:     my $r = shift;
  318:     &Apache::loncommon::content_type($r,'text/html');
  319:     $r->send_http_header;
  320:     return OK if $r->header_only;
  321: 
  322: # ---------------------------------------------------------- Get time right now
  323:     my $today=time;
  324:     %todayhash=&Apache::loncommon::timehash($today);
  325: # ----------------------------------------------------------------- Check marks
  326:     %showedcheck=();
  327:     undef %showedcheck;
  328: # ---------------------------------------------------------- Get month and year
  329:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  330:                              ['month','year','pickdate','formname','element']);
  331: # --------------------------------------------------- Decide what month to show
  332:     my $year=$todayhash{'year'};
  333:     if ($env{'form.year'}) { $year=$env{'form.year'}; }
  334:     my $month=$todayhash{'month'};
  335:     if ($env{'form.month'}) { $month=$env{'form.month'}; }
  336: 
  337: # ---------------------------------------------- See if we are in pickdate mode
  338:     my $pickdatemode=($env{'form.pickdate'} eq 'yes');
  339:     my $pickinfo='&pickdate=yes&formname='.$env{'form.formname'}.
  340: 	'&element='.$env{'form.element'};
  341: # --------------------------------------------- Find out first day of the month
  342: 
  343:     my %firstday=&Apache::loncommon::timehash(
  344:        &Apache::loncommon::maketime( 'day' => 1, 'month'=> $month,
  345:                                      'year' => $year, 'hours' => 0,
  346: 				     'minutes' => 0, 'seconds' => 0,
  347:                                      'dlsav' => -1 ));
  348:     my $weekday=$firstday{'weekday'};
  349: # ------------------------------------------------------------ Print the screen
  350:     my $html=&Apache::lonxml::xmlbegin();
  351:     $r->print(<<ENDDOCUMENT);
  352: $html
  353: <head>
  354: <title>The LearningOnline Network with CAPA</title>
  355: <script>
  356: 
  357:     function trysubmit() {
  358:         document.anno.action.value="new";
  359: 	document.anno.submit();
  360:     }
  361: 
  362:     function removesub() {
  363:         document.anno.action.value="del";
  364: 	document.anno.submit();
  365:     }
  366: </script>
  367: </head>
  368: ENDDOCUMENT
  369:     if ($pickdatemode) {
  370: # no big header in pickdate mode
  371: 	$r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).
  372: 		  &dialscript().
  373: 		  '<font size="1">');
  374:     } else {
  375:        $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
  376:     }
  377: # does this user have privileges to post, etc?
  378:     my $allowed=0;
  379:     if ($env{'request.course.id'}) {
  380:        $allowed=&Apache::lonnet::allowed('srm',$env{'request.course.id'});
  381:     }
  382: # does this user have privileges to post to servers?
  383:     my $serverpost=0;
  384:     if ($env{'request.role.domain'}) {
  385: 	$serverpost=&Apache::lonnet::allowed('psa',
  386: 					     $env{'request.role.domain'});
  387:     } else {
  388: 	$serverpost=&Apache::lonnet::allowed('psa','/');
  389:     }
  390: # -------------------------------- BUT: do no fancy stuff when in pickdate mode
  391:     if ($pickdatemode) { 
  392: 	$serverpost=0; 
  393: 	$allowed=0;
  394:     }
  395: # ------------------------------------------------------------ Process commands
  396:     if ($serverpost) {
  397: 	if ($env{'form.serveraction'}) {
  398: 	    foreach (keys %env) {
  399: 		if ($_=~/^form\.postto\_(\w+)/) {
  400: 		    $r->print( 
  401: 			'<br />Posting '.$1.': '.&Apache::lonnet::postannounce
  402: 			($1,$env{'form.serverannnounce'}));
  403: 		}
  404: 	    }
  405: 	}
  406: 	$r->print(<<SERVERANNOUNCE);
  407: <form name="serveranno" method="post">
  408: <h3>Post Server Announcements</h3>
  409: Post announcements to the system login and roles screen<br />
  410: <i>(leave blank to delete announcement)</i><br />
  411: <textarea name="serverannnounce" cols="60" rows="5"></textarea><br />
  412: Check machines:<br />
  413: SERVERANNOUNCE
  414: # list servers
  415:     foreach (sort keys %Apache::lonnet::hostname) {
  416: 	if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$_})) {
  417: 	    $r->print ('<br /><input type="checkbox" name="postto_'.$_.'" /> '.
  418: 		       $_.' <tt>'.$Apache::lonnet::hostname{$_}.'</tt> '.
  419: 		       '<a href="http://'.$Apache::lonnet::hostname{$_}.
  420: 		       '/announcement.txt" target="annowin">current</a>');
  421: 	}
  422:     }
  423:     $r->print(
  424:   '<br /><input type="submit" name="serveraction" value="Post"></form><hr />');
  425:     }
  426:     if ($allowed) {
  427:         my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
  428:         my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
  429: # ----------------------------------------------------- Store new submitted one
  430:         if ($env{'form.action'} eq 'new') {
  431: 	    my $startdate = 
  432: 		&Apache::lonhtmlcommon::get_date_from_form('startdate');
  433: 	    my $enddate   = 
  434: 		&Apache::lonhtmlcommon::get_date_from_form('enddate');
  435: 	    unless ($startdate=~/^\d+$/) { $startdate=time; }
  436:             unless ($enddate=~/^\d+$/) { $enddate=$startdate+1; }
  437:             if ($startdate>$enddate) {
  438: 		my $buffer=$startdate;
  439: 		$startdate=$enddate;
  440: 		$enddate=$buffer;
  441:             }
  442: 	    &Apache::lonnet::put('calendar',{ 
  443: 		$startdate.'_'.$enddate => 
  444: 		    $env{'form.msg'} },$coursedom,$coursenum);
  445: 	    if ($env{'form.rsspost'}) {
  446:                &Apache::lonrss::addentry($coursenum,$coursedom,'Course_Announcements',
  447: 					 &mt('Event from [_1] to [_2]',
  448: 					     &Apache::lonlocal::locallocaltime($startdate),
  449: 					     &Apache::lonlocal::locallocaltime($enddate)),
  450: 					 $env{'form.msg'},'/adm/announcements','public');
  451: 	   }
  452:         }
  453: # ---------------------------------------------------------------- Remove items
  454:         if ($env{'form.action'} eq 'del') {
  455: 	    my @delwhich=();
  456:             foreach (keys %env) {
  457: 		if ($_=~/^form\.remove\_(.+)$/) {
  458: 		    push(@delwhich,$1);
  459:                 }
  460:             }
  461:             &Apache::lonnet::del('calendar',\@delwhich,$coursedom,$coursenum);
  462:         }
  463: # -------------------------------------------------------- Form to post new one
  464:         my %tomorrowhash=%todayhash;
  465:         $tomorrowhash{'day'}++;
  466:         my $tomorrow=&Apache::loncommon::maketime(%tomorrowhash);
  467:         
  468:         &editfield($r,$today,$tomorrow,'');
  469:     }
  470: # ----------------------------------------------------- Summarize all calendars
  471:     my %allcal=();
  472:     foreach (&Apache::loncommon::findallcourses()) {
  473: 	%allcal=(%allcal,&readcalendar($_));
  474:     }
  475: 
  476: # ------------------------------- Initialize table and forward backward buttons
  477:     my ($pm,$py,$fm,$fy)=($month-1,$year,$month+1,$year);
  478:     if ($pm<1) { ($pm,$py)=(12,$year-1); }
  479:     if ($fm>12){ ($fm,$fy)=(1,$year+1); }
  480: 
  481:     $r->print('<h1>'.('',&mt('January'),&mt('February'),&mt('March'),
  482: 		      &mt('April'),&mt('May'),
  483: 		      &mt('June'),&mt('July'),&mt('August'),
  484:                       &mt('September'),&mt('October'),
  485:                       &mt('November'),&mt('December'))[$month].' '.
  486: 	              $year.'</h1>');
  487: # Reached the end of times, give up
  488:     if (($year<1970) || ($year>2037)) {
  489: 	$r->print('<h3>No calendar available for this date.</h3>'.
  490:  '<a href="/adm/announcements?month='.$todayhash{'month'}.
  491:  '&year='.$todayhash{'year'}.'">Current Month</a></body></html>');
  492: 	return OK;
  493:     }
  494:     $r->print(
  495:  '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  496:  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  497:  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  498:  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  499:  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  500:  '&year='.$todayhash{'year'}.
  501:  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a><p>'.
  502:         '<table border="2" cols="7" rows="5"><tr><th>'.
  503: &tfont(&mt('Sun'))
  504: .'</th><th>'.
  505: &tfont(&mt('Mon'))
  506: .'</th><th>'.
  507: &tfont(&mt('Tue'))
  508: .'</th><th>'.
  509: &tfont(&mt('Wed'))
  510: .'</th><th>'.
  511: &tfont(&mt('Thu'))
  512: .'</th><th>'.
  513: &tfont(&mt('Fri'))
  514: .'</th><th>'.
  515: &tfont(&mt('Sat'))
  516: .'</th></tr>');
  517: 
  518:     my $tk=&Apache::loncommon::maketime(%firstday);
  519:     my $outp;
  520:     my $nm;
  521: 
  522: # ---------------------------------------------------------------- Actual table
  523:     $r->print('<tr>');
  524:     for (my $i=0;$i<$weekday;$i++) { $r->print(&emptycell); }
  525:     for (my $i=$weekday;$i<=6;$i++) { 
  526:         ($tk,$nm,$outp)=&showday($tk,0,%allcal);
  527:         $r->print($outp);
  528:     }
  529:     $r->print('</tr>');
  530: 
  531:     for (my $k=0;$k<=4;$k++) {
  532:         $r->print('<tr>');
  533:         for (my $i=0;$i<=6;$i++) {
  534:             ($tk,$nm,$outp)=&showday($tk,0,%allcal);
  535:             if ($month!=$nm) { $outp=&emptycell; }
  536:             $r->print($outp);
  537:         }
  538:         $r->print('</tr>');
  539:     }
  540: # ------------------------------------------------------------------- End table
  541:     $r->print('</table>');
  542: # ----------------------------------------------------------------- Check marks
  543:     %showedcheck=();
  544:     undef %showedcheck;
  545: # --------------------------------------------------------------- Remove button
  546:     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries">'.
  547: 			      &Apache::loncommon::help_open_topic('Calendar_Remove_Announcement').'</form>'); }
  548:     $r->print('<p>'.
  549:  '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  550:  ($pickdatemode?$pickinfo:'').'">'.&mt('Previous Month').'</a> '.
  551:  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  552:  ($pickdatemode?$pickinfo:'').'">'.&mt('Next Month').'</a>'.
  553:  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  554:  '&year='.$todayhash{'year'}.
  555:  ($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'.
  556:  ($pickdatemode?'</font>':'').
  557:  '</body></html>');
  558:     return OK;
  559: } 
  560: 
  561: 1;
  562: __END__

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