[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages/annotator admannotations.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 10 Apr 2006 23:26:48 -0000


albertel		Mon Apr 10 19:26:48 2006 EDT

  Modified files:              
    /loncom/html/res/adm/pages/annotator	admannotations.pm 
  Log:
  - start_page
  
  
Index: loncom/html/res/adm/pages/annotator/admannotations.pm
diff -u loncom/html/res/adm/pages/annotator/admannotations.pm:1.19 loncom/html/res/adm/pages/annotator/admannotations.pm:1.20
--- loncom/html/res/adm/pages/annotator/admannotations.pm:1.19	Thu Apr  7 02:56:22 2005
+++ loncom/html/res/adm/pages/annotator/admannotations.pm	Mon Apr 10 19:26:48 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # This will take annotations and then plug them into a page.
 #
-# $Id: admannotations.pm,v 1.19 2005/04/07 06:56:22 albertel Exp $
+# $Id: admannotations.pm,v 1.20 2006/04/10 23:26:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,6 +31,7 @@
 
 use strict;
 use Apache::Constants qw(:common);
+use Apache::loncommon();
 use Apache::lonnet;
 
 # --------------------------------------------------------------Put annotation
@@ -58,11 +59,8 @@
     my $annotation=shift;
     if ($annotation=~/^error:/) { $annotation=''; }
     my $urlnew=shift;
-    return(<<END_HTML)
-<html>
-<head>
-<title>Annotations</title>
-<script>
+    my $js = << ENDJS;
+<script type="text/javascript">
 var timeout;
 
 function changed() {
@@ -74,10 +72,19 @@
     timeout=setTimeout('changed();','1000');
 }
 </script>
-</head>
-<body BGCOLOR="#555555" 
- onLoad="timeout=setTimeout('changed()','1000')"
- onUnload='clearTimeout(timeout);'>
+ENDJS
+
+    my %load_items = ('onload'   => "timeout=setTimeout('changed()','1000')",
+		      'onunload' => 'clearTimeout(timeout);');
+    my $start_page =
+	&Apache::loncommon::start_page('Annotations',$js,
+				       {'only_body'   => 1,
+					'add_entries' => \%load_items,});
+
+    my $end_page =
+        &Apache::loncommon::end_page();
+    return(<<END_HTML)
+$start_page
  <center>
   <FORM name="annotInfo" method="post" action="/adm/annotations">
     <TEXTAREA NAME="annotation" WRAP=ON ROWS=12 COLS=36>$annotation</TEXTAREA><br>
@@ -89,21 +96,20 @@
     <INPUT TYPE=button name="close" value="Close (no save)" onClick="javascript:window.close();">
   </FORM>
  </center>
-</body>
-</html>
+$end_page
 END_HTML
 }
 
 # ----------------------------------------------------Constructs error window
 
 sub construct_error {
-  my $annot_error=shift;
-  my $button_name=shift;
+  my ($annot_error,$button_name) = @_;
+  my $start_page = &Apache::loncommon::start_page('Annotations',undef,
+						  {'only_body'   => 1,});
+  my $end_page =  &Apache::loncommon::end_page();
+
   return(<<END_HTML2)
-<html><head>
-<title>Annotations</title>
-</head>
-<body BGCOLOR="#555555">
+$start_page
  <center>
   <FORM name="annotInfo" method="post" action="/adm/annotations">
 <table bgcolor="#FFFFFF" width="100%" height="90%" align="center">
@@ -121,8 +127,7 @@
     <INPUT TYPE=button name="close" value="Close" onClick="javascript:window.close();">
   </FORM>
  </center>
-</body>
-</html>
+$end_page
 END_HTML2
 }