version 1.38, 2005/11/22 16:16:53
|
version 1.48, 2006/03/23 22:32:10
|
Line 33 use Apache::Constants qw(:common);
|
Line 33 use Apache::Constants qw(:common);
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnavmaps(); |
use Apache::lonrss(); |
use Apache::lonrss(); |
use Apache::lonnet; |
use Apache::lonnet; |
use HTML::Entities(); |
use HTML::Entities(); |
Line 63 $help
|
Line 64 $help
|
<tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table> |
<tr><td>$lt{'end'}:</td><td>$enddateform</td></tr></table> |
<textarea name="msg" rows="4" cols="60">$text</textarea> |
<textarea name="msg" rows="4" cols="60">$text</textarea> |
<br /> |
<br /> |
<!-- <label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> --> |
<label><input type="checkbox" name="rsspost" /> $lt{'incrss'}</label> |
<br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr /> |
<br /><input type="button" onClick="trysubmit()" value="$lt{'post'}" /><hr /> |
ENDFORM |
ENDFORM |
} |
} |
Line 74 sub readcalendar {
|
Line 75 sub readcalendar {
|
my $coursedom=$env{'course.'.$courseid.'.domain'}; |
my $coursedom=$env{'course.'.$courseid.'.domain'}; |
my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum); |
my %thiscal=&Apache::lonnet::dump('calendar',$coursedom,$coursenum); |
my %returnhash=(); |
my %returnhash=(); |
foreach (keys %thiscal) { |
foreach my $item (keys(%thiscal)) { |
unless (($_=~/^error\:/) || ($thiscal{$_}=~/^error\:/)) { |
unless (($item=~/^error\:/) || ($thiscal{$item}=~/^error\:/)) { |
$returnhash{$courseid.'@'.$_}=$thiscal{$_}; |
$returnhash{$courseid.'@'.$item}=$thiscal{$item}; |
} |
} |
} |
} |
|
|
if ($courseid eq $env{'request.course.id'}) { |
if ($courseid eq $env{'request.course.id'}) { |
|
my $can_see_hidden = $env{'request.role.adv'}; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my %resourcedata= |
my %resourcedata= |
&Apache::lonnet::dump('resourcedata',$coursedom,$coursenum); |
&Apache::lonnet::dump('resourcedata',$coursedom,$coursenum); |
foreach my $thiskey (sort keys %resourcedata) { |
foreach my $thiskey (sort keys %resourcedata) { |
Line 101 sub readcalendar {
|
Line 105 sub readcalendar {
|
$middle=~s/\.$//; |
$middle=~s/\.$//; |
my $realm=&mt('All Resources'); |
my $realm=&mt('All Resources'); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1); |
my $map_url=$1; |
|
if (!$can_see_hidden && !$navmap) { |
|
next; |
|
} |
|
if (!$can_see_hidden) { |
|
my $res = $navmap->getResourceByUrl($map_url); |
|
if ($res && $res->randomout()) { next; } |
|
} |
|
$realm=&mt('Folder/Map').': '.&Apache::lonnet::gettitle($map_url); |
} elsif ($middle) { |
} elsif ($middle) { |
|
if (!$can_see_hidden && !$navmap) { |
|
next; |
|
} |
|
if (!$can_see_hidden) { |
|
my $res = $navmap->getBySymb($middle); |
|
if ($res && $res->randomout()) { next; } |
|
} |
$realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle); |
$realm=&mt('Resource').': '.&Apache::lonnet::gettitle($middle); |
} |
} |
my $datetype=''; |
my $datetype=''; |
Line 142 sub emptycell {
|
Line 161 sub emptycell {
|
sub normalcell { |
sub normalcell { |
my ($day,$month,$year,$text)=@_; |
my ($day,$month,$year,$text)=@_; |
my $output=''; |
my $output=''; |
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { |
my @items=&order($text); |
if ($_) { |
foreach my $item (@items) { |
|
if ($item) { |
my $internalflag=0; |
my $internalflag=0; |
my ($courseid,$start,$end,@msg)=split(/\@/,$_); |
my ($courseid,$start,$end,$msg)=split(/\@/,$item,4); |
my $msg=join('@',@msg); |
|
if ($msg=~/INTERNAL\:/) { |
if ($msg=~/INTERNAL\:/) { |
$msg=~s/INTERNAL\://gs; |
$msg=~s/INTERNAL\://gs; |
$internalflag=1; |
$internalflag=1; |
Line 184 sub normalcell {
|
Line 203 sub normalcell {
|
sub plaincell { |
sub plaincell { |
my ($text)=@_; |
my ($text)=@_; |
my $output=''; |
my $output=''; |
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { |
my @items=&order($text); |
if ($_) { |
foreach my $item (@items) { |
my ($courseid,$start,$end,@msg)=split(/\@/,$_); |
if ($item) { |
my $msg=join('@',@msg); |
my ($courseid,$start,$end,$msg)=split(/\@/,$item,4); |
my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}. |
my $fullmsg=&mt('Calendar Announcement for ').$env{'course.'.$courseid.'.description'}. |
'\n'.&Apache::lonlocal::locallocaltime($start); |
'\n'.&Apache::lonlocal::locallocaltime($start); |
if ($start!=$end) { |
if ($start!=$end) { |
Line 208 sub plaincell {
|
Line 227 sub plaincell {
|
sub listcell { |
sub listcell { |
my ($text)=@_; |
my ($text)=@_; |
my $output=''; |
my $output=''; |
foreach (split(/\_\_\_\&\&\&\_\_\_/,$text)) { |
my @items=&order($text); |
if ($_) { |
foreach my $item (@items) { |
my ($courseid,$start,$end,@msg)=split(/\@/,$_); |
if ($item) { |
my $msg=join('@',@msg); |
my ($courseid,$start,$end,$msg)=split(/\@/,$item,4); |
$msg=~s/INTERNAL\://gs; |
$msg=~s/INTERNAL\://gs; |
my $fullmsg=&Apache::lonlocal::locallocaltime($start); |
my $fullmsg=&Apache::lonlocal::locallocaltime($start); |
if ($start!=$end) { |
if ($start!=$end) { |
Line 226 sub listcell {
|
Line 245 sub listcell {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub order { |
|
my ($text)=@_; |
|
my @items = split(/___&&&___/,$text); |
|
sort { |
|
my (undef,$astart,$aend)=split(/\@/,$a); |
|
my (undef,$bstart,$bend)=split(/\@/,$b); |
|
if ($astart != $bstart) { |
|
return $astart <=> $bstart; |
|
} |
|
return $aend <=> $bend; |
|
} @items; |
|
} |
|
|
sub nextday { |
sub nextday { |
my %th=@_; |
my %th=@_; |
$th{'day'}++; |
$th{'day'}++; |
Line 242 sub showday {
|
Line 274 sub showday {
|
$tk-=$oneday; |
$tk-=$oneday; |
$nextday+=$oneday; |
$nextday+=$oneday; |
} |
} |
foreach (keys %allcal) { |
foreach my $item (keys(%allcal)) { |
my ($course,$startdate,$enddate)=($_=~/^(\w+)\@(\d+)\_(\d+)$/); |
my ($course,$startdate,$enddate)=($item=~/^(\w+)\@(\d+)\_(\d+)$/); |
if (($startdate<$nextday) && ($enddate>$tk)) { |
if (($startdate<$nextday) && ($enddate>=$tk)) { |
$outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'. |
$outp.='___&&&___'.$course.'@'.$startdate.'@'.$enddate.'@'. |
$allcal{$_}; |
$allcal{$item}; |
} |
} |
} |
} |
unless ($mode) { |
unless ($mode) { |
Line 334 sub handler {
|
Line 366 sub handler {
|
'dlsav' => -1 )); |
'dlsav' => -1 )); |
my $weekday=$firstday{'weekday'}; |
my $weekday=$firstday{'weekday'}; |
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
my $html=&Apache::lonxml::xmlbegin(); |
my $js = <<ENDDOCUMENT; |
$r->print(<<ENDDOCUMENT); |
<script type="text/javascript"> |
$html |
|
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
<script> |
|
|
|
function trysubmit() { |
function trysubmit() { |
document.anno.action.value="new"; |
document.anno.action.value="new"; |
Line 351 $html
|
Line 379 $html
|
document.anno.submit(); |
document.anno.submit(); |
} |
} |
</script> |
</script> |
</head> |
|
ENDDOCUMENT |
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::start_page("Pick a Date",$js, |
|
{'only_body' => 1,}). |
&dialscript(). |
&dialscript(). |
'<font size="1">'); |
'<font size="1">'); |
} else { |
} else { |
$r->print(&Apache::loncommon::bodytag("Announcements and Calendar")); |
$r->print(&Apache::loncommon::start_page("Announcements and Calendar", |
|
$js)); |
} |
} |
# does this user have privileges to post, etc? |
# does this user have privileges to post, etc? |
my $allowed=0; |
my $allowed=0; |
Line 382 ENDDOCUMENT
|
Line 412 ENDDOCUMENT
|
# ------------------------------------------------------------ Process commands |
# ------------------------------------------------------------ Process commands |
if ($serverpost) { |
if ($serverpost) { |
if ($env{'form.serveraction'}) { |
if ($env{'form.serveraction'}) { |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.postto\_(\w+)/) { |
if ($key=~/^form\.postto\_(\w+)/) { |
$r->print( |
$r->print( |
'<br />Posting '.$1.': '.&Apache::lonnet::postannounce |
'<br />Posting '.$1.': '.&Apache::lonnet::postannounce |
($1,$env{'form.serverannnounce'})); |
($1,$env{'form.serverannnounce'})); |
Line 399 Post announcements to the system login a
|
Line 429 Post announcements to the system login a
|
Check machines:<br /> |
Check machines:<br /> |
SERVERANNOUNCE |
SERVERANNOUNCE |
# list servers |
# list servers |
foreach (sort keys %Apache::lonnet::hostname) { |
foreach my $host (sort(keys(%Apache::lonnet::hostname))) { |
if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$_})) { |
if (&Apache::lonnet::allowed('psa',$Apache::lonnet::hostdom{$host})) { |
$r->print ('<br /><input type="checkbox" name="postto_'.$_.'" /> '. |
$r->print ('<br /><input type="checkbox" name="postto_'.$host.'" /> '. |
$_.' <tt>'.$Apache::lonnet::hostname{$_}.'</tt> '. |
$host.' <tt>'.$Apache::lonnet::hostname{$host}.'</tt> '. |
'<a href="http://'.$Apache::lonnet::hostname{$_}. |
'<a href="http://'.$Apache::lonnet::hostname{$host}. |
'/announcement.txt" target="annowin">current</a>'); |
'/announcement.txt" target="annowin">current</a>'); |
} |
} |
} |
} |
Line 440 SERVERANNOUNCE
|
Line 470 SERVERANNOUNCE
|
# ---------------------------------------------------------------- Remove items |
# ---------------------------------------------------------------- Remove items |
if ($env{'form.action'} eq 'del') { |
if ($env{'form.action'} eq 'del') { |
my @delwhich=(); |
my @delwhich=(); |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^form\.remove\_(.+)$/) { |
if ($key=~/^form\.remove\_(.+)$/) { |
push(@delwhich,$1); |
push(@delwhich,$1); |
} |
} |
} |
} |
Line 456 SERVERANNOUNCE
|
Line 486 SERVERANNOUNCE
|
} |
} |
# ----------------------------------------------------- Summarize all calendars |
# ----------------------------------------------------- Summarize all calendars |
my %allcal=(); |
my %allcal=(); |
foreach (&Apache::loncommon::findallcourses()) { |
foreach my $course (&Apache::loncommon::findallcourses()) { |
%allcal=(%allcal,&readcalendar($_)); |
%allcal=(%allcal,&readcalendar($course)); |
} |
} |
|
|
# ------------------------------- Initialize table and forward backward buttons |
# ------------------------------- Initialize table and forward backward buttons |
Line 475 SERVERANNOUNCE
|
Line 505 SERVERANNOUNCE
|
if (($year<1970) || ($year>2037)) { |
if (($year<1970) || ($year>2037)) { |
$r->print('<h3>No calendar available for this date.</h3>'. |
$r->print('<h3>No calendar available for this date.</h3>'. |
'<a href="/adm/announcements?month='.$todayhash{'month'}. |
'<a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}.'">Current Month</a></body></html>'); |
'&year='.$todayhash{'year'}.'">Current Month</a>'. |
|
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
$r->print( |
$r->print( |
Line 540 SERVERANNOUNCE
|
Line 571 SERVERANNOUNCE
|
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
' <a href="/adm/announcements?month='.$todayhash{'month'}. |
'&year='.$todayhash{'year'}. |
'&year='.$todayhash{'year'}. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'. |
($pickdatemode?$pickinfo:'').'">'.&mt('Current Month').'</a></p>'. |
($pickdatemode?'</font>':''). |
($pickdatemode?'</font>':'').&Apache::loncommon::end_page()); |
'</body></html>'); |
|
return OK; |
return OK; |
} |
} |
|
|