[LON-CAPA-cvs] cvs: loncom /xml scripttag.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 23 Mar 2006 23:47:57 -0000


albertel		Thu Mar 23 18:47:57 2006 EDT

  Modified files:              
    /loncom/xml	scripttag.pm 
  Log:
  - start_page
  - increasing support for webgrade
  
  
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.134 loncom/xml/scripttag.pm:1.135
--- loncom/xml/scripttag.pm:1.134	Thu Dec 15 14:00:36 2005
+++ loncom/xml/scripttag.pm	Thu Mar 23 18:47:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.134 2005/12/15 19:00:36 albertel Exp $
+# $Id: scripttag.pm,v 1.135 2006/03/23 23:47:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -118,14 +118,22 @@
 	    $Apache::lonxml::evaluate--;
 	    my (undef,undef,$udom,$uname)=&Apache::lonxml::whichuser();
 	    my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();
+	    my $start_page =
+		&Apache::loncommon::start_page('Script Vars', undef,
+					       {'only_body' => 1,
+						'bgcolor'   => '#FFFFFF',
+						'js_ready'  => 1,});
+	    my $end_page =
+		&Apache::loncommon::end_page({'js_ready' => 1,});
+
 	    $result.="<script type=\"text/javascript\">
 // <![CDATA[
-    function LONCAPA_scriptvars_".$uname."_".$udom."_"."$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('<html><head><title>Script Vars</title></head><body bgcolor=\"#FFFFFF\"><pre>";
+    function LONCAPA_scriptvars_".$uname."_".$udom."_"."$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page<pre>";
 	    my $listing=&Apache::run::dump($target,$safeeval);
 	    $listing=~s/\\/\\\\/g;
 	    $listing=~s/\'/\\\'/g;
 	    $result.=$listing;
-	    $result.= "</pre></body></html>');newWindow.document.close();newWindow.focus()}
+	    $result.= "</pre>$end_page');newWindow.document.close();newWindow.focus()}
 // ]]>
 </script><a href=\"javascript:LONCAPA_scriptvars_".$uname."_".$udom."_$Apache::lonxml::curdepth();void(0);\">Script Vars</a><br />";
 	}
@@ -334,7 +342,15 @@
     if (!$width) { $width='500'; }
     my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);
     if (!$height) { $height='200'; }
-    $result = "<script type=\"text/javascript\"> function LONCAPA_newwindow_$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=$width,height=$height,scrollbars=1');newWindow.document.open('text/html','replace');newWindow.document.writeln('<html><head><title>newwindow</title></head><body bgcolor=\"#FFFFFF\"> $output </body></html>');newWindow.document.close();}</script><a href=\"javascript:LONCAPA_newwindow_$Apache::lonxml::curdepth();void(0);\">$linktext</a>";
+
+    my $start_page =
+	&Apache::loncommon::start_page($linktext, undef,
+				       {'only_body' => 1,
+					'bgcolor'   => '#FFFFFF',
+					'js_ready'  => 1,});
+    my $end_page =
+	&Apache::loncommon::end_page({'js_ready' => 1,});
+    $result = "<script type=\"text/javascript\"> function LONCAPA_newwindow_$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=$width,height=$height,scrollbars=1');newWindow.document.open('text/html','replace');newWindow.document.writeln('$start_page $output $end_page');newWindow.document.close();}</script><a href=\"javascript:LONCAPA_newwindow_$Apache::lonxml::curdepth();void(0);\">$linktext</a>";
   } elsif ($target eq 'tex') {
       $result = '}';
   } else {
@@ -350,8 +366,8 @@
 
   $bodytext=Apache::run::evaluate($bodytext,$safeeval,$$parstack[$#$parstack]);
 
-  if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
-      $target eq 'tex' || $target eq 'analyze' ) {
+  if ($target eq 'web' ||  $target eq 'webgrade' || $target eq 'grade' 
+      || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze' ) {
     # FIXME this probably needs to be smart about construction vs.
     # non construction space.
     my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);