[Mozile] Newbie - how to save the changed pages

lpoppleton lpoppleton at yahoo.com
Tue Apr 15 15:57:25 PDT 2008


Thanks James.  I am beginning to write and understand php, but javascript is
a little beyond me and I only understand AJAX in a vague way.  Should I just
give up or do you think I can get this working with few programming skills? 
In the following clip from basic.html, I see that most of the lines are
commented out.
For what I am attempting to do, which lines would I need to uncomment?

<script type="text/javascript" src="../mozile.js"></script>
<script type="text/javascript">
mozile.root = "../";

// LOAD MODULES
// Load desired modules. They'll take care of their own requirements.
//mozile.require("mozile.dom");
//mozile.require("mozile.xml");
//mozile.require("mozile.xpath");
//mozile.require("mozile.util");
//mozile.require("mozile.edit");
//mozile.require("mozile.event");
//mozile.require("mozile.save");
//mozile.require("mozile.gui");
//mozile.require("mozile.gui.htmlToolbar");

// MODULE CONFIG
// Configure the loaded modules.
//mozile.useDesignMode = false;
//mozile.defaultNS = "http://www.w3.org/1999/xhtml";
//mozile.help = [mozile.root, "doc", "html",
"index.html"].join(mozile.filesep);
mozile.debug.alertLevel = "inform";
mozile.debug.logLevel = "debug";
mozile.alternateSpace = "\u00A0";

// SAVE CONFIG
// Configure the save system.
//mozile.save.target = document;
//mozile.save.format = null;
//mozile.save.warn = true;
//mozile.save.method = mozile.save.post;
//mozile.save.post.async = true;
//mozile.save.post.uri = "http://somesite.com/save_data.php?id=Mozile";
//mozile.save.post.user = null;
//mozile.save.post.password = null;
//mozile.save.post.showResponse = false;

// COMMANDS
// Run commands to finish configuring Mozile.
//mozile.editDocument();
//mozile.editAllText(false);

// Wait until the document is loaded before executing these commands.
window.onload = function() {
	//mozile.editElement("editor");
	mozile.editElements("editor");
	mozile.useSchema("../lib/xhtml.rng");
	//mozile.save.target = document.getElementById("editor");
}
		</script>


James A. Overton wrote:
> 
> Hi,
> 
> The reason that the docs are thin on this point is that every server  
> configuration is different. Mozile provides a mozile.save.Module class  
> which is meant to be customized, as well as two sample  
> implementations. The one you are seeing is the default, which just  
> displays the source text. The other uses XMLHttpRequest and is called  
> mozile.save.post, and the basic.html page shows a sample  
> configuration. You can see the code here:
> http://mozile.mozdev.org/0.8/src/save.js
> 
> Dealing with the data on the server-side is like any AJAX application.  
> If you're using PHP, I think something like this will get you started  
> (it's been a while...):
> 
> <?php
> // Get POSTed data.
> $post_data = file_get_contents('php://input');
> //Strip CR/LF pair from beginning and end of data. (Might not be  
> needed.)
> $post_data = substr($post_data, 2, strlen($post_data)-4);
> // Save to file.
> $fp1 = fopen( "temp.html", "wb" );
> fwrite($fp1, $post_data,  strlen($post_data));
> ?>
> 
> Local save is complicated in Mozilla and I never got around to trying  
> it in IE, so it is not implemented in Mozile 0.8. Mozile 0.6 and 0.7  
> had more developed save systems, but they worked differently.
> 
> Hopefully that will get you started. Let me know if you run into more  
> problems.
> 
> James
> 
> 
> _______________________________________________
> Mozile mailing list
> Mozile at mozdev.org
> https://www.mozdev.org/mailman/listinfo/mozile
> 
> 

-- 
View this message in context: http://www.nabble.com/Newbie---how-to-save-the-changed-pages-tp16661372p16713253.html
Sent from the MozDev - mozile mailing list archive at Nabble.com.



More information about the Mozile mailing list