[LON-CAPA-cvs] cvs: loncom /interface lonrss.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 11 May 2006 02:08:48 -0000


www		Wed May 10 22:08:48 2006 EDT

  Modified files:              
    /loncom/interface	lonrss.pm 
  Log:
  Start a new blog
  
  
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.18 loncom/interface/lonrss.pm:1.19
--- loncom/interface/lonrss.pm:1.18	Wed May 10 11:52:11 2006
+++ loncom/interface/lonrss.pm	Wed May 10 22:08:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # RSS Feeder
 #
-# $Id: lonrss.pm,v 1.18 2006/05/10 15:52:11 www Exp $
+# $Id: lonrss.pm,v 1.19 2006/05/11 02:08:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,7 @@
     return $name;
 }
 
-sub renamefeed {
+sub namefeed {
     my ($rawname,$uname,$udom,$newname)=@_;
     return &Apache::lonnet::put('nohist_all_rss_feeds',
 				{ &filterfeedname($rawname) => $newname },
@@ -212,6 +212,20 @@
 # 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') {
@@ -225,6 +239,13 @@
 	} else {
 	    $name=&Apache::loncommon::nickname($uname,$udom);
 	}
+# Add a new feed
+        if (($html) && ($edit)) {
+	    $r->print('<form method="post">');
+            $r->print(&mt('Name for New Blog').": <input type='text' size='40' name='namenewblog' />");
+	    $r->print('<input type="submit" value="'.&mt('Start a New Blog').'" />');
+	    $r->print('</form>');
+	}
         if ($displayfeedname) { # this is an existing feed
 # Anything to store?
 	    if ($edit) {
@@ -241,14 +262,10 @@
 			}
 		    }
 		}
-		if ($env{'form.newblogname'} ne $displayfeedname) {
-		    &Apache::lonnet::put('nohist_all_rss_feeds',{ $filterfeedname => $env{'form.newblogname'} },$udom,$uname);
-		    $displayfeedname=&displayfeedname($filename,$uname,$udom);
-		}
 	    } #done storing
 
 	    $r->print("\n".
-		      ($html?'<h3>':'<title>').
+		      ($html?'<hr /><h3>':'<title>').
 		      &mt('LON-CAPA Feed "[_1]" for [_2]',$displayfeedname,$name).
 		      ($html?'</h3>'.($edit?'<form method="post"><br />'.
 				      &mt('Name of blog/journal').