Author: achiumenti Date: Sat Jun 14 02:00:26 2008 New Revision: 51
Added: trunk/main/dojo/ trunk/main/dojo/README trunk/main/dojo/claw-dojo-tests.asd trunk/main/dojo/claw-dojo.asd trunk/main/dojo/src/ trunk/main/dojo/src/dijit.lisp trunk/main/dojo/src/djbody.lisp trunk/main/dojo/src/djbutton.lisp trunk/main/dojo/src/djclaw.lisp trunk/main/dojo/src/djcolorpalette.lisp trunk/main/dojo/src/djcontainers.lisp trunk/main/dojo/src/djcontent-pane.lisp trunk/main/dojo/src/djdialog.lisp trunk/main/dojo/src/djform.lisp trunk/main/dojo/src/djlayout.lisp trunk/main/dojo/src/djlink.lisp trunk/main/dojo/src/djmenu.lisp trunk/main/dojo/src/djprogressbar.lisp trunk/main/dojo/src/djtitlepane.lisp trunk/main/dojo/src/djtoolbar.lisp trunk/main/dojo/src/djtooltip.lisp trunk/main/dojo/src/djtree.lisp trunk/main/dojo/src/djwidget.lisp trunk/main/dojo/src/js/ trunk/main/dojo/src/misc.lisp trunk/main/dojo/src/packages.lisp trunk/main/dojo/tests/ trunk/main/dojo/tests/ajax-test.lisp trunk/main/dojo/tests/common.lisp trunk/main/dojo/tests/djbutton-test.lisp trunk/main/dojo/tests/djcalendar-test.lisp trunk/main/dojo/tests/djcolorpalette-test.lisp trunk/main/dojo/tests/djdialog-test.lisp trunk/main/dojo/tests/djeditor-test.lisp trunk/main/dojo/tests/djmenu-test.lisp trunk/main/dojo/tests/djprogressbar-test.lisp trunk/main/dojo/tests/docroot/ trunk/main/dojo/tests/docroot/css/ trunk/main/dojo/tests/docroot/css/style.css trunk/main/dojo/tests/docroot/img/ trunk/main/dojo/tests/docroot/img/roundedbg.gif (contents, props changed) trunk/main/dojo/tests/docroot/img/roundedbg.png (contents, props changed) trunk/main/dojo/tests/docroot/img/spinner.gif (contents, props changed) trunk/main/dojo/tests/header-info-page.lisp trunk/main/dojo/tests/index.lisp trunk/main/dojo/tests/main.lisp trunk/main/dojo/tests/packages.lisp trunk/main/dojo/tests/realm.lisp trunk/main/dojo/tests/slider-test.lisp Log: claw dojo-integration, first commit
Added: trunk/main/dojo/README ============================================================================== --- (empty file) +++ trunk/main/dojo/README Sat Jun 14 02:00:26 2008 @@ -0,0 +1,6 @@ +to use claw-dojo library download dojo at + +http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1.tar.gz + +Then unpack it into the src directory and rename the extacted directory +"dojo-release-1.1.1" from to "dojotoolkit" \ No newline at end of file
Added: trunk/main/dojo/claw-dojo-tests.asd ============================================================================== --- (empty file) +++ trunk/main/dojo/claw-dojo-tests.asd Sat Jun 14 02:00:26 2008 @@ -0,0 +1,51 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/claw-dojo-tests.asd $ + +;;; 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. + +(asdf:defsystem :claw-dojo-tests + :name "claw-dojo-tests" + :author "Andrea Chiumenti" + :description "Tests for claw-dojo" + :depends-on (:claw :claw-dojo :parenscript) + :components ((:module tests + :components ((:file "packages") + (:file "common" :depends-on ("packages")) + (:file "main" :depends-on ("common")) + (:file "index" :depends-on ("main")) + (:file "realm" :depends-on ("main")) + (:file "header-info-page" :depends-on ("main")) + (:file "djbutton-test" :depends-on ("main")) + (:file "djdialog-test" :depends-on ("main")) + (:file "djcolorpalette-test" :depends-on ("main")) + (:file "djeditor-test" :depends-on ("main")) + (:file "ajax-test" :depends-on ("main")) + (:file "djcalendar-test" :depends-on ("main")) + (:file "slider-test" :depends-on ("main")) + (:file "djmenu-test" :depends-on ("main")))))) + +
Added: trunk/main/dojo/claw-dojo.asd ============================================================================== --- (empty file) +++ trunk/main/dojo/claw-dojo.asd Sat Jun 14 02:00:26 2008 @@ -0,0 +1,53 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/claw-dojo.asd $ + +;;; 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. + +(asdf:defsystem :claw-dojo + :name "claw-dojo" + :author "Andrea Chiumenti" + :description "claw dojo-1.1.0 integration" + :depends-on (:claw :parenscript) + :components ((:module src + :components ((:file "packages") + (:file "misc" :depends-on ("packages")) + (:file "djlink" :depends-on ("misc")) + (:file "djwidget" :depends-on ("misc")) + (:file "djcontent-pane" :depends-on ("misc")) + (:file "djbody" :depends-on ("djcontent-pane")) + (:file "dijit" :depends-on ("djwidget")) + (:file "djclaw" :depends-on ("djwidget")) + (:file "djform" :depends-on ("djwidget")) + (:file "djbutton" :depends-on ("djwidget")) + (:file "djmenu" :depends-on ("djwidget")) + (:file "djdialog" :depends-on ("djwidget")) + (:file "djcolorpalette" :depends-on ("djwidget")) + (:file "djprogressbar" :depends-on ("djwidget")) + (:file "djtitlepane" :depends-on ("djwidget")) + (:file "djtree" :depends-on ("djwidget")) + (:file "djlayout" :depends-on ("djwidget")) + (:file "djtooltip" :depends-on ("djwidget"))))))
Added: trunk/main/dojo/src/dijit.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/dijit.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,35 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/dijit.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djbackground-iframe (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.BackgroundIframe component. More info at http://api.dojotoolkit.org/"))
Added: trunk/main/dojo/src/djbody.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djbody.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,121 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djbody.lisp $ + +;;; 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. + +(in-package :dojo) + +(defgeneric scripts-content-pane> (&rest rest)) + +(defclass djbody (wcomponent) + ((class :initarg :class + :reader djbody-class + :documentation "The css class of the <body> tag element") + (theme :initarg :theme + :reader djbody-theme + :documentation "The theme name. See http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/themes-and-design for more details") + (themes-url :initarg :themes-url + :reader djbody-themes-url + :documentation "The url that contains dojo themes") + (parse-on-load-p :initarg :parse-on-load + :reader djbody-parse-on-load-p + :documentation "Shoul always be true") + (debugp :initarg :is-debug + :reader djbody-debugp + :documentation "Set to true if you want to debug dojo calls") + (load-dojo-js :initarg :load-dojo-js + :reader load-dojo-js + :documentation "When not nil it loads the dojo.js file with a <script> tag") + (djconfig :initarg :djconfig + :reader djbody-djconfig + :documentation "Additional dojo configurations")) + (:metaclass metacomponent) + (:default-initargs :class "" :theme "tundra" + :themes-url (format nil "~a/dojotoolkit/dijit/themes/" (clawserver-base-path (current-server))) + :parse-on-load "true" + :load-dojo-js t + :is-debug nil + :djconfig nil) + (:documentation "This class provide a <body> tag that is enabled for dojo.")) + +(let ((class (find-class 'djbody))) + (closer-mop:ensure-finalized class) + (setf (documentation (find-symbol (format nil "~a>" (class-name class))) 'function) + (format nil "Description: ~a~%Parameters:~%~a~a~%~%~a" + "Function that instantiates a DJBODY component and renders a html <body> tag enabled for dojo." + *id-and-static-id-description* + (describe-html-attributes-from-class-slot-initargs class) + (describe-component-behaviour class)))) + +(defmethod htcomponent-script-files ((o djbody)) + (let ((parse-on-load (djbody-parse-on-load-p o)) + (is-debug (djbody-debugp o)) + (djconfig (djbody-djconfig o))) + (when (load-dojo-js o) + (script> :type "text/javascript" + :src (format nil "~a/dojotoolkit/dojo/dojo.js" (clawserver-base-path (current-server))) + :djconfig (if (null djconfig) + (format nil + "parseOnLoad:~a,usePlainJson:true,isDebug:~a" + parse-on-load is-debug) + (format nil + "parseOnLoad:~a,usePlainJson:true,~a,isDebug:~a" + parse-on-load djconfig is-debug)))))) + + +(defmethod htcomponent-stylesheet-files ((o djbody)) + (let ((theme (djbody-theme o))) + (list + (format nil "~a/dojotoolkit/dojo/resources/dojo.css" (clawserver-base-path (current-server))) + (format nil "~a/dojotoolkit/dijit/themes/dijit.css" (clawserver-base-path (current-server))) + (format nil "~a~a/~a.css" (djbody-themes-url o) theme theme)))) + + +(defmethod djbody-cssclass ((o djbody)) + (format nil "~a ~a" (djbody-theme o) (djbody-class o))) + +(defmethod wcomponent-template ((obj djbody)) + (let ((id "scripts-content-pane") + (pobj (htcomponent-page obj)) + (attributes (append (list :class (djbody-cssclass obj)) + (wcomponent-informal-parameters obj)))) + (build-tagf "body" 'tag nil + attributes + (htcomponent-body obj) + (djxcontent-pane> :static-id id + (script> :type "text/javascript" + (page-body-init-scripts pobj)))))) + + +(defmethod wcomponent-after-prerender ((obj djbody) (pobj page)) + (let ((scripts (page-instance-initscripts pobj))) + ;;remember that scripts are in reverse order + (when scripts + (push "});" (page-instance-initscripts pobj)) + (nconc scripts (list "dojo.addOnLoad(function() {"))))) + +
Added: trunk/main/dojo/src/djbutton.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djbutton.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,90 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djbutton.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djbutton (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.Button component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.Button")) + +(defclass djdrop-down-button (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.DropDownButton component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.DropDownButton" :dojo-require (list "dijit.form.Button"))) + + +(defclass djcombo-button (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.ComboButton component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.ComboButton" :dojo-require (list "dijit.form.Button"))) + + +(defclass djtoggle-button (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.ToggleButton component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.ToggleButton" :dojo-require (list "dijit.form.Button"))) + + +;;;-------------------------------------------------------- +(defclass djsubmit-button (csubmit) + ((form :initform nil + :accessor djsubmit-button-form)) + (:metaclass metacomponent) + (:documentation "This class is used to render dijit.form.Button that incorporates the logic to be included inside a CFORM component.")) + +(defmethod wcomponent-template ((obj djsubmit-button)) + (let* ((id (htcomponent-client-id obj)) + (value (csubmit-value obj))) + (djbutton> :static-id id + (wcomponent-informal-parameters obj) + value))) + +(defmethod wcomponent-before-prerender ((obj djsubmit-button) (page page)) + (hunchentoot:log-message :info "PRERENDER@@@@@@@@@@@@@@@~a" (page-current-form page)) + (setf (djsubmit-button-form obj) (page-current-form page))) + +(defmethod wcomponent-before-render ((obj djsubmit-button) (page page)) + (hunchentoot:log-message :info "RENDER@@@@@@@@@@@@@@@~a" (page-current-form page)) + (setf (djsubmit-button-form obj) (page-current-form page))) + +(defmethod htcomponent-instance-initscript ((obj djsubmit-button)) + (let ((id (htcomponent-client-id obj)) + (form-id (htcomponent-client-id (djsubmit-button-form obj)))) + (ps* + `(dojo.connect (dijit.by-id ,id) + "onClick" + (lambda (e) (let ((the-form (dijit.by-id ,form-id))) + (unless the-form + (setf the-form (dojo.by-id ,form-id))) + (.submit the-form)))))))
Added: trunk/main/dojo/src/djclaw.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djclaw.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,61 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djclaw.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass _djfloating-content (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo claw.FloatingContent component.") + (:default-initargs :dojo-type "claw.FloatingContent")) + +(defclass djfloating-content (wcomponent) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.FloatingContent component.")) + +(defmethod wcomponent-template ((obj djfloating-content)) + (let ((id (htcomponent-client-id obj))) + (list + (djhard-link> :id id :ref-id id) + (_djfloating-content> :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj))))) + +(defclass djhard-link (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo claw.HardLink component.") + (:default-initargs :dojo-type "claw.HardLink")) + +(defclass djrounded (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo claw.Rounded component. Provide bgImg and bgImgAlt (for msie <= 6)") + (:default-initargs :dojo-type "claw.Rounded")) \ No newline at end of file
Added: trunk/main/dojo/src/djcolorpalette.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djcolorpalette.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,37 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djcolorpalette.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djcolor-palette (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.ColorPalette. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.ColorPalette")) +
Added: trunk/main/dojo/src/djcontainers.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djcontainers.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,46 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djcontainers.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djaccordion-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.AccordionContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.AccordionContainer")) + +(defclass djaccordion-pane (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.AccordionPane component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.AccordionPane":dojo-require (list "dijit.layout.AccordionContainer"))) + + + +
Added: trunk/main/dojo/src/djcontent-pane.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djcontent-pane.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,59 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djcontent-plane.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djxcontent-pane (djwidget) + ((execute-scripts-p :initarg :execute-scripts-p + :reader djcontent-pane-execute-scripts-p + :documentation "When not nil permits to the content pane to evaluate javascript directives") + (render-styles-p :initarg :render-styles-p + :reader djcontent-pane-render-styles-p + :documentation "When not nil permits to the content pane to evaluate style sheet directives")) + (:metaclass metacomponent) + (:documentation "Class for dojo dojox.layout.ContentPane component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dojox.layout.ContentPane" :execute-scripts-p t + :render-styles-p t)) + + +(defmethod wcomponent-template ((obj djxcontent-pane)) + (let ((id (htcomponent-client-id obj)) + (dojo-type (djwidget-dojo-type obj)) + (execute-scripts (if (djcontent-pane-execute-scripts-p obj) + "true" + "false")) + (render-styles (if (djcontent-pane-render-styles-p obj) + "true" + "false"))) + (div> :dojoType dojo-type + :executeScripts execute-scripts + :renderStyles render-styles + :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj))))
Added: trunk/main/dojo/src/djdialog.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djdialog.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,86 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djdialog.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass _djdialog (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Dialog component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.Dialog")) + +(defclass djdialog (wcomponent) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Dialog component. More info at http://api.dojotoolkit.org/. It adds a HardLink so that the Dialog, that is moved inside body, may be referenced where it war originally placed, and so can be deleted from there")) + +(defmethod wcomponent-template ((obj djdialog)) + (let ((id (htcomponent-client-id obj))) + (list + (_djdialog> :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj)) + (djhard-link> :id "hidden" :ref-id id)))) + +(defclass _djdialog-underlay (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.DialogUnderlay component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.DialogUnderlay" :dojo-require (list "dijit.Dialog"))) + +(defclass djdialog-underlay (wcomponent) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.DialogUnderlay component. More info at http://api.dojotoolkit.org/. It adds a HardLink so that the Dialog, that is moved inside body, may be referenced where it war originally placed, and so can be deleted from there")) + +(defmethod wcomponent-template ((obj djdialog-underlay)) + (let ((id (htcomponent-client-id obj))) + (list + (djhard-link> :id id :ref-id id) + (_djdialog-underlay> :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj))))) + + +(defclass _djtooltip-dialog (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.TooltipDialog component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.TooltipDialog" :dojo-require (list "dijit.Dialog"))) + +(defclass djtooltip-dialog (wcomponent) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.TooltipDialog component. More info at http://api.dojotoolkit.org/. It adds a HardLink so that the Dialog, that is moved inside body, may be referenced where it war originally placed, and so can be deleted from there")) + +(defmethod wcomponent-template ((obj djtooltip-dialog)) + (let ((id (htcomponent-client-id obj))) + (_djtooltip-dialog> :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj))))
Added: trunk/main/dojo/src/djform.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djform.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,469 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djform.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djform (cform djwidget) + ((update-id :initarg :update-id + :reader update-id + :documentation "A list of the component id to update") + (ajax-form-p :initarg :ajax-form-p + :reader djform-ajax-form-p + :documentation "When not nil, requests are sent via XHR call.")) + (:metaclass metacomponent) + (:documentation "Class to generate a <form> element that is capable of XHR requests. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "claw.Form" :update-id () :ajax-form-p t)) + +(defmethod wcomponent-template((obj djform)) + (let ((id (htcomponent-client-id obj)) + (method (form-method obj)) + (dojo-type (djwidget-dojo-type obj)) + (update-id (update-id obj))) + (form> :static-id id + :xhr (djform-ajax-form-p obj) + :method method + :dojotype dojo-type + :update-id (when update-id + (let ((js-array (ps* `(array ,update-id)))) + (subseq js-array 0 (1- (length js-array))))) + (wcomponent-informal-parameters obj) + (input> :name *rewind-parameter* + :type "hidden" + :value id) + (htcomponent-body obj)))) + + +(defmethod htcomponent-instance-initscript ((obj djform)) + nil) + +(defclass djtext-box (cinput djwidget) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.TextBox") + (:default-initargs :dojo-type "dijit.form.TextBox" :type "text")) + +(defmethod wcomponent-template ((obj djtext-box)) + (let ((client-id (htcomponent-client-id obj)) + (type (claw::input-type obj)) + (dojo-type (djwidget-dojo-type obj)) + (translator (translator obj)) + (value "") + (class (claw::css-class obj))) + (when (component-validation-errors obj) + (if (or (null class) (string= class "")) + (setf class "dijitError") + (setf class (format nil "~a dijitError" class)))) + (setf value (translator-encode translator obj)) + (input> :static-id client-id + :type type + :dojoType dojo-type + :name client-id + :class class + :value value + (wcomponent-informal-parameters obj)))) + +(defclass djtextarea (ctextarea djwidget) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.Textarea") + (:default-initargs :dojo-type "dijit.form.Textarea" :tag-name "textarea")) + +(defmethod wcomponent-template ((obj djtextarea)) + (let ((client-id (htcomponent-client-id obj)) + (tag-name (djwidget-tag-name obj)) + (dojo-type (djwidget-dojo-type obj)) + (translator (translator obj)) + (value "") + (class (claw::css-class obj))) + (when (component-validation-errors obj) + (if (or (null class) (string= class "")) + (setf class "dijitError") + (setf class (format nil "~a dijitError" class)))) + (setf value (translator-encode translator obj)) + (if (string-equal tag-name "textarea") + (textarea> :static-id client-id + :dojoType dojo-type + :name (name-attr obj) + :class class + (wcomponent-informal-parameters obj) + (or (when value ($raw> value)) (htcomponent-body obj))) + (let ((tag-name (djwidget-tag-name obj)) + (parameters (nconc (list :static-id (htcomponent-client-id obj) + :dojo-type (djwidget-dojo-type obj) + :name (name-attr obj)) + (djwidget-formal-parameters obj)))) + (build-tagf tag-name + 'tag + (not (null (find tag-name *empty-tags*))) + (list + parameters + (wcomponent-informal-parameters obj) + (or (when value ($raw> value)) + (htcomponent-body obj)))))))) + + +(defclass djsimple-textarea (djtextarea) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.SimpleTextarea") + (:default-initargs :dojo-type "dijit.form.SimpleTextarea" :type "text")) + +(defclass djvalidation-text-box (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.ValidationTextBox") + (:default-initargs :dojo-type "dijit.form.ValidationTextBox" :type "text" + :dojo-require (list "dijit.form.ValidationTextBox"))) + +(defclass djmapped-text-box (djvalidation-text-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a DJVALIDATION-TEXT-BOX, but is used to render a dojo dijit.form.MappedTextBox") + (:default-initargs :dojo-type "dijit.form.MappedTextBox")) + +(defclass djrange-bound-text-box (djvalidation-text-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a DJVALIDATION-TEXT-BOX, but is used to render a dojo dijit.form.RangeBoundTextBox") + (:default-initargs :dojo-type "dijit.form.RangeBoundTextBox")) + +(defclass djnumber-text-box (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.NumberTextBox") + (:default-initargs :dojo-type "dijit.form.NumberTextBox" :type "text")) + +(defclass djnumber-spinner (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.NumberSpinner") + (:default-initargs :dojo-type "dijit.form.NumberSpinner" :type "text")) + +(defclass djcheck-box (ccheckbox djwidget) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CCHECKBOX, but is used to render a dojo dijit.form.CheckBox") + (:default-initargs :dojo-type "dijit.form.CheckBox")) + +(defmethod wcomponent-template ((cinput djcheck-box)) + (let* ((client-id (htcomponent-client-id cinput)) + (dojo-type (djwidget-dojo-type cinput)) + (translator (translator cinput)) + (type (input-type cinput)) + (value (translator-value-type-to-string translator (ccheckbox-value cinput))) + (current-value (translator-type-to-string translator cinput)) + (class (css-class cinput))) + (when (component-validation-errors cinput) + (if (or (null class) (string= class "")) + (setf class "error") + (setf class (format nil "~a error" class)))) + (input> :static-id client-id + :type type + :dojoType dojo-type + :name (name-attr cinput) + :class class + :value value + :checked (when (and current-value (equal value current-value)) "checked") + (wcomponent-informal-parameters cinput)))) + +(defclass djradio-button (cradio djwidget) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CRADIO, but is used to render a dojo dijit.form.CheckBox") + (:default-initargs :dojo-type "dijit.form.RadioButton" :dojo-require (list "dijit.form.CheckBox"))) + +(defmethod wcomponent-template ((cinput djradio-button)) + (let* ((client-id (htcomponent-client-id cinput)) + (translator (translator cinput)) + (type (input-type cinput)) + (dojo-type (djwidget-dojo-type cinput)) + (value (translator-value-type-to-string translator (ccheckbox-value cinput))) + (current-value (translator-type-to-string translator cinput)) + (class (css-class cinput))) + (when (component-validation-errors cinput) + (if (or (null class) (string= class "")) + (setf class "error") + (setf class (format nil "~a error" class)))) + (input> :static-id client-id + :type type + :dojoType dojo-type + :name (name-attr cinput) + :class class + :value value + :checked (when (and current-value (equal value current-value)) "checked") + (wcomponent-informal-parameters cinput)))) + +(defclass djcombo-box (cinput djwidget) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CSELECT, but is used to render a dojo dijit.form.ComboBox") + (:default-initargs :dojo-type "dijit.form.ComboBox" :multiple nil)) + +(defmethod wcomponent-template ((obj djcombo-box)) + (let ((client-id (htcomponent-client-id obj)) + (dojo-type (djwidget-dojo-type obj)) + (translator (translator obj)) + (value "") + (class (claw::css-class obj))) + (when (component-validation-errors obj) + (if (or (null class) (string= class "")) + (setf class "dijitError") + (setf class (format nil "~a dijitError" class)))) + (setf value (translator-encode translator obj)) + (select> :static-id client-id + :dojoType dojo-type + :name client-id + :class class + :value value + :multiple (cinput-result-as-list-p obj) + (wcomponent-informal-parameters obj) + (htcomponent-body obj)))) + +(defclass djmulti-select (djcombo-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a DJVALIDATION-TEXT-BOX, but is used to render a dojo dijit.form.MultiSelect") + (:default-initargs :dojo-type "dijit.form.MultiSelect" :multiple t)) + +(defclass djfiltering-select (djcombo-box) + ((onchange :initarg :onchange)) + (:metaclass metacomponent) + (:documentation "This class inherits from a CSELECT, but is used to render a dojo dijit.form.FilteringSelect") + (:default-initargs :dojo-type "dijit.form.FilteringSelect")) + +(defclass djinline-edit-box (cinput djwidget) + ((autosavep :initarg :autosavep + :reader djinline-edit-box-autosavep + :documentation "Changing the value automatically saves it; don't have to push save button (and save button isn't even displayed)") + (button-save :initarg :button-save + :reader djinline-edit-box-button-save + :documentation "Save button label") + (button-cancel :initarg :button-cancel + :reader djinline-edit-box-button-cancel + :documentation "Cancel button label") + (render-as-html :initarg :render-as-html + :accessor djinline-edit-box-render-as-html + :documentation "Set this to true if the specified Editor's value should be interpreted as HTML rather than plain text (ie, dijit.Editor)") + (editor :initarg :editor + :reader djinline-edit-box-editor + :documentation "The widget used to edit the value")) + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.InLineEditBox. More info at http://api.dojotoolkit.org/") + (:default-initargs :empty t :dojo-type "dijit.InlineEditBox" + :tag-name "span" + :autosavep t + :button-save nil + :button-cancel nil + :render-as-html nil + :editor "dijit.form.TextBox")) + +(defmethod wcomponent-template ((obj djinline-edit-box)) + (let ((id (htcomponent-client-id obj)) + (tag-name (djwidget-tag-name obj)) + (auto-save (if (djinline-edit-box-autosavep obj) "true" "false")) + (button-save (djinline-edit-box-button-save obj)) + (button-cancel (djinline-edit-box-button-cancel obj)) + (render-as-html (if (djinline-edit-box-render-as-html obj) "true" "false")) + (editor (djinline-edit-box-editor obj)) + (value "")) + (build-tagf tag-name + 'tag nil + :static-id id + :value value + :autosave auto-save + :buttonsave button-save + :buttoncancel button-cancel + :renderashtml render-as-html + :editor editor + (wcomponent-informal-parameters obj)))) + +(defmethod htcomponent-instance-initscript((obj djinline-edit-box)) + (let ((id (htcomponent-client-id obj)) + (page-url (page-url (htcomponent-page obj)))) + (ps* `(dojo.connect (dijit.by-id ,id) + "onChange" + (lambda (e) (dojo.xhrPost (create :url ,page-url + :error (lambda (data) (console.error data)) + :timeout 2000 + :handle-as "json" + :content (create :json (array) + ,*rewind-parameter* ,id)))))))) + +(defclass djdate-text-box (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.DateTextBox") + (:default-initargs :dojo-type "dijit.form.DateTextBox" :type "text" + :translator *date-translator-ymd*)) + + +(defclass djtime-text-box (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.DateTextBox") + (:default-initargs :dojo-type "dijit.form.TimeTextBox" :type "text" + :translator *date-translator-time*)) + +(defclass djcalendar (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit._Calendar") + (:default-initargs :dojo-type "dijit._Calendar" :dojo-require (list "dijit._Calendar" "dojo.date.locale") + :type "text" + :translator *date-translator-ymd*)) + + +(defclass djcurrency-text-box (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT, but is used to render a dojo dijit.form.CurrencyTextBox") + (:default-initargs :dojo-type "dijit.form.CurrencyTextBox" :type "text")) + + +(defclass _djslider (djwidget) + () + (:metaclass metacomponent) + (:documentation "Base class to map dojo dijit.form.Slider. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-require (list "dijit.form.Slider"))) + +(defclass _djslider-slider (cinput _djslider) + () + (:metaclass metacomponent) + (:default-initargs :reserved-parameters (list :value :name) :translator *number-translator*) + (:documentation "Base class to map dojo dijit.form.HorizontalSlider and dijit.form.VerticalSlider. More info at http://api.dojotoolkit.org/")) + +(defmethod wcomponent-template ((_djslider-slider _djslider-slider)) + (let ((client-id (htcomponent-client-id _djslider-slider)) + (translator (translator _djslider-slider)) + (value "") + (class (css-class _djslider-slider))) + (when (component-validation-errors _djslider-slider) + (if (or (null class) (string= class "")) + (setf class "dijitError") + (setf class (format nil "~a dijitError" class)))) + (setf value (translator-encode translator _djslider-slider)) + (div> :static-id client-id + :dojoType (djwidget-dojo-type _djslider-slider) + :value value + :class class + :name (name-attr _djslider-slider) + (wcomponent-informal-parameters _djslider-slider) + (htcomponent-body _djslider-slider)))) + +(defclass djhorizontal-slider (_djslider-slider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.HorizontalSlider. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.HorizontalSlider")) + +(defclass djhorizontal-rule (_djslider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.HorizontalRule. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.HorizontalRule")) + +(defclass djhorizontal-rule-labels (_djslider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.HorizontalRuleLabels. Renders like an <ol> tag element, so put +<li> tag elements inside. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.HorizontalRuleLabels" :tag-name "ol")) + +(defclass djvertical-slider (_djslider-slider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.VerticalSlider. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.VerticalSlider")) + +(defclass djvertical-rule (_djslider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.VerticalRule. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.VerticalRule")) + +(defclass djvertical-rule-labels (_djslider) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.form.VerticalRuleLabels. Renders like an <ol> tag element, so put +<li> tag elements inside. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.form.VerticalRuleLabels" :tag-name "ol")) + +(defclass djtext-box-file (djtext-box) + () + (:metaclass metacomponent) + (:documentation "This class inherits from a CINPUT of type "file", but is used to render a dojo dijit.form.DateTextBox") + (:default-initargs :dojo-type "dojox.widget.FileInput" :type nil + :translator *file-translator*)) + +(defmethod htcomponent-stylesheet-files((djtext-box-file djtext-box-file)) + (list (format nil "~a/dojotoolkit/dojox/widget/FileInput/FileInput.css" (clawserver-base-path (current-server))))) + +(defclass djeditor (djtextarea) + ((form :initform nil + :accessor djeditor-form)) + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "claw.Editor" :tag-name "div")) + +(defclass djeditor-plugins-always-show-toolbar (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.AlwaysShowToolbar" :tag-name nil)) + +(defclass djeditor-plugins-enter-key-handling (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.EnterKeyHandling" :tag-name nil)) + +(defclass djeditor-plugins-font-choice (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.FontChoice" :tag-name nil)) + +(defclass djeditor-plugins-link-dialog (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.LinkDialog" :tag-name nil)) + +(defclass djeditor-plugins-text-color (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.TextColor" :tag-name nil)) + +(defclass djeditor-plugins-toggle-dir (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Editor. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit._editor.plugins.ToggleDir" :tag-name nil)) +
Added: trunk/main/dojo/src/djlayout.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djlayout.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,101 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djcontainers.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djaccordion-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.AccordionContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.AccordionContainer")) + +(defclass djaccordion-pane (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.AccordionPane component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.AccordionPane":dojo-require (list "dijit.layout.AccordionContainer"))) + +(defclass djborder-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.BorderContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.BorderContainer")) + +(defclass djcontent-pane (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.ContentPane component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.ContentPane")) + +(defclass djlayout-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.LayoutContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.LayoutContainer")) + +(defclass djlink-pane (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.LinkPane component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.LinkPane")) + +(defclass djsplit-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.SplitContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.SplitContainer")) + +(defclass djstack-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.StackContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.StackContainer")) + +(defclass djstack-controller (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.StackController component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.StackController" :dojo-require (list "dijit.layout.StackContainer"))) + +(defclass djtab-container (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.TabContainer component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.TabContainer")) + +(defclass djtab-controller (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.layout.TabController component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.layout.TabController" :dojo-require (list "dijit.layout.TabContainer"))) + + + + +
Added: trunk/main/dojo/src/djlink.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djlink.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,63 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djlink.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djaction-link (action-link djwidget) + ((update-id :initarg :update-id + :reader update-id + :documentation "A list of the component id to update")) + (:metaclass metacomponent) + (:documentation "Class that extends ACTION-LINK to handle XHR requests.") + (:default-initargs :dojo-type "dijit.form.Form" :update-id ())) + +(defmethod wcomponent-template((o djaction-link)) + (let ((client-id (htcomponent-client-id o))) + (a> :static-id client-id + :href "#" + (wcomponent-informal-parameters o) + (htcomponent-body o)))) + + +(defmethod htcomponent-instance-initscript((obj djaction-link)) + (let ((id (htcomponent-client-id obj)) + (page-url (page-url (htcomponent-page obj))) + (update-id-list (update-id obj))) + (ps* + `(dojo.connect (dojo.by-id ,id) + "onclick" + (lambda (e) (progn + (e.prevent-default) + (dojo.xhr-post (create :url ,page-url + :load (lambda (data) (claw.update-and-eval data)) + :error (lambda (data) (console.error data)) + :timeout 2000 + :handle-as "json" + :content (create :json (array ,update-id-list) + ,*rewind-parameter* ,id)))))))))
Added: trunk/main/dojo/src/djmenu.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djmenu.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,55 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djmenu.lisp $ + +;;; 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. + +(in-package :dojo) + + +(defclass djmenu (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Menu. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.Menu")) + +(defclass djmenu-item (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.MenuItem. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.MenuItem" :dojo-require (list "dijit.Menu"))) + +(defclass djmenu-separator (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.MenuSeparator. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.MenuSeparator" :dojo-require (list "dijit.Menu"))) + +(defclass djpopup-menu-item (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.PopupMenuItem. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.PopupMenuItem" :dojo-require (list "dijit.Menu")))
Added: trunk/main/dojo/src/djprogressbar.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djprogressbar.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,39 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djprogressbar.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djprogress-bar (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.ProgressBar. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.ProgressBar")) + + +
Added: trunk/main/dojo/src/djtitlepane.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djtitlepane.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,37 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djtitlepane.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djtitle-pane (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.TitlePane. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.TitlePane")) +
Added: trunk/main/dojo/src/djtoolbar.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djtoolbar.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,43 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djtoolbar.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djtoolbar (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Toolbar. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.Toolbar")) + +(defclass djtoolbar-separator (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.ToolbarSeparator. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.ToolbarSeparator")) +
Added: trunk/main/dojo/src/djtooltip.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djtooltip.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,49 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djtooltip.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass _djtooltip (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Tooltip component. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.Tooltip")) + +(defclass djtooltip (wcomponent) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Tooltip component. More info at http://api.dojotoolkit.org/. It adds a HardLink so that the Dialog, that is moved inside body, may be referenced where it war originally placed, and so can be deleted from there")) + +(defmethod wcomponent-template ((obj djtooltip)) + (let ((id (htcomponent-client-id obj))) + (list + (djhard-link> :ref-id id) + (_djtooltip> :static-id id + (wcomponent-informal-parameters obj) + (htcomponent-body obj)))))
Added: trunk/main/dojo/src/djtree.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djtree.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,39 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djtree.lisp $ + +;;; 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. + +(in-package :dojo) + +(defclass djtree (djwidget) + () + (:metaclass metacomponent) + (:documentation "Class for dojo dijit.Toolbar. More info at http://api.dojotoolkit.org/") + (:default-initargs :dojo-type "dijit.Tree")) + + +
Added: trunk/main/dojo/src/djwidget.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/djwidget.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,81 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/djwidget.lisp $ + +;;; 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. + +(in-package :dojo) + +(defgeneric djwidget-formal-parameters (djwidget) + (:documentation "list of html attributes defined by widget slots")) + +(defclass djwidget (wcomponent) + ((tag-name :initarg :tag-name + :reader djwidget-tag-name + :documentation "The HTML tag element that will be rendered") + (dojo-type :initarg :dojo-type + :reader djwidget-dojo-type + :documentation "The type of the dojo element, it will be added as dojoType HTML custom tag attribute") + (dojo-rquire :initarg :dojo-require + :reader djwidget-dojo-require + :documentation "A list of addictional dojo reqirements")) + (:metaclass metacomponent) + (:default-initargs :tag-name "div" :dojo-require nil) + (:documentation "Base class to render dojo widgets")) + +(let ((class (find-class 'djwidget))) + (closer-mop:ensure-finalized class) + (setf (documentation (find-symbol (format nil "~a>" (class-name class))) 'function) + (format nil "Description: ~a~%Parameters:~%~a~a~%~%~a" + "Function that instantiates a DJWIDGET component and renders a html tag enabled for dojo whose name is provided by the :TAG-NAME keyword and the dojo widget by :DOJO-TYPE." + *id-and-static-id-description* + (describe-html-attributes-from-class-slot-initargs class) + (describe-component-behaviour class)))) + +(defmethod djwidget-formal-parameters ((djwidget djwidget))()) + +(defmethod htcomponent-class-initscripts ((obj djwidget)) + (let ((dojo-type (djwidget-dojo-type obj)) + (dojo-require (djwidget-dojo-require obj))) + (append + (list (ps* `(dojo.require "dojo.parser"))) + (unless dojo-require + (list (ps* `(dojo.require ,dojo-type)))) + (loop for require in dojo-require + collect (ps* `(dojo.require ,require)))))) + +(defmethod wcomponent-template ((obj djwidget)) + (let ((tag-name (djwidget-tag-name obj))) + (when tag-name + (let ((parameters (nconc (list :static-id (htcomponent-client-id obj) :dojo-type (djwidget-dojo-type obj)) + (djwidget-formal-parameters obj)))) + (build-tagf tag-name + 'tag + (not (null (find tag-name *empty-tags*))) + (list + parameters + (wcomponent-informal-parameters obj) + (htcomponent-body obj)))))))
Added: trunk/main/dojo/src/misc.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/misc.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,43 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/misc.lisp $ + +;;; 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. + +(in-package :dojo) + +(defvar *dojo-misc-file* (load-time-value + (or #.*compile-file-pathname* *load-pathname*))) + +(defun djuser-locale () + (substitute #- #_ (string-downcase (user-locale)))) + +(register-library-resource "dojotoolkit/" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("dojotoolkit")))) +(register-library-resource "dojotoolkit/claw/HardLink.js" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("js")) :name "HardLink" :type "js")) +(register-library-resource "dojotoolkit/claw/FloatingContent.js" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("js")) :name "FloatingContent" :type "js")) +(register-library-resource "dojotoolkit/claw/Rounded.js" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("js")) :name "Rounded" :type "js")) +(register-library-resource "dojotoolkit/claw/Form.js" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("js")) :name "Form" :type "js")) +(register-library-resource "dojotoolkit/claw/Editor.js" (make-pathname :directory (append (pathname-directory *dojo-misc-file*) '("js")) :name "Editor" :type "js"))
Added: trunk/main/dojo/src/packages.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/src/packages.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,185 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/src/packages.lisp $ + +;;; 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. + +(in-package :cl-user) + +(defpackage :claw-dojo + (:nicknames :dojo) + (:use :cl :claw :parenscript) + (:export :*dojo-directory-name* + :djuser-locale + :djwidget-dojo-type + :djwidget-dojo-require + :djwidget + :djwidget> + :djwidget-formal-parameters + :djxcontent-pane + :djxcontent-pane> + :djbody + :djbody> + ;;dijit namespace + :djbackground-iframe + :djbackground-iframe> + :djcolor-palette + :djcolor-palette> + :djdialog + :djdialog> + :djdialog-underlay + :djdialog-underlay> + :djeditor + :djeditor> + :djeditor-plugins-always-show-toolbar + :djeditor-plugins-always-show-toolbar> + :djeditor-plugins-enter-key-handling + :djeditor-plugins-enter-key-handling> + :djeditor-plugins-font-choice + :djeditor-plugins-font-choice> + :djeditor-plugins-link-dialog + :djeditor-plugins-link-dialog> + :djeditor-plugins-text-color + :djeditor-plugins-text-color> + :djeditor-plugins-toggle-dir + :djeditor-plugins-toggle-dir> + :djinline-edit-box + :djinline-edit-box> + :djmenu + :djmenu> + :djmenu-item + :djmenu-item> + :djmenu-separator + :djmenu-separator> + :djpopup-menu-item + :djpopup-menu-item> + :djprogress-bar + :djprogress-bar> + :djtitle-pane + :djtitle-pane> + :djtoolbar + :djtoolbar> + :djtoolbar-separator + :djtoolbar-separator> + :djtooltip + :djtooltip> + :djtooltip-dialog + :djtooltip-dialog> + :djtree + :djtree> + ;;dijit.form namespace + :djbutton + :djbutton> + :djsubmit-button + :djsubmit-button> + :djcheck-box + :djcheck-box> + :djcombo-box + :djcombo-box> + :djcombo-button + :djcombo-button> + :djcurrency-text-box + :djcurrency-text-box> + :djdate-text-box + :djdate-text-box> + :djcalendar + :djcalendar> + :djdrop-down-button + :djdrop-down-button> + :djfiltering-select + :djfiltering-select> + :djform + :djform> + :djhorizontal-rule + :djhorizontal-rule> + :djhorizontal-rule-labels + :djhorizontal-rule-labels> + :djhorizontal-slider + :djhorizontal-slider> + :djmapped-text-box + :djmapped-text-box> + :djmulti-select + :djmulti-select> + :djnumber-spinner + :djnumber-spinner> + :djnumber-text-box + :djnumber-text-box> + :djradio-button + :djradio-button> + :djrange-bound-text-box + :djrange-bound-text-box> + :djsimple-textarea + :djsimple-textarea> + :djtextarea + :djtextarea> + :djtext-box + :djtext-box> + :djtime-text-box + :djtime-text-box> + :djtoggle-button + :djtoggle-button> + :djvalidation-text-box + :djvalidation-text-box> + :djvertical-rule + :djvertical-rule> + :djvertical-rule-labels + :djvertical-rule-labels> + :djvertical-slider + :djvertical-slider> + :djaction-link + :djaction-link> + :djtext-box-file + :djtext-box-file> + ;;dijit.layout namespace + :djaccordion-container + :djaccordion-container> + :djaccordion-pane + :djaccordion-pane> + :djborder-container + :djborder-container> + :djcontent-pane + :djcontent-pane> + :djlayout-container + :djlayout-container> + :djlink-pane + :djlink-pane> + :djsplit-container + :djsplit-container> + :djstack-container + :djstack-container> + :djstack-controller + :djstack-controller> + :djtab-container + :djtab-container> + :djtab-controller + :djtab-controller> + ;;claw namespace + :djfloating-content + :djfloating-content> + :djhard-link + :djhard-link> + :djrounded + :djrounded>))
Added: trunk/main/dojo/tests/ajax-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/ajax-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,285 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/ajax-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + +(defgeneric display-btn (pobj)) +(defgeneric read-message (pobj)) +(defgeneric write-message (pobj value)) + + +(defclass ajax-page (page) + ((display-btn-p :initform nil + :accessor ajax-page-display-btn-p) + (name :initform "" + :accessor ajax-page-name) + (surname :initform "" + :accessor ajax-page-surname) + (combo-message :initform "" + :accessor ajax-page-country) + (cardinal-point :initform "NE" + :accessor ajax-page-cardinal-point) + (lisper :initform nil + :accessor ajax-page-lisper) + (color :initform "red" + :accessor ajax-page-color) + (date :initform (local-time:now) + :accessor ajax-page-date) + (time :initform (local-time:now) + :accessor ajax-page-time) + (wallet :initform 50.25 + :accessor ajax-page-wallet) + (year :initform 2000 + :accessor ajax-page-year) + (file :initform nil + :accessor ajax-page-inputfile))) + +(defclass simpledjbutton (djbutton) + () + (:metaclass metacomponent)) + +(defclass ajax-exception-monitor (exception-monitor) + () + (:metaclass metacomponent)) + +(defmethod wcomponent-template ((obj ajax-exception-monitor)) + (exception-monitor> :static-id (htcomponent-client-id obj) + (let ((errors (validation-errors)) + (dialog-id (format nil "~aDialog" (htcomponent-client-id obj)))) + (div> :render-condition #'(lambda() errors) + (list + (djbutton> :id "id" :onclick (ps* `(.show (dijit.by-id ,dialog-id))) + "Validation errors") + (style> (format nil "#~a .dijitError {border-color:#f3d118;background-color:#f9f7ba;color:red;}" dialog-id)) + (djdialog> :static-id dialog-id + ;:open "true" + :title "Validation errors" + (loop for (component-id reasons) on errors by #'cddr + collect (loop for reason in reasons + collect (p> reason))))))))) + +(defmethod htcomponent-instance-initscript ((obj ajax-exception-monitor)) + (let ((errors (validation-errors)) + (dialog-id (format nil "~aDialog" (htcomponent-client-id obj)))) + (when errors + (ps* `(let ((dialog (dijit.by-id ,dialog-id))) + (dojo.add-class (slot-value dialog 'container-node) "dijitError") + (.show dialog)))))) + + +(defmethod htcomponent-instance-initscript ((obj simpledjbutton)) + (let ((id (htcomponent-client-id obj)) + (pobj (htcomponent-page obj))) + (ps* `(dojo.connect (dijit.by-id ,id) + "onClick" + nil + (lambda () (alert (+ "Hello " + ,(ajax-page-name pobj) + " " + ,(ajax-page-surname pobj) + " from " + ,(ajax-page-country pobj) + "!\nYour preferred color is " + ,(ajax-page-color pobj) + "\nDirection taken --> " + ,(ajax-page-cardinal-point pobj)))))))) + +(defmethod display-btn ((pobj ajax-page)) + (setf (ajax-page-display-btn-p pobj) t)) + +(defvar *integet-translator* (make-instance 'translator-integer)) + +(defmethod page-content ((pobj ajax-page)) + (let ((dyna-content-id (generate-id "dynacontent")) + (spinner-id (generate-id "spinner")) + (djbutton-id (generate-id "djbutton")) + (path-file-mimetype (ajax-page-inputfile pobj))) + (site-template> :title "dojo ajax test page" + (style> "table td {text-align: right; vertical-align: top;} +td.left {text-align: left;} +td p {margin: 0.25em;} +.colorInput, .colorBox {float: left; position: relative; } +.colorBox {display: block; margin-right: 10px; height: 1em; width: 1em; border: 1px solid gray;}") + (p> + (div> :static-id dyna-content-id + (div> :render-condition #'(lambda () (ajax-page-display-btn-p pobj)) + (simpledjbutton> :id djbutton-id (span> "Show message")) + (div> :render-condition #'(lambda () path-file-mimetype) + :style "border: 1px solid gray;" + (third path-file-mimetype)))) + (div> + (action-link> :id "alink" + :action 'display-btn + "display") + "|" + (djaction-link> :id "djlink" + :action 'display-btn + :update-id (list dyna-content-id) + "ajax display") + (djform> :id "djform" + :enctype "multipart/form-data" + :ajax-form-p t + :method "post" + :action 'display-btn + :update-id (list dyna-content-id) + :on-before-submit (ps* `(.show (dijit.by-id ,spinner-id))) + :on-xhr-finish (ps* `(.hide (dijit.by-id ,spinner-id))) + (table> + (tr> + (td> "Name") + (td> :class "left" + (djvalidation-text-box> :id "name" + :label "Name" + :required "true" + :accessor 'ajax-page-name + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value))))) + + (tr> + (td> "Surname") + (td> :class "left" + (djtext-box> :id "surname" + :label "Surname" + :accessor 'ajax-page-surname + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value))))) + (tr> + (td> "Country") + (td> :class "left" + (djcombo-box> :id "country" + :accessor 'ajax-page-country + :label "Country" + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value)) + (option> :value "FR" "France") + (option> :value "IT" "Italy") + (option> :value "US" "USA") + (option> :value "ES" "Spain")) + (p> + "djcombo-box allow to insert even non expected values.") + (p> :style "margin-bottom: .75em;" + "The passed parameter value is the one typed"))) + (tr> + (td> "Cardinal point") + (td> :class "left" + (djfiltering-select> :id "cardinal" + :accessor 'ajax-page-cardinal-point + :label "Cardinal point" + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value)) + (option> :value "N" "North") + (option> :value "NE" "North-East") + (option> :value "E" "East") + (option> :value "SE" "South-East") + (option> :value "S" "South") + (option> :value "SW" "South-West") + (option> :value "W" "West") + (option> :value "NW" "North-West")) + (p> + "djfiltring-select doesn't allow to insert non expected values.") + (p> :style "margin-bottom: .75em;" + "The value submitted with the form is the hidden value (ex: NE), not the displayed value a.k.a. label (ex: North-East)"))) + (tr> + (td> "Year") + (td> :class "left" + (djnumber-spinner> :id "year" + :label "Year" + :pattern "####" + :constraints "{min:2000,max:2100}" + :translator *integet-translator* + :accessor 'ajax-page-year + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value))))) + (tr> + (td> "Date") + (td> :class "left" + (djdate-text-box> :id "date" + :label "Date" + :accessor 'ajax-page-date))) + (tr> + (td> "Time") + (td> :class "left" + (djtime-text-box> :id "time" + :label "Time" + :accessor 'ajax-page-time))) + (tr> + (td> "Wallet") + (td> :class "left" + (djcurrency-text-box> :id "wallet" + :label "Wallet" + :currency "€" + :accessor 'ajax-page-wallet))) + (tr> + (td> "Lisper") + (td> :class "left" + (djcheck-box> :id "lisper" + :label "Lisper" + :translator *boolean-translator* + :accessor 'ajax-page-lisper + :value T + :validator #'(lambda (value) + (validate-required (page-current-component pobj) value :message "You must be a lisper to submit data!"))))) + (tr> + (td> "Preferred color") + (td> :class "left" + (djradio-button> :id "color" + :class "colorInput" + :label "Color" + :accessor 'ajax-page-color + :value "red") + (span> :style "background: red;" :class "colorBox") + (djradio-button> :id "color" + :class "colorInput" + :label "Color" + :accessor 'ajax-page-color + :value "green") + (span> :style "background: green;" :class "colorBox") + (djradio-button> :id "color" + :class "colorInput" + :label "Color" + :accessor 'ajax-page-color + :value "blue") + (span> :style "background: blue;" :class "colorBox"))) + (tr> + (td> "Text file") + (td> :class "left" + (djtext-box-file> :id "inputFile" + :label "File" + :accessor 'ajax-page-inputfile)))) + (submit-link> :id "slink" + :action 'display-btn + "update link") + (djsubmit-button> :id "submitButton" :value "Update") + (ajax-exception-monitor> :id "exceptionMonitor")) + (djfloating-content> :static-id spinner-id + (img> :alt "spinner" + :src (format nil "~a/docroot/img/spinner.gif" (build-lisplet-location (current-lisplet)))))))))) + + +(lisplet-register-page-location *dojo-test-lisplet* 'ajax-page "ajax.html") \ No newline at end of file
Added: trunk/main/dojo/tests/common.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/common.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,56 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/common.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + +(defclass site-template (wcomponent) + ((title :initarg :title + :reader site-template-title) + (djconfig :initarg :djconfig + :reader site-template-djconfig)) + (:metaclass metacomponent) + (:default-initargs :djconfig nil)) + +(defmethod wcomponent-template ((o site-template)) + (html> + (head> + ;;(meta> :HTTP-EQUIV "expires" :CONTENT "Wed, 26 Feb 2100 08:21:57 GMT") + (title> (site-template-title o)) + (link> :href (format nil "~a/docroot/css/style.css" (build-lisplet-location (current-lisplet))) + :rel "stylesheet" + :type "text/css")) + (djbody> :is-debug "false" + :djconfig (site-template-djconfig o) + (p> + (a> :href "../test/index.html" "home") + (p> + " Current language "" + (djuser-locale) """)) + (wcomponent-informal-parameters o) + (htcomponent-body o))))
Added: trunk/main/dojo/tests/djbutton-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djbutton-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,75 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djbutton-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djbutton-page (page) ()) + +(defmethod page-content ((o djbutton-page)) + (site-template> :title "dojo buttons test page" + (p> + (djbutton> :id "djbutton" + (span> "djbutton")) + (djdrop-down-button> :id "djddbutton" + (span> "djdropdown-button") + (djmenu> :id "menu" + (djmenu-item> :id "menu" + :iconclass "dijitEditorIcon dijitEditorIconCopy" + "copy") + (djmenu-item> :id "menu" + :iconclass "dijitEditorIcon dijitEditorIconCut" + "cut") + (djmenu-item> :id "menu" + :iconclass "dijitEditorIcon dijitEditorIconPaste" + "paste"))) + (djcombo-button> :id "djComboButton" + :optionstitle "save options" + :iconclass "plusBlockIcon" + (span> "combo button") + (djmenu> :id "menu" + (djmenu-item> :id "menu" + :iconClass "dijitEditorIcon dijitEditorIconSave" + :onclick "alert('save')" + "save") + (djmenu-item> :id "menu" + :iconClass "dijitEditorIcon dijitEditorIconSave" + :onclick "alert('save as')" + "save as"))) + (djtoggle-button> :id "djToggleButtonCheck" + :iconclass "dijitCheckBoxIcon" + :onchange "console.log('toggled button checked='+arguments[0]);" + "Toggle me") + (djtoggle-button> :id "djToggleButtonRadio" + :iconclass "dijitRadioIcon" + :onchange "console.log('toggled button checked='+arguments[0]);" + "Toggle me")))) + + +(lisplet-register-page-location *dojo-test-lisplet* 'djbutton-page "djbutton.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djcalendar-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djcalendar-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,87 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djcalendar-tests.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + +(defgeneric djcalendar-page-null-action (page)) + +(defclass djcalendar-page (page) + ((cal1 :initarg :cal1 + :accessor djcalendar-page-cal1) + (cal2 :initarg :cal2 + :accessor djcalendar-page-cal2) + (cal3 :initarg :cal3 + :accessor djcalendar-page-cal3) + (cal4 :initarg :cal4 + :accessor djcalendar-page-cal4) + (cal-local :initarg :cal-local + :accessor djcalendar-page-cal-local)) + (:default-initargs :cal1 (local-time:now) :cal2 (local-time:now) + :cal3 (local-time:now) + :cal4 (local-time:now) + :cal-local (local-time:now))) + +(defmethod djcalendar-page-null-action ((o djcalendar-page))) + +(defmethod page-content ((o djcalendar-page)) + (let ((lang (djuser-locale)) + (dates-container-id (generate-id "datesContainer"))) + (site-template> :title "dojo calendar test page" + :djconfig (format nil "extraLocale:['en-us','es-es', 'ar-sy', 'zh-cn', '~a']" lang) + (djform> :id "theForm" :update-id (list dates-container-id) + (div> :static-id dates-container-id + (p> + (h1> "en-en" " encoding") + (djdate-text-box> :id "cal" :lang "en-us" + :accessor 'djcalendar-page-cal1) + (span> (translator-value-type-to-string *date-translator-ymd* (djcalendar-page-cal1 o)))) + (p> + (h1> "es-es" " encoding") + (djdate-text-box> :id "cal" :lang "es-es" + :accessor 'djcalendar-page-cal2) + (span> (translator-value-type-to-string *date-translator-ymd* (djcalendar-page-cal2 o)))) + (p> + (h1> "zh-cn" " encoding") + (djdate-text-box> :id "cal" :lang "zh-cn" + :accessor 'djcalendar-page-cal3) + (span> (translator-value-type-to-string *date-translator-ymd* (djcalendar-page-cal3 o)))) + (p> + (h1> "ar-sy" " encoding") + (djdate-text-box> :id "cal" :lang "ar-sy" + :accessor 'djcalendar-page-cal4) + (span> (translator-value-type-to-string *date-translator-ymd* (djcalendar-page-cal4 o)))) + (p> + (h1> "Local encoding") + (djdate-text-box> :id "cal" :lang lang + :accessor 'djcalendar-page-cal-local) + (span> (translator-value-type-to-string *date-translator-ymd* (djcalendar-page-cal-local o))))) + (p> + (djsubmit-button> :id "submitDates" :value "Submit dates")))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'djcalendar-page "djcalendar.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djcolorpalette-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djcolorpalette-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,51 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djcolorpalette-tests.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djcolorpalette-page (page) ()) + +(defmethod page-content ((o djcolorpalette-page)) + (let ((dialog (djdialog> :id "dialog" + :title "Color Palette!" + (djcolor-palette>)))) + (site-template> :title "dojo buttons test page" + (p> + (djbutton> :id "djbutton" + :onclick (format nil "dijit.byId('~a').show()" (htcomponent-client-id dialog)) + (span> "show color paette dialog")) + (djdropdown-button> + (span> "tooltip dialog") + (djtooltip-dialog> :id "dialog" + :title "HELLO!" + (djcolor-palette>))) + dialog)))) + +(lisplet-register-page-location *dojo-test-lisplet* 'djcolorpalette-page "djcolorpalette.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djdialog-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djdialog-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,67 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djdialog-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djdialog-page (page) ()) + +(defmethod page-content ((o djdialog-page)) + (let ((dialog (djdialog> :id "dialog" + :title "HELLO!" + (span> ($> "hello world")))) + (no-title-dialog-id (generate-id "ntId")) + (lisplet-path (build-lisplet-location (current-lisplet)))) + (site-template> :title "dojo buttons test page" + (p> + (djbutton> :id "djbutton" + :onclick (format nil "dijit.byId('~a').show()" + (htcomponent-client-id dialog)) + (span> "show dialog")) + (djdrop-down-button> :id "ddButton" + (span> "tooltip dialog") + (djtooltip-dialog> :id "dialog" + :title "HELLO!" + (span> "hello world"))) + dialog) + (p> + (djrounded> :id "rounded" + :style "width: 130px;height: 1.5em" + :bg-img (format nil "~a/docroot/img/roundedbg.png" lisplet-path) + :bg-img-alt (format nil "~a/docroot/img/roundedbg.gif" lisplet-path) + (span> :style "font-weight: bold;" "Rounded box gg"))) + (p> + (djbutton> :id "djbutton" + :onclick (format nil "dijit.byId('~a').show()" no-title-dialog-id) + "No title dialog") + (djfloating-content> :static-id no-title-dialog-id + :style "background: transparent;" + (div> :style (format nil "height:60px;width:60px;background: url('~a/docroot/img/spinner.gif') 50% 50% no-repeat;" lisplet-path))))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'djdialog-page "djdialog.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djeditor-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djeditor-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,135 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djeditor-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djeditor-page (page) + ((text1 :initarg :text1 + :accessor djeditor-page-text1) + (text2 :initarg :text2 + :accessor djeditor-page-text2) + (text3 :initarg :text3 + :accessor djeditor-page-text3) + (text4 :initarg :text4 + :accessor djeditor-page-text4)) + (:default-initargs :text1 "" :text2 "" + :text3 "" :text4 "")) + +(defclass editor-dialog (djdialog) + () + (:metaclass metacomponent)) + +(defmethod htcomponent-instance-initscript ((editor-dialog editor-dialog)) + (parenscript:ps* `(.show (dijit.by-id ,(htcomponent-client-id editor-dialog))))) + +(defclass result-text (wcomponent) + ((dialog-content :initarg :dialog-content + :accessor dialog-content) + (style :initarg :style + :reader style)) + (:metaclass metacomponent) + (:default-initargs :style "display:inline;line-height:normal;vertical-align:middle;padding:0pt 0.3em;")) + + +(defmethod wcomponent-template ((obj result-text)) + (let* ((dialog-id (generate-id "resultDialog")) + (dialog-content (dialog-content obj)) + (render-content-function #'(lambda () (progn + (hunchentoot:log-message :info "~a::------->~a" (htcomponent-client-id obj) dialog-content) + (and dialog-content + (string-not-equal dialog-content "")))))) + (div> :static-id (htcomponent-client-id obj) + :style (style obj) + (wcomponent-informal-parameters obj) + (htcomponent-body obj) + (djbutton> :id "showDialog" + :render-condition render-content-function + :onclick (format nil "dijit.byId('~a').show()" dialog-id) + "show text") + (editor-dialog> :render-condition render-content-function + :static-id dialog-id + (div> :style "height:370px;width: 800px;overflow:auto;border: 1px solid gray;padding: 0 .5em;" + ($raw> dialog-content)) + (div> :style "text-align:center;margin-top: 1em;" + (djbutton> :id "close" + :onclick (format nil "dijit.byId('~a').hide()" dialog-id) + (span> "Close"))))))) + +(defmethod page-content ((o djeditor-page)) + (let ((result-text1 (generate-id "resultText")) + (result-text2 (generate-id "resultText")) + (result-text3 (generate-id "resultText")) + (result-text4 (generate-id "resultText")) + (text1 (djeditor-page-text1 o)) + (text2 (djeditor-page-text2 o)) + (text3 (djeditor-page-text3 o)) + (text4 (djeditor-page-text4 o))) + (site-template> :title "dojo editor test page" + (djeditor-plugins-always-show-toolbar>) + (djeditor-plugins-enter-key-handling>) + (djeditor-plugins-font-choice>) + (djeditor-plugins-link-dialog>) + (djeditor-plugins-text-color>) + (djeditor-plugins-toggle-dir>) + (djform> :id "theForm" + :ajax-form-p nil + :update-id (list result-text1) + (p> (djeditor> :id "editor" + :tag-name "div" :accessor 'djeditor-page-text1)) + (result-text> :static-id result-text1 + :dialog-content text1 + (djsubmit-button> :id "submitData" :value "Submit on normal form"))) + (djform> :id "theForm" + :update-id (list result-text2) + (p> (djeditor> :id "editor" + :extraPlugins "['dijit._editor.plugins.AlwaysShowToolbar']" + :accessor 'djeditor-page-text2)) + (result-text> :static-id result-text2 + :dialog-content text2 + (djsubmit-button> :id "submitData" + :value "Submit on claw.Form"))) + (djform> :id "theForm" + :update-id (list result-text3) + (p> (djeditor> :id "editor" + :plugins "['bold','italic','|','createLink','foreColor','hiliteColor',{name:'dijit._editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','insertImage']" + :accessor 'djeditor-page-text3)) + (result-text> :static-id result-text3 + :dialog-content text3 + (csubmit> :id "submitData" :value "Standard submit"))) + (djform> :id "theForm" + :update-id (list result-text4) + (p> (djeditor> :id "editor" + :plugins "['bold','italic','|',{name:'dijit._editor.plugins.EnterKeyHandling'},{name:'dijit._editor.plugins.FontChoice', command:'fontName', custom:['Verdana','Myriad','Garamond','Apple Chancery','Hiragino Mincho Pro']}, {name:'dijit._editor.plugins.FontChoice', command:'fontSize', custom:[3,4,5]}]" + :accessor 'djeditor-page-text4)) + (result-text> :static-id result-text4 + :dialog-content text4 + (djsubmit-button> :id "submitData" :value "Submit")))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'djeditor-page "djeditor.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djmenu-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djmenu-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,272 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djmenu-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djmenu-page (page) + ((top-left :initform "top-left" + :accessor top-left) + (top-right :initform "top-right" + :accessor top-right) + (bottom-left :initform "bottom-left" + :accessor bottom-left) + (bottom-right :initform "bottom-right" + :accessor bottom-right) + (text-area :initform "Hello there" + :accessor text-area) + (select-value :initform "1" + :accessor select-value))) + +(defclass djmenu-page-menu (wcomponent) + () + (:metaclass metacomponent) + (:default-initargs :empty t)) + +(defmethod wcomponent-template ((obj djmenu-page-menu)) + (let ((id (htcomponent-client-id obj))) + (djmenu> :static-id id + (wcomponent-informal-parameters obj) + (djmenu-item> :id "mi" + :onClick "alert('Hello world');" + "Enabled Item") + (djmenu-item> :id "mi" + :disabled "true" + "Disabled Item") + (djmenu-separator> :id "ms") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconCut" + :on-click "alert('not actually cutting anything, just a test!')" + "Cut") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconCopy" + :on-click "alert('not actually copying anything, just a test!')" + "Copy") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconPaste" + :on-click "alert('not actually pasting anything, just a test!')" + "Paste") + (djmenu-separator> :id "ms") + (djpopup-menu-item> :id "mpi" + (span> "Enabled Submenu") + (djmenu> :id "submenu2" + (djmenu-item> :id "mi" + :on-click "alert('Submenu 1!')" + "Submenu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Submenu 2!')" + "Submenu Item Two") + (djpopup-menu-item> :id "pmi" + (span> "Deeper Submenu") + (djmenu> :id "submenu4" + (djmenu-item> :id "mi" + :on-click "alert('Sub-submenu 1!')" + "Sub-sub-menu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Sub-submenu 2!')" + "Sub-sub-menu Item Two"))))) + (djpopup-menu-item> :id "pmi" + :disabled "true" + (span> "Disabled Submenu") + (djmenu> :id "submenu3" :style "display: none;" + (djmenu-item> :id "mi" + :on-click "alert('Submenu 1!')" + "Submenu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Submenu 2!')" + "Submenu Item Two"))) + (djpopup-menu-item> :id "pmi" + (span> "Different popup") + (djcolor-palette> :id "cp"))))) + + +(defmethod page-content ((o djmenu-page)) + (let ((input2-id (generate-id "input2"))) + (site-template> :title "dojo menu test page" + (script> :language "Javascript" :type "text/javascript" + "function createMenu() { + // create a menu programmatically + function fClick() {alert('clicked!')}; + + pMenu = new dijit.Menu({targetNodeIds:['prog_menu'], id:'progMenu'}); + pMenu.addChild(new dijit.MenuItem({label:'Programmatic Context Menu', disabled:true})); + pMenu.addChild(new dijit.MenuSeparator()); + pMenu.addChild(new dijit.MenuItem({label:'Simple menu item', onClick:fClick})); + pMenu.addChild(new dijit.MenuItem({label:'Another menu item', onClick:fClick})); + pMenu.addChild(new dijit.MenuItem({label:'With an icon', iconClass:'dijitEditorIcon dijitEditorIconCut', onClick:fClick})); + var mItem = new dijit.MenuItem({label:'dojo.event clicking'}); + dojo.connect(mItem, 'onClick', function(){alert('click! handler created via dojo.connect()')}); + pMenu.addChild(mItem); + + var pSubMenu = new dijit.Menu({parentMenu:pMenu, id:'progSubMenu'}); + pSubMenu.addChild(new dijit.MenuItem({label:'Submenu item', onClick:fClick})); + pSubMenu.addChild(new dijit.MenuItem({label:'Submenu item', onClick:fClick})); + pMenu.addChild(new dijit.PopupMenuItem({label:'Submenu', popup:pSubMenu, id:'progPopupMenuItem'})); + + pMenu.startup(); + + dojo.byId('prog_menu').innerHTML="This div has a programmatic context menu on it that's different to the page menu."; + dojo.byId('createButton').disabled = true; + dojo.byId('destroyButton').disabled = false; + } + + function destroyMenu(){ + pMenu.destroyRecursive(); + dojo.byId('prog_menu').innerHTML='No programmatic menu on this div, should get page level menu.'; + dojo.byId('createButton').disabled = false; + dojo.byId('destroyButton').disabled = true; + }") + (djmenu-page-menu> :id "submenu1" + :context-menu-for-window "true" + :style "display: none;") + (djmenu-page-menu> :id "leftClick" + :left-click-to-open "true" + :target-node-ids input2-id + :style "display: none;") + (div> :style "padding: 1em" + (h1> :class "testTitle" "Dijit Menu System Test") + (h3> "Form") + (cform> :id "theForm" + (cinput> :id "input1" :accessor 'top-left) + (p> :style "text-align:right" + "left click to open the menu for this input:" + (br>) + "Note: because of the window contextMenu, make sure you get" + (br>) + "the right menu by verifying the left" + (br>) + "click one starts with "Left Click Menu"" + (br>) + "at the very top." + (cinput> :static-id input2-id :accessor 'top-right)) + (ctextarea> :id "textarea" :accessor 'text-area) + (br>) + (cselect> :id "select" + :accessor 'select-value + (option> :value "1" + (when (string= "1" (select-value o)) + (list :selected "selected")) + "check if i") + (option> :value "2" + (when (string= "2" (select-value o)) + (list :selected "selected")) + "bleed through") + (option> :value "3" + (when (string= "3" (select-value o)) + (list :selected "selected")) + "on IE6")) + (button> :id "button" + "push me")) + (div> :id "prog_menu" + :style "border:1px solid blue; padding:10px; margin:20px 0;" + "Click button below to create special menu on this div.") + (button> :id "createButton" + :onclick "createMenu();" + "create programmatic menu") + (button> :id "destroyButton" + :onclick "destroyMenu();" + :disabled "disabled" + "destroy programmatic menu") + (div> :style "height:500px") + (p> "(this space intentionally left blank to aid testing with controls + at the bottom of the browser window)") + (div> :style "height:500px") + (cform> :id "theForm" + (cinput> :id "input3" + :accessor 'bottom-left) + (p> :style "text-align:right" + (cinput> :id "input4" :accessor 'bottom-right)) + (p> "See also: " + (a> :href "djbutton.html" + "test Button") + "(PopupMenu is used with DropDownButton and ComboButton)") + (h3> "Mouse opening tests") + (ul> + (li> "Right click on the client area of the page (ctrl-click for Macintosh). Menu should open.") + (li> "Right click on each of the form controls above. Menu should open.") + (li> "Right click near the righthand window border. Menu should open to the left of the pointer.") + (li> "Right click near the bottom window border. Menu should open above the pointer.")) + (h3> "Mouse hover tests") + (ul> + (li> "Hover over the first item with the pointer. Item should highlight and get focus.") + (li> "Hover over the second (disabled) item. Item should highlight and get focus.") + (li> "Seperator items should not highlight on hover - no items should highlight in this case.")) + (h3> "Mouse click tests") + (ul> + (li> "Click on the first menu item. Alert should open with the message "Hello world". The menu should dissapear.") + (li> "Click on the second menu item (disabled). Should not do anything - focus should remain on the disabled item.") + (li> "Click anywhere outside the menu. Menu should close. Focus will be set by the browser based on where the user clicks.")) + (h3> "Mouse submenu tests") + (ul> + (li> "Hover over the "Enabled Submenu" item. Item should highlight and then pop open a submenu after a short (500ms) delay.") + (li> "Hover over any of the other menu items. Submenu should close immediately and deselect the submenu parent item. The newly hovered item should become selected.") + (li> "Hover over the "Disabled Submenu" item. Item should highlight, but no submenu should appear.") + (li> "Clicking on the "Enabled Submenu" item before the submenu has opened (you'll have to be quick!) should immediatley open the submenu.") + (li> "Clicking on the "Enabled Submenu" item " + (i> "after") + " the submenu has opened should have no effect - the item is still selected and the submenu still open.") + (li> "Hover over submenu item 1. Should select it - the parent menu item should stay selected also.") + (li> "Hover over submenu item 2. Should select it - the parent menu item should stay selected also.")) + (h3> "Keyboard opening tests") + (ul> + (li> "On Windows: press shift-f10 with focus on any of the form controls. Should open the menu.") + (li> "On Windows: press the context menu key (located on the right of the space bar on North American keyboards) with focus on any of the form controls. Should open the menu.") + (li> "On Firefox on the Mac: press ctrl-space with focus on any of the form controls. Should open the menu.")) + (h3> "Keyboard closing tests") + (ul> + (li> "Open the menu.") + (li> "Press tab. Should close the menu and return focus to where it was before the menu was opened.") + (li> "Open the menu.") + (li> "Press escape. Should close the menu and return focus to where it was before the menu was opened.")) + (h3> "Keyboard navigation tests") + (ul> + (li> "Open the menu.") + (li> "Pressing up or down arrow should cycle focus through the items in that menu.") + (li> "Pressing enter or space should invoke the menu item.") + (li> "Disabled items receive focus but no action is taken upon pressing enter or space.")) + (h3> "Keyboard submenu tests") + (ul> + (li> "Open the menu.") + (li> "The first item should become selected.") + (li> "Press the right arrow key. Nothing should happen.") + (li> "Press the left arrow key. Nothing should happen.") + (li> "Press the down arrow until "Enabled Submenu" is selected. The submenu should not appear.") + (li> "Press enter. The submenu should appear with the first item selected.") + (li> "Press escape. The submenu should vanish - "Enabled Submenu" should remain selected.") + (li> "Press the right arrow key. The submenu should appear with the first item selected.") + (li> "Press the right arrow key. Nothing should happen.") + (li> "Press the left arrow key. The submenu should close - "Enabled Submenu" should remain selected.") + (li> "Press the left arrow key. The menu should " + (i> "not") + " close and "Enabled Submenu" should remain selected.") + (li> "Press escape. The menu should close and focus should be returned to where it was before the menu was opened."))))))) + + + +(lisplet-register-page-location *dojo-test-lisplet* 'djmenu-page "djmenu.html") \ No newline at end of file
Added: trunk/main/dojo/tests/djprogressbar-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/djprogressbar-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,272 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/djprogressbar-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass djmenu-page (page) + ((top-left :initform "top-left" + :accessor top-left) + (top-right :initform "top-right" + :accessor top-right) + (bottom-left :initform "bottom-left" + :accessor bottom-left) + (bottom-right :initform "bottom-right" + :accessor bottom-right) + (text-area :initform "Hello there" + :accessor text-area) + (select-value :initform "1" + :accessor select-value))) + +(defclass djmenu-page-menu (wcomponent) + () + (:metaclass metacomponent) + (:default-initargs :empty t)) + +(defmethod wcomponent-template ((obj djmenu-page-menu)) + (let ((id (htcomponent-client-id obj))) + (djmenu> :static-id id + (wcomponent-informal-parameters obj) + (djmenu-item> :id "mi" + :onClick "alert('Hello world');" + "Enabled Item") + (djmenu-item> :id "mi" + :disabled "true" + "Disabled Item") + (djmenu-separator> :id "ms") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconCut" + :on-click "alert('not actually cutting anything, just a test!')" + "Cut") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconCopy" + :on-click "alert('not actually copying anything, just a test!')" + "Copy") + (djmenu-item> :id "mi" + :icon-class "dijitEditorIcon dijitEditorIconPaste" + :on-click "alert('not actually pasting anything, just a test!')" + "Paste") + (djmenu-separator> :id "ms") + (djpopup-menu-item> :id "mpi" + (span> "Enabled Submenu") + (djmenu> :id "submenu2" + (djmenu-item> :id "mi" + :on-click "alert('Submenu 1!')" + "Submenu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Submenu 2!')" + "Submenu Item Two") + (djpopup-menu-item> :id "pmi" + (span> "Deeper Submenu") + (djmenu> :id "submenu4" + (djmenu-item> :id "mi" + :on-click "alert('Sub-submenu 1!')" + "Sub-sub-menu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Sub-submenu 2!')" + "Sub-sub-menu Item Two"))))) + (djpopup-menu-item> :id "pmi" + :disabled "true" + (span> "Disabled Submenu") + (djmenu> :id "submenu3" :style "display: none;" + (djmenu-item> :id "mi" + :on-click "alert('Submenu 1!')" + "Submenu Item One") + (djmenu-item> :id "mi" + :on-click "alert('Submenu 2!')" + "Submenu Item Two"))) + (djpopup-menu-item> :id "pmi" + (span> "Different popup") + (djcolor-palette> :id "cp"))))) + + +(defmethod page-content ((o djmenu-page)) + (let ((input2-id (generate-id "input2"))) + (site-template> :title "dojo menu test page" + (script> :language "Javascript" :type "text/javascript" + "function createMenu() { + // create a menu programmatically + function fClick() {alert('clicked!')}; + + pMenu = new dijit.Menu({targetNodeIds:['prog_menu'], id:'progMenu'}); + pMenu.addChild(new dijit.MenuItem({label:'Programmatic Context Menu', disabled:true})); + pMenu.addChild(new dijit.MenuSeparator()); + pMenu.addChild(new dijit.MenuItem({label:'Simple menu item', onClick:fClick})); + pMenu.addChild(new dijit.MenuItem({label:'Another menu item', onClick:fClick})); + pMenu.addChild(new dijit.MenuItem({label:'With an icon', iconClass:'dijitEditorIcon dijitEditorIconCut', onClick:fClick})); + var mItem = new dijit.MenuItem({label:'dojo.event clicking'}); + dojo.connect(mItem, 'onClick', function(){alert('click! handler created via dojo.connect()')}); + pMenu.addChild(mItem); + + var pSubMenu = new dijit.Menu({parentMenu:pMenu, id:'progSubMenu'}); + pSubMenu.addChild(new dijit.MenuItem({label:'Submenu item', onClick:fClick})); + pSubMenu.addChild(new dijit.MenuItem({label:'Submenu item', onClick:fClick})); + pMenu.addChild(new dijit.PopupMenuItem({label:'Submenu', popup:pSubMenu, id:'progPopupMenuItem'})); + + pMenu.startup(); + + dojo.byId('prog_menu').innerHTML="This div has a programmatic context menu on it that's different to the page menu."; + dojo.byId('createButton').disabled = true; + dojo.byId('destroyButton').disabled = false; + } + + function destroyMenu(){ + pMenu.destroyRecursive(); + dojo.byId('prog_menu').innerHTML='No programmatic menu on this div, should get page level menu.'; + dojo.byId('createButton').disabled = false; + dojo.byId('destroyButton').disabled = true; + }") + (djmenu-page-menu> :id "submenu1" + :context-menu-for-window "true" + :style "display: none;") + (djmenu-page-menu> :id "leftClick" + :left-click-to-open "true" + :target-node-ids input2-id + :style "display: none;") + (div> :style "padding: 1em" + (h1> :class "testTitle" "Dijit Menu System Test") + (h3> "Form") + (cform> :id "theForm" + (cinput> :id "input1" :accessor 'top-left) + (p> :style "text-align:right" + "left click to open the menu for this input:" + (br>) + "Note: because of the window contextMenu, make sure you get" + (br>) + "the right menu by verifying the left" + (br>) + "click one starts with "Left Click Menu"" + (br>) + "at the very top." + (cinput> :static-id input2-id :accessor 'top-right)) + (ctextarea> :id "textarea" :accessor 'text-area) + (br>) + (cselect> :id "select" + :accessor 'select-value + (option> :value "1" + (when (string= "1" (select-value o)) + (list :selected "selected")) + "check if i") + (option> :value "2" + (when (string= "2" (select-value o)) + (list :selected "selected")) + "bleed through") + (option> :value "3" + (when (string= "3" (select-value o)) + (list :selected "selected")) + "on IE6")) + (button> :id "button" + "push me")) + (div> :id "prog_menu" + :style "border:1px solid blue; padding:10px; margin:20px 0;" + "Click button below to create special menu on this div.") + (button> :id "createButton" + :onclick "createMenu();" + "create programmatic menu") + (button> :id "destroyButton" + :onclick "destroyMenu();" + :disabled "disabled" + "destroy programmatic menu") + (div> :style "height:500px") + (p> "(this space intentionally left blank to aid testing with controls + at the bottom of the browser window)") + (div> :style "height:500px") + (cform> :id "theForm" + (cinput> :id "input3" + :accessor 'bottom-left) + (p> :style "text-align:right" + (cinput> :id "input4" :accessor 'bottom-right)) + (p> "See also: " + (a> :href "djbutton.html" + "test Button") + "(PopupMenu is used with DropDownButton and ComboButton)") + (h3> "Mouse opening tests") + (ul> + (li> "Right click on the client area of the page (ctrl-click for Macintosh). Menu should open.") + (li> "Right click on each of the form controls above. Menu should open.") + (li> "Right click near the righthand window border. Menu should open to the left of the pointer.") + (li> "Right click near the bottom window border. Menu should open above the pointer.")) + (h3> "Mouse hover tests") + (ul> + (li> "Hover over the first item with the pointer. Item should highlight and get focus.") + (li> "Hover over the second (disabled) item. Item should highlight and get focus.") + (li> "Seperator items should not highlight on hover - no items should highlight in this case.")) + (h3> "Mouse click tests") + (ul> + (li> "Click on the first menu item. Alert should open with the message "Hello world". The menu should dissapear.") + (li> "Click on the second menu item (disabled). Should not do anything - focus should remain on the disabled item.") + (li> "Click anywhere outside the menu. Menu should close. Focus will be set by the browser based on where the user clicks.")) + (h3> "Mouse submenu tests") + (ul> + (li> "Hover over the "Enabled Submenu" item. Item should highlight and then pop open a submenu after a short (500ms) delay.") + (li> "Hover over any of the other menu items. Submenu should close immediately and deselect the submenu parent item. The newly hovered item should become selected.") + (li> "Hover over the "Disabled Submenu" item. Item should highlight, but no submenu should appear.") + (li> "Clicking on the "Enabled Submenu" item before the submenu has opened (you'll have to be quick!) should immediatley open the submenu.") + (li> "Clicking on the "Enabled Submenu" item " + (i> "after") + " the submenu has opened should have no effect - the item is still selected and the submenu still open.") + (li> "Hover over submenu item 1. Should select it - the parent menu item should stay selected also.") + (li> "Hover over submenu item 2. Should select it - the parent menu item should stay selected also.")) + (h3> "Keyboard opening tests") + (ul> + (li> "On Windows: press shift-f10 with focus on any of the form controls. Should open the menu.") + (li> "On Windows: press the context menu key (located on the right of the space bar on North American keyboards) with focus on any of the form controls. Should open the menu.") + (li> "On Firefox on the Mac: press ctrl-space with focus on any of the form controls. Should open the menu.")) + (h3> "Keyboard closing tests") + (ul> + (li> "Open the menu.") + (li> "Press tab. Should close the menu and return focus to where it was before the menu was opened.") + (li> "Open the menu.") + (li> "Press escape. Should close the menu and return focus to where it was before the menu was opened.")) + (h3> "Keyboard navigation tests") + (ul> + (li> "Open the menu.") + (li> "Pressing up or down arrow should cycle focus through the items in that menu.") + (li> "Pressing enter or space should invoke the menu item.") + (li> "Disabled items receive focus but no action is taken upon pressing enter or space.")) + (h3> "Keyboard submenu tests") + (ul> + (li> "Open the menu.") + (li> "The first item should become selected.") + (li> "Press the right arrow key. Nothing should happen.") + (li> "Press the left arrow key. Nothing should happen.") + (li> "Press the down arrow until "Enabled Submenu" is selected. The submenu should not appear.") + (li> "Press enter. The submenu should appear with the first item selected.") + (li> "Press escape. The submenu should vanish - "Enabled Submenu" should remain selected.") + (li> "Press the right arrow key. The submenu should appear with the first item selected.") + (li> "Press the right arrow key. Nothing should happen.") + (li> "Press the left arrow key. The submenu should close - "Enabled Submenu" should remain selected.") + (li> "Press the left arrow key. The menu should " + (i> "not") + " close and "Enabled Submenu" should remain selected.") + (li> "Press escape. The menu should close and focus should be returned to where it was before the menu was opened."))))))) + + + +(lisplet-register-page-location *dojo-test-lisplet* 'djmenu-page "djmenu.html") \ No newline at end of file
Added: trunk/main/dojo/tests/docroot/css/style.css ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/docroot/css/style.css Sat Jun 14 02:00:26 2008 @@ -0,0 +1,61 @@ +.Rounded { + display: table-cell; + position:relative; + margin:0px auto; + min-width: 10px; + max-width:1000px; + z-index:1; + margin-left:5px; + margin-top: 3px; +} + +.Rounded .RoundedContent, +.Rounded .RoundedTop, +.Rounded .RoundedBottom, +.Rounded .RoundedBottom div { + background:transparent url('../img/roundedbg.png') no-repeat top right; + _background:transparent url('../img/roundedbg.gif') no-repeat top right; +} + +.Rounded .RoundedContent { + position:relative; + zoom:1; + _overflow-y:hidden; + padding:5px 10px 0px 5px; + margin: 0 0 0 0; +} + +.Rounded .RoundedTop { + position:absolute; + left:0px; + top:0px; + width:5px; + margin-left:-5px; + height:100%; + _height:1000px; + background-position:top left; +} + +.Rounded .RoundedBottom, +.Rounded .RoundedBottom div { + height:7px; + font-size:1px; +} + +.Rounded .RoundedBottom { + background-position:bottom right; + position:relative; + width:100%; + clear: both; + margin-left: 0px; + margin-right: 0px; + padding: 0; + display: table; +} + +.Rounded .RoundedBottom div { + position:relative; + width:5px; + margin-left:-5px; + background-position:bottom left; +}
Added: trunk/main/dojo/tests/docroot/img/roundedbg.gif ============================================================================== Binary file. No diff available.
Added: trunk/main/dojo/tests/docroot/img/roundedbg.png ============================================================================== Binary file. No diff available.
Added: trunk/main/dojo/tests/docroot/img/spinner.gif ============================================================================== Binary file. No diff available.
Added: trunk/main/dojo/tests/header-info-page.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/header-info-page.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,47 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/header-info-page.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass header-info-page (page) ()) + +(defmethod page-content ((o header-info-page)) + (let ((header-props (headers-in))) + (site-template> :title "Header info page" + (p> :id "p" + (table> + (tr> (td> :colspan "2" "Header info")) + (loop for key-val in header-props + collect (tr> + (td> (format nil "~a" (car key-val)) + (td> (format nil "~a" (cdr key-val))))))))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'header-info-page "info.html") +
Added: trunk/main/dojo/tests/index.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/index.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,52 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/index.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass index-page (page) ()) + +(defmethod page-content ((o index-page)) + (site-template> :title "Home test page" + (p> :id "p" + (ul> + (li> (a> :href "realm.html" "realm on test")) + (li> (a> :href "info.html" "HTTP Header info")) + (li> (a> :href "../test2/realm.html" "realm on test2")) + (li> (a> :href "djbutton.html" "dojo buttons integration test")) + (li> (a> :href "djdialog.html" "dojo dialog integration test")) + (li> (a> :href "djcolorpalette.html" "dojo color palette integration test")) + (li> (a> :href "djeditor.html" "dojo editor integration test")) + (li> (a> :href "djevent.html" "dojo event integration test")) + (li> (a> :href "ajax.html" "dojo ajax test")) + (li> (a> :href "djcalendar.html" "dojo calendar test")) + (li> (a> :href "slider.html" "dojo slider test")) + (li> (a> :href "djmenu.html" "dojo menu test")))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'index-page "index.html" :welcome-page-p t) \ No newline at end of file
Added: trunk/main/dojo/tests/main.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/main.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,87 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/main.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + +(setf hunchentoot:*default-content-type* "text/html; charset=UTF-8") + +(defvar *main-file* (load-time-value + (or #.*compile-file-pathname* *load-pathname*))) + +(defvar *dojo-test-lisplet*) +(defvar *dojo-test-lisplet2*) +(setf *dojo-test-lisplet* (make-instance 'lisplet :realm "test1" :base-path "/test")) +(setf *dojo-test-lisplet2* (make-instance 'lisplet :realm "test2" :base-path "/test2")) + +(defparameter *clawserver* (make-instance 'clawserver + :port 4242 + :mod-lisp-p nil + :base-path "/claw")) + +;;;(defparameter *clawserver* (make-instance 'clawserver :port 4242 :sslport 4445 :base-path "/claw" +;;; :ssl-certificate-file #P"/home/kiuma/pem/cacert.pem" +;;; :ssl-privatekey-file #P"/home/kiuma/pem/privkey.pem")) + +(clawserver-register-lisplet *clawserver* *dojo-test-lisplet*) +(clawserver-register-lisplet *clawserver* *dojo-test-lisplet2*) + +(defun test-image-file () + (make-pathname :directory (append (pathname-directory *main-file*) '("img")) :name "matrix" :type "jpg")) + +(let ((path (make-pathname :directory (append (pathname-directory *main-file*) '("docroot"))))) + (lisplet-register-resource-location *dojo-test-lisplet* + path + "docroot/") + (lisplet-register-resource-location *dojo-test-lisplet2* + path + "docroot/")) + +(defun djstart () + (clawserver-start *clawserver*) + *clawserver*) + +(defun djstop () + (clawserver-stop *clawserver*) + *clawserver*) + +(defun debug-mode () + (setf hunchentoot:*catch-errors-p* nil + hunchentoot::*log-lisp-backtraces-p* t + hunchentoot::*log-lisp-errors-p* t + hunchentoot::*log-lisp-warnings-p* t + hunchentoot::*show-lisp-errors-p* t + hunchentoot::*show-lisp-backtraces-p* t)) + +(defun production-mode () + (setf hunchentoot:*catch-errors-p* t + hunchentoot::*log-lisp-backtraces-p* nil + hunchentoot::*log-lisp-errors-p* t + hunchentoot::*log-lisp-warnings-p* t + hunchentoot::*show-lisp-errors-p* nil + hunchentoot::*show-lisp-backtraces-p* nil)) \ No newline at end of file
Added: trunk/main/dojo/tests/packages.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/packages.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,38 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/packages.lisp $ + +;;; 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. + +(in-package :cl-user) + +(defpackage :claw-dojo-tests + (:nicknames :dojo-tests) + (:use :cl :hunchentoot :claw :dojo :parenscript) + (:export :djstart + :djstop + :debug-mode + :production-mode)) \ No newline at end of file
Added: trunk/main/dojo/tests/realm.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/realm.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,59 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/realm.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + + +(defclass realm-page (page) ()) + +(defmethod page-content ((o realm-page)) + (when (null hunchentoot:*session*) + (claw-start-session)) + (unless (session-value 'RND-NUMBER) + (setf (session-value 'RND-NUMBER) (random 1000))) + (site-template> :title "Realm test page" + (p> + "session" + (ul> + (li> (a> :href "http://www.gentoo.org" :target "gentoo" + "gentoo")) + (li> (a> :href "../test/realm.html" :target "clwo1" + "realm on lisplet 'test'")) + (li> (a> :href "../test2/realm.html" :target "clwo2" + "realm on lisplet 'test2'")) + (li> "Rnd number value: " (format nil "~d" (session-value 'RND-NUMBER))) + (li> "Remote Addr: " (session-remote-addr *session*)) + (li> "User agent: " (session-user-agent *session*)) + (li> "Lisplet Realm: " (current-realm)) + (li> "Session Realm: " (session-realm *session*)) + (li> "Session value: " (format nil "~a" (hunchentoot::session-string *session*))) + (li> "Request Realm: " (hunchentoot::realm *request*)))))) + +(lisplet-register-page-location *dojo-test-lisplet* 'realm-page "realm.html") +(lisplet-register-page-location *dojo-test-lisplet2* 'realm-page "realm.html")
Added: trunk/main/dojo/tests/slider-test.lisp ============================================================================== --- (empty file) +++ trunk/main/dojo/tests/slider-test.lisp Sat Jun 14 02:00:26 2008 @@ -0,0 +1,129 @@ +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- +;;; $Header: dojo/tests/slider-test.lisp $ + +;;; 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. + +(in-package :claw-dojo-tests) + +(defgeneric slide-page-null-action (slider-page)) + +(defclass slider-page (page) + ((hval :initform 10 + :accessor slider-page-hval) + (vval :initform 50 + :accessor slider-page-vval) + (message-content :initform "" + :accessor slider-page-message-content))) + +(defmethod slide-page-null-action ((slider-page slider-page)) + (setf (slider-page-message-content slider-page) + (div> :style "border: 1px solid gray;" + (format nil "Sent djhorizontal-slider value: ~a" (slider-page-hval slider-page)) + (br>) + (format nil "Sent djvertical-slider value: ~a" (slider-page-vval slider-page))))) + +(defmethod page-content ((pobj slider-page)) + (let ((hs-content-id (generate-id "content")) + (vs-content-id (generate-id "content"))) + (site-template> :title "dojo slider test page" + (h1> :class "testTitle" "Slider") + "Also try using the arrow keys, buttons, or clicking on the progress bar to move the slider." + (br>) + (cform> :id "djform" + :action 'slide-page-null-action + (br>) + "initial value=10, min=0, max=100, pageIncrement=100, onChange event triggers span innerHTML change immediately" + (br>) + (djhorizontal-slider> :id "slider1" + :onChange (parenscript:ps* `(setf (slot-value (dojo.by-id ,hs-content-id) 'inner-H-T-M-L) + (dojo.number.format (/ (aref arguments 0) 100) + (create :places 1 + :pattern "#%")))) + :accessor 'slider-page-hval + :maximum 100 + :minimum 0 + :page-increment 100 + :show-buttons "false" + :intermediate-changes "true" + :style "width:50%; height: 20px;" + (djhorizontal-rule-labels> :container "topDecoration" + :style "height:1.2em;font-size:75%;color:gray;" + :count 6 + :numeric-margin 1) + (djhorizontal-rule> :container "topDecoration" + :style "height:5px;" + :count 6) + (djhorizontal-rule> :container "bottomDecoration" + :style "height:5px;" + :count 5) + (djhorizontal-rule-labels> :container "bottomDecoration" + :style "height:1em;font-size:75%;color:gray;" + (li> "lowest") + (li> "normal") + (li> "highest"))) + (p> + (span> :style="font-weight: bolder;" "djhorizontal-slider current value:")(span> :static-id hs-content-id "--")) + + (br>) + "initial value=10, min=0, max=100, pageIncrement=100, onChange event triggers span innerHTML change immediately" + (br>) + (djvertical-slider> :id "slider2" + :onChange (parenscript:ps* `(setf (slot-value (dojo.by-id ,vs-content-id) 'inner-H-T-M-L) + (dojo.number.format (/ (aref arguments 0) 100) + (create :places 1 + :pattern "#%")))) + :accessor 'slider-page-vval + :maximum 100 + :minimum 0 + :page-increment 100 + :discrete-values 11 + :style "height: 300px;" + (djvertical-rule-labels> :container "leftDecoration" + :style "width:2em;color:gray;" + (li> "0") + (li> "100")) + (djvertical-rule> :container "leftDecoration" + :style "width:5px;" + :count 11 + :rule-style "border-color:gray;") + (djvertical-rule> :container "rightDecoration" + :style "width:5px;" + :count 11 + :rule-style "border-color:gray;") + (djvertical-rule-labels> :container "rightDecoration" + :style "width:2em;color:gray;" + :count 6 + :numeric-margin 1 + :maximum 100 + :constraints "{pattern:'#'}")) + (p> + (span> :style="font-weight: bolder;" "djvertical-slider current value:")(span> :static-id vs-content-id "--")) + (djsubmit-button> :id "submit" :value "Submit")) + (slider-page-message-content pobj)))) + + +(lisplet-register-page-location *dojo-test-lisplet* 'slider-page "slider.html") \ No newline at end of file