[claw-cvs] r92 - trunk/main/claw-html.dojo/src/js
achiumenti at common-lisp.net
achiumenti at common-lisp.net
Thu Sep 18 13:30:51 UTC 2008
Author: achiumenti
Date: Thu Sep 18 09:30:51 2008
New Revision: 92
Modified:
trunk/main/claw-html.dojo/src/js/ActionLink.js
trunk/main/claw-html.dojo/src/js/Dialog.js
trunk/main/claw-html.dojo/src/js/Form.js
Log:
several bugfixes
Modified: trunk/main/claw-html.dojo/src/js/ActionLink.js
==============================================================================
--- trunk/main/claw-html.dojo/src/js/ActionLink.js (original)
+++ trunk/main/claw-html.dojo/src/js/ActionLink.js Thu Sep 18 09:30:51 2008
@@ -51,15 +51,14 @@
_updateParts: function (reply) {
for (var item in reply.components) {
var element = dojo.byId(item);
- if ((element != null) && (reply.components[item] != null)) {
- var list = dojo.query('[widgetId]', element);
- dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); });
+ if (element != null) {
+ if (reply.components[item] != null) {
+ var list = dojo.query('[widgetId]', element);
+ dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); });
+ }
+ element.innerHTML = reply.components[item];
+ dojo.parser.parse(element, true);
}
- var oldVisibility = element.style.visibility;
- element.style.visibility = 'hidden';
- element.innerHTML = reply.components[item];
- dojo.parser.parse(element, true);
- element.style.visibility = oldVisibility;
}
},
Modified: trunk/main/claw-html.dojo/src/js/Dialog.js
==============================================================================
--- trunk/main/claw-html.dojo/src/js/Dialog.js (original)
+++ trunk/main/claw-html.dojo/src/js/Dialog.js Thu Sep 18 09:30:51 2008
@@ -52,6 +52,10 @@
this.templateString = this.templateStringUnclosable;
}
this.inherited(arguments);
+ },
+ hide: function () {
+ this.domNode.style.visibility = 'hidden';
+ this.inherited(arguments);
}
}
);
Modified: trunk/main/claw-html.dojo/src/js/Form.js
==============================================================================
--- trunk/main/claw-html.dojo/src/js/Form.js (original)
+++ trunk/main/claw-html.dojo/src/js/Form.js Thu Sep 18 09:30:51 2008
@@ -28,135 +28,135 @@
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-if(!dojo._hasResource["claw.Form"]){
-dojo.provide("claw.Form");
+ if(!dojo._hasResource["claw.Form"]){
+ dojo.provide("claw.Form");
-dojo.require("dojo.io.iframe");
-dojo.require("dijit.form.Form");
+ dojo.require("dojo.io.iframe");
+ dojo.require("dijit.form.Form");
-dojo.declare(
- "claw.Form",
- [dijit.form.Form],
- {
+ dojo.declare(
+ "claw.Form",
+ [dijit.form.Form],
+ {
// summary:
// Adds conveniences to regular HTML form
// HTML <FORM> attributes
- xhrTimeout: "",//2000,
+ xhrTimeout: "",//2000,
updateId: null,
enctype: "",
xhr: null,
jsonContent: {},
_updateParts: function (reply) {
- for (var item in reply.components) {
- var element = dojo.byId(item);
- if ((element != null) && (reply.components[item] != null)) {
- var list = dojo.query('[widgetId]', element);
- dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); });
- }
- var oldVisibility = element.style.visibility;
- element.style.visibility = 'hidden';
- element.innerHTML = reply.components[item];
- dojo.parser.parse(element, true);
- element.style.visibility = oldVisibility;
- }
- },
+ for (var item in reply.components) {
+ var element = dojo.byId(item);
+ if (element != null) {
+ if (reply.components[item] != null) {
+ var list = dojo.query('[widgetId]', element);
+ dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); });
+ }
+ element.innerHTML = reply.components[item];
+ dojo.parser.parse(element, true);
+ }
+ }
+ },
_evalReplClassScripts: function (reply) {
- dijit.byId('scripts-content-pane').setContent(reply.classInjections);
+ dijit.byId('scripts-content-pane').setContent(reply.classInjections);
},
_evalReplInstanceScripts: function (reply) {
- dijit.byId('scripts-content-pane').setContent(reply.instanceInjections);
+ dijit.byId('scripts-content-pane').setContent(reply.instanceInjections);
},
_updateAndEval: function (reply) {
- console.debug("Plain object as string is: ", reply);
- console.debug("Object as string is: ", dojo.toJson(reply, true));
- this._evalReplClassScripts(reply);
- this._updateParts(reply);
- this._evalReplInstanceScripts(reply);
+ console.debug("Plain object as string is: ", reply);
+ console.debug("Object as string is: ", dojo.toJson(reply, true));
+ this._evalReplClassScripts(reply);
+ this._updateParts(reply);
+ this._evalReplInstanceScripts(reply);
},
submit: function(){
- if(!(this.onSubmit() === false) && !this.xhr){
- this.containerNode.submit();
- }
+ if(!(this.onSubmit() === false) && !this.xhr){
+ this.containerNode.submit();
+ }
},
onSubmit: function(e){
- // summary:
- // Callback when user submits the form. This method is
- // intended to be over-ridden, but by default it checks and
- // returns the validity of form elements. When the `submit`
- // method is called programmatically, the return value from
- // `onSubmit` is used to compute whether or not submission
- // should proceed
-
- var valid = this.validate(); // Boolean
-
- if (valid && this.xhr) {
- if (e) {
- e.preventDefault();
- }
- this.onBeforeSubmit(e);
- var thisForm = this;
- var jsonContent = dojo.mixin(this.jsonContent, { json : thisForm.updateId });
- this.jsonContent = {};
- var formId = this.id;
- if (this.enctype != 'multipart/form-data') {
- try {
- dojo.xhrPost({
- url: '#',
- load : function (data) {
- try {
- thisForm._updateAndEval(data);
- } finally {
- thisForm.onXhrFinish(e);
- }
- },
- error : function (data) {console.error("!!!!!!",data);thisForm.onXhrFinish(e);},
- timeout : thisForm.xhrTimeout,
- handleAs : 'json',
- form : formId,
- content : jsonContent });
- } catch (e) {alert(e);}
- } else {
- jsonContent = dojo.mixin(jsonContent, { jsonPrefix: '<textarea>', jsonSuffix: '</textarea>' });
- dojo.io.iframe.send({
- load : function (data) {
- try {
- thisForm._updateAndEval(data);
- } finally {
- thisForm.onXhrFinish(e);
- }
- },
- error : function (data) {
- console.error(data);
+ // summary:
+ // Callback when user submits the form. This method is
+ // intended to be over-ridden, but by default it checks and
+ // returns the validity of form elements. When the `submit`
+ // method is called programmatically, the return value from
+ // `onSubmit` is used to compute whether or not submission
+ // should proceed
+
+ var valid = this.validate(); // Boolean
+
+ if (valid && this.xhr) {
+ if (e) {
+ e.preventDefault();
+ }
+ this.onBeforeSubmit(e);
+ var thisForm = this;
+ var jsonContent = dojo.mixin(this.jsonContent, { json : thisForm.updateId });
+ this.jsonContent = {};
+ var formId = this.id;
+ if (this.enctype != 'multipart/form-data') {
+ try {
+ dojo.xhrPost({
+ url: '#',
+ load : function (data) {
+ try {
+ thisForm._updateAndEval(data);
+ } finally {
thisForm.onXhrFinish(e);
- },
- timeout : thisForm.xhrTimeout,
- handleAs : 'json',
- form: formId,
- content : jsonContent });
- }
+ }
+ },
+ error : function (data) {console.error("!!!!!!",data);thisForm.onXhrFinish(e);},
+ timeout : thisForm.xhrTimeout,
+ handleAs : 'json',
+ form : formId,
+ content : jsonContent });
+ } catch (e) {alert(e);}
+ } else {
+ jsonContent = dojo.mixin(jsonContent, { jsonPrefix: '<textarea>', jsonSuffix: '</textarea>' });
+ dojo.io.iframe.send({
+ load : function (data) {
+ try {
+ thisForm._updateAndEval(data);
+ } finally {
+ thisForm.onXhrFinish(e);
+ }
+ },
+ error : function (data) {
+ console.error(data);
+ thisForm.onXhrFinish(e);
+ },
+ timeout : thisForm.xhrTimeout,
+ handleAs : 'json',
+ form: formId,
+ content : jsonContent });
}
- return valid;
+ }
+ this.jsonContent = {};
+ return valid;
},
onBeforeSubmit: function(/*Event?*/e){
- // summary:
- // Callback when user submits the form. This method is
- // intended to be over-ridden. When the `submit` calls dojo.xhrPost
- // this method is called before.
+ // summary:
+ // Callback when user submits the form. This method is
+ // intended to be over-ridden. When the `submit` calls dojo.xhrPost
+ // this method is called before.
},
onXhrFinish: function(/*Event?*/e){
- // summary:
- // Callback when user submits the form. This method is
- // intended to be over-ridden. After the call to dojo.xhrPost
- // thouches lload or error this event is fired
+ // summary:
+ // Callback when user submits the form. This method is
+ // intended to be over-ridden. After the call to dojo.xhrPost
+ // thouches lload or error this event is fired
}
- }
-);
+ }
+ );
-}
+ }
More information about the Claw-cvs
mailing list