[LON-CAPA-cvs] cvs: loncom /interface lonrss.pm
www
lon-capa-cvs@mail.lon-capa.org
Sun, 20 Nov 2005 19:37:44 -0000
www Sun Nov 20 14:37:44 2005 EDT
Modified files:
/loncom/interface lonrss.pm
Log:
A little more work on editing interface
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.5 loncom/interface/lonrss.pm:1.6
--- loncom/interface/lonrss.pm:1.5 Sat Nov 19 21:12:35 2005
+++ loncom/interface/lonrss.pm Sun Nov 20 14:37:44 2005
@@ -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 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.='<li>'.$feednames{$feed}.
- '<br />HTML: <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.
- '<br />RSS: <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a></li>';
+ '<br />'.($edit?&mt('Edit'):'HTML').': <a href="'.$htmlurl.'"><tt>'.$htmlurl.'</tt></a>'.
+ ($edit?'':'<br />RSS: <a href="'.$feedurl.'"><tt>'.$feedurl.'</tt></a>').'</li>';
}
}
if ($feeds) {
@@ -163,7 +167,13 @@
if ($html) {
$r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag
($displayfeedname,'','','',$udom,
- $env{'form.register'}));
+ $env{'form.register'}).<<ENDSCRIPT);
+<script>
+ function changed(tform,id) {
+ tform.elements[id+"_modified"].checked=true;
+ }
+</script>
+ENDSCRIPT
} else {
$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.'/'.
@@ -173,7 +183,10 @@
'</description>');
}
# 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?'<h3>':'<title>').&mt('No feed available').($html?'</h3>':'</title>'));
} else {
@@ -188,7 +201,10 @@
$r->print("\n".
($html?'<h3>':'<title>').
&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?
my $viewpubliconly=1;
if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) {
@@ -203,23 +219,26 @@
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);
<li>
-<input name='$id\_modified' type='hidden' value='0' />
-<label><input name='$id\_status' type="radio" value="public" $status{'public'}> $lt{'public'}</label>
+<label><input name='$id\_modified' type='checkbox' /> $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="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>
-<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>
-<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 />
-<input name='$id\_title' type='text' size='80' value='$newsfeed{$id.'_title'}' /><br />
-<textarea name='$id\_description' rows="6" cols="80">$newsfeed{$id.'_description'}</textarea>
-</li>
+<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 />
+<input name='$id\_link' type='text' size='80' value='$newsfeed{$id.'_link'}' onChange="changed(this.form,'$id');" />
+<hr /></li>
ENDEDIT
} else {
if (($newsfeed{$id.'_status'} ne 'public') && ($viewpubliconly)) { next; }
@@ -245,7 +264,7 @@
}
}
}
- $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;
}
1;