Diff for /loncom/interface/lonannounce.pm between versions 1.18 and 1.19

version 1.18, 2003/09/02 21:15:59 version 1.19, 2003/09/03 01:53:46
Line 86  sub normalcell { Line 86  sub normalcell {
  ', '.localtime($start).' - '.localtime($end).': '.$msg;   ', '.localtime($start).' - '.localtime($end).': '.$msg;
             if ($courseid eq $ENV{'request.course.id'}) {              if ($courseid eq $ENV{'request.course.id'}) {
               if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))                if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))
                && (!$showedcheck{$start.'_'.$end})) {                 && (!$showedcheck{$start.'_'.$end})
          && ($ENV{'form.pickdate'} ne 'yes')) {
                $output.='<input type="checkbox" name="remove_'.$start.'_'.                 $output.='<input type="checkbox" name="remove_'.$start.'_'.
    $end.'">';     $end.'">';
                $showedcheck{$start.'_'.$end}=1;                 $showedcheck{$start.'_'.$end}=1;
Line 102  sub normalcell { Line 103  sub normalcell {
  ((($day eq $todayhash{'day'}) &&   ((($day eq $todayhash{'day'}) &&
           ($month eq $todayhash{'month'}) &&            ($month eq $todayhash{'month'}) &&
           ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').            ($year eq $todayhash{'year'}))?' bgcolor="#FFFF00"':'').
            '><b>'.$day.'</b><br>'.$output.'</td>';             '>'.&tfont('<b>'.&picklink($day,$day,$month,$year).'</b><br>'.$output).'</td>';
 }  }
   
 sub plaincell {  sub plaincell {
Line 171  sub showday { Line 172  sub showday {
    }     }
 }  }
   
   sub tfont {
       my $text=shift;
       if ($ENV{'form.pickdate'} eq 'yes') {
    return '<font size="1">'.$text.'</font>';
       } else {
    return $text;
       }
   }
   
   sub picklink {
       my ($text,$day,$month,$year)=@_;
       if ($ENV{'form.pickdate'} eq 'yes') {
    return '<a href="javascript:dialin('.$day.','.$month.','.$year.')">'.
       $text.'</a>';
       } else {
    return $text;
       }
   }
   
   sub dialscript {
       return (<<ENDDIA);
   <script language="Javascript">
   function dialin(day,month,year) {
    opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_year.value=year;
       var slct=opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_month;
       var i;
       for (i=0;i<slct.length;i++) {
           if (slct.options[i].value==month) { slct.selectedIndex=i; }
       }
       opener.document.$ENV{'form.formname'}.$ENV{'form.element'}\_day.value=day;
       opener.$ENV{'form.element'}\_checkday();
       self.close();
   }
   </script>
   ENDDIA
   }
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     $r->content_type('text/html');      $r->content_type('text/html');
Line 185  sub handler { Line 223  sub handler {
     undef %showedcheck;      undef %showedcheck;
 # ---------------------------------------------------------- Get month and year  # ---------------------------------------------------------- Get month and year
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['month','year','pickdate']);                               ['month','year','pickdate','formname','element']);
 # --------------------------------------------------- Decide what month to show  # --------------------------------------------------- Decide what month to show
     my $year=$todayhash{'year'};      my $year=$todayhash{'year'};
     if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; }      if ($ENV{'form.year'}) { $year=$ENV{'form.year'}; }
Line 194  sub handler { Line 232  sub handler {
   
 # ---------------------------------------------- See if we are in pickdate mode  # ---------------------------------------------- See if we are in pickdate mode
     my $pickdatemode=($ENV{'form.pickdate'} eq 'yes');      my $pickdatemode=($ENV{'form.pickdate'} eq 'yes');
       my $pickinfo='&pickdate=yes&formname='.$ENV{'form.formname'}.
    '&element='.$ENV{'form.element'};
 # --------------------------------------------- Find out first day of the month  # --------------------------------------------- Find out first day of the month
   
     my %firstday=&Apache::loncommon::timehash(      my %firstday=&Apache::loncommon::timehash(
Line 226  ENDDOCUMENT Line 265  ENDDOCUMENT
     if ($pickdatemode) {      if ($pickdatemode) {
 # no big header in pickdate mode  # no big header in pickdate mode
  $r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).   $r->print(&Apache::loncommon::bodytag("Pick a Date",'','',1).
     &dialscript().
   '<font size="1">');    '<font size="1">');
     } else {      } else {
        $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));         $r->print(&Apache::loncommon::bodytag("Announcements and Calendar"));
Line 339  SERVERANNOUNCE Line 379  SERVERANNOUNCE
     }      }
     $r->print(      $r->print(
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.   '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  ($pickdatemode?'&pickdate=yes':'').'">Previous Month</a> '.   ($pickdatemode?$pickinfo:'').'">Previous Month</a> '.
  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.   '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  ($pickdatemode?'&pickdate=yes':'').'">Next Month</a>'.   ($pickdatemode?$pickinfo:'').'">Next Month</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.   '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  '&year='.$todayhash{'year'}.   '&year='.$todayhash{'year'}.
  ($pickdatemode?'&pickdate=yes':'').'">Current Month</a><p>'.   ($pickdatemode?$pickinfo:'').'">Current Month</a><p>'.
         '<table border="2" cols="7" rows="5"><tr><th>Sun</th><th>Mon</th>'.          '<table border="2" cols="7" rows="5"><tr><th>'.
         '<th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr>');  &tfont('Sun')
   .'</th><th>'.
   &tfont('Mon')
   .'</th><th>'.
   &tfont('Tue')
   .'</th><th>'.
   &tfont('Wed')
   .'</th><th>'.
   &tfont('Thu')
   .'</th><th>'.
   &tfont('Fri')
   .'</th><th>'.
   &tfont('Sat')
   .'</th></tr>');
   
     my $tk=&Apache::loncommon::maketime(%firstday);      my $tk=&Apache::loncommon::maketime(%firstday);
     my $outp;      my $outp;
Line 379  SERVERANNOUNCE Line 432  SERVERANNOUNCE
     if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></form>'); }      if ($allowed) { $r->print('<input type="button" onClick="removesub()" value="Remove Checked Entries"></form>'); }
     $r->print('<p>'.      $r->print('<p>'.
  '<a href="/adm/announcements?month='.$pm.'&year='.$py.   '<a href="/adm/announcements?month='.$pm.'&year='.$py.
  ($pickdatemode?'&pickdate=yes':'').'">Previous Month</a> '.   ($pickdatemode?$pickinfo:'').'">Previous Month</a> '.
  '<a href="/adm/announcements?month='.$fm.'&year='.$fy.   '<a href="/adm/announcements?month='.$fm.'&year='.$fy.
  ($pickdatemode?'&pickdate=yes':'').'">Next Month</a>'.   ($pickdatemode?$pickinfo:'').'">Next Month</a>'.
  '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.   '&nbsp;&nbsp;&nbsp;<a href="/adm/announcements?month='.$todayhash{'month'}.
  '&year='.$todayhash{'year'}.   '&year='.$todayhash{'year'}.
  ($pickdatemode?'&pickdate=yes':'').'">Current Month</a></p>'.   ($pickdatemode?$pickinfo:'').'">Current Month</a></p>'.
  ($pickdatemode?'</font>':'').   ($pickdatemode?'</font>':'').
  '</body></html>');   '</body></html>');
     return OK;      return OK;

Removed from v.1.18  
changed lines
  Added in v.1.19


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