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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 10 Sep 2007 19:46:58 -0000


albertel		Mon Sep 10 15:46:58 2007 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - adding cstr headers on to .sty file when editing in CSTR
  - enable the autoresizing textarea to editing .sty files
  
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.455 loncom/xml/lonxml.pm:1.456
--- loncom/xml/lonxml.pm:1.455	Fri Aug 31 15:32:54 2007
+++ loncom/xml/lonxml.pm	Mon Sep 10 15:46:57 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.455 2007/08/31 19:32:54 albertel Exp $
+# $Id: lonxml.pm,v 1.456 2007/09/10 19:46:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1357,13 +1357,13 @@
       my $initialize='';
       my $textarea_id = 'filecont';
       my ($add_to_onload, $add_to_onresize);
-      if ($filetype eq 'html') {
-	  my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons();
-	  $initialize=&Apache::lonhtmlcommon::spellheader();
-	  if (!&Apache::lonhtmlcommon::htmlareablocked() &&
-	      &Apache::lonhtmlcommon::htmlareabrowser()) {
-	      $textarea_id .= '_htmlarea';
-	      $initialize.=(<<FULLPAGE);
+      my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons();
+      $initialize=&Apache::lonhtmlcommon::spellheader();
+      if ($filetype eq 'html' 
+	  && (!&Apache::lonhtmlcommon::htmlareablocked() &&
+	      &Apache::lonhtmlcommon::htmlareabrowser())) {
+	  $textarea_id .= '_htmlarea';
+	  $initialize.=(<<FULLPAGE);
 <script type="text/javascript">
 $addbuttons
 
@@ -1383,8 +1383,8 @@
     }
 </script>
 FULLPAGE
-          } else {
-	      $initialize.=(<<FULLPAGE);
+      } else {
+	  $initialize.=(<<FULLPAGE);
 <script type="text/javascript">
 $addbuttons
     function initDocument() {
@@ -1392,9 +1392,12 @@
     }
 </script>
 FULLPAGE
-	  }
-	  $add_to_onload = 'initDocument();';
-	  $add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
+      }
+
+      $add_to_onload = 'initDocument();';
+      $add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
+
+      if ($filetype eq 'html') {
 	  $xml_help=&Apache::loncommon::helpLatexCheatsheet();
       }
 
@@ -1409,7 +1412,7 @@
       my $buttons=(<<BUTTONS);
 $cleanbut
 <input type="submit" name="discardview" accesskey="d"  value="$lt{'dv'}" />
-<input type="submit" name="Undo" accesskey="u"  value="$lt{'un'}" /><hr>
+<input type="submit" name="Undo" accesskey="u"  value="$lt{'un'}" /><hr />
 <input type="submit" name="savethisfile" accesskey="s"  value="$lt{'st'}" />
 <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
 BUTTONS
@@ -1539,9 +1542,17 @@
 	    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 						    ['rawmode']);
 	    if ($env{'form.rawmode'}) { $result = $filecontents; }
+	    if ($filetype eq 'sty') {
+		my %options = ('bgcolor' => '#FFFFFF');
+		$result = 
+		    &Apache::loncommon::start_page(undef,undef,\%options).
+		    &Apache::londefdef::edit_controls().
+		    $result.
+		    &Apache::loncommon::end_page();
+	    }
 	}
     }
-    
+
 #
 # Edit action? Insert editing commands
 #