Author: pyaschenko
Date: 2008-09-29 12:46:52 -0400 (Mon, 29 Sep 2008)
New Revision: 10604
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
editor: added onbeforeajax event listeners process (draft)
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-09-29 14:40:16 UTC
(rev 10603)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-09-29 16:46:52 UTC
(rev 10604)
@@ -552,6 +552,10 @@
this.onafterajax = onafterajax;
};
+A4J.AJAX.AjaxListener = function(type, callback){
+ this[type] = callback;
+};
+
A4J.AJAX._listeners= [];
A4J.AJAX.AddListener = function(listener){
A4J.AJAX._listeners.push(listener);
@@ -559,7 +563,15 @@
A4J.AJAX.removeListeners = function(listener){
A4J.AJAX._listeners = [];
};
+A4J.AJAX.removeListener = function(listener){
+ for (var i=A4J.AJAX._listeners.length-1;i>=0;i--){
+ if (A4J.AJAX._listeners[i] == listener){
+ A4J.AJAX._listeners.splice(i,1);
+ }
+ }
+};
+
//head element transformers
A4J.AJAX.HeadElementTransformer = function(elt){
this.elt = elt;
@@ -753,6 +765,13 @@
// statusID - DOM id request status tags.
// oncomplete - function for call after complete request.
A4J.AJAX.SubmitRequest = function( containerId, formId ,domEvt , options ) {
+ // Process listeners.
+ for(var li = 0; li < A4J.AJAX._listeners.length; li++){
+ var listener = A4J.AJAX._listeners[li];
+ if(listener.onbeforeajax){
+ listener.onbeforeajax(formId,domEvt,options);
+ }
+ }
// First - run onsubmit event for client-side validation.
LOG.debug("NEW AJAX REQUEST !!! with form :"+formId );
// var form = A4J.AJAX.locateForm(event);
Show replies by date