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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 15 Mar 2006 21:43:20 -0000


albertel		Wed Mar 15 16:43:20 2006 EDT

  Modified files:              
    /loncom/interface	lonrss.pm 
  Log:
  - use general page start functions
  
  
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.7 loncom/interface/lonrss.pm:1.8
--- loncom/interface/lonrss.pm:1.7	Tue Nov 22 11:16:53 2005
+++ loncom/interface/lonrss.pm	Wed Mar 15 16:43:20 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # RSS Feeder
 #
-# $Id: lonrss.pm,v 1.7 2005/11/22 16:16:53 albertel Exp $
+# $Id: lonrss.pm,v 1.8 2006/03/15 21:43:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -139,8 +139,19 @@
     }
 }
 
+sub changed_js {
+
+    return <<ENDSCRIPT;
+<script type="text/javascript">
+    function changed(tform,id) {
+        tform.elements[id+"_modified"].checked=true;
+    }
+</script>
+ENDSCRIPT    
+}
+
 sub handler {
-    my $r = shift;
+    my ($r) = @_;
 
     my $edit=0;
     my $html=0;
@@ -166,15 +177,12 @@
     my $feedname=&feedname($filename);
     my $displayfeedname=&displayfeedname($filename,$uname,$udom);
     if ($html) {
-	$r->print(&Apache::lonxml::xmlbegin().&Apache::loncommon::bodytag
-                  ($displayfeedname,'','','',$udom,
-                   $env{'form.register'}).<<ENDSCRIPT);
-<script>
-    function changed(tform,id) {
-        tform.elements[id+"_modified"].checked=true;
-    }
-</script>
-ENDSCRIPT
+	$r->print(&Apache::lonxml::xmlbegin().
+		  &Apache::loncommon::head($displayfeedname).
+		  &Apache::loncommon::bodytag($displayfeedname,'','','',$udom,
+					      $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.'/'.
@@ -265,7 +273,7 @@
 	    }
 	}
     }
-    $r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').'</body></html>':'</channel></rss>'."\n"));
+    $r->print("\n".($html?'</ul>'.($edit?'<input type="submit" value="'.&mt('Store Marked Changes').'" /></form>':'').&Apache::loncommon::end_page():'</channel></rss>'."\n"));
     return OK;
 } 
 1;