Diff for /loncom/interface/lonrss.pm between versions 1.5 and 1.6

version 1.5, 2005/11/20 02:12:35 version 1.6, 2005/11/20 19:37:44
Line 74  sub renamefeed { Line 74  sub renamefeed {
 }  }
   
 sub advertisefeeds {  sub advertisefeeds {
     my ($uname,$udom)=@_;      my ($uname,$udom,$edit)=@_;
     my $feeds='';      my $feeds='';
     my %feednames=&Apache::lonnet::dump('nohist_all_rss_feeds',$udom,$uname);      my %feednames=&Apache::lonnet::dump('nohist_all_rss_feeds',$udom,$uname);
       my $mode='public';
       if ($edit) {
    $mode='adm';
       }
     foreach my $feed (sort(keys(%feednames))) {      foreach my $feed (sort(keys(%feednames))) {
  if ($feed!~/^error\:/) {   if ($feed!~/^error\:/) {
     my $feedurl='feed://'.$ENV{'HTTP_HOST'}.'/public/'.$udom.'/'.$uname.'/'.$feed.'.rss';      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.='<li>'.$feednames{$feed}.      $feeds.='<li>'.$feednames{$feed}.
  '<br />HTML: <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.   '<br />'.($edit?&mt('Edit'):'HTML').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.
  '<br />RSS: <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a></li>';   ($edit?'':'<br />RSS: <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a>').'</li>';
  }   }
     }      }
     if ($feeds) {      if ($feeds) {
Line 163  sub handler { Line 167  sub handler {
     if ($html) {      if ($html) {
  $r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag   $r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag
                   ($displayfeedname,'','','',$udom,                    ($displayfeedname,'','','',$udom,
                    $env{'form.register'}));                     $env{'form.register'}).<<ENDSCRIPT);
   <script>
       function changed(tform,id) {
           tform.elements[id+"_modified"].checked=true;
       }
   </script>
   ENDSCRIPT
     } 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 173  sub handler { Line 183  sub handler {
   '</description>');    '</description>');
     }      }
 # 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) {
    $r->print(&advertisefeeds($uname,$udom,$edit));
       } 
     if ($homeserver eq 'no_host') {      if ($homeserver eq 'no_host') {
  $r->print(($html?'<h3>':'<title>').&mt('No feed available').($html?'</h3>':'</title>'));   $r->print(($html?'<h3>':'<title>').&mt('No feed available').($html?'</h3>':'</title>'));
     } else {      } else {
Line 188  sub handler { Line 201  sub handler {
         $r->print("\n".          $r->print("\n".
   ($html?'<h3>':'<title>').    ($html?'<h3>':'<title>').
   &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name).    &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name).
   ($html?'</h3>'.($edit?'<form method="post">':'').'<ul>':'</title>'));    ($html?'</h3>'.($edit?'<form method="post"><br />'.
     &mt('Name of blog/journal').
     ': <input type="text" size="50" name="newblogname" value="'.
     $displayfeedname.'" />':'').'<ul>':'</title>'));
 # Render private items?  # Render private items?
         my $viewpubliconly=1;          my $viewpubliconly=1;
         if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) {          if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) {
Line 203  sub handler { Line 219  sub handler {
     my %lt=&Apache::lonlocal::texthash('public' => 'public',      my %lt=&Apache::lonlocal::texthash('public' => 'public',
        'private' => 'private',         'private' => 'private',
        'hidden' => 'hidden',         'hidden' => 'hidden',
        'delete' => 'delete');         'delete' => 'delete',
          'store' => 'Store changes');
     my %status=();      my %status=();
     $status{$newsfeed{$id.'_status'}}='checked="checked"';      $status{$newsfeed{$id.'_status'}}='checked="checked"';
     $r->print(<<ENDEDIT);      $r->print(<<ENDEDIT);
 <li>  <li>
 <input name='$id\_modified' type='hidden' value='0' />  <label><input name='$id\_modified' type='checkbox' /> $lt{'store'}</label>
 <label><input name='$id\_status' type="radio" value="public" $status{'public'}> $lt{'public'}</label>  &nbsp;&nbsp;
   <label><input name='$id\_status' type="radio" value="public" $status{'public'} onClick="changed(this.form,'$id');" /> $lt{'public'}</label>
 &nbsp;&nbsp;  &nbsp;&nbsp;
 <label><input name='$id\_status' type="radio" value="private" $status{'private'}> $lt{'private'}</label>  <label><input name='$id\_status' type="radio" value="private" $status{'private'} onClick="changed(this.form,'$id');" /> $lt{'private'}</label>
 &nbsp;&nbsp;  &nbsp;&nbsp;
 <label><input name='$id\_status' type="radio" value="hidden" $status{'hidden'}> $lt{'hidden'}</label>  <label><input name='$id\_status' type="radio" value="hidden" $status{'hidden'} onClick="changed(this.form,'$id');" /> $lt{'hidden'}</label>
 &nbsp;&nbsp;  &nbsp;&nbsp;
 <label><input name='$id\_status' type="radio" value="delete"> $lt{'delete'}</label>  <label><input name='$id\_status' type="radio" value="delete" onClick="changed(this.form,'$id');" /> $lt{'delete'}</label>
 <br />  <br />
 <input name='$id\_title' type='text' size='80' value='$newsfeed{$id.'_title'}' /><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">$newsfeed{$id.'_description'}</textarea>  <textarea name='$id\_description' rows="6" cols="80" onChange="changed(this.form,'$id');">$newsfeed{$id.'_description'}</textarea><br />
 </li>  <input name='$id\_link' type='text' size='80' value='$newsfeed{$id.'_link'}' onChange="changed(this.form,'$id');" />
   <hr /></li>
 ENDEDIT  ENDEDIT
  } else {   } else {
     if (($newsfeed{$id.'_status'} ne 'public') && ($viewpubliconly)) { next; }      if (($newsfeed{$id.'_status'} ne 'public') && ($viewpubliconly)) { next; }
Line 245  ENDEDIT Line 264  ENDEDIT
     }      }
  }   }
     }      }
     $r->print("\n".($html?'</ul>'.($edit?'</form>':'').'</body></html>':'</channel></rss>'."\n"));      $r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').'</body></html>':'</channel></rss>'."\n"));
     return OK;      return OK;
 }   } 
 1;  1;

Removed from v.1.5  
changed lines
  Added in v.1.6


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