[LON-CAPA-cvs] cvs: loncom /interface loncommunicate.pm lonrss.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 13 Apr 2006 17:57:19 -0000
www Thu Apr 13 13:57:19 2006 EDT
Modified files:
/loncom/interface loncommunicate.pm lonrss.pm
Log:
Work in progress on making editor work
Index: loncom/interface/loncommunicate.pm
diff -u loncom/interface/loncommunicate.pm:1.31 loncom/interface/loncommunicate.pm:1.32
--- loncom/interface/loncommunicate.pm:1.31 Sat Apr 8 02:59:34 2006
+++ loncom/interface/loncommunicate.pm Thu Apr 13 13:57:17 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Communicate
#
-# $Id: loncommunicate.pm,v 1.31 2006/04/08 06:59:34 albertel Exp $
+# $Id: loncommunicate.pm,v 1.32 2006/04/13 17:57:17 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,7 +47,8 @@
'unr' =>
'User Notes, Records of Face-to-Face Discussions, and Critical Messages',
-'cbs' => 'Configure blocking of student communication during exams'
+'cbs' => 'Configure Blocking of Student Communication during Exams',
+'blog' => 'Edit to my Blogs'
);
my %help=();
@@ -65,6 +66,9 @@
<td bgcolor="#FFFFAA">
<b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>
</td></tr>
+<tr><td bgcolor="#FFFFAA">
+ <b><a href="/adm/$env{'user.domain'}/$env{'user.name'}/_rss.html">$lt{'blog'}</a></b>
+</td><td></td></tr>
END
if (($env{'request.course.id'}) &&
(
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.14 loncom/interface/lonrss.pm:1.15
--- loncom/interface/lonrss.pm:1.14 Thu Apr 13 12:23:03 2006
+++ loncom/interface/lonrss.pm Thu Apr 13 13:57:17 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# RSS Feeder
#
-# $Id: lonrss.pm,v 1.14 2006/04/13 16:23:03 www Exp $
+# $Id: lonrss.pm,v 1.15 2006/04/13 17:57:17 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,10 +36,14 @@
use Apache::lonlocal;
use Apache::lonhtmlcommon;
+my $feedcounter;
+
sub filterfeedname {
my $filename=shift;
$filename=~s/(\_rss\.html|\.rss)$//;
$filename=~s/\W//g;
+ $filename=~s/\_rssfeed$//;
+ $filename=~s/^nohist\_//;
return $filename;
}
@@ -100,20 +104,19 @@
sub rss_link {
my ($url) = @_;
return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|;
-
}
-{
- my $feedcounter;
- sub addentry {
- $feedcounter++;
- my $id=time.'00000'.$$.'00000'.$feedcounter;
- return &editentry($id,@_);
- }
+sub addentry {
+ $feedcounter++;
+ my $id=time.'00000'.$$.'00000'.$feedcounter;
+ return &editentry($id,@_);
}
sub editentry {
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);
&Apache::lonnet::put('nohist_all_rss_feeds',
{ &filterfeedname($filename) => &displayfeedname($filename,$uname,$udom) },
@@ -186,7 +189,6 @@
'force_register' =>
$env{'form.register'}}).
&changed_js());
-
} 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.'/'.
@@ -195,6 +197,24 @@
&mt('An RSS Feed provided by the LON-CAPA Learning Content Management System').
'</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?
my $homeserver=&Apache::lonnet::homeserver($uname,$udom);
if ($html) {
@@ -225,7 +245,7 @@
}
# Get feed items
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$/) {
my $id=$1;
if ($edit) {
@@ -235,10 +255,11 @@
'delete' => 'delete',
'store' => 'Store changes');
my %status=();
+ unless ($newsfeed{$id.'_status'}) { $newsfeed{$id.'_status'}='public'; }
$status{$newsfeed{$id.'_status'}}='checked="checked"';
$r->print(<<ENDEDIT);
<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>
@@ -246,7 +267,7 @@
<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 />
<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 />
@@ -277,7 +298,7 @@
}
}
}
- $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;
}
1;