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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 17 Aug 2007 21:24:21 -0000


albertel		Fri Aug 17 17:24:21 2007 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - add on change detection to the html editor (both views)
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.450 loncom/xml/lonxml.pm:1.451
--- loncom/xml/lonxml.pm:1.450	Fri Aug 17 16:34:31 2007
+++ loncom/xml/lonxml.pm	Fri Aug 17 17:24:21 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.450 2007/08/17 20:34:31 albertel Exp $
+# $Id: lonxml.pm,v 1.451 2007/08/17 21:24:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1371,6 +1371,11 @@
 	var editor=new HTMLArea("filecont",config);
 	editor.registerPlugin(FullPage);
 	editor.generate();
+	setTimeout(
+		   function () {
+		       HTMLArea._addEvents(editor._doc,
+					   ["keypress","mousedown"], unClean);
+		   },300);
     }
 </script>
 FULLPAGE
@@ -1402,15 +1407,17 @@
 <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
 BUTTONS
       $buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont');
+      my $textarea_events = &Apache::edit::element_change_detection();
+      my $form_events     = &Apache::edit::form_change_detection();
       my $editfooter=(<<ENDFOOTER);
 $initialize
 <hr />
 <a name="editsection" />
-<form method="post" name="xmledit">
+<form $form_events method="post" name="xmledit">
 $xml_help
 <input type="hidden" name="editmode" value="$lt{'ed'}" />
 $buttons<br />
-<textarea style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea>
+<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea>
 <br />$buttons
 <br />
 </form>
@@ -1540,7 +1547,8 @@
 		$options{'bgcolor'}   = '#FFFFFF';
 		$options{'only_body'} = 1;
 	    }
-	    my $start_page = &Apache::loncommon::start_page(undef,undef,
+	    my $js = &Apache::edit::js_change_detection();
+	    my $start_page = &Apache::loncommon::start_page(undef,$js,
 							    \%options);
 	    $result=$start_page.
 		&Apache::lonxml::message_location().'<h3>'.