
Author: achiumenti Date: Tue Oct 21 13:04:29 2008 New Revision: 124 Log: several bugfixes and enhancements 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 trunk/main/claw-html.dojo/src/js/HardLink.js trunk/main/claw-html.dojo/src/js/claw.js 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 Tue Oct 21 13:04:29 2008 @@ -53,8 +53,16 @@ var element = dojo.byId(item); if (element != null) { if (reply.components[item] != null) { - var list = dojo.query('[widgetId]', element); + var list = dojo.query('[dndId]', element); + dojo.forEach(list, function(dndEl){ + var dndObj = claw.dnd.byId(dojo.attr(dndEl, "dndId")); + if (dndObj) { + dndObj.destroy(); + } + }); + 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); 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 Tue Oct 21 13:04:29 2008 @@ -59,4 +59,25 @@ } } ); + + claw.showMessage = function(/*String?*/dialogTitle, /*String*/message,/*String?*/closeLabel) { + var closeButton = new dijit.form.Button({label:closeLabel || 'Ok'}); + var buttonsContainer = document.createElement('div'); + dojo.attr(buttonsContainer, 'class', 'clawButtons'); + buttonsContainer.appendChild(closeButton.domNode); + var dialog = new dijit.Dialog({title: dialogTitle || 'Message', content: message}); + dialog.containerNode.appendChild(buttonsContainer); + dojo.connect(dialog, + 'onClose', + function(evt) { + dialog.destroy(); + }); + dojo.connect(closeButton, + 'onClick', + function(evt) { + dialog.destroy(); + }); + dialog.show(); + + }; } \ No newline at end of file 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 Tue Oct 21 13:04:29 2008 @@ -52,7 +52,14 @@ var element = dojo.byId(item); if (element != null) { if (reply.components[item] != null) { - var list = dojo.query('[widgetId]', element); + var list = dojo.query('[dndId]', element); + dojo.forEach(list, function(dndEl){ + var dndObj = claw.dnd.byId(dojo.attr(dndEl, "dndId")); + if (dndObj) { + dndObj.destroy(); + } + }); + list = dojo.query('[widgetId]', element); dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); }); } element.innerHTML = reply.components[item]; Modified: trunk/main/claw-html.dojo/src/js/HardLink.js ============================================================================== --- trunk/main/claw-html.dojo/src/js/HardLink.js (original) +++ trunk/main/claw-html.dojo/src/js/HardLink.js Tue Oct 21 13:04:29 2008 @@ -51,7 +51,14 @@ var widget = dijit.byId(this.refId); if (widget) { var domNode = widget.domNode; - var list = dojo.query('[widgetId]', domNode); + var list = dojo.query('[dndId]', domNode); + dojo.forEach(list, function(dndEl){ + var dndObj = claw.dnd.byId(dojo.attr(dndEl, "dndId")); + if (dndObj) { + dndObj.destroy(); + } + }); + list = dojo.query('[widgetId]', domNode); dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); }); widget.destroy(); } Modified: trunk/main/claw-html.dojo/src/js/claw.js ============================================================================== --- trunk/main/claw-html.dojo/src/js/claw.js (original) +++ trunk/main/claw-html.dojo/src/js/claw.js Tue Oct 21 13:04:29 2008 @@ -1,4 +1,4 @@ -/** +y/** ;;; $Header: dojo/src/js/claw.js $ ;;; Copyright (c) 2008, Andrea Chiumenti. All rights reserved. @@ -28,32 +28,6 @@ ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -//dojo.require('dijit.Tooltip'); +dojo.provide("claw"); -var claw = { - _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(); }); - element.innerHTML = reply.components[item]; - dojo.parser.parse(element, true); - } - } - }, - _evalReplClassScripts: function (reply) { - dijit.byId('scripts-content-pane').setContent(reply.classInjections); - }, - _evalReplInstanceScripts: function (reply) { - 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); - - } -}; \ No newline at end of file +var claw = {}; \ No newline at end of file