version 1.14, 2006/04/13 16:23:03
|
version 1.15, 2006/04/13 17:57:17
|
Line 36 use Apache::lontexconvert;
|
Line 36 use Apache::lontexconvert;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
|
|
|
my $feedcounter; |
|
|
sub filterfeedname { |
sub filterfeedname { |
my $filename=shift; |
my $filename=shift; |
$filename=~s/(\_rss\.html|\.rss)$//; |
$filename=~s/(\_rss\.html|\.rss)$//; |
$filename=~s/\W//g; |
$filename=~s/\W//g; |
|
$filename=~s/\_rssfeed$//; |
|
$filename=~s/^nohist\_//; |
return $filename; |
return $filename; |
} |
} |
|
|
Line 100 sub advertisefeeds {
|
Line 104 sub advertisefeeds {
|
sub rss_link { |
sub rss_link { |
my ($url) = @_; |
my ($url) = @_; |
return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|; |
return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|; |
|
|
} |
} |
|
|
{ |
sub addentry { |
my $feedcounter; |
$feedcounter++; |
sub addentry { |
my $id=time.'00000'.$$.'00000'.$feedcounter; |
$feedcounter++; |
return &editentry($id,@_); |
my $id=time.'00000'.$$.'00000'.$feedcounter; |
|
return &editentry($id,@_); |
|
} |
|
} |
} |
|
|
sub editentry { |
sub editentry { |
my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enclength,$enctype)=@_; |
my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enclength,$enctype)=@_; |
|
if ($status eq 'deleted') { |
|
return &changestatus($id,$uname,$udom,$filename,$status); |
|
} |
my $feedname=&feedname($filename); |
my $feedname=&feedname($filename); |
&Apache::lonnet::put('nohist_all_rss_feeds', |
&Apache::lonnet::put('nohist_all_rss_feeds', |
{ &filterfeedname($filename) => &displayfeedname($filename,$uname,$udom) }, |
{ &filterfeedname($filename) => &displayfeedname($filename,$uname,$udom) }, |
Line 186 sub handler {
|
Line 189 sub handler {
|
'force_register' => |
'force_register' => |
$env{'form.register'}}). |
$env{'form.register'}}). |
&changed_js()); |
&changed_js()); |
|
|
} else { |
} else { |
$r->print("<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1'>\n<channel>". |
$r->print("<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1'>\n<channel>". |
"\n<link>http://".$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'. |
"\n<link>http://".$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'. |
Line 195 sub handler {
|
Line 197 sub handler {
|
&mt('An RSS Feed provided by the LON-CAPA Learning Content Management System'). |
&mt('An RSS Feed provided by the LON-CAPA Learning Content Management System'). |
'</description>'); |
'</description>'); |
} |
} |
|
# Do we have stuff to store? |
|
if ($edit) { |
|
my %newsfeed=&Apache::lonnet::dump($feedname,$udom,$uname); |
|
foreach my $entry (sort(keys(%newsfeed)),$env{'form.newid'}.'_status') { |
|
if ($entry=~/^(\d+)\_status$/) { |
|
my $id=$1; |
|
if ($env{'form.'.$id.'_modified'}) { |
|
&editentry($id,$uname,$udom,$feedname, |
|
$env{'form.'.$id.'_title'}, |
|
$env{'form.'.$id.'_description'}, |
|
$env{'form.'.$id.'_url'}, |
|
$env{'form.'.$id.'_status'}); |
|
} |
|
} |
|
} |
|
} |
|
$feedcounter++; |
|
my $newid=time.'00000'.$$.'00000'.$feedcounter; |
# Is this user for real? |
# Is this user for real? |
my $homeserver=&Apache::lonnet::homeserver($uname,$udom); |
my $homeserver=&Apache::lonnet::homeserver($uname,$udom); |
if ($html) { |
if ($html) { |
Line 225 sub handler {
|
Line 245 sub handler {
|
} |
} |
# Get feed items |
# Get feed items |
my %newsfeed=&Apache::lonnet::dump($feedname,$udom,$uname); |
my %newsfeed=&Apache::lonnet::dump($feedname,$udom,$uname); |
foreach my $entry (sort(keys(%newsfeed))) { |
foreach my $entry (sort(keys(%newsfeed)),$newid.'_status') { |
if ($entry=~/^(\d+)\_status$/) { |
if ($entry=~/^(\d+)\_status$/) { |
my $id=$1; |
my $id=$1; |
if ($edit) { |
if ($edit) { |
Line 235 sub handler {
|
Line 255 sub handler {
|
'delete' => 'delete', |
'delete' => 'delete', |
'store' => 'Store changes'); |
'store' => 'Store changes'); |
my %status=(); |
my %status=(); |
|
unless ($newsfeed{$id.'_status'}) { $newsfeed{$id.'_status'}='public'; } |
$status{$newsfeed{$id.'_status'}}='checked="checked"'; |
$status{$newsfeed{$id.'_status'}}='checked="checked"'; |
$r->print(<<ENDEDIT); |
$r->print(<<ENDEDIT); |
<li> |
<li> |
<label><input name='$id\_modified' type='checkbox' /> $lt{'store'}</label> |
<label><input name='$id\_modified' type='checkbox' value="modified" /> $lt{'store'}</label> |
|
|
<label><input name='$id\_status' type="radio" value="public" $status{'public'} onClick="changed(this.form,'$id');" /> $lt{'public'}</label> |
<label><input name='$id\_status' type="radio" value="public" $status{'public'} onClick="changed(this.form,'$id');" /> $lt{'public'}</label> |
|
|
Line 246 sub handler {
|
Line 267 sub handler {
|
|
|
<label><input name='$id\_status' type="radio" value="hidden" $status{'hidden'} onClick="changed(this.form,'$id');" /> $lt{'hidden'}</label> |
<label><input name='$id\_status' type="radio" value="hidden" $status{'hidden'} onClick="changed(this.form,'$id');" /> $lt{'hidden'}</label> |
|
|
<label><input name='$id\_status' type="radio" value="delete" onClick="changed(this.form,'$id');" /> $lt{'delete'}</label> |
<label><input name='$id\_status' type="radio" value="deleted" onClick="changed(this.form,'$id');" /> $lt{'delete'}</label> |
<br /> |
<br /> |
<input name='$id\_title' type='text' size='80' value='$newsfeed{$id.'_title'}' onChange="changed(this.form,'$id');" /><br /> |
<input name='$id\_title' type='text' size='80' value='$newsfeed{$id.'_title'}' onChange="changed(this.form,'$id');" /><br /> |
<textarea name='$id\_description' rows="6" cols="80" onChange="changed(this.form,'$id');">$newsfeed{$id.'_description'}</textarea><br /> |
<textarea name='$id\_description' rows="6" cols="80" onChange="changed(this.form,'$id');">$newsfeed{$id.'_description'}</textarea><br /> |
Line 277 ENDEDIT
|
Line 298 ENDEDIT
|
} |
} |
} |
} |
} |
} |
$r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').&Apache::loncommon::end_page():'</channel></rss>'."\n")); |
$r->print("\n".($html?'</ul>'.($edit?'<input type="hidden" name="newid" value="'.$newid.'"/><input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').&Apache::loncommon::end_page():'</channel></rss>'."\n")); |
return OK; |
return OK; |
} |
} |
1; |
1; |