';
+ ' RSS: '.$feedurl.'';
}
}
if ($feeds) {
@@ -100,20 +103,26 @@ sub advertisefeeds {
sub rss_link {
my ($url) = @_;
return qq||;
-
}
{
my $feedcounter;
- sub addentry {
+ sub get_new_feed_id {
$feedcounter++;
- my $id=time.'00000'.$$.'00000'.$feedcounter;
- return &editentry($id,@_);
+ return time().'00000'.$$.'00000'.$feedcounter;
}
}
+sub addentry {
+ my $id=&get_new_feed_id();
+ return &editentry($id,@_);
+}
+
sub editentry {
- my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enclength,$enctype)=@_;
+ my ($id,$uname,$udom,$filename,$title,$description,$url,$status,$encurl,$enctype)=@_;
+ if ($status eq 'deleted') {
+ return &changestatus($id,$uname,$udom,$filename,$status);
+ }
my $feedname=&feedname($filename);
&Apache::lonnet::put('nohist_all_rss_feeds',
{ &filterfeedname($filename) => &displayfeedname($filename,$uname,$udom) },
@@ -123,7 +132,6 @@ sub editentry {
$id.'_description' => $description,
$id.'_link' => $url,
$id.'_enclosureurl' => $encurl,
- $id.'_enclosurelength' => $enclength,
$id.'_enclosuretype' => $enctype,
$id.'_status' => $status},$udom,$uname);
}
@@ -136,7 +144,6 @@ sub changestatus {
$id.'_description',
$id.'_link',
$id.'_enclosureurl',
- $id.'_enclosurelength',
$id.'_enclosuretype',
$id.'_status'],$udom,$uname);
} else {
@@ -154,6 +161,12 @@ sub changed_js {
ENDSCRIPT
}
+sub determine_enclosure_types {
+ my ($url)=@_;
+ my ($ending)=($url=~/\.(\w+)$/);
+ return &Apache::loncommon::filemimetype($ending);
+}
+
sub handler {
my ($r) = @_;
@@ -186,8 +199,7 @@ sub handler {
'force_register' =>
$env{'form.register'}}).
&changed_js());
-
- } else {
+ } else { # render RSS
$r->print("\n".
"\nhttp://".$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.
$filterfeedname.'_rss.html'.
@@ -195,14 +207,30 @@ sub handler {
&mt('An RSS Feed provided by the LON-CAPA Learning Content Management System').
'');
}
+# Do we have stuff to store?
+ my $newid = &get_new_feed_id();
# Is this user for real?
my $homeserver=&Apache::lonnet::homeserver($uname,$udom);
if ($html) {
+# Any new feeds or renaming of feeds?
+ if ($edit) {
+# New feed?
+ if ($env{'form.namenewblog'}=~/\w/) {
+ &namefeed($env{'form.namenewblog'},$uname,$udom,$env{'form.namenewblog'});
+ }
+# Old feed that is being renamed?
+ if (($displayfeedname) && ($env{'form.newblogname'}=~/\w/)) {
+ if ($env{'form.newblogname'} ne $displayfeedname) {
+ &namefeed($feedname,$uname,$udom,$env{'form.newblogname'});
+ $displayfeedname=&displayfeedname($filename,$uname,$udom);
+ }
+ }
+ }
$r->print(&advertisefeeds($uname,$udom,$edit));
}
if ($homeserver eq 'no_host') {
$r->print(($html?'
':'').&mt('No feed available').($html?'
':''));
- } else {
+ } else { # is indeed a user
# Course or user?
my $name='';
if ($uname=~/^\d/) {
@@ -211,34 +239,63 @@ sub handler {
} else {
$name=&Apache::loncommon::nickname($uname,$udom);
}
- $r->print("\n".
- ($html?'
':'').
- &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name).
- ($html?'
'.($edit?'');
}
+ if ($displayfeedname) { # this is an existing feed
+# Anything 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'});
+ }
+ }
+ }
+ } #done storing
+
+ $r->print("\n".
+ ($html?'
':'').
+ &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name).
+ ($html?'
'.($edit?'':'').&Apache::loncommon::end_page():''."\n"));
+ } # was a real display feedname
+ $r->print(($html?''.&Apache::loncommon::end_page():''."\n"));
+ } # a real user
return OK;
-}
+} # end handler
1;
__END__