cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jer...@apache.org
Subject svn commit: r293107 - in /cocoon/blocks: ajax/trunk/java/org/apache/cocoon/ajax/resources/js/ ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/ forms/trunk/java/org/apache/cocoon/forms/resources/ forms/trunk/java/org/apache/cocoon/forms/resource...
Date Sun, 02 Oct 2005 13:09:28 GMT
Author: jeremy
Date: Sun Oct  2 06:09:18 2005
New Revision: 293107

URL: http://svn.apache.org/viewcvs?rev=293107&view=rev
Log:
Added JavaScript NameSpacing to the CForms and BrowserUpdater Classes, to avoid conflict between
our stuff and the Libraries we are using.

Modified:
    cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/browserupdater.js
    cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
    cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
    cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/js/cforms.js

Modified: cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/browserupdater.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/browserupdater.js?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/browserupdater.js (original)
+++ cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/browserupdater.js Sun
Oct  2 06:09:18 2005
@@ -17,8 +17,8 @@
 /* @version $Id$ */
 
 
-BrowserUpdater = Class.create();
-Object.extend(Object.extend(BrowserUpdater.prototype, Ajax.Request.prototype), {
+Cocoon.Ajax.BrowserUpdater = Class.create();
+Object.extend(Object.extend(Cocoon.Ajax.BrowserUpdater.prototype, Ajax.Request.prototype),
{
   initialize: function(url, options) {
     this.transport = Ajax.getTransport();
     this.setOptions(options);
@@ -48,7 +48,7 @@
 										// No DOM2 support (IE6)
 										handler = node.nodeName.replace(/.*:/, "");
 								}
-								var handlerFunc = BrowserUpdater.handlers[handler];
+								var handlerFunc = Cocoon.Ajax.BrowserUpdater.Handlers[handler];
 								if (handlerFunc) {
 										handlerFunc(node);
 								} else {
@@ -109,7 +109,7 @@
 	
 });
 
-BrowserUpdater.handlers = {
+Cocoon.Ajax.BrowserUpdater.Handlers = {
     replace :  function(element) {
         var id = element.getAttribute("id");
         if (!id) {
@@ -133,8 +133,8 @@
         // Ensure the new node has the correct id
         newElement.setAttribute("id", id);
         
-        if (BrowserUpdater.highlight) {
-           BrowserUpdater.highlight(newElement);
+        if (Cocoon.Ajax.BrowserUpdater.highlight) {
+           Cocoon.Ajax.BrowserUpdater.highlight(newElement);
         }
     }
 
@@ -234,7 +234,7 @@
     return c;
 }
 
-BrowserUpdater.highlight = Fader.fade;
+Cocoon.Ajax.BrowserUpdater.highlight = Fader.fade;
 
 //-------------------------------------------------------------------------------------------------
 // Blinker used to highlight page areas that have been updated

Modified: cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js (original)
+++ cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js Sun Oct
 2 06:09:18 2005
@@ -37,7 +37,9 @@
       }
     }
     alert("Could not load Cocoon Ajax libraries");
-  }
+  },
+  CForms: new Object(),
+  Ajax: new Object()
 }
 
 Cocoon.load();

Modified: cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
(original)
+++ cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
Sun Oct  2 06:09:18 2005
@@ -17,8 +17,8 @@
 /* @version $Id$ */
 
 
-TimedBrowserUpdater = Class.create();
-TimedBrowserUpdater.prototype = Object.extend(new Ajax.Base(), {
+Cocoon.Ajax.TimedBrowserUpdater = Class.create();
+Cocoon.Ajax.TimedBrowserUpdater.prototype = Object.extend(new Ajax.Base(), {
   initialize: function(url, options) {
     this.setOptions(options);
     this.onComplete = this.options.onComplete;
@@ -62,7 +62,7 @@
   onTimerEvent: function() {
     if (this.populated) {
     	this.options.postBody = this.buildQueryString();
-    	this.updater = new BrowserUpdater(this.url, this.options);
+    	this.updater = new Cocoon.Ajax.BrowserUpdater(this.url, this.options);
     	    self.status = "Timer fired event";
     } else {
     	this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency *
1000);
@@ -102,8 +102,8 @@
 	
 });
 
-TimedBrowserUpdater.Console = Class.create();
-TimedBrowserUpdater.Console.prototype = Object.extend(new Ajax.Base(), {
+Cocoon.Ajax.TimedBrowserUpdater.Console = Class.create();
+Cocoon.Ajax.TimedBrowserUpdater.Console.prototype = Object.extend(new Ajax.Base(), {
 	initialize: function(client, options) {
 		this.expires = 604800000; // cookie expiry, 1 week
 		this.client = client;
@@ -209,10 +209,10 @@
 
 });
 
-TimedBrowserUpdaterInstance = new TimedBrowserUpdater(
+TimedBrowserUpdaterInstance = new Cocoon.Ajax.TimedBrowserUpdater(
 	document.location, 
 	{
 		method: 'post', 
-		onFailure: BrowserUpdater.handleError
+		onFailure: Cocoon.Ajax.BrowserUpdater.handleError
 	}
 );

Modified: cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
(original)
+++ cocoon/blocks/ajax/trunk/java/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
Sun Oct  2 06:09:18 2005
@@ -169,7 +169,7 @@
 				</table>
 			</form>
 			<script language="Javascript">
-				TimedBrowserConsole = new TimedBrowserUpdater.Console (
+				TimedBrowserConsole = new Cocoon.Ajax.TimedBrowserUpdater.Console (
 					TimedBrowserUpdaterInstance,
 					{
 						frequencyControl: $("tbuFrequencySelector"),

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
(original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
Sun Oct  2 06:09:18 2005
@@ -538,7 +538,7 @@
       <!-- hidden field to store the submit id -->
       <div><input type="hidden" name="forms_submit_id"/></div>
       <xsl:if test="@ajax = 'true'">
-        <script script="text/javascript">CForms.ajax = true;</script>
+        <script script="text/javascript">Cocoon.CForms.ajax = true;</script>
       </xsl:if>
       <xsl:apply-templates/>
       

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/js/cforms.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/js/cforms.js?rev=293107&r1=293106&r2=293107&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/js/cforms.js (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/js/cforms.js Sun Oct
 2 06:09:18 2005
@@ -19,14 +19,18 @@
  * The CForms class holds all forms-related properties and methods.
  */
 
-CForms = {
+// in case the cocoon-ajax.js lib is not loaded
+if (!Cocoon) Cocoon = new Object();
+if (!Cocoon.CForms) Cocoon.CForms = new Object();
+
+Cocoon.CForms = {
     ajax : false // default mode is full page update
 };
 
 /**
  * Submits a form. If ajax mode is on and the browser is ajax-aware, the page isn't reloaded
  */
-CForms.submitForm = function(element, name) {
+Cocoon.CForms.submitForm = function(element, name) {
 
     if (name == undefined) {
         name = element.name;
@@ -40,7 +44,7 @@
         // FIXME: programmatically submitting the form doesn't trigger onsubmit ? (both in
IE and Moz)
         forms_onsubmit();
         
-        if (CForms.ajax && BrowserUpdater != null) {
+        if (Cocoon.CForms.ajax && Cocoon.Ajax.BrowserUpdater != null) {
         
         	// Provide feedback that something is happening.
         	document.body.style.cursor = "wait";
@@ -49,12 +53,12 @@
 					if (! uri) uri = form.action;
 					if ( uri == "" ) uri = document.location;
         
-        	var req = new BrowserUpdater(
+        	var req = new Cocoon.Ajax.BrowserUpdater(
         		uri, 
 						{
 							method: 'post', 
-							postBody: CForms._buildQueryString(form, name), 
-							onFailure: BrowserUpdater.handleError,
+							postBody: Cocoon.CForms.buildQueryString(form, name), 
+							onFailure: Cocoon.Ajax.BrowserUpdater.handleError,
 							form: form
 						}
 					);
@@ -71,7 +75,7 @@
 }
 
 // Override the default forms_submitForm
-forms_submitForm = CForms.submitForm;
+forms_submitForm = Cocoon.CForms.submitForm;
 
 /**
  * Build a query string with all form inputs
@@ -83,7 +87,7 @@
  * unchecked checkboxes are not normally submitted :-)
  *
  */
-CForms._buildQueryString = function(form, submitId) {
+Cocoon.CForms.buildQueryString = function(form, submitId) {
     // Indicate to the server that we're in ajax mode
     var result = "cocoon-ajax=true";
     // Iterate on all form controls



Mime
View raw message