[claw-cvs] r58 - trunk/main/dojo/src/js

achiumenti at common-lisp.net achiumenti at common-lisp.net
Thu Jul 17 13:17:48 UTC 2008


Author: achiumenti
Date: Thu Jul 17 09:17:46 2008
New Revision: 58

Added:
   trunk/main/dojo/src/js/ActionLink.js
   trunk/main/dojo/src/js/Dialog.js
   trunk/main/dojo/src/js/Editor.js
   trunk/main/dojo/src/js/Editor2.js
   trunk/main/dojo/src/js/FloatingContent.js
   trunk/main/dojo/src/js/Form.js
   trunk/main/dojo/src/js/HardLink.js
   trunk/main/dojo/src/js/Rounded.js
   trunk/main/dojo/src/js/claw.js
Log:
commit of version 0.1.0 (dojo)

Added: trunk/main/dojo/src/js/ActionLink.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/ActionLink.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,130 @@
+/**
+;;; $Header: dojo/src/js/ActionLink.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+    if(!dojo._hasResource["claw.ActionLink"]){
+        dojo.provide("claw.ActionLink");
+
+        dojo.require("dijit._Widget");
+        dojo.require("dijit._Templated");
+        dojo.declare(
+            "claw.ActionLink",
+            [dijit._Widget, dijit._Templated],
+            {
+                xhrTimeout: "",//2000,
+                updateId: null,
+                enctype: "",
+                xhr: true,
+                templateString: "<a dojoAttachPoint='containerNode' dojoAttachEvent='onclick:_onClick' href='#'></a>",
+                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(); });
+                            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);
+                },
+                click: function(){
+                    if(!(this.onClick() === false) && !this.xhr){
+                        this.containerNode.click();
+		    }
+                },
+	        _onClick: 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
+
+                    if (this.xhr) {
+                        if (e) {
+                            e.preventDefault();
+                        }
+                        this.onBeforeClick(e);
+                        var thisLink = this;
+                        var jsonContent = dojo.mixin(this.jsonContent, { json : thisLink.updateId, rewindobject : thisLink.id });
+                        this.jsonContent = {};
+                        var linkId = this.id;
+                        dojo.xhrPost({
+                            url: '#',
+                            load : function (data) {
+                                try {
+                                    thisLink._updateAndEval(data);
+                                } finally {
+                                    thisLink.onXhrFinish(e);
+                                }
+                            },
+                            error : function (data) {console.error(data);thisLink.onXhrFinish(e);},
+                            timeout : thisLink.xhrTimeout,
+                            handleAs : 'json',
+                            content : jsonContent });
+                    }
+                    return true;
+	        },
+
+                onBeforeClick: 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.
+	        },
+
+                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
+	        }
+	    }
+        );
+
+    }
+

Added: trunk/main/dojo/src/js/Dialog.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/Dialog.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,40 @@
+/**
+;;; $Header: dojo/src/js/HardLink.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+//if(!dojo._hasResource["claw.Dialog"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+    dojo.provide("claw.Dialog");
+
+    dojo.require("dijit.Dialog");
+
+    dojo.declare(
+        "claw.Dialog",
+        dijit.Dialog
+    );
+//}
\ No newline at end of file

Added: trunk/main/dojo/src/js/Editor.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/Editor.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,63 @@
+/**
+;;; $Header: dojo/src/js/Editor.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+if(!dojo._hasResource["claw.Editor"]){
+    dojo.provide("claw.Editor");
+    dojo.require("dijit.Editor");
+    dojo.declare(
+                 "claw.Editor",
+                 dijit.Editor,
+                 {
+                     name: "",
+                     hidden: null,
+                     postCreate: function(){
+                         this.inherited(arguments);
+                         this.hidden = dojo.doc.createElement('input');
+                         var hidden = this.hidden;
+                         hidden.type = "hidden";
+                         hidden.name = this.name;
+                         this.domNode.parentNode.appendChild(this.hidden);
+                         var theEditor = this;
+                         if (this.hidden.form) {
+                             var theForm = dijit.byId(this.hidden.form.id);
+                             if (theForm) {
+                                 dojo.connect(theForm, 
+                                              "onBeforeSubmit", 
+                                              function(e) {hidden.value = theEditor.getValue();});
+                             }
+                         }
+                     },
+                     destroy: function(){
+                         this.domNode.parentNode.removeChild(this.hidden);
+                         this.inherited(arguments);
+                     }
+                 });
+}
\ No newline at end of file

Added: trunk/main/dojo/src/js/Editor2.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/Editor2.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,63 @@
+/**
+;;; $Header: dojo/src/js/Editor.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+if(!dojo._hasResource["claw.Editor2"]){
+    dojo.provide("claw.Editor2");
+    dojo.require("dijit.Editor");
+    dojo.require("dojox.lang.aspect");
+    dojo.declare(
+                 "claw.Editor2",
+                 dijit.Editor,
+                 {
+                     name: "",
+                     hidden: null,
+                     postCreate: function(){
+                         this.inherited(arguments);
+                         this.hidden = dojo.doc.createElement('input');
+                         var hidden = this.hidden;
+                         hidden.type = "hidden";
+                         hidden.name = this.name;
+                         this.domNode.parentNode.appendChild(this.hidden);
+                         var aop = dojox.lang.aspect;
+                         var theEditor = this;
+                         if (this.hidden.form) {
+                             var theForm = dijit.byId(this.hidden.form.id);
+                             if (!theForm)
+                                 theForm = this.hidden.form;
+                             aop.advise(theForm, /submit/, { before: function(args) {hidden.value = theEditor.getValue();} });
+                         }
+                     },
+                     destroy: function(){
+                         this.domNode.parentNode.removeChild(this.hidden);
+                         this.inherited(arguments);
+                     }
+                 });
+}
\ No newline at end of file

Added: trunk/main/dojo/src/js/FloatingContent.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/FloatingContent.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,47 @@
+/**
+;;; $Header: dojo/src/js/FloatingContent.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+if(!dojo._hasResource["claw.FloatingContent"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+    dojo._hasResource["claw.FloatingContent"] = true;
+    dojo.provide("claw.FloatingContent");
+    
+    dojo.require("dijit.Dialog");
+    
+    dojo.declare(
+        "claw.FloatingContent",
+        dijit.Dialog,
+        {
+            
+            templateString:"<div class=\"dijitDialog\" style=\"border:0;\" tabindex=\"-1\" waiRole=\"dialog\" waiState=\"labelledby-${id}_title\">\n\t<div dojoAttachPoint=\"containerNode\"></div>\n</div>",
+            _getFocusItems: function (domNode) {}
+                                  
+        }
+    );
+}
\ No newline at end of file

Added: trunk/main/dojo/src/js/Form.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/Form.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,157 @@
+/**
+;;; $Header: dojo/src/js/Form.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+if(!dojo._hasResource["claw.Form"]){
+dojo.provide("claw.Form");
+
+dojo.require("dojo.io.iframe");
+dojo.require("dijit.form.Form");
+
+dojo.declare(
+	"claw.Form",
+	[dijit.form.Form],
+	{
+		// summary:
+		// Adds conveniences to regular HTML form
+
+		// HTML <FORM> attributes
+            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(); });
+                               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);
+                },
+                submit: function(){
+                       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') {
+                                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 });
+                            } 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;
+		},
+
+                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.
+		},
+
+                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
+		}
+	}
+);
+
+}
+

Added: trunk/main/dojo/src/js/HardLink.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/HardLink.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,64 @@
+/**
+;;; $Header: dojo/src/js/HardLink.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+if(!dojo._hasResource["claw.HardLink"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+    dojo._hasResource["claw.HardLink"] = true;
+    dojo.provide("claw.HardLink");
+
+    dojo.require("dijit._Widget");
+
+    dojo.declare(
+        "claw.HardLink",
+        dijit._Widget,
+        {
+
+            // connectId: String
+            // Id of domNode to attach the hard link to.
+
+            refId: "",
+
+            style: "display:none;",
+
+            destroy: function () {
+                if (this.refId) {
+                    var widget = dijit.byId(this.refId);
+                    if (widget) {
+                        var domNode = widget.domNode;
+                        var list = dojo.query('[widgetId]', domNode);
+                        dojo.forEach(list.map(dijit.byNode), function(widget){if (widget) widget.destroy(); });
+                        widget.destroy();
+                    }
+                }
+                this.inherited(arguments);
+            }
+
+        }
+    );
+}
\ No newline at end of file

Added: trunk/main/dojo/src/js/Rounded.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/Rounded.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,58 @@
+/**
+;;; $Header: dojo/src/js/LoadingSpinner.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+if(!dojo._hasResource["claw.Rounded"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+    dojo._hasResource["claw.Rounded"] = true;
+    dojo.provide("claw.Rounded");
+    
+    dojo.require("dijit._Widget");
+    dojo.require("dijit._Templated");
+    
+    
+    dojo.declare(                 
+        "claw.Rounded",
+        [dijit._Widget, dijit._Templated],
+        {
+        templateString:"<div class=\"Rounded\" dojoAttachPoint=\"outerNode\">\n\t<div class=\"RoundedContent\" dojoAttachPoint=\"roundedContent\">\n\t\t<div class=\"RoundedTop\" dojoAttachPoint=\"roundedTop\"></div>\n\t\t<div dojoAttachPoint=\"contentNode\">\n\t\t\t<div dojoAttachPoint=\"containerNode\"></div>\n\t\t</div>\n\t</div>\n\t<div class=\"RoundedBottom\" dojoAttachPoint=\"roundedBottom\">\n\t\t<div dojoAttachPoint=\"roundedBottomDiv\"></div>\n\t</div>\n</div>",
+        bgImg: "",              // standard background image (png)
+        bgImgAlt: "",   // background image for ie6
+ 
+        postCreate: function() {
+                dojo.style(this.contentNode, "height", dojo.style(this.outerNode, "height")-10+'px'); // TODO: Calculate correct height                
+                var alt = (this.bgImgAlt.length && dojo.isIE < 7 && dojo.isIE > 0);
+                dojo.forEach(["roundedContent","roundedTop","roundedBottom","roundedBottomDiv"],
+                        function(elName){
+                                dojo.style(this[elName],"backgroundImage", "url(" + (alt ? this.bgImgAlt : this.bgImg)  + ")");
+                        },
+                this);
+        }
+    });
+       
+}
\ No newline at end of file

Added: trunk/main/dojo/src/js/claw.js
==============================================================================
--- (empty file)
+++ trunk/main/dojo/src/js/claw.js	Thu Jul 17 09:17:46 2008
@@ -0,0 +1,59 @@
+/**
+;;; $Header: dojo/src/js/claw.js $
+
+;;; Copyright (c) 2008, Andrea Chiumenti.  All rights reserved.
+
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions
+;;; are met:
+
+;;;   * Redistributions of source code must retain the above copyright
+;;;     notice, this list of conditions and the following disclaimer.
+
+;;;   * Redistributions in binary form must reproduce the above
+;;;     copyright notice, this list of conditions and the following
+;;;     disclaimer in the documentation and/or other materials
+;;;     provided with the distribution.
+
+;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
+;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+//dojo.require('dijit.Tooltip');
+
+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



More information about the Claw-cvs mailing list