--- loncom/interface/lonrss.pm 2005/11/20 02:12:35 1.5 +++ loncom/interface/lonrss.pm 2005/11/20 19:37:44 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # RSS Feeder # -# $Id: lonrss.pm,v 1.5 2005/11/20 02:12:35 www Exp $ +# $Id: lonrss.pm,v 1.6 2005/11/20 19:37:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,16 +74,20 @@ sub renamefeed { } sub advertisefeeds { - my ($uname,$udom)=@_; + my ($uname,$udom,$edit)=@_; my $feeds=''; my %feednames=&Apache::lonnet::dump('nohist_all_rss_feeds',$udom,$uname); + my $mode='public'; + if ($edit) { + $mode='adm'; + } foreach my $feed (sort(keys(%feednames))) { if ($feed!~/^error\:/) { my $feedurl='feed://'.$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss'; - my $htmlurl='http://'.$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.$feed.'_rss.html'; + my $htmlurl='http://'.$ENV{'HTTP_HOST'}.'/'.$mode.'/'.$udom.'/'.$uname.'/'.$feed.'_rss.html'; $feeds.='
  • '.$feednames{$feed}. - '
    HTML: '.$htmlurl.''. - '
    RSS: '.$feedurl.'
  • '; + '
    '.($edit?&mt('Edit'):'HTML').': '.$htmlurl.''. + ($edit?'':'
    RSS: '.$feedurl.'').''; } } if ($feeds) { @@ -163,7 +167,13 @@ sub handler { if ($html) { $r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag ($displayfeedname,'','','',$udom, - $env{'form.register'})); + $env{'form.register'}).< + function changed(tform,id) { + tform.elements[id+"_modified"].checked=true; + } + +ENDSCRIPT } else { $r->print("\n". "\nhttp://".$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'. @@ -173,7 +183,10 @@ sub handler { ''); } # Is this user for real? - my $homeserver=&Apache::lonnet::homeserver($uname,$udom); + my $homeserver=&Apache::lonnet::homeserver($uname,$udom); + if ($html) { + $r->print(&advertisefeeds($uname,$udom,$edit)); + } if ($homeserver eq 'no_host') { $r->print(($html?'

    ':'').&mt('No feed available').($html?'</h3>':'')); } else { @@ -188,7 +201,10 @@ sub handler { $r->print("\n". ($html?'

    ':''). &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name). - ($html?'</h3>'.($edit?'<form method="post">':'').'<ul>':'')); + ($html?'

    '.($edit?'

    '. + &mt('Name of blog/journal'). + ': ':'').'
      ':'')); # Render private items? my $viewpubliconly=1; if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { @@ -203,23 +219,26 @@ sub handler { my %lt=&Apache::lonlocal::texthash('public' => 'public', 'private' => 'private', 'hidden' => 'hidden', - 'delete' => 'delete'); + 'delete' => 'delete', + 'store' => 'Store changes'); my %status=(); $status{$newsfeed{$id.'_status'}}='checked="checked"'; $r->print(< - - + +   +    - +    - +    - +
      -
      - - +
      +
      + +
      ENDEDIT } else { if (($newsfeed{$id.'_status'} ne 'public') && ($viewpubliconly)) { next; } @@ -245,7 +264,7 @@ ENDEDIT } } } - $r->print("\n".($html?'
    '.($edit?'
    ':'').'':'
    '."\n")); + $r->print("\n".($html?''.($edit?'':'').'':''."\n")); return OK; } 1;