diff options
author | wei <> | 2006-06-17 01:55:05 +0000 |
---|---|---|
committer | wei <> | 2006-06-17 01:55:05 +0000 |
commit | b3ceed048bb533a00bbea542f7c12b49c8c83d9b (patch) | |
tree | 97962fc3cb6746ae404c4f1d0095834bbb0e1ac7 /framework/Web/Javascripts/prado | |
parent | 6c0154fb4e292ad22667e618f598a37cc5f9d524 (diff) |
Update changes to active controls, add FT tests for active controls, add comments.
Diffstat (limited to 'framework/Web/Javascripts/prado')
-rw-r--r-- | framework/Web/Javascripts/prado/activecontrols3.js | 16 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/ajax3.js | 57 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/element.js | 15 |
3 files changed, 54 insertions, 34 deletions
diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js index 4be2779a..6fbde405 100644 --- a/framework/Web/Javascripts/prado/activecontrols3.js +++ b/framework/Web/Javascripts/prado/activecontrols3.js @@ -42,3 +42,19 @@ Prado.WebUI.TAutoComplete = Class.extend(Autocompleter.Base, this.updateChoices(result);
}
});
+
+Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
+{
+ onInit : function(options)
+ {
+ if(options['TextMode'] != 'MultiLine')
+ Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
+ Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
+ },
+
+ doCallback : function(event, options)
+ {
+ new Prado.CallbackRequest(options.EventTarget, options);
+ Event.stop(event);
+ }
+});
diff --git a/framework/Web/Javascripts/prado/ajax3.js b/framework/Web/Javascripts/prado/ajax3.js index 1e832889..adf8534a 100644 --- a/framework/Web/Javascripts/prado/ajax3.js +++ b/framework/Web/Javascripts/prado/ajax3.js @@ -19,7 +19,7 @@ Object.extend(Ajax.Request.prototype, Prado.CallbackRequest.updatePageState(this,transport);
Ajax.Responders.dispatch('on' + transport.status, this, transport, json);
Prado.CallbackRequest.dispatchActions(transport,this.getHeaderData(Prado.CallbackRequest.ACTION_HEADER));
-
+
(this.options['on' + this.transport.status]
|| this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
|| Prototype.emptyFunction)(transport, json);
@@ -57,10 +57,7 @@ Object.extend(Ajax.Request.prototype, catch (e)
{
if(typeof(json) == "string")
- {
- Logger.info("using json")
return Prado.CallbackRequest.decode(json);
- }
}
}
});
@@ -118,6 +115,14 @@ Object.extend(Prado.CallbackRequest, requestInProgress : null,
/**
+ * Add ids of inputs element to post in the request.
+ */
+ addPostLoaders : function(ids)
+ {
+ this.PostDataLoaders = this.PostDataLoaders.concat(ids);
+ },
+
+ /**
* Dispatch callback response actions.
*/
dispatchActions : function(transport,actions)
@@ -133,26 +138,14 @@ Object.extend(Prado.CallbackRequest, {
for(var method in command)
{
- if(command[method][0])
+ try
{
- var id = command[method][0];
- if($(id) || id.indexOf("[]") > -1)
- {
- try
- {
- method.toFunction().apply(this,command[method].concat(transport));
- }
- catch(e)
- {
- if(typeof(Logger) != "undefined")
- Prado.CallbackRequest.Exception.onException(null,e);
- }
- }
- else if(typeof(Logger) != "undefined")
- {
- Logger.error("Error in executing callback response:",
- "Unable to find HTML element with ID '"+id+"' before executing "+method+"().");
- }
+ method.toFunction().apply(this,command[method].concat(transport));
+ }
+ catch(e)
+ {
+ if(typeof(Logger) != "undefined")
+ Prado.CallbackRequest.Exception.onException(null,e);
}
}
},
@@ -251,18 +244,18 @@ Object.extend(Prado.CallbackRequest, */
dispatchPriorityRequest : function(callback)
{
- Logger.info("priority request "+callback.id)
+ //Logger.info("priority request "+callback.id)
this.abortRequestInProgress();
callback.request = new Ajax.Request(callback.url, callback.options);
callback.timeout = setTimeout(function()
{
- Logger.warn("priority timeout");
+ // Logger.warn("priority timeout");
Prado.CallbackRequest.abortRequestInProgress();
},callback.options.RequestTimeOut);
this.requestInProgress = callback;
- Logger.info("dispatched "+this.requestInProgress)
+ //Logger.info("dispatched "+this.requestInProgress)
},
/**
@@ -270,7 +263,7 @@ Object.extend(Prado.CallbackRequest, */
dispatchNormalRequest : function(callback)
{
- Logger.info("dispatching normal request");
+ // Logger.info("dispatching normal request");
new Ajax.Request(callback.url, callback.options);
},
@@ -280,10 +273,10 @@ Object.extend(Prado.CallbackRequest, abortRequestInProgress : function()
{
inProgress = Prado.CallbackRequest.requestInProgress;
- Logger.info("aborting ... "+inProgress);
+ //Logger.info("aborting ... "+inProgress);
if(inProgress)
{
- Logger.warn("aborted "+inProgress.id)
+ // Logger.warn("aborted "+inProgress.id)
inProgress.request.transport.abort();
clearTimeout(inProgress.timeout);
Prado.CallbackRequest.requestInProgress = null;
@@ -303,13 +296,11 @@ Object.extend(Prado.CallbackRequest, {
data = request.header(this.PAGESTATE_HEADER);
if(typeof(data) == "string" && data.length > 0)
- {
- Logger.warn("updating page state");
pagestate.value = data;
- }
else
{
- Logger.debug("Bad page state:"+data);
+ if(typeof(Logger) != "undefined")
+ Logger.debug("Bad page state:"+data);
}
}
}
diff --git a/framework/Web/Javascripts/prado/element.js b/framework/Web/Javascripts/prado/element.js index 0ff0e8fa..5c76d4e6 100644 --- a/framework/Web/Javascripts/prado/element.js +++ b/framework/Web/Javascripts/prado/element.js @@ -71,7 +71,15 @@ Prado.Element = if(result != null)
content = result;
}
- method.toFunction().apply(this,[element,content]);
+ if(typeof(element) == "string")
+ {
+ if($(element))
+ method.toFunction().apply(this,[element,content]);
+ }
+ else
+ {
+ method.toFunction().apply(this,[content]);
+ }
},
extractContent : function(text, boundary)
@@ -82,6 +90,11 @@ Prado.Element = return result[2];
else
return null;
+ },
+
+ evaluateScript : function(content)
+ {
+ content.evalScripts();
}
}
|