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

www lon-capa-cvs@mail.lon-capa.org
Fri, 04 Jun 2004 14:03:58 -0000


www		Fri Jun  4 10:03:58 2004 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Work on making fullpage HTMLArea - still need to install the plugin.
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.320 loncom/xml/lonxml.pm:1.321
--- loncom/xml/lonxml.pm:1.320	Thu Jun  3 10:28:39 2004
+++ loncom/xml/lonxml.pm	Fri Jun  4 10:03:57 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.320 2004/06/03 14:28:39 www Exp $
+# $Id: lonxml.pm,v 1.321 2004/06/04 14:03:57 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1094,21 +1094,20 @@
 }
 
 sub createnewhtml {
-  my $filecontents=(<<SIMPLECONTENT);
+    my $title=&mt('Title of document goes here');
+    my $body=&mt('Body of document goes here');
+    my $filecontents=(<<SIMPLECONTENT);
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml/11/DTD/xhtml11.dtd">
 <html>
 <head>
-<title>
-                           Title of Document Goes Here
-</title>
+<title>$title</title>
 </head>
 <body bgcolor="#FFFFFF">
-
-                           Body of Document Goes Here
-
+$body
 </body>
 </html>
 SIMPLECONTENT
-  return $filecontents;
+    return $filecontents;
 }
 
 sub createnewsty {
@@ -1129,8 +1128,24 @@
       $filecontents = &HTML::Entities::encode($filecontents,'<>&"');
 #      my $editheader='<a href="#editsection">Edit below</a><hr />';
       my $xml_help = '';
+      my $activate='';
+      my $initialize='';
       if ($filetype eq 'html') {
-	  $xml_help=Apache::loncommon::helpLatexCheatsheet();
+	  $initialize=&Apache::lonhtmlcommon::htmlareaheaders().(<<FULLPAGE);
+<script type="text/javascript">
+    HTMLArea.loadPlugin("FullPage");
+
+    function initDocument() {
+	var editor=new HTMLArea("editor");
+	editor.registerPlugin(FullPage);
+	editor.generate();
+    }
+</script>
+FULLPAGE
+          $result=~s/\<body([^\>]*)\>/\<body onload="initDocument()" $1\>/i;
+	  $xml_help=&Apache::loncommon::helpLatexCheatsheet();
+#FIXME: need to install FullPage plugin during install
+# 	  $activate=&Apache::lonhtmlcommon::htmlareaactive();
       }
       my $cleanbut = '';
       if ($filetype eq 'html') {
@@ -1147,17 +1162,20 @@
 <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
 BUTTONS
       my $editfooter=(<<ENDFOOTER);
+$initialize
 <hr />
 <a name="editsection" />
 <form method="post">
 $xml_help
 <input type="hidden" name="editmode" value="$lt{'ed'}" />
 $buttons<br />
-<textarea cols="80" rows="40" name="filecont">$filecontents</textarea>
+<textarea cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea>
 <br />$buttons
 <br />
 </form>
 $titledisplay
+$activate
+</body>
 ENDFOOTER
 #      $result=~s/(\<body[^\>]*\>)/$1$editheader/is;
       $result=~s/(\<\/body\>)/$editfooter/is;