[Z3lab-checkins] r2484 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional
Author: jmorliaguet Date: Mon Feb 27 13:50:34 2006 New Revision: 2484 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.css cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.css cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.css Log: - cosmetic Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.css == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.css (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.css Mon Feb 27 13:50:34 2006 @@ -1,10 +1,10 @@ .panel1 { - background-color: #fec; - padding: 0.5em; + background-color: #fd8; + padding: 0.8em; color: red; - margin: 0.5em; - border: 2px solid red; + margin: 0.2em; + border: 1px solid #f99; } .panel1 h2 { Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.css == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.css (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.css Mon Feb 27 13:50:34 2006 @@ -4,6 +4,7 @@ padding: 1em; color: #00c; margin: 0.5em; + border: 1px solid #cfc; } .panel2 h2 { Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.css == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.css (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.css Mon Feb 27 13:50:34 2006 @@ -1,7 +1,7 @@ .panel3 { - background-color: #ffc; - border: 1px solid #090; + background-color: #efc; + border: 1px solid #9c9; padding: 0.5em; color: green; margin: 1em; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2485 - in cpsskins/branches/jmo-perspectives/ui/framework/tests: functional unit zope3/functional/chat zope3/unit
Author: jmorliaguet Date: Mon Feb 27 14:06:15 2006 New Revision: 2485 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/cpsskins_storage_adapters.pt Log: - the ram type of storage is used by default if none is specified. Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html Mon Feb 27 14:06:15 2006 @@ -47,9 +47,6 @@ {id: panel1, data: { url: panel1.html -}, -storage: { - type: ram }} /ins @@ -57,9 +54,6 @@ {id: panel2, data: { url: panel2.html -}, -storage: { - type: ram }} /ins @@ -67,9 +61,6 @@ {id: panel3, data: { url: panel3.html -}, -storage: { - type: ram }} /ins @@ -77,9 +68,6 @@ {id: panel4, data: { url: panel4.html -}, -storage: { - type: ram }} /ins Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html Mon Feb 27 14:06:15 2006 @@ -45,9 +45,6 @@ data: { url: panel1.html, css: panel1.css - }, - storage: { - type: ram }} /ins @@ -56,9 +53,6 @@ data: { url: panel2.html, css: panel2.css - }, - storage: { - type: ram }} /ins @@ -67,9 +61,6 @@ data: { url: panel3.html, css: panel3.css - }, - storage: { - type: ram }} /ins @@ -78,9 +69,6 @@ data: { url: panel4.html, css: panel4.css - }, - storage: { - type: ram }} /ins @@ -89,9 +77,6 @@ data: { url: panel5.html, css: popup.css - }, - storage: { - type: ram }} /ins Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html Mon Feb 27 14:06:15 2006 @@ -45,11 +45,8 @@ /div ins class=model - {id: ram-data-provider, - data: , - storage: { - type: ram - } + {id: dummy, + data: }} /ins @@ -58,7 +55,7 @@ template: ajax_widget_template.pt, replace: htmlwidget }, - model: ram-data-provider, + model: dummy, render_effect: { transition: fadein }} Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html Mon Feb 27 14:06:15 2006 @@ -58,10 +58,6 @@ } ] } - }, - storage: { - type: ram - } }} /ins Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Mon Feb 27 14:06:15 2006 @@ -77,9 +77,6 @@ {id: p1, data: { url: p1.html -}, -storage: { - type: ram }} /ins @@ -87,9 +84,6 @@ {id: p2, data: { url:
[Z3lab-checkins] r2486 - in cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3: . functional/aggregator functional/benchmarks functional/chat functional/forms functional/latency functional/tr
Author: jmorliaguet Date: Mon Feb 27 14:34:26 2006 New Revision: 2486 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/__init__.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/benchmarks/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Log: - removed deprecation warning when registering layers / skins cpsskins-test was renamed as cpsskinsTest Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/__init__.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/__init__.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/__init__.py Mon Feb 27 14:34:26 2006 @@ -1,9 +1,9 @@ -from zope.publisher.interfaces.browser import ILayer, IDefaultBrowserLayer +from zope.publisher.interfaces.browser import IDefaultBrowserLayer from zope.publisher.interfaces.browser import IBrowserRequest -class ITestLayer(ILayer, IBrowserRequest): +class cpsskinsTest(IBrowserRequest): The test layer -class ITestSkin(ITestLayer, IDefaultBrowserLayer): +class ITestSkin(cpsskinsTest, IDefaultBrowserLayer): The test skin Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/configure.zcml Mon Feb 27 14:34:26 2006 @@ -1,16 +1,13 @@ configure + xmlns=http://namespaces.zope.org/zope; xmlns:browser=http://namespaces.zope.org/browser; - !-- Default cpsskins layer -- + !-- Test cpsskins skin -- - browser:layer - name=cpsskins-test - interface=.ITestLayer - / - - browser:skin - name=cpsskins-test - interface=.ITestSkin + interface + name=cpsskinsTest + interface=cpsskins.ui.framework.tests.zope3.ITestSkin + type=zope.publisher.interfaces.browser.IBrowserSkinType / include package=.functional / Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml Mon Feb 27 14:34:26 2006 @@ -3,7 +3,7 @@ browser:page for=* - layer=cpsskins-test + layer=cpsskins.ui.framework.tests.zope3.cpsskinsTest name=cpsskins_aggregator.html permission=zope.Public template=cpsskins_aggregator.pt @@ -11,14 +11,14 @@ browser:page for=* - layer=cpsskins-test + layer=cpsskins.ui.framework.tests.zope3.cpsskinsTest name=feedbox.html permission=zope.Public template=feedbox.pt / browser:pages - layer=cpsskins-test + layer=cpsskins.ui.framework.tests.zope3.cpsskinsTest for=* class=.browser.Views permission=zope.Public Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/benchmarks/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/benchmarks/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/benchmarks/configure.zcml Mon Feb 27 14:34:26 2006 @@ -3,14 +3,14 @@ browser:page for=* - layer=cpsskins-test + layer=cpsskins.ui.framework.tests.zope3.cpsskinsTest name=cpsskins_benchmarks.html permission=zope.Public template=cpsskins_benchmarks.pt / browser:pages - layer=cpsskins-test + layer=cpsskins.ui.framework.tests.zope3.cpsskinsTest for=* class=.browser.Views permission=zope.Public Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml == ---
[Z3lab-checkins] r2487 - cpsskins/branches/jmo-perspectives/locales
Author: jmorliaguet Date: Mon Feb 27 14:47:59 2006 New Revision: 2487 Modified: cpsskins/branches/jmo-perspectives/locales/custom.pot Log: - i18n updates Modified: cpsskins/branches/jmo-perspectives/locales/custom.pot == --- cpsskins/branches/jmo-perspectives/locales/custom.pot (original) +++ cpsskins/branches/jmo-perspectives/locales/custom.pot Mon Feb 27 14:47:59 2006 @@ -52,3 +52,16 @@ msgid IMacroSlotPortlet msgstr +# Hints + +msgid hint-site-designer +msgstr + +msgid hint-layout-designer +msgstr + +msgid hint-page-designer +msgstr + +msgid hint-content-author +msgstr -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2488 - in cpsskins/branches/jmo-perspectives: . browser browser/negociation browser/skin portlets/macroslot ui/authoring ui/authoring/icons ui/authoring/images ui/default/filters/sty
Author: jmorliaguet Date: Mon Feb 27 14:49:18 2006 New Revision: 2488 Added: cpsskins/branches/jmo-perspectives/portlets/macroslot/skin.py (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/__init__.py cpsskins/branches/jmo-perspectives/browser/configure.zcml cpsskins/branches/jmo-perspectives/browser/negociation/configure.zcml cpsskins/branches/jmo-perspectives/browser/skin/__init__.py cpsskins/branches/jmo-perspectives/browser/skin/configure.zcml cpsskins/branches/jmo-perspectives/portlets/macroslot/configure.zcml cpsskins/branches/jmo-perspectives/portlets/macroslot/portlet.py cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml cpsskins/branches/jmo-perspectives/ui/authoring/icons/configure.zcml cpsskins/branches/jmo-perspectives/ui/authoring/images/configure.zcml cpsskins/branches/jmo-perspectives/ui/default/filters/style/configure.zcml cpsskins/branches/jmo-perspectives/ui/editing/configure.zcml cpsskins/branches/jmo-perspectives/ui/editing/icons/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/configure.zcml cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/contentauthor/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/pagedesigner/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/sitedesigner/configure.zcml Log: - fixed the registration of the 'cpsskins' layer according to the new way of registering skins / layers Modified: cpsskins/branches/jmo-perspectives/__init__.py == --- cpsskins/branches/jmo-perspectives/__init__.py (original) +++ cpsskins/branches/jmo-perspectives/__init__.py Mon Feb 27 14:49:18 2006 @@ -21,3 +21,4 @@ # load profiles from cpsskins.profiles import default + Modified: cpsskins/branches/jmo-perspectives/browser/configure.zcml == --- cpsskins/branches/jmo-perspectives/browser/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/browser/configure.zcml Mon Feb 27 14:49:18 2006 @@ -12,7 +12,7 @@ menu=zmi_actions title=Add class=zope.app.container.browser.adding.Adding permission=zope.ManageContent - layer=cpsskins + layer=cpsskins.browser.skin.cpsskins page name=index.html template=skin/add.pt / page name=action.html attribute=action / @@ -47,7 +47,7 @@ !-- Cache view -- pages - layer=cpsskins + layer=cpsskins.browser.skin.cpsskins for=* class=.caching.ImageCacheView permission=zope.Public Modified: cpsskins/branches/jmo-perspectives/browser/negociation/configure.zcml == --- cpsskins/branches/jmo-perspectives/browser/negociation/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/browser/negociation/configure.zcml Mon Feb 27 14:49:18 2006 @@ -10,7 +10,7 @@ class=.views.NegociationView permission=zope.Public allowed_interface=.interfaces.INegociation - layer=cpsskins + layer=cpsskins.browser.skin.cpsskins / /configure Modified: cpsskins/branches/jmo-perspectives/browser/skin/__init__.py == --- cpsskins/branches/jmo-perspectives/browser/skin/__init__.py (original) +++ cpsskins/branches/jmo-perspectives/browser/skin/__init__.py Mon Feb 27 14:49:18 2006 @@ -18,14 +18,14 @@ __docformat__ = reStructuredText from zope.app.publisher.browser import applySkin -from zope.publisher.interfaces.browser import ILayer, IDefaultBrowserLayer +from zope.publisher.interfaces.browser import IDefaultBrowserLayer from zope.publisher.interfaces.browser import IBrowserRequest from cpsskins.utils import getThemeManager -class IDefaultLayer(ILayer, IBrowserRequest): -The default layer +class cpsskins(IBrowserRequest): +The default cpsskins layer -class IDefaultSkin(IDefaultLayer, IDefaultBrowserLayer): -The default skin +class IDefaultSkin(cpsskins, IDefaultBrowserLayer): +The default cpsskins skin Modified: cpsskins/branches/jmo-perspectives/browser/skin/configure.zcml == --- cpsskins/branches/jmo-perspectives/browser/skin/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/browser/skin/configure.zcml Mon Feb 27 14:49:18 2006 @@ -3,16 +3,12 @@
[Z3lab-checkins] r2489 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms
Author: jmorliaguet Date: Mon Feb 27 14:52:35 2006 New Revision: 2489 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt Log: - skin name fix Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt Mon Feb 27 14:52:35 2006 @@ -17,7 +17,7 @@ href=/++skin++cpsskins/@@/++resource++cpsskins.css / link rel=stylesheet type=text/css -href=/++skin++cpsskins-test/@@/++resource++form.css / +href=/++skin++cpsskinsTest/@@/++resource++form.css / /head body -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2490 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Mon Feb 27 15:19:03 2006 New Revision: 2490 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html Log: - refactoring of the perspective infrastructure (sub-perspectives will be removed, instead views will be able to specify which controller to use to switch perspectives) - registered a new controller: perspective selector that controls a collection of views. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 15:19:03 2006 @@ -431,6 +431,10 @@ 'drag-and-drop': function(node, def) { return new CPSSkins.DragAndDropController(node, def); + }, + + 'perspective selector': function(node, def) { +return new CPSSkins.PerspectiveSelector(node, def); } }); @@ -609,6 +613,18 @@ }); +CPSSkins.PerspectiveSelector= Class.create(); +CPSSkins.PerspectiveSelector.prototype = Object.extend( + new CPSSkins.Controller(), { + + setup: function() { + }, + + register: function(view) { + } + +}); + // Identifiable DOM elements. if (!CPSSkins.Identifiable) { CPSSkins.Identifiable = new Object() } Object.extend(CPSSkins.Identifiable, { Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html Mon Feb 27 15:19:03 2006 @@ -36,6 +36,13 @@ Element editor/a /div + !-- perspective controller -- + ins class=controller + {id: perspective-selector1, + type: perspective selector + } + /ins + table style=width:100% tr style=vertical-align: top td colspan=3 @@ -72,20 +79,13 @@ }} /ins -ins class=model -{id: panel5, - data: { - url: panel5.html, - css: popup.css -}} -/ins - ins class=view {widget: { type: panel }, model: panel1, - perspectives: [page-designer, layout-designer] + perspectives: [page-designer, layout-designer], + controllers: [perspective-selector1] } /ins @@ -94,7 +94,8 @@ type: panel }, model: panel2, - perspectives: [site-designer] + perspectives: [site-designer], + controllers: [perspective-selector1] } /ins @@ -109,7 +110,8 @@ type: panel }, model: panel2, - perspectives: [page-designer] + perspectives: [page-designer], + controllers: [perspective-selector1] } /ins @@ -118,7 +120,8 @@ type: panel }, model: panel3, - perspectives: [site-designer, layout-designer] + perspectives: [site-designer, layout-designer], + controllers: [perspective-selector1] } /ins @@ -130,7 +133,8 @@ type: panel }, model: panel3, - perspectives: [page-designer] + perspectives: [page-designer], + controllers: [perspective-selector1] } /ins @@ -139,7 +143,8 @@ type: panel }, model: panel4, - perspectives: [page-designer] + perspectives: [page-designer], + controllers: [perspective-selector1] } /ins @@ -151,7 +156,8 @@ type: panel }, model: panel4, - perspectives: [site-designer, layout-designer] + perspectives: [site-designer, layout-designer], + controllers: [perspective-selector1] } /ins @@ -160,7 +166,8 @@ type: panel }, model: panel2, - perspectives: [site-designer] + perspectives: [site-designer], + controllers: [perspective-selector1] } /ins @@ -169,14 +176,6 @@ /tr /table - ins class=view - {widget: { - type: panel - }, - model: panel5, - perspectives: [element-editor] - } - /ins /body -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2491 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 27 16:17:33 2006 New Revision: 2491 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - fix: a same controller may control several views. - PerspectiveSelector: we register which views are visible for each perspective. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 16:17:33 2006 @@ -285,7 +285,7 @@ var evt_id = registered controller + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.publisher; -controller.view = view; +controller.views.push(view); controller.register(view); CPSSkins.unsubscribe(evt_id); }); @@ -399,6 +399,7 @@ initialize: function(node, def) { this.node = this.node; this.def = def; +this.views = []; }, setup: function() { @@ -511,16 +512,17 @@ }, submitEvent: function(e) { -var view = this.view; -var model = this.view.model; -var widget = this.view.widget; +$A(this.views).each(function(view) { + var model = this.view.model; + var widget = this.view.widget; + + var form_data = {}; + $A(Form.getInputs(widget)).each(function(i) { +form_data[i.name] = Form.Element.getValue(i); + }); -var form_data = {}; -$A(Form.getInputs(widget)).each(function(i) { - form_data[i.name] = Form.Element.getValue(i); + model.setData(form_data); }); - -model.setData(form_data); return false; } @@ -618,9 +620,17 @@ new CPSSkins.Controller(), { setup: function() { +this._perspectives = {}; }, register: function(view) { +var perspectives = this._perspectives; +$A(view.def.perspectives).each(function(p) { + if (!(p in perspectives)) { +perspectives[p] = []; + } + perspectives[p].push(view); +}); } }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2492 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 27 16:39:10 2006 New Revision: 2492 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - simplifications: perspectives are now managed via the perspective selector Controller instead of being managed globally. sub-perspectives are no longer needed. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 16:39:10 2006 @@ -45,9 +45,6 @@ _models: $H({}), _controllers: $H({}), _handlers: $H({}), - _perspectives: $H({}), - _currentPerspective: , - _previousPerspective: , init: function() { CPSSkins._parse(document); @@ -305,86 +302,12 @@ el.parentNode.insertBefore(view.widget, el); } -/* registers views per perspective */ -var perspectives = def.perspectives || []; -perspectives.each(function(p) { - if (!p) return; - if (!(p in CPSSkins._perspectives)) { -CPSSkins._perspectives[p] = []; - } - CPSSkins._perspectives[p].push(view); -}); //CPSSkins.notify(registered view + def.id, view); } break; } } - }, - - _resolvePerspective: function(perspective) { -var path = CPSSkins._currentPerspective.split(/); -var base = perspective; -var ext = ; - -if (perspective == '..') { - if (path.length 0) { -base = path.slice(0, path.length-1).join(/); - } -} - -if (perspective.substr(0,2) == ./) { - base = CPSSkins._currentPerspective; - if (base) { -base += /; - } - ext = perspective.substr(2); -} - -var up = perspective.match(new RegExp(/\.\.\//g)); -if (up (up.length = path.length)) { - base = path.slice(0, path.length - up.length).join(/); - if (base) { -base += /; - } - ext = perspective.substr(up.length*3); -} - -if (perspective == '-') { - base = CPSSkins._previousPerspective; -} - -return base + ext; - }, - - switchPerspective: function(perspective) { -var to_show = []; -var to_hide = []; - -perspective = CPSSkins._resolvePerspective(perspective); -CPSSkins._perspectives.each(function(s) { - var elements = s.value; - var path = perspective.split(/); - path.each(function(p, index) { -var subpath = path.slice(0,index+1).join(/); -if (s.key == subpath) { - elements.each(function(el) { to_show.push(el) } ); -} else { - elements.each(function(el) { to_hide.push(el) } ); -} - }); -}); - -// Do not hide objects to be shown -to_hide = to_hide.select(function(el) { - return to_show.indexOf(el) 0; -}); - -to_hide.each(function(el) { el.hide(); }); -to_show.each(function(el) { el.show(); }); - -CPSSkins._previousPerspective = CPSSkins._currentPerspective; -CPSSkins._currentPerspective = perspective; } } @@ -620,17 +543,27 @@ new CPSSkins.Controller(), { setup: function() { -this._perspectives = {}; +this._visible_views = {}; }, register: function(view) { -var perspectives = this._perspectives; +var visible = this._visible_views; $A(view.def.perspectives).each(function(p) { - if (!(p in perspectives)) { -perspectives[p] = []; + if (!(p in visible)) { +visible[p] = []; } - perspectives[p].push(view); + visible[p].push(view); }); + }, + + switchTo: function(perspective) { +var to_show = this._visible_views[perspective]; +var to_hide = this.views.select(function(el) { + return to_show.indexOf(el) 0; +}); + +to_hide.each(function(el) { el.hide(); }); +to_show.each(function(el) { el.show(); }); } }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2493 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional
Author: jmorliaguet Date: Mon Feb 27 17:21:52 2006 New Revision: 2493 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel5.css (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel5_1.html (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel5_2.html (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel5.html Log: - test updates to demonstrate perspectives in perspectives Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html Mon Feb 27 17:21:52 2006 @@ -16,6 +16,12 @@ margin: 2px; border: 1px solid #999; } +.selector a { + font: 12px Verdana, Arial; + padding-right: 1.5em; + text-decoration: none; + color: #069; +} /style /head @@ -25,24 +31,25 @@ div id=msg/div - div - a href=javascript:CPSSkins.switchPerspective('site-designer') - Site designer/a - a href=javascript:CPSSkins.switchPerspective('page-designer') - Page designer/a - a href=javascript:CPSSkins.switchPerspective('layout-designer') - Layout designer/a - a href=javascript:CPSSkins.switchPerspective('element-editor') - Element editor/a + div class=selector + a href=javascript:CPSSkins.getControllerById('controller1').switchTo('perspective1') + Perspective 1/a + a href=javascript:CPSSkins.getControllerById('controller1').switchTo('perspective2') + Perspective 2/a + a href=javascript:CPSSkins.getControllerById('controller1').switchTo('perspective3') + Perspective 3/a + + /div - !-- perspective controller -- + !-- perspective selectors -- ins class=controller - {id: perspective-selector1, + {id: controller1, type: perspective selector } /ins + table style=width:100% tr style=vertical-align: top td colspan=3 @@ -79,13 +86,21 @@ }} /ins +ins class=model +{id: panel5, + data: { + url: panel5.html, + css: panel5.css +}} +/ins + ins class=view {widget: { type: panel }, model: panel1, - perspectives: [page-designer, layout-designer], - controllers: [perspective-selector1] + perspectives: [perspective2, perspective3], + controllers: [controller1] } /ins @@ -94,8 +109,8 @@ type: panel }, model: panel2, - perspectives: [site-designer], - controllers: [perspective-selector1] + perspectives: [perspective1], + controllers: [controller1] } /ins @@ -110,8 +125,8 @@ type: panel }, model: panel2, - perspectives: [page-designer], - controllers: [perspective-selector1] + perspectives: [perspective2], + controllers: [controller1] } /ins @@ -120,8 +135,8 @@ type: panel }, model: panel3, - perspectives: [site-designer, layout-designer], - controllers: [perspective-selector1] + perspectives: [perspective1, perspective3], + controllers: [controller1] } /ins @@ -133,8 +148,8 @@ type: panel }, model: panel3, - perspectives: [page-designer], - controllers: [perspective-selector1] + perspectives: [perspective2], + controllers: [controller1] } /ins @@ -143,11 +158,23 @@ type: panel }, model: panel4, - perspectives: [page-designer], - controllers: [perspective-selector1] + perspectives: [perspective2], + controllers: [controller1] } /ins +!-- this panel contains sub-panels -- +ins class=view +{widget: { + type: panel + }, + model: panel5, + perspectives: [perspective1], + controllers: [controller1] +} +/ins + + /td td style=width: 20% @@ -156,8 +183,8 @@ type: panel }, model: panel4, - perspectives: [site-designer, layout-designer], - controllers: [perspective-selector1] + perspectives: [perspective1, perspective3], + controllers: [controller1] } /ins @@ -166,11 +193,13 @@ type: panel }, model: panel2, - perspectives: [site-designer], -
[Z3lab-checkins] r2494 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 27 19:52:38 2006 New Revision: 2494 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - fixes Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 19:52:38 2006 @@ -46,6 +46,8 @@ _controllers: $H({}), _handlers: $H({}), + _count: 0, + init: function() { CPSSkins._parse(document); }, @@ -178,7 +180,7 @@ } }); -elements.each(function(el, index) { +elements.each(function(el) { var url = el.getAttribute(cite); if (url) { var options = { @@ -204,9 +206,10 @@ _load: function(node) { var elements = $A(node.getElementsByTagName(ins)); [view, controller, model].each(function(type) { - elements.each(function(el, index) { + elements.each(function(el) { if (Element.hasClassName(el, type)) { - CPSSkins._register(el, type, index); + CPSSkins._register(el, type, CPSSkins._count); + CPSSkins._count += 1; } }); }); @@ -557,7 +560,7 @@ }, switchTo: function(perspective) { -var to_show = this._visible_views[perspective]; +var to_show = this._visible_views[perspective] || []; var to_hide = this.views.select(function(el) { return to_show.indexOf(el) 0; }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2496 - cpsskins/branches/jmo-perspectives/ui/framework/doc
Author: jmorliaguet Date: Mon Feb 27 20:17:14 2006 New Revision: 2496 Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Log: - doc update Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt == --- cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Mon Feb 27 20:17:14 2006 @@ -56,21 +56,17 @@ The notion of perspective is borrowed from the Eclipse UI. A perspective -determines which views are visible in a given context. Perspectives are -usually task-oriented, they are selected by the *controller*. +is a collection of views which are visible. When switching between +perspectives, views get shown or hidden. -Perspectives can be nested to create sub-perspectives. Sub-perspectives can -be used to create sub-views of a given view. - -It is possible to navigate between nested perspectives. Switching perspectives -translates into switching views. Controllers --- Controllers map user actions to model updates. -Controllers can also select views -- this is done by switching *perspectives*. +Controllers can also select which views to display -- this is done by switching +*perspectives* (see the Perspective Selector). Technical implementation @@ -182,19 +178,18 @@ - local - remote - + - accessors: the storage accessors (get, set) - refresh: the refresh rate - access: the type of access - - sequence type: queue, stack + - sequence type: queue, stack - sequence signature - View @@ -296,6 +291,11 @@ - draggable +* perspective selector + + - javascript API: switchTo + + Javascript API == @@ -318,11 +318,6 @@ - registerWidgets(widgets) -- perspectives - - - switchPerspective(perspective) - - - action handlers - addActions(handlers) @@ -351,7 +346,7 @@ - writeData(data) -- high-level IO +- high-level IO - getData() -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2498 - in cpsskins/branches/jmo-perspectives/ui: authoring panels screens
Author: jmorliaguet Date: Mon Feb 27 21:23:01 2006 New Revision: 2498 Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py cpsskins/branches/jmo-perspectives/ui/authoring/views.py cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt cpsskins/branches/jmo-perspectives/ui/screens/editor.pt Log: - updated to the latest API Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js == --- cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/authoring.jsMon Feb 27 21:23:01 2006 @@ -36,7 +36,7 @@ this.node = node; this.bg = node.style.background; this.container = node.parentNode; -this.order = Identifiable.getOrder(node); +this.order = CPSSkins.Identifiable.getOrder(node); this.xpos = null; this.ypos = null; this.can_move = true; @@ -85,7 +85,7 @@ var new_id = request.responseText; var rendered = render_element(id=new_id); var container = current_elem.parentNode; -container.insertBefore(rendered, Identifiable.getNext(current_elem)); +container.insertBefore(rendered, CPSSkins.Identifiable.getNext(current_elem)); // set up the new nodes pd_setupPage(); } @@ -196,7 +196,7 @@ var speed = vertical_speed(e); if (Math.abs(speed) 1) return; if (speed 0) { -var target = Identifiable.getNext(el); +var target = CPSSkins.Identifiable.getNext(el); } else { var target = el; } @@ -211,10 +211,10 @@ } function save_move(elem) { - var parent = Identifiable.getParent(elem); + var parent = CPSSkins.Identifiable.getParent(elem); var src_id = elem.getAttribute(id); var dest_id = parent.getAttribute(id); - var order = Identifiable.getOrder(elem); + var order = CPSSkins.Identifiable.getOrder(elem); current_elem = elem; current_container = parent; model.move({'src_id': src_id, 'dest_id': dest_id, 'order': order}); @@ -228,15 +228,15 @@ if (!Element.hasClassName(moving, 'draggable')) return; var target = Event.element(e); if (!Element.hasClassName(target, 'container')) return; - if (!Identifiable.isEmpty(target)) return; + if (!CPSSkins.Identifiable.isEmpty(target)) return; target.appendChild(moving); current_elem = moving; } function add_element(container, el, type_name) { - var container_id = Identifiable.getIdentifiableElement(container).getAttribute(id); + var container_id = CPSSkins.Identifiable.getIdentifiableElement(container).getAttribute(id); if (el) { -var order = Identifiable.getOrder(el); +var order = CPSSkins.Identifiable.getOrder(el); } else { var order = 0; } @@ -283,7 +283,7 @@ setCursor(default); if (!moved) return; if (!current_elem) return; -if ((moved.order == Identifiable.getOrder(current_elem)) +if ((moved.order == CPSSkins.Identifiable.getOrder(current_elem)) (moved.container == current_elem.parentNode)) return; save_move(current_elem); moved = null; @@ -313,11 +313,11 @@ Event.observe(mo, 'mouseup', function(e) { if (factory) { var type_name = factory.node.getAttribute(type_name); - if (Identifiable.isEmpty(mo)) { + if (CPSSkins.Identifiable.isEmpty(mo)) { var el = null; } else { var target = Event.element(e); -var el = Identifiable.getIdentifiableElement(target); +var el = CPSSkins.Identifiable.getIdentifiableElement(target); } add_element(mo, el, type_name); } Modified: cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml Mon Feb 27 21:23:01 2006 @@ -123,6 +123,12 @@ name=getView attribute=getView / + + browser:page + name=getController + attribute=getController + / + /browser:pages /configure Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py == --- cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py Mon Feb 27 21:23:01 2006 @@ -90,6 +90,7 @@ 'model': 'action-pad', 'perspectives': ['site-designer', 'page-designer', 'layout-designer', 'content-author'], +'controllers': ['main-editor-perspectives'], }, 'tooltip': { @@ -108,6 +109,7 @@ }, 'model':
[Z3lab-checkins] r2499 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 27 22:17:24 2006 New Revision: 2499 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - the content of panels must be parsed (not only loaded) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 22:17:24 2006 @@ -1493,7 +1493,7 @@ var widget = this.widget; var options = { onComplete: function() { - CPSSkins._load(widget); + CPSSkins._parse(widget); } }; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2500 - in cpsskins/branches/jmo-perspectives/ui: authoring panels screens/sitedesigner
Author: jmorliaguet Date: Mon Feb 27 22:25:20 2006 New Revision: 2500 Added: cpsskins/branches/jmo-perspectives/ui/panels/associations.pt (contents, props changed) cpsskins/branches/jmo-perspectives/ui/panels/management.pt (contents, props changed) cpsskins/branches/jmo-perspectives/ui/panels/settings.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/sitedesigner/site_designer.pt Log: - the site designer panels are displayed using perspectives Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py == --- cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py Mon Feb 27 22:25:20 2006 @@ -78,6 +78,26 @@ } }, +'settings': { +'id': 'settings', +'data': { +'url': '@@settings.html', +} +}, + +'management': { +'id': 'management', +'data': { +'url': '@@management.html', +} +}, + +'associations': { +'id': 'associations', +'data': { +'url': '@@associations.html', +} +}, } VIEWS = { @@ -181,8 +201,35 @@ 'controllers': ['main-editor-perspectives'], }, -# Bottom area +# site designer panels +'settings': { +'widget': { +'type': 'panel', +}, +'model': 'settings', +'perspectives': ['settings'], +'controllers': ['site-designer-perspectives'], +}, + +'associations': { +'widget': { +'type': 'panel', +}, +'model': 'associations', +'perspectives': ['associations'], +'controllers': ['site-designer-perspectives'], +}, + +'management': { +'widget': { +'type': 'panel', +}, +'model': 'management', +'perspectives': ['management'], +'controllers': ['site-designer-perspectives'], +}, +# Bottom area 'portlet-factory': { 'widget': { 'type': 'panel', @@ -258,6 +305,9 @@ 'main-editor-perspectives': { 'id': 'main-editor-perspectives', 'type': 'perspective selector', -} - +}, +'site-designer-perspectives': { +'id': 'site-designer-perspectives', +'type': 'perspective selector', +}, } Added: cpsskins/branches/jmo-perspectives/ui/panels/associations.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/panels/associations.ptMon Feb 27 22:25:20 2006 @@ -0,0 +1,9 @@ + + h2Associations/h2 + div class=sections +img class=icon + src=/++skin++cpsskins/@@/++resource++associations-48.png / +span class=descriptionlocal themes, perspectives .../span +br style=clear:both/ + /div + Modified: cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml Mon Feb 27 22:25:20 2006 @@ -38,6 +38,22 @@ template=location_selector.pt / +!-- site designer -- +page + name=settings.html + template=settings.pt +/ + +page + name=associations.html + template=associations.pt +/ + +page + name=management.html + template=management.pt +/ + /pages pages Added: cpsskins/branches/jmo-perspectives/ui/panels/management.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/panels/management.pt Mon Feb 27 22:25:20 2006 @@ -0,0 +1,9 @@ + + h2Management/h2 + div class=sections +img class=icon + src=/++skin++cpsskins/@@/++resource++management-48.png / +span class=descriptionexport, import themes and settings .../span +br style=clear:both/ + /div + Added: cpsskins/branches/jmo-perspectives/ui/panels/settings.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/panels/settings.ptMon Feb 27 22:25:20 2006 @@ -0,0 +1,55 @@ +tal:block define=engine string:site-designer; + selection context/@@getSelection; + section selection/section|nothing; + subsection selection/subsection|nothing; + selected selection/selected|nothing + + table class=panel cellpadding=0 cellspacing=0 + tal:define=info context/@@getSettingInfo +tr + td class=first +h2Settings/h2 +div
[Z3lab-checkins] r2477 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Sun Feb 26 13:41:47 2006 New Revision: 2477 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - test optimization the document only needs to be parsed once. Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Sun Feb 26 13:41:47 2006 @@ -331,13 +331,14 @@ return text.toLowerCase(); } + try { +ctal.process_ctal(document, data); + } catch (e) { + } + new Test.Unit.Runner({ setup: function() { - try { -ctal.process_ctal(document, data); - } catch (e) { - } }, testDataStructure: function() { with(this) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2478 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sun Feb 26 14:37:35 2006 New Revision: 2478 Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Log: - fix for IE and optimizations (tmpl.attributes is extremely costly under IE since all node attributes even those that are not in the HTML are listed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js == --- cpsskins/branches/jmo-perspectives/ui/framework/ctal.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Sun Feb 26 14:37:35 2006 @@ -182,26 +182,21 @@ ctal.process_ctal = function(tmpl, data) { var recurse = true; + var parsers, ctal_attr, ctal_attr_name, attr; if (tmpl.nodeType == 1) { -var parsers = ctal.parsers; +parsers = ctal.parsers; for (ctal_attr in parsers) { - var attrs = tmpl.attributes; - for (i=0; iattrs.length; i++) { -var attrnode = attrs[i]; -var attrname = attrnode.nodeName; -if (attrname != ctal: + ctal_attr) { - continue; -} -tmpl.removeAttribute(ctal: + ctal_attr); + ctal_attr_name = ctal: + ctal_attr; + attr = tmpl.getAttribute(ctal_attr_name); + if (attr != null) { +tmpl.removeAttribute(ctal_attr_name); // For Opera tmpl.removeAttribute(ctal_attr); - var parser = parsers[ctal_attr]; if (!parser.recurse) { recurse = false; } -parser.parse(tmpl, attrnode.value, data) -break; +parser.parse(tmpl, attr, data) } } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2479 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Sun Feb 26 15:11:20 2006 New Revision: 2479 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - simpler test syntax - we remove line breaks when testing HTML Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Sun Feb 26 15:11:20 2006 @@ -328,42 +328,40 @@ function htmlOf(node) { var text = $(node).innerHTML; -return text.toLowerCase(); +return text.toLowerCase().replace(/\r/g, '').replace(/\n/g,''); } try { ctal.process_ctal(document, data); - } catch (e) { - } + } catch (e) {} - new Test.Unit.Runner({ + var inspect = Test.Unit.inspect; -setup: function() { -}, + new Test.Unit.Runner({ testDataStructure: function() { with(this) { assertEqual(1, data['a']); assertEqual(2, data['b']); assertEqual(3, data['c']['d']); assertEqual(4, data['c']['e']); - assertEqual($A([4, 5, 6]).inspect(), $A(data['f']).inspect()); - assertEqual($H({h: 7, i: 8, j: 9}).inspect(), $H(data['g'][0]).inspect()); + assertEqual(inspect([4, 5, 6]), inspect(data['f'])); + assertEqual(inspect({h: 7, i: 8, j: 9}), inspect(data['g'][0])); assertEqual(10, data['k']['l']['m']); assertEqual(1, data['ctrue']); assertEqual(0, data['cfalse']); }}, testPrivateAPI: function() { with(this) { - assertEqual($A(['style', '']).inspect(), - $A(ctal.get_nameexpr('style')).inspect()); - assertEqual($A(['style', 'string:1']).inspect(), - $A(ctal.get_nameexpr('style string:1')).inspect()); - assertEqual($A(['style', 'string:1']).inspect(), - $A(ctal.get_nameexpr(' style string:1 ')).inspect()); - assertEqual($A(['style', 'a/b/c']).inspect(), - $A(ctal.get_nameexpr(' style a/b/c')).inspect()); - assertEqual($A(['style', 'a/b/c; color a/b']).inspect(), - $A(ctal.get_nameexpr('style a/b/c; color a/b')).inspect()); + assertEqual(inspect(['style', '']), + inspect(ctal.get_nameexpr('style'))); + assertEqual(inspect(['style', 'string:1']), + inspect(ctal.get_nameexpr('style string:1'))); + assertEqual(inspect(['style', 'string:1']), + inspect(ctal.get_nameexpr(' style string:1 '))); + assertEqual(inspect(['style', 'a/b/c']), + inspect(ctal.get_nameexpr(' style a/b/c'))); + assertEqual(inspect(['style', 'a/b/c; color a/b']), + inspect(ctal.get_nameexpr('style a/b/c; color a/b'))); }}, testTALContent: function() { with(this) { @@ -422,8 +420,11 @@ }}, testTALAttributesTALContent: function() { with(this) { - assertEqual('a alt=q href=http://r/;s/a', htmlOf(e15)); - assertEqual('a alt=q href=http://r/;s/a', htmlOf(e15b)); + assert(htmlOf(e15) == 'a alt=q href=http://r/;s/a' || + htmlOf(e15) == 'a href=http://r/; alt=qs/a'); + + assert(htmlOf(e15b) == 'a alt=q href=http://r/;s/a' || + htmlOf(e15b) == 'a href=http://r/; alt=qs/a'); }}, testTALReplace: function() { with(this) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2481 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Sun Feb 26 16:27:48 2006 New Revision: 2481 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_widgets_test.html Log: - test update Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_widgets_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_widgets_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_widgets_test.html Sun Feb 26 16:27:48 2006 @@ -29,6 +29,12 @@ div + ins class=controller + {id: show-hide-tooltip, + type: focus observer + } + /ins + ins class=model {data: { hint:Tooltip hint for e0 @@ -46,7 +52,9 @@ ins class=view {widget: { type: tooltip - }} + }, + controllers: [show-hide-tooltip] + } /ins /div -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2482 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Sun Feb 26 16:41:20 2006 New Revision: 2482 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Log: - test fixes Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Sun Feb 26 16:41:20 2006 @@ -229,7 +229,9 @@ var e6 = $('e6'); function isVisible(element) { -return $(element).style.display != 'none'; +var element = $(element); +if (!element) { return false }; +return element.style.display != 'none'; } var handler = function() {} @@ -491,127 +493,120 @@ /* Perspectives */ testSwitchPerspectives: function() { with(this) { - var p1 = $(p1).parentNode; - var p1_2 = $(p1_2).parentNode; - var p2_3 = $(p2_3).parentNode; - var p2_3_1 = $(p2_3_1).parentNode; - var p2 = $(p2).parentNode; - var p3 = $(p3).parentNode; - var p4 = $(p4).parentNode; - - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p2)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + + assert(!isVisible(p1)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p2)); + assert(!isVisible(p3)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(1); - assert(isVisible(p1)); - assert(isVisible(p2)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + assert(isVisible(p1)); + assert(isVisible(p2)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p3)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(2); - assert(isVisible(p2)); - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + assert(isVisible(p2)); + assert(!isVisible(p1)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p3)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(3); - assert(isVisible(p3)); - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p2)); - assert(!isVisible(p4)); + assert(isVisible(p3)); + assert(!isVisible(p1)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p2)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(4); - assert(isVisible(p4)); - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p2)); - assert(!isVisible(p3)); + assert(isVisible(p4)); + assert(!isVisible(p1)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p2)); + assert(!isVisible(p3)); CPSSkins.switchPerspective(1/2); - assert(isVisible(p1)); - assert(isVisible(p2)); // visible because p2 is visible in perspective 1 - assert(isVisible(p1_2)); - assert(!isVisible(p2_3)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + assert(isVisible(p1)); + assert(isVisible(p2)); // visible because p2 is visible in perspective 1 + assert(isVisible(p1_2)); + assert(!isVisible(p2_3)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p3)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(2/3); - assert(isVisible(p2)); - assert(isVisible(p2_3)); - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p2_3_1)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + assert(isVisible(p2)); + assert(isVisible(p2_3)); + assert(!isVisible(p1)); + assert(!isVisible(p1_2)); + assert(!isVisible(p2_3_1)); + assert(!isVisible(p3)); + assert(!isVisible(p4)); CPSSkins.switchPerspective(2/3/1); - assert(isVisible(p2)); - assert(isVisible(p2_3)); - assert(isVisible(p2_3_1)); - assert(!isVisible(p1)); - assert(!isVisible(p1_2)); - assert(!isVisible(p3)); - assert(!isVisible(p4)); + assert(isVisible(p2)); +
[Z3lab-checkins] r2452 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 10:56:40 2006 New Revision: 2452 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - simpler code Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 10:56:40 2006 @@ -889,20 +889,17 @@ fadeout: function(node, options) { var setOpacity = CPSSkins.Canvas.setOpacity; setOpacity(node, 1); -return new CPSSkins.Scheduler(node, { - delay: options.delay, - duration: options.duration, +Object.extend(options, { action: function(value) { setOpacity(node, 1-value) }, onComplete: function() { Element.hide(node) } }); +return new CPSSkins.Scheduler(node, options); }, blinddown: function(node, options) { var height = parseInt(Element.getStyle(node, 'height')); Element.makeClipping(node); -return new CPSSkins.Scheduler(node, { - delay: options.delay, - duration: options.duration, +Object.extend(options, { action: function(value) { Element.setStyle(node, {height: height*value + 'px'}); }, @@ -911,21 +908,19 @@ Element.undoClipping(node); } }); +return new CPSSkins.Scheduler(node, options); }, blindup: function(node, options) { var height = parseInt(Element.getStyle(node, 'height')); Element.makeClipping(node); -return new CPSSkins.Scheduler(node, { - delay: options.delay, - duration: options.duration, +Object.extend(options, { action: function(value) { Element.setStyle(node, {height: height*(1-value) + 'px'}); }, - onComplete: function() { -Element.setStyle(node, {height: '0px'}); - } + onComplete: function() { Element.setStyle(node, {height: '0px'}); } }); +return new CPSSkins.Scheduler(node, options); } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2453 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 12:03:26 2006 New Revision: 2453 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - code simplifications Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 12:03:26 2006 @@ -92,28 +92,25 @@ }, unsubscribe: function(eventid, event) { -new_subscribers = []; -CPSSkins._subscribers[eventid].each(function(e) { - if (!(event.subscriber == e.subscriber event.publisher == e.publisher)) { -new_subscribers.push(e); - } -}); -CPSSkins._subscribers[eventid] = new_subscribers; +var subscribers = CPSSkins._subscribers; +subscribers[eventid] = subscribers[eventid].reject(function(e) { + return (event.subscriber == e.subscriber + event.publisher == e.publisher) + }); }, notify: function(eventid, event) { -var subscribers = CPSSkins._subscribers[eventid] || []; +var subscribers = CPSSkins._subscribers; var publisher = event.publisher; -subscribers.each(function(e) { - var event_publisher = e.publisher; - if (event_publisher == publisher || event_publisher == null) { -var handler = CPSSkins.getEventHandler(eventid, e.subscriber); -if (handler) { - // set the publisher in case no publisher is specified in the subscription. - event.subscriber = e.subscriber; - event.publisher = publisher; - handler(event); -} +(subscribers[eventid] || []).findAll(function(e) { + return (e.publisher == publisher || e.publisher == null) +}).each(function(e) { + var handler = CPSSkins.getEventHandler(eventid, e.subscriber); + if (handler) { +// set the publisher in case no publisher is specified. +event.subscriber = e.subscriber; +event.publisher = publisher; +handler(event); } }); }, @@ -127,12 +124,7 @@ }, getEventHandler: function(eventid, subscriber) { -var handlers = subscriber._handlers; -if (handlers) { - return handlers[eventid]; -} else { - return null; -} +return (subscriber._handlers || {})[eventid]; }, /* Document parsing */ @@ -164,7 +156,7 @@ } }); - elements.each(function(el, index) { +elements.each(function(el, index) { var url = el.getAttribute(cite); if (url) { var options = { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2454 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 12:28:24 2006 New Revision: 2454 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - we unsubscribe from events that are only used once (initialization, setup) - the subscription list is cleaned up when there are no subscribers left. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 12:28:24 2006 @@ -94,9 +94,11 @@ unsubscribe: function(eventid, event) { var subscribers = CPSSkins._subscribers; subscribers[eventid] = subscribers[eventid].reject(function(e) { + if (typeof event == 'undefined') return true; return (event.subscriber == e.subscriber event.publisher == e.publisher) }); +if (subscribers[eventid].length == 0) {delete subscribers[eventid]} }, notify: function(eventid, event) { @@ -145,7 +147,7 @@ // first stage parse: function(node) { var elements = $A(node.getElementsByTagName(ins)); -var progress = new Object({'initialized': 0}); +var progress = {'initialized': 0}; var length = elements.length; CPSSkins.subscribe(initialized, {'subscriber': progress}); @@ -153,6 +155,7 @@ progress.initialized += 1; if (progress.initialized = length) { CPSSkins.load(node); +CPSSkins.unsubscribe(initialized); } }); @@ -249,6 +252,7 @@ CPSSkins.registerEventHandler(evt_id, view, function(event) { var model = event.publisher; view.observe(model); +CPSSkins.unsubscribe(evt_id); }); CPSSkins.subscribe(evt_id, {'subscriber': view}); } @@ -261,6 +265,7 @@ var controller = event.publisher; controller.view = view; controller.register(view); +CPSSkins.unsubscribe(evt_id); }); CPSSkins.subscribe(evt_id, {'subscriber': view}); }); @@ -1443,6 +1448,7 @@ CPSSkins.registerEventHandler(evt_id, view, function(event) { view.getData(); +CPSSkins.unsubscribe(evt_id); }); CPSSkins.subscribe(evt_id, {'subscriber': view}); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2456 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 13:44:27 2006 New Revision: 2456 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - simplifications: the scheduler doesn't need to know about the node on which the effect is applied. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 13:44:27 2006 @@ -805,12 +805,11 @@ CPSSkins.Scheduler = Class.create(); CPSSkins.Scheduler.prototype = { - initialize: function(element, options) { -this.element = $(element); -this.action = options.action || function(value) {}; + initialize: function(options) { this.delay = options.delay || 0; -this.onComplete = options.onComplete || function() {}; this.duration = options.duration || 300; +this.action = options.action || function(value) {}; +this.onComplete = options.onComplete || function() {}; this.started = false; this.start(); @@ -848,11 +847,9 @@ show: function(node, options) { var delay = options.delay; if (delay) { - return new CPSSkins.Scheduler(node, { + return new CPSSkins.Scheduler({ delay: delay, -onComplete: function() { - Element.show(node); -} +onComplete: function() { Element.show(node); } }); } else { Element.show(node); @@ -862,11 +859,9 @@ hide: function(node, options) { var delay = options.delay; if (delay) { - return new CPSSkins.Scheduler(node, { + return new CPSSkins.Scheduler({ delay: delay, -onComplete: function() { - Element.hide(node); -} +onComplete: function() { Element.hide(node); } }); } else { Element.hide(node); @@ -876,7 +871,7 @@ fadein: function(node, options) { var setOpacity = CPSSkins.Canvas.setOpacity; setOpacity(node, 0); -return new CPSSkins.Scheduler(node, { +return new CPSSkins.Scheduler({ delay: options.delay, duration: options.duration, action: function(value) { setOpacity(node, value) }, @@ -891,7 +886,7 @@ action: function(value) { setOpacity(node, 1-value) }, onComplete: function() { Element.hide(node) } }); -return new CPSSkins.Scheduler(node, options); +return new CPSSkins.Scheduler(options); }, blinddown: function(node, options) { @@ -906,7 +901,7 @@ Element.undoClipping(node); } }); -return new CPSSkins.Scheduler(node, options); +return new CPSSkins.Scheduler(options); }, blindup: function(node, options) { @@ -918,7 +913,7 @@ }, onComplete: function() { Element.setStyle(node, {height: '0px'}); } }); -return new CPSSkins.Scheduler(node, options); +return new CPSSkins.Scheduler(options); } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2457 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 15:17:08 2006 New Revision: 2457 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - we compare the new data to store with the old data to avoid firing an event for nothing if the data is the same. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 15:17:08 2006 @@ -95,7 +95,7 @@ var subscribers = CPSSkins._subscribers; if (!(eventid in subscribers)) { return; } subscribers[eventid] = subscribers[eventid].reject(function(e) { - if (typeof event == 'undefined') return true; + if (event == undefined) return true; return (event.subscriber == e.subscriber event.publisher == e.publisher) }); @@ -1069,19 +1069,19 @@ var next = this._queue[0]; if (next in this._queued_data) { data = this._queued_data[next]; - stored = this._writeFields(data); + stored = this._storeFields(data); this._queue.shift(); } else { break; } } } else { - stored = this._writeFields(data); + stored = this._storeFields(data); } return stored; }, - _writeFields: function(data) { + _storeFields: function(data) { // filter out fields with the wrong data type var schema = this.model.schema; var filtered_data = new Object(); @@ -1092,12 +1092,17 @@ filtered_data[field] = value; } }); -// TODO compare old and new data -this.model.def.data = filtered_data; -CPSSkins.notify('stored', {'publisher': this}); +if (!this._compareData(this.model.def.data, filtered_data)) {; + this.model.def.data = filtered_data; + CPSSkins.notify('stored', {'publisher': this}); +} return filtered_data; }, + _compareData: function(a, b) { +return JSON.stringify(a) == JSON.stringify(b); + }, + merge: function(data) { var current_data = this.read(); var new_data = $H(current_data).merge(data); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2458 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 16:17:33 2006 New Revision: 2458 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - added a function for refreshing the view Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 16:17:33 2006 @@ -1312,6 +1312,11 @@ } }, + refresh: function() { +var data = this.getData(); +if (data) this.display(data); + }, + display: function(data) { this.render(data); if (this.def.render_effect) { @@ -1327,9 +1332,8 @@ CPSSkins.notify(gained focus, {'publisher': this, 'context': this.selected}); -// get new data and display the view -var data = this.getData(); -if (data) this.display(data); +// refresh the view +this.refresh(); // prepare the view this.prepare(); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2461 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 25 18:30:18 2006 New Revision: 2461 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - using readData() instead of getData() otherwise the requested data can arrive after the data returned get setData(data) (fixes race condition) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 25 18:30:18 2006 @@ -35,7 +35,7 @@ var nodeid = target.getAttribute(nodeid); var model = this.view.model; - var data = model.getData(); + var data = model.readData(); data['state'][nodeid] = open; model.setData(data); } @@ -45,7 +45,7 @@ var nodeid = target.getAttribute(nodeid); var model = this.view.model; - var data = model.getData(); + var data = model.readData(); delete data['state'][nodeid]; model.setData(data); } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2463 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 19:07:38 2006 New Revision: 2463 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - more robust code Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 19:07:38 2006 @@ -890,7 +890,7 @@ }, blinddown: function(node, options) { -var height = parseInt(Element.getStyle(node, 'height')); +var height = Element.getHeight(node); Element.makeClipping(node); Object.extend(options, { action: function(value) { @@ -905,7 +905,7 @@ }, blindup: function(node, options) { -var height = parseInt(Element.getStyle(node, 'height')); +var height = Element.getHeight(node); Element.makeClipping(node); Object.extend(options, { action: function(value) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2464 - cpsskins/branches/jmo-perspectives/ui/framework/doc
Author: jmorliaguet Date: Sat Feb 25 20:42:07 2006 New Revision: 2464 Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Log: - doc update Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt == --- cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Sat Feb 25 20:42:07 2006 @@ -114,24 +114,186 @@ Controller classes have access to the model and to the view. -Available widgets -= +Definitions +=== -Panels --- +The Model, View and Controller elements are registered in the HTML page using +the HTML *ins* tag:: -... + ins class=model + ... + /ins -Contextual menus + ins class=view + ... + /ins + + ins class=controller + ... + /ins + + +The definitions are written in the JSON format, either inline :: + + ins class=view + {widget: { + type: menu + }} + /ins + +or they can be inserted from a remote location:: + + ins class=view cite=/def/viewDefinition.html + /ins + + +Note: the ins tag is part of the HTML specification. +Semantically it denotes an editorial insertion of content. + +Model += + +The model contains some initial data (used to define a schema) and a storage. + +* id: the model's id + +* data: the model's initial data and schema definition + +* storage: the data storage + + There are different types of storages: + + - RAM (the data is stored in the browser's RAM) + + - local (the data is stored in a cookie) + + - remote (the data is stored on a remote server) + + - unified (a combination of several data storages to provide unified +data access) + +Storage adapters -... +* type: the storage type + + - ram (used by default) -Tooltip + - local + + - remote + +- accessors: the storage accessors (get, set) + +- refresh: the refresh rate + +- access: the type of access + + - sequence type: queue, stack + + - sequence signature + + + +View + + +* widget type + +* template: a CTAL template (optional) + +* model: the model's id (optional) + +* show_effect: the effect to applied when the widget is shown (optional) + +* render_effect: the effect to applied when the widget is rendered (optional) + +* hide_effect: the effect to applied when the widget is hidden (optional) + +* controllers: a list of controllers that apply to the view (optional) + +* perspectives: the perspectives in which the view is visible (optional) + +Widgets --- -... +* Panel + + +* Contextual menus + + - items + +- type (item, submenu, separator) + +- label + +- icon + +- action + +- confirm + + +* Contextual actions + + (same options as the Contextual menu) + + +* Tooltip + + +* Custom + + a custom widget, requires a 'template'. + +Effects +--- + +* transition type + + - fadein + + - fadeout + + - blinddown + + - blindup + + +* effect options: + + - delay + + - duration + + +Controllers +=== + +* form controller + + +* behaviour controller + + - rules + + +* focus observer + + +* command controller + + - handlers + + +* drag-and-drop + + - action + + - droppable + - draggable .. Emacs -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2465 - in cpsskins/branches/jmo-perspectives/ui: authoring screens
Author: jmorliaguet Date: Sat Feb 25 21:07:42 2006 New Revision: 2465 Modified: cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py cpsskins/branches/jmo-perspectives/ui/authoring/views.py cpsskins/branches/jmo-perspectives/ui/screens/editor.pt Log: - the panels' url and css information is now stored in the model Modified: cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml Sat Feb 25 21:07:42 2006 @@ -115,10 +115,14 @@ / browser:page + name=getModel + attribute=getModel + / + + browser:page name=getView attribute=getView / - /browser:pages /configure Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py == --- cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py Sat Feb 25 21:07:42 2006 @@ -3,14 +3,91 @@ _ = MessageFactory(cpsskins) +MODELS = { +'action-pad': { +'id': 'action-pad', +'data': { +'url': '@@actionPad.html', +} +}, + +'perspective-selector': { +'id': 'perspective-selector', +'data': { +'url': '@@perspectiveSelector.html', +} +}, + +'theme-tabs': { +'id': 'theme-tabs', +'data': { +'url': '@@themeTabs.html', +} +}, + +'page-tabs': { +'id': 'page-tabs', +'data': { +'url': '@@pageTabs.html', +} +}, + +'location-selector': { +'id': 'location-selector', +'data': { +'url': '@@locationSelector.html', +} +}, + +'page-designer': { +'id': 'page-designer', +'data': { +'url': '@@renderPage.html?engine=page-designer', +'css': '/++skin++cpsskins/@@/++resource++page-designer.css', +} +}, + +'layout-designer': { +'id': 'layout-designer', +'data': { +'url': '@@renderPage.html?engine=layout-designer', +'css': '/++skin++cpsskins/@@/++resource++layout-designer.css', +} +}, + +'content-author': { +'id': 'content-author', +'data': { +'url': '@@renderPage.html?engine=content-author', +'css': '/++skin++cpsskins/@@/++resource++content-author.css', +} +}, + +'site-designer': { +'id': 'site-designer', +'data': { +'url': '@@site-designer.html', +'css': '/++skin++cpsskins/@@/++resource++site-designer.css', +} +}, + +'portlet-factory': { +'id': 'portlet-factory', +'data': { +'url': '@@portletFactory.html', +} +}, + +} + VIEWS = { # Top area 'action-pad': { 'widget': { 'type': 'panel', -'url': '@@actionPad.html', }, +'model': 'action-pad', 'perspectives': ['site-designer', 'page-designer', 'layout-designer', 'content-author'], }, @@ -28,8 +105,8 @@ 'perspective-selector': { 'widget': { 'type': 'panel', -'url': '@@perspectiveSelector.html', }, +'model': 'perspective-selector', 'perspectives': ['page-designer', 'layout-designer', 'content-author'], }, @@ -37,24 +114,24 @@ 'theme-tabs': { 'widget': { 'type': 'panel', -'url': '@@themeTabs.html', }, +'model': 'theme-tabs', 'perspectives': ['page-designer', 'layout-designer'], }, 'page-tabs': { 'widget': { 'type': 'panel', -'url': '@@pageTabs.html', }, +'model': 'page-tabs', 'perspectives': ['page-designer', 'layout-designer'], }, 'location-selector': { 'widget': { 'type': 'panel', -'url': '@@locationSelector.html', }, +'model': 'location-selector', 'perspectives': ['content-author'], 'show_effect': { 'transition': 'fadein', @@ -65,27 +142,24 @@ 'page-designer': { 'widget': { 'type': 'panel', -'url': '@@renderPage.html?engine=page-designer', -'css': '/++skin++cpsskins/@@/++resource++page-designer.css', }, +'model': 'page-designer', 'perspectives': ['page-designer'], }, 'layout-designer': { 'widget': { 'type': 'panel', -'url': '@@renderPage.html?engine=layout-designer', -
[Z3lab-checkins] r2466 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional
Author: jmorliaguet Date: Sat Feb 25 21:11:13 2006 New Revision: 2466 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html Log: - added link to the effects test Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html Sat Feb 25 21:11:13 2006 @@ -44,4 +44,8 @@ a target=main href=cpsskins_dragdrop_test.htmlDrag and drop/a /li + li +a target=main + href=cpsskins_effects_test.htmlVisual effects/a + /li /ul -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2467 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 21:38:44 2006 New Revision: 2467 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - better API for registering controllers, storage adapters, widgets, effects Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 21:38:44 2006 @@ -44,6 +44,11 @@ _currentPerspective: , _previousPerspective: , + Controllers: $H({}), + Effects: $H({}), + Storages: $H({}), + Widgets: $H({}), + init: function() { CPSSkins.parse(document); }, @@ -70,6 +75,22 @@ return controller; }, + registerControllers: function(controllers) { +Object.extend(CPSSkins.Controllers, controllers) + }, + + registerEffects: function(effects) { +Object.extend(CPSSkins.Effects, effects) + }, + + registerStorages: function(storages) { +Object.extend(CPSSkins.Storages, storages) + }, + + registerWidgets: function(widgets) { +Object.extend(CPSSkins.Widgets, widgets) + }, + /* Error handling */ warn: function(msg, context) { var div = document.createElement(div); @@ -390,8 +411,7 @@ } -if (!CPSSkins.Controllers) { CPSSkins.Controllers = new Object(); } -Object.extend(CPSSkins.Controllers, { +CPSSkins.registerControllers({ 'command': function(node, def) { return new CPSSkins.CommandController(node, def); @@ -842,7 +862,7 @@ // Effects -CPSSkins.Effects = { +CPSSkins.registerEffects({ show: function(node, options) { var delay = options.delay; @@ -915,7 +935,7 @@ }); return new CPSSkins.Scheduler(options); } -} +}); // Model @@ -1114,8 +1134,7 @@ } -if (!CPSSkins.Storages) { CPSSkins.Storages = new Object(); } -Object.extend(CPSSkins.Storages, { +CPSSkins.registerStorages({ ram: function(model) { return new CPSSkins.RAMStorage(model); @@ -1381,15 +1400,7 @@ } -// Renderer: instanciate a widget. -if (!CPSSkins.Widgets) { CPSSkins.Widgets = new Object(); } - -Object.extend(CPSSkins, { - registerWidgets: function(widgets) { -Object.extend(CPSSkins.Widgets, widgets) - } -}); - +// Widgets CPSSkins.registerWidgets({ custom: function(def) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2468 - cpsskins/branches/jmo-perspectives/ui/framework/doc
Author: jmorliaguet Date: Sat Feb 25 21:39:06 2006 New Revision: 2468 Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Log: - doc update Javascript API Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt == --- cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Sat Feb 25 21:39:06 2006 @@ -296,6 +296,96 @@ - draggable +Javascript API +== + +CPSSkins + + + - getModelById(id) + + - getControllerById(id) + + + - registerControllers(controllers) + + - registerEffects(effects) + + - registerStorages(storages) + + - registerWidgets(widgets) + + + - switchPerspective(perspective) + + + - registerHandlers(handlers) + + + - subscribe(eventid, event) + + - unsubscribe(eventid, event) + + - notify(eventid, event) + + - registerEventHandler(eventid, subscriber, handler) + + - getEventHandler(eventid, subscriber) + + +CPSSkins.Model +-- + + - readData() + + - getData() + + - setData(data) + + - updateData(data) + + - addObserver(view) + + - removeObserver(view) + + +CPSSkins.StorageAdapter +--- + + - setup() + + - requestData() + + - storeData(data) + + +CPSSkins.View +- + + - setup() + + - render(data) + + - prepare() + + - teardown() + + - refresh() + + - display() + + - show() + + - hide() + + +CPSSkins.Controller +--- + + - setup() + + - register(view) + .. Emacs .. Local Variables: .. mode: rst -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2469 - in cpsskins/branches/jmo-perspectives/ui/framework: . doc tests/functional tests/functional/behaviour tests/unit tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 25 22:09:31 2006 New Revision: 2469 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - renamed registerHandlers as addActions Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 22:09:31 2006 @@ -36,6 +36,11 @@ var CPSSkins = { Version: 0.7, + Controllers: $H({}), + Effects: $H({}), + Storages: $H({}), + Widgets: $H({}), + _subscribers: $H({}), _models: $H({}), _controllers: $H({}), @@ -44,11 +49,6 @@ _currentPerspective: , _previousPerspective: , - Controllers: $H({}), - Effects: $H({}), - Storages: $H({}), - Widgets: $H({}), - init: function() { CPSSkins.parse(document); }, @@ -99,12 +99,12 @@ context.parentNode.replaceChild(div, context); }, - /* Public events */ - registerHandlers: function(handlers) { + /* Action handlers */ + addActions: function(handlers) { Object.extend(CPSSkins._handlers, handlers); }, - /* Internal events */ + /* Event system */ subscribe: function(eventid, event) { if (!(eventid in CPSSkins._subscribers)) { CPSSkins._subscribers[eventid] = []; Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt == --- cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Sat Feb 25 22:09:31 2006 @@ -319,7 +319,7 @@ - switchPerspective(perspective) - - registerHandlers(handlers) + - addActions(handlers) - subscribe(eventid, event) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html Sat Feb 25 22:09:31 2006 @@ -44,7 +44,7 @@ Element.setStyle(target, {'background-color': null}); } -CPSSkins.registerHandlers( +CPSSkins.addActions( {'say-hello': sayHello, 'focus-area': focusArea, 'unfocus-area': unfocusArea Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html Sat Feb 25 22:09:31 2006 @@ -118,7 +118,7 @@ context.getAttribute('id') + ' =gt; ' + options.choice + '\n'; } -CPSSkins.registerHandlers({'displayChoice': displayChoice}); +CPSSkins.addActions({'displayChoice': displayChoice}); /script pre id=message/pre Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html Sat Feb 25 22:09:31 2006 @@ -177,7 +177,7 @@ context.getAttribute('id') + ' =gt; ' + options.choice + '\n'; } -CPSSkins.registerHandlers({'displayChoice': displayChoice}); +CPSSkins.addActions({'displayChoice': displayChoice}); /script pre id=message/pre Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html
[Z3lab-checkins] r2470 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 23:06:41 2006 New Revision: 2470 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - fixes: the model's data is stored in model._data and the data schema definition is in model.def.data - added low-level IO methods (readData / getData) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 23:06:41 2006 @@ -951,11 +951,20 @@ this.storage = this._setStorageAdapter(); }, - // high-level I/O + // low-level I/O readData: function() { -return this.storage.read(); +return this._data || this.def.data; + }, + + writeData: function(data) { +this._data = data; }, + hasData: function() { +return this._data != undefined; + }, + + // high-level I/O getData: function() { this.storage.readTransaction(); /* asynchronous call */ return this.readData(); @@ -975,7 +984,7 @@ var model = this; // observers subscribes to events on the model CPSSkins.registerEventHandler('modified', view, function(event) { - var data = event.publisher.def.data; + var data = event.publisher.readData(); event.subscriber.display(data); }); CPSSkins.subscribe('modified', {'subscriber': view, 'publisher': model}); @@ -1078,7 +1087,8 @@ // low-level I/O read: function() { -return this.model.def.data; +// TODO implement a policy for reading data +return this.model.readData(); }, write: function(data) { @@ -1107,19 +1117,19 @@ _storeFields: function(data) { // filter out fields with the wrong data type var schema = this.model.schema; -var filtered_data = new Object(); +var new_data = new Object(); schema.each(function(f) { var field = f.key; var value = data[field]; if (value != null typeof value == f.value) { -filtered_data[field] = value; +new_data[field] = value; } }); -if (!this._compareData(this.model.def.data, filtered_data)) {; - this.model.def.data = filtered_data; +if (!this.model.hasData() || !this._compareData(this.read(), new_data)) {; + this.model.writeData(new_data); CPSSkins.notify('stored', {'publisher': this}); } -return filtered_data; +return new_data; }, _compareData: function(a, b) { @@ -1903,7 +1913,7 @@ var model = CPSSkins.Canvas.getModel(selected); if (!model) return; -var data = model.def.data; +var data = model.readData(); if (!data) return; if (data.hint == null) return; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2471 - cpsskins/branches/jmo-perspectives/ui/framework/doc
Author: jmorliaguet Date: Sat Feb 25 23:11:22 2006 New Revision: 2471 Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Log: - doc update Modified: cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt == --- cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/doc/index.txt Sat Feb 25 23:11:22 2006 @@ -307,6 +307,8 @@ - getControllerById(id) +- plugin registration + - registerControllers(controllers) - registerEffects(effects) @@ -316,12 +318,18 @@ - registerWidgets(widgets) +- perspectives + - switchPerspective(perspective) +- action handlers + - addActions(handlers) +- events + - subscribe(eventid, event) - unsubscribe(eventid, event) @@ -336,14 +344,24 @@ CPSSkins.Model -- +- low-level IO + - readData() + - writeData(data) + + +- high-level IO + - getData() - setData(data) - updateData(data) + +- observer pattern + - addObserver(view) - removeObserver(view) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2472 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 23:14:22 2006 New Revision: 2472 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - private methods begin with _ Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 23:14:22 2006 @@ -50,7 +50,7 @@ _previousPerspective: , init: function() { -CPSSkins.parse(document); +CPSSkins._parse(document); }, getModelById: function(id) { @@ -153,7 +153,7 @@ /* Document parsing */ - jsonParse: function(el) { + _jsonParse: function(el) { var res = null; var text = el.innerHTML; if (!text) return; @@ -167,7 +167,7 @@ }, // first stage - parse: function(node) { + _parse: function(node) { var elements = $A(node.getElementsByTagName(ins)); var progress = {'initialized': 0}; var length = elements.length; @@ -176,7 +176,7 @@ CPSSkins.registerEventHandler(initialized, progress, function(event) { progress.initialized += 1; if (progress.initialized = length) { -CPSSkins.load(node); +CPSSkins._load(node); CPSSkins.unsubscribe(initialized); } }); @@ -204,22 +204,22 @@ }, // second stage - load: function(node) { + _load: function(node) { var elements = $A(node.getElementsByTagName(ins)); [view, controller, model].each(function(type) { elements.each(function(el, index) { if (Element.hasClassName(el, type)) { - CPSSkins.register(el, type, index); + CPSSkins._register(el, type, index); } }); }); }, - register: function(el, classid, index) { + _register: function(el, classid, index) { // make the element identifiable var name = classid + index; el.setAttribute(name, name); - var def = CPSSkins.jsonParse(el); + var def = CPSSkins._jsonParse(el); def.name = name; switch(classid) { @@ -1531,7 +1531,7 @@ var widget = this.widget; var options = { onComplete: function() { - CPSSkins.load(widget); + CPSSkins._load(widget); } }; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2474 - cookbook/trunk
Author: tziade Date: Sun Feb 26 00:34:20 2006 New Revision: 2474 Added: cookbook/trunk/macros.tex cookbook/trunk/recipe0.tex Log: added macros and recipe 0 Added: cookbook/trunk/macros.tex == --- (empty file) +++ cookbook/trunk/macros.tex Sun Feb 26 00:34:20 2006 @@ -0,0 +1,104 @@ +% Import all the nice and important packages +\usepackage{amssymb, amsmath} % Allows math symbols. +\usepackage{epsfig} % Allows us to insert EPS figures. +\usepackage{eso-pic} +\usepackage{graphicx} +\usepackage{fancyvrb} +\usepackage[obeyspaces]{url} +\usepackage{listings} +\usepackage{nameref} +\usepackage[usenames]{color} + +% Setup up listings. +\lstnewenvironment{python} +{ +\lstset{language=Python, +fancyvrb=true, +morekeywords={self}, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +stringstyle=\ttfamily\color{Blue}, +keywordstyle=\color{BlueViolet}\bfseries, +commentstyle=\color{BrickRed}\itshape, +showstringspaces=false} +}{} + +\lstnewenvironment{codetext} +{ +\lstset{language=Python, +fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +showstringspaces=false} +}{} + +\lstnewenvironment{zcml} +{ +\lstset{language=XML, +fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +stringstyle=\ttfamily\color{Blue}, +keywordstyle=\color{BlueViolet}\bfseries, +commentstyle=\color{BrickRed}\itshape, +showstringspaces=false} +}{} + +\lstnewenvironment{xml} +{ +\lstset{language=XML, +fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +stringstyle=\ttfamily\color{Blue}, +keywordstyle=\color{BlueViolet}\bfseries, +commentstyle=\color{BrickRed}\itshape, +showstringspaces=false} +}{} + +\lstnewenvironment{zpt} +{ +\lstset{language=XML, +fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +stringstyle=\ttfamily\color{Blue}, +keywordstyle=\color{BlueViolet}\bfseries, +commentstyle=\color{BrickRed}\itshape, +showstringspaces=false} +}{} + +\lstnewenvironment{css} +{ +\lstset{fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +stringstyle=\ttfamily\color{Blue}, +keywordstyle=\color{BlueViolet}\bfseries, +commentstyle=\color{BrickRed}\itshape, +showstringspaces=false} +}{} + +\lstnewenvironment{shell} +{ +\lstset{fancyvrb=true, +basicstyle=\footnotesize\ttfamily, +basewidth=0.51em, +showstringspaces=false} +}{} + + +% Problem/Task +\newenvironment{problem} +{ +% todo: see later +} +{} + +% Solution +\newenvironment{solution} +{ +% todo: see later +} +{} + Added: cookbook/trunk/recipe0.tex == --- (empty file) +++ cookbook/trunk/recipe0.tex Sun Feb 26 00:34:20 2006 @@ -0,0 +1,105 @@ +\documentclass{book} +\pagestyle{headings} +\include{macros} + +\begin{document} + +\chapter{Dummy Recipe} + +\begin{problem} +This dummy recipe is a tutorial on how to write a recipe. +\end{problem} + +\begin{solution} + +\section*{Recipe structure} + +A recipe is made of a problem and a solution section. + +\begin{itemize} +\item The problem describe in less than 20 lines the problem to solve. + +\item The solution is made of sections and subsections, and provide the +solution. +\end{itemize} + +The solution can contain text and code. The code can be made with several +specific commands. + +\section*{Specific commands for the code blocs} + +You can define special sections to present Python, ZPT, XML, CSS, +and ZCML examples. They are all defined in macros.tex. They help +you write examples. + +\subsection*{Python} + +\begin{python} + import math + math.pow(2, 4) +16.0 +\end{python} + +\subsection*{Codetext} + +\begin{codetext} + import math + math.pow(2, 4) +16.0 +\end{codetext} + + +The only difference between Codetext and Python is that Python blocs are +executed for real. + +\subsection*{ZCML} +\begin{zcml} +page + for=IMyInterface + name=mypage.html + permission=the.permission + layer=the_layer + class=MyClass + template=my_template.pt / +\end{zcml} + +\subsection*{XML or HTML} +\begin{xml} +PERSONS + PERSON +NAMEJohn/NAME + /PERSON +/PERSONS +\end{xml} + +\subsection*{CSS} +\begin{css} +.style { + background: 1px; + color: red; +} +\end{css} + +\subsection*{Shell} +\begin{shell} +[EMAIL PROTECTED]:/home/svn.z3lab.org/cookbook\$ ls -lh +total 72K +-rw-r--r-- 1 tziade tziade 647 2006-02-25 23:30 cookbookmacros.aux +-rw-r--r-- 1 tziade tziade 2,9K 2006-02-25 23:30 cookbookmacros.tex +-rw-r--r-- 1 tziade tziade 158 2006-02-25 23:30 recipe1.aux +
[Z3lab-checkins] r2476 - cookbook/trunk
Author: tziade Date: Sun Feb 26 00:50:55 2006 New Revision: 2476 Modified: cookbook/trunk/macros.tex cookbook/trunk/recipe0.en.tex Log: added status Modified: cookbook/trunk/macros.tex == --- cookbook/trunk/macros.tex (original) +++ cookbook/trunk/macros.tex Sun Feb 26 00:50:55 2006 @@ -102,3 +102,5 @@ } {} +\newcommand{\status}[1]{ +} Modified: cookbook/trunk/recipe0.en.tex == --- cookbook/trunk/recipe0.en.tex (original) +++ cookbook/trunk/recipe0.en.tex Sun Feb 26 00:50:55 2006 @@ -1,6 +1,7 @@ \documentclass{book} \pagestyle{headings} \include{macros} +\status{draft} \begin{document} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2444 - cpsskins/branches/jmo-perspectives/browser
Author: jmorliaguet Date: Fri Feb 24 19:34:15 2006 New Revision: 2444 Modified: cpsskins/branches/jmo-perspectives/browser/configure.zcml Log: - ContentAdding is now Adding Modified: cpsskins/branches/jmo-perspectives/browser/configure.zcml == --- cpsskins/branches/jmo-perspectives/browser/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/browser/configure.zcml Fri Feb 24 19:34:15 2006 @@ -10,7 +10,7 @@ for=cpsskins.elements.interfaces.IElementContainer name=+ menu=zmi_actions title=Add - class=zope.app.container.browser.adding.ContentAdding + class=zope.app.container.browser.adding.Adding permission=zope.ManageContent layer=cpsskins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2445 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 24 19:38:27 2006 New Revision: 2445 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - simpler code Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 24 19:38:27 2006 @@ -50,7 +50,7 @@ getModelById: function(id) { var model = null; -$A(CPSSkins._models).each(function(m) { +CPSSkins._models.each(function(m) { var def = m.value.def; if (def.id == id) { model = m.value @@ -61,7 +61,7 @@ getControllerById: function(id) { var controller = null; -$A(CPSSkins._controllers).each(function(c) { +CPSSkins._controllers.each(function(c) { var def = c.value.def; if (def.id == id) { controller = c.value; @@ -86,13 +86,13 @@ /* Internal events */ subscribe: function(eventid, event) { if (!(eventid in CPSSkins._subscribers)) { - CPSSkins._subscribers[eventid] = $A([]); + CPSSkins._subscribers[eventid] = []; } CPSSkins._subscribers[eventid].push(event); }, unsubscribe: function(eventid, event) { -new_subscribers = $A([]); +new_subscribers = []; CPSSkins._subscribers[eventid].each(function(e) { if (!(event.subscriber == e.subscriber event.publisher == e.publisher)) { new_subscribers.push(e); @@ -102,9 +102,9 @@ }, notify: function(eventid, event) { -var subscribers = CPSSkins._subscribers[eventid]; +var subscribers = CPSSkins._subscribers[eventid] || []; var publisher = event.publisher; -$A(subscribers).each(function(e) { +subscribers.each(function(e) { var event_publisher = e.publisher; if (event_publisher == publisher || event_publisher == null) { var handler = CPSSkins.getEventHandler(eventid, e.subscriber); @@ -152,7 +152,7 @@ // first stage parse: function(node) { -var elements = node.getElementsByTagName(ins); +var elements = $A(node.getElementsByTagName(ins)); var progress = new Object({'initialized': 0}); var length = elements.length; @@ -164,7 +164,7 @@ } }); -$A(elements).each(function(el, index) { + elements.each(function(el, index) { var url = el.getAttribute(cite); if (url) { var options = { @@ -188,9 +188,9 @@ // second stage load: function(node) { -var elements = node.getElementsByTagName(ins); -$A([view, controller, model]).each(function(type) { - $A(elements).each(function(el, index) { +var elements = $A(node.getElementsByTagName(ins)); +[view, controller, model].each(function(type) { + elements.each(function(el, index) { if (Element.hasClassName(el, type)) { CPSSkins.register(el, type, index); } @@ -263,7 +263,7 @@ /* register the controllers */ var controllers_id = def.controllers || []; -$A(controllers_id).each(function(c) { +controllers_id.each(function(c) { var evt_id = registered controller + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.publisher; @@ -288,10 +288,10 @@ /* registers views per perspective */ var perspectives = def.perspectives || []; -$A(perspectives).each(function(p) { +perspectives.each(function(p) { if (!p) return; if (!(p in CPSSkins._perspectives)) { -CPSSkins._perspectives[p] = $A([]); +CPSSkins._perspectives[p] = []; } CPSSkins._perspectives[p].push(view); }); @@ -361,8 +361,8 @@ return to_show.indexOf(el) 0; }); -$A(to_hide).each(function(el) { el.hide(); }); -$A(to_show).each(function(el) { el.show(); }); +to_hide.each(function(el) { el.hide(); }); +to_show.each(function(el) { el.show(); }); CPSSkins._previousPerspective = CPSSkins._currentPerspective; CPSSkins._currentPerspective = perspective; @@ -542,13 +542,13 @@ this.moveEvent = this.moveEvent.bindAsEventListener(this); this.dropEvent = this.dropEvent.bindAsEventListener(this); -$A(this.def.draggable || []).each(function(d) { - $A($$(d)).each(function(el) { +(this.def.draggable || []).each(function(d) { + $$(d).each(function(el) { Event.observe(el, mousedown, dragEvent); }); }); var dropzones = this._dropzones = []; -$A(this.def.droppable || []).each(function(d) { +(this.def.droppable || []).each(function(d) { $$(d).each(function(el) { dropzones.push(el); }); }); }, @@ -580,7 +580,7 @@ var y = Event.pointerY(e); var inTarget = false; -
[Z3lab-checkins] r2446 - cookbook/trunk
Author: tziade Date: Fri Feb 24 21:47:50 2006 New Revision: 2446 Added: cookbook/trunk/recipe_list.txt (contents, props changed) Log: initial commit Added: cookbook/trunk/recipe_list.txt == --- (empty file) +++ cookbook/trunk/recipe_list.txt Fri Feb 24 21:47:50 2006 @@ -0,0 +1,64 @@ +Recipes list + + +Categories +== + +- Using Zope +- Developping Zope +- Administrating Zope +- Integrating Zope + +Levels +== + +TODO + + +Recipes +=== + +Using Zope +~~ + +- zope installation +- understanding runzope, zopectl, and other things +- understanding the interface + +Developping Zope + + +- the zope component architecture +- understanding the development process +- writing unit tests +- writing functional tests +- debugging the code +- understanding Interfaces +- understanding traversal +- mastering ZCML +- adding an extension package +- mastering ZPT +- creating and publishing an object +- creating resources +- creating a global utility +- creating a local utility +- understanding Adapters +- creating an Adapter +- understanding forms +- creating a object with forms +- understanding Events +- using events +- create internationalized interfaces +- create multilanguage content objects + +Administrating Zope +~~~ + +- setting up zope with apache +- setting up zope with squid + +Integrating Zope + + +- implementing and using xml-rpc views +- implementing a new publisher -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2447 - cookbook/trunk
Author: tziade Date: Fri Feb 24 22:43:51 2006 New Revision: 2447 Modified: cookbook/trunk/recipe_list.txt Log: tipo Modified: cookbook/trunk/recipe_list.txt == --- cookbook/trunk/recipe_list.txt (original) +++ cookbook/trunk/recipe_list.txt Fri Feb 24 22:43:51 2006 @@ -48,8 +48,8 @@ - creating a object with forms - understanding Events - using events -- create internationalized interfaces -- create multilanguage content objects +- creating internationalized interfaces +- creating multilanguage content objects Administrating Zope ~~~ -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2448 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 00:00:27 2006 New Revision: 2448 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - added basic effects (blinddown, blindup) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 00:00:27 2006 @@ -877,34 +877,55 @@ fadein: function(node, options) { var setOpacity = CPSSkins.Canvas.setOpacity; -if (node.style.display == none) { - node.style.display = ; - setOpacity(node, 0); -} +setOpacity(node, 0); +return new CPSSkins.Scheduler(node, { + delay: options.delay, + duration: options.duration, + action: function(value) { setOpacity(node, value) }, + onComplete: function() { Element.show(node) } +}); + }, + + fadeout: function(node, options) { +var setOpacity = CPSSkins.Canvas.setOpacity; +setOpacity(node, 1); +return new CPSSkins.Scheduler(node, { + delay: options.delay, + duration: options.duration, + action: function(value) { setOpacity(node, 1-value) }, + onComplete: function() { Element.hide(node) } +}); + }, + + blinddown: function(node, options) { +var height = parseInt(Element.getStyle(node, 'height')); +Element.makeClipping(node); return new CPSSkins.Scheduler(node, { delay: options.delay, + duration: options.duration, action: function(value) { -setOpacity(node, value); -}, +Element.setStyle(node, {height: height*value + 'px'}); + }, onComplete: function() { -Element.show(node); +Element.undoClipping(node); } }); }, - fadeout: function(node, options) { -var setOpacity = CPSSkins.Canvas.setOpacity; + blindup: function(node, options) { +var height = parseInt(Element.getStyle(node, 'height')); +Element.makeClipping(node); return new CPSSkins.Scheduler(node, { delay: options.delay, + duration: options.duration, action: function(value) { -setOpacity(node, 1-value); +Element.setStyle(node, {height: height*(1-value) + 'px'}); }, onComplete: function() { -Element.hide(node); +Element.setStyle(node, {height: '0px'}); } }); } - } // Model @@ -1350,6 +1371,9 @@ this.effect.stop(); } if (options.transition in CPSSkins.Effects) { + if (node.style.display == none) { +node.style.display = ; + } this.effect = CPSSkins.Effects[options.transition](node, options) } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2449 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional
Author: jmorliaguet Date: Sat Feb 25 00:01:06 2006 New Revision: 2449 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_effects_test.html (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/effect_template.pt (contents, props changed) Log: - tests for effects Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_effects_test.html == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_effects_test.html Sat Feb 25 00:01:06 2006 @@ -0,0 +1,128 @@ +!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN + http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; +html xml:lang=en lang=en + xmlns=http://www.w3.org/1999/xhtml; +head + titleCPSSkins Unit test file/title + meta http-equiv=content-type content=text/html; charset=utf-8 / + script src=../../prototype.js type=text/javascript/script + script src=../../json.js type=text/javascript/script + script src=../../ctal.js type=text/javascript/script + script src=../../cpsskins.js type=text/javascript/script + link rel=stylesheet href=../../cpsskins.css type=text/css / + + style stype=text/css + .frame { +background-color: #f9f3f3; +padding: 0.5em; +width: 130px; +border: 1px solid #999; +font: 1.3em arial, sans-serif; + } + table.demo th { +border: 1px solid #999; +background-color: #efc; +font: 1.3em arial, sans-serif; + } + table.demo td { +width: 150px; +padding: 0.5em; +border: 1px solid #999; + } + /style + +/head +body + + h1CPSSkins: effects/h1 + + ins class=model + {id: effect1} + /ins + + ins class=model + {id: effect2} + /ins + + ins class=model + {id: effect3} + /ins + + ins class=model + {id: effect4} + /ins + + table class=demo + tr + thfadein/th + thfadeout/th + thblinddown/th + thblindup/th + /tr + + tr + td valign=top + + ins class=view + {widget: { + template: effect_template.pt + }, + model: effect1, + render_effect: { + duration: 1000, + delay: 300, + transition: fadein + }} + /ins + + /td + td valign=top + + ins class=view + {widget: { + template: effect_template.pt + }, + model: effect2, + render_effect: { + duration: 1000, + delay: 1300, + transition: fadeout + }} + /ins + + /td + td valign=top + + ins class=view + {widget: { + template: effect_template.pt + }, + model: effect3, + render_effect: { + duration: 1000, + delay: 2300, + transition: blinddown + }} + /ins + + /td + td valign=top + + ins class=view + {widget: { + template: effect_template.pt + }, + model: effect4, + render_effect: { + duration: 1000, + delay: 3300, + transition: blindup + }} + /ins + /td + + /tr + /table + +/body +/html Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/effect_template.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/effect_template.pt Sat Feb 25 00:01:06 2006 @@ -0,0 +1,5 @@ +div class=frame + + Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce hendrerit nisi eget dui. Suspendisse elementum tellus sed lorem. Nam lacus tellus, condimentum eu, tempus in, dapibus sed, augue. Maecenas eget lorem. Vivamus faucibus malesuada magna. Sed sem. + +/div -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2450 - in cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional: latency quiz
Author: jmorliaguet Date: Sat Feb 25 00:02:25 2006 New Revision: 2450 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt Log: - test fixes Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Sat Feb 25 00:02:25 2006 @@ -58,7 +58,7 @@ CPSSkins.registerWidgets({ counter: function(def) { -var widget = Canvas.createNode({ +var widget = CPSSkins.Canvas.createNode({ tag: div, classes: counter }); @@ -71,7 +71,7 @@ render: function(data) { var size = data.position * 10; -var div = Canvas.createNode( +var div = CPSSkins.Canvas.createNode( {tag: div, classes: bar, style: {width: size + px, backgroundColor: rgb( + size + ,0,150)}, Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt Sat Feb 25 00:02:25 2006 @@ -72,7 +72,7 @@ CPSSkins.registerWidgets({ typewriter: function(def) { -var widget = Canvas.createNode({ +var widget = CPSSkins.Canvas.createNode({ tag: div, classes: typewriter }); @@ -86,7 +86,7 @@ render: function(data) { -var span = Canvas.createNode( +var span = CPSSkins.Canvas.createNode( {tag: span, classes:car, text: String.fromCharCode(data.position)} ); this.widget.appendChild(span); Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt Sat Feb 25 00:02:25 2006 @@ -56,7 +56,7 @@ CPSSkins.registerWidgets({ inputbox: function(def) { -var widget = Canvas.createNode({ +var widget = CPSSkins.Canvas.createNode({ tag: form, classes: inputbox, attributes: {method: post, onsubmit: return false} @@ -75,7 +75,7 @@ widget.innerHTML = ''; if (data.message) { - var message = Canvas.createNode({ + var message = CPSSkins.Canvas.createNode({ tag: div, classes: message, text: data.message @@ -83,7 +83,7 @@ widget.appendChild(message); } -var status = Canvas.createNode({ +var status = CPSSkins.Canvas.createNode({ tag: input, attributes: { name: message, @@ -93,7 +93,7 @@ }); widget.appendChild(status); -var input = Canvas.createNode({ +var input = CPSSkins.Canvas.createNode({ tag: input, attributes: { name: content, @@ -102,7 +102,7 @@ }); widget.appendChild(input); -var content = Canvas.createNode({ +var content = CPSSkins.Canvas.createNode({ tag: div, classes: content, text: data.content -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2451 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 25 00:09:15 2006 New Revision: 2451 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - fixed the final clipping in the blind down effect Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 25 00:09:15 2006 @@ -907,6 +907,7 @@ Element.setStyle(node, {height: height*value + 'px'}); }, onComplete: function() { +Element.setStyle(node, {height: height + 'px'}); Element.undoClipping(node); } }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2443 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 24 00:16:11 2006 New Revision: 2443 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - using x.key x.value instead of x[0] x[1] Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 24 00:16:11 2006 @@ -51,9 +51,9 @@ getModelById: function(id) { var model = null; $A(CPSSkins._models).each(function(m) { - var def = m[1].def; + var def = m.value.def; if (def.id == id) { -model = m[1] +model = m.value }; }); return model; @@ -62,9 +62,9 @@ getControllerById: function(id) { var controller = null; $A(CPSSkins._controllers).each(function(c) { - var def = c[1].def; + var def = c.value.def; if (def.id == id) { -controller = c[1] +controller = c.value; }; }); return controller; @@ -176,7 +176,7 @@ var parts = url.split('?'); if (parts.length == 2) { var url = parts[0]; - options.parameters = parts[1]; + options.parameters = parts.value; } new Ajax.Request(url, options); } else { @@ -344,11 +344,11 @@ perspective = CPSSkins._resolvePerspective(perspective); CPSSkins._perspectives.each(function(s) { - var elements = s[1]; + var elements = s.value; var path = perspective.split(/); path.each(function(p, index) { var subpath = path.slice(0,index+1).join(/); -if (s[0] == subpath) { +if (s.key == subpath) { elements.each(function(el) { to_show.push(el) } ); } else { elements.each(function(el) { to_hide.push(el) } ); @@ -457,11 +457,11 @@ CPSSkins.registerEventHandler(displayed, controller, function(event) { $H(rules).each(function(r) { -var selector = $$(r[0]); +var selector = $$(r.key); if (selector) { - $H(r[1]).each(function(s) { -var event_name = s[0]; -var handler_name = s[1]; + $H(r.value).each(function(s) { +var event_name = s.key; +var handler_name = s.value; var handler = CPSSkins._handlers[handler_name]; selector.each(function(el) { Event.observe(el, event_name, handler.bindAsEventListener(controller)); @@ -711,7 +711,7 @@ Element.addClassName(node, options.classes); Element.setStyle(node, options.style); $H(options.attributes).each(function(attr) { - node.setAttribute(attr[0], attr[1]) + node.setAttribute(attr.key, attr.value) }); if (options.text) { node.appendChild(document.createTextNode(options.text)); @@ -958,8 +958,8 @@ var initial_data = this.def.data; var schema = $H({}); $H(initial_data).each(function(f) { - var field = f[0]; - var value = f[1]; + var field = f.key; + var value = f.value; schema[field] = typeof value; }); return schema; @@ -1076,9 +1076,9 @@ var schema = this.model.schema; var filtered_data = new Object(); schema.each(function(f) { - var field = f[0]; + var field = f.key; var value = data[field]; - if (value != null typeof value == f[1]) { + if (value != null typeof value == f.value) { filtered_data[field] = value; } }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2439 - in cookbook: . branches tags trunk
Author: tziade Date: Wed Feb 22 23:25:32 2006 New Revision: 2439 Added: cookbook/ cookbook/branches/ cookbook/tags/ cookbook/trunk/ Log: cookbook module -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2440 - cookbook/trunk/test
Author: srichter Date: Wed Feb 22 23:34:12 2006 New Revision: 2440 Added: cookbook/trunk/test/ Log: foo. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2442 - cookbook/trunk/test
Author: srichter Date: Wed Feb 22 23:58:50 2006 New Revision: 2442 Added: cookbook/trunk/test/ Log: New password check. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2436 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 20 22:49:03 2006 New Revision: 2436 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - drag and drop: save the pointer's offset relative to the widget. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 20 22:49:03 2006 @@ -543,6 +543,9 @@ dragEvent: function(e) { var widget = this.view.widget; +var pos = Position.page(widget); +this.x0 = Event.pointerX(e) - pos[0]; +this.y0 = Event.pointerY(e) - pos[1]; Event.observe(document, mousemove, this.moveEvent); Event.observe(document, mouseup, this.dropEvent); }, @@ -551,7 +554,7 @@ var widget = this.view.widget; var mouseX = Event.pointerX(e); var mouseY = Event.pointerY(e); -CPSSkins.Canvas.moveTo(widget, parseInt(mouseX)-20, parseInt(mouseY-20)); +CPSSkins.Canvas.moveTo(widget, mouseX-this.x0, mouseY-this.y0); }, dropEvent: function(e) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2437 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Mon Feb 20 23:25:32 2006 New Revision: 2437 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/draggable.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html Log: - there are two ways to register draggable elements: - through css selectors (draggable: [div.drag, ...]) - explicitly by associating a drag-and-drop controller to a view Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 20 23:25:32 2006 @@ -212,6 +212,7 @@ var factory = CPSSkins.Controllers[controller_type]; if (factory) { var controller = factory(el, def); +controller.setup(); CPSSkins._controllers[name] = controller; CPSSkins.notify(registered controller + def.id, {'publisher': controller}); @@ -381,6 +382,10 @@ this.def = def; }, + setup: function() { +/* to override */ + }, + register: function(view) { /* to override */ } @@ -532,18 +537,28 @@ CPSSkins.DragAndDropController.prototype = Object.extend( new CPSSkins.Controller(), { - register: function(view) { -var widget = view.widget; - + setup: function() { this.dragEvent = this.dragEvent.bindAsEventListener(this); this.moveEvent = this.moveEvent.bindAsEventListener(this); this.dropEvent = this.dropEvent.bindAsEventListener(this); + +var dragEvent = this.dragEvent; +$A(this.def.draggable || []).each(function(d) { + $A($$(d)).each(function(el) { +Event.observe(el, mousedown, dragEvent); + }); + +}); + }, + + register: function(view) { +var widget = view.widget; Event.observe(widget, mousedown, this.dragEvent); }, dragEvent: function(e) { -var widget = this.view.widget; -var pos = Position.page(widget); +this.moved = Event.element(e); +var pos = Position.page(this.moved); this.x0 = Event.pointerX(e) - pos[0]; this.y0 = Event.pointerY(e) - pos[1]; Event.observe(document, mousemove, this.moveEvent); @@ -551,14 +566,12 @@ }, moveEvent: function(e) { -var widget = this.view.widget; var mouseX = Event.pointerX(e); var mouseY = Event.pointerY(e); -CPSSkins.Canvas.moveTo(widget, mouseX-this.x0, mouseY-this.y0); +CPSSkins.Canvas.moveTo(this.moved, mouseX-this.x0, mouseY-this.y0); }, dropEvent: function(e) { -var widget = this.view.widget; Event.stopObserving(document, mousemove, this.moveEvent); Event.stopObserving(document, mouseup, this.dropEvent); } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html Mon Feb 20 23:25:32 2006 @@ -12,6 +12,12 @@ link rel=stylesheet href=../../cpsskins.css type=text/css / style stype=text/css + div.drag { +background-color: #ddc; +border: 1px solid #999; +padding: 1em; +width: 200px; + } /style /head @@ -19,9 +25,16 @@ h1CPSSkins: drag-and-drop/h1 + div class=dragDRAG ME/div + + div class=dragDRAG ME/div + + div id=dragthisDRAG ME/div + ins class=controller {id: dnd, type: drag-and-drop, + draggable: [div.drag, #dragthis], action: displayInfo } /ins Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/draggable.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/draggable.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/draggable.html Mon Feb 20 23:25:32 2006 @@ -1,5 +1,5 @@ -div style=border: 1px solid #ccc; padding: 1em; position: absolute; +div style=border: 1px solid #999; padding: 1em; position: absolute; background-color: #ffc; width: 300px DRAG ME /div Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html Mon Feb 20 23:25:32 2006 @@ -40,4 +40,8 @@ a target=main
[Z3lab-checkins] r2438 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Tue Feb 21 00:09:05 2006 New Revision: 2438 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html Log: - implemented drop zones. TODO handle the drop action. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Tue Feb 21 00:09:05 2006 @@ -538,22 +538,23 @@ new CPSSkins.Controller(), { setup: function() { -this.dragEvent = this.dragEvent.bindAsEventListener(this); +var dragEvent = this.dragEvent = this.dragEvent.bindAsEventListener(this); this.moveEvent = this.moveEvent.bindAsEventListener(this); this.dropEvent = this.dropEvent.bindAsEventListener(this); -var dragEvent = this.dragEvent; $A(this.def.draggable || []).each(function(d) { $A($$(d)).each(function(el) { -Event.observe(el, mousedown, dragEvent); - }); +Event.observe(el, mousedown, dragEvent); }); +}); +var dropzones = this._dropzones = []; +$A(this.def.droppable || []).each(function(d) { + $$(d).each(function(el) { dropzones.push(el); }); }); }, register: function(view) { -var widget = view.widget; -Event.observe(widget, mousedown, this.dragEvent); +Event.observe(view.widget, mousedown, this.dragEvent); }, dragEvent: function(e) { @@ -574,6 +575,18 @@ dropEvent: function(e) { Event.stopObserving(document, mousemove, this.moveEvent); Event.stopObserving(document, mouseup, this.dropEvent); + +var x = Event.pointerX(e); +var y = Event.pointerY(e); + +var inTarget = false; +$A(this._dropzones).each(function(d) { + if (Position.within(d, x, y)) { inTarget = true; } +}); + +if (inTarget) { + /* TODO: handle action */ +} } }); Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html Tue Feb 21 00:09:05 2006 @@ -13,11 +13,17 @@ style stype=text/css div.drag { -background-color: #ddc; +background-color: #efc; border: 1px solid #999; padding: 1em; width: 200px; } + div.drop { +background-color: #ffe; +border: 1px solid #999; +padding: 2em; +width: 200px; + } /style /head @@ -31,11 +37,14 @@ div id=dragthisDRAG ME/div + div class=dropDROP ZONE/div + ins class=controller {id: dnd, type: drag-and-drop, + action: displayInfo, draggable: [div.drag, #dragthis], - action: displayInfo + droppable: [div.drop] } /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2431 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sun Feb 19 13:23:17 2006 New Revision: 2431 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - renamed private variables using the js styleguide Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sun Feb 19 13:23:17 2006 @@ -36,18 +36,13 @@ var CPSSkins = { Version: 0.7, - Subscribers: $H({}), - - Models: $H({}), - - Controllers: $H({}), - - Handlers: $H({}), - - Perspectives: $H({}), - - CurrentPerspective: , - PreviousPerspective: , + _subscribers: $H({}), + _models: $H({}), + _controllers: $H({}), + _handlers: $H({}), + _perspectives: $H({}), + _currentPerspective: , + _previousPerspective: , init: function() { CPSSkins.parse(document); @@ -55,7 +50,7 @@ getModelById: function(id) { var model = null; -$A(CPSSkins.Models).each(function(m) { +$A(CPSSkins._models).each(function(m) { var def = m[1].def; if (def.id == id) { model = m[1] @@ -66,7 +61,7 @@ getControllerById: function(id) { var controller = null; -$A(CPSSkins.Controllers).each(function(c) { +$A(CPSSkins._controllers).each(function(c) { var def = c[1].def; if (def.id == id) { controller = c[1] @@ -85,29 +80,29 @@ /* Public events */ registerHandlers: function(handlers) { -Object.extend(CPSSkins.Handlers, handlers); +Object.extend(CPSSkins._handlers, handlers); }, /* Internal events */ subscribe: function(eventid, event) { -if (!(eventid in CPSSkins.Subscribers)) { - CPSSkins.Subscribers[eventid] = $A([]); +if (!(eventid in CPSSkins._subscribers)) { + CPSSkins._subscribers[eventid] = $A([]); } -CPSSkins.Subscribers[eventid].push(event); +CPSSkins._subscribers[eventid].push(event); }, unsubscribe: function(eventid, event) { new_subscribers = $A([]); -CPSSkins.Subscribers[eventid].each(function(e) { +CPSSkins._subscribers[eventid].each(function(e) { if (!(event.subscriber == e.subscriber event.publisher == e.publisher)) { new_subscribers.push(e); } }); -CPSSkins.Subscribers[eventid] = new_subscribers; +CPSSkins._subscribers[eventid] = new_subscribers; }, notify: function(eventid, event) { -var subscribers = CPSSkins.Subscribers[eventid]; +var subscribers = CPSSkins._subscribers[eventid]; var publisher = event.publisher; $A(subscribers).each(function(e) { var event_publisher = e.publisher; @@ -217,7 +212,7 @@ var factory = Controllers[controller_type]; if (factory) { var controller = factory(el, def); -CPSSkins.Controllers[name] = controller; +CPSSkins._controllers[name] = controller; CPSSkins.notify(registered controller + def.id, {'publisher': controller}); } @@ -226,7 +221,7 @@ case model: { var model = new CPSSkins.Model(el, def); - CPSSkins.Models[name] = model; + CPSSkins._models[name] = model; CPSSkins.notify(registered model + def.id, {'publisher': model}); break; } @@ -294,10 +289,10 @@ var perspectives = def.perspectives || []; $A(perspectives).each(function(p) { if (!p) return; - if (!(p in CPSSkins.Perspectives)) { -CPSSkins.Perspectives[p] = $A([]); + if (!(p in CPSSkins._perspectives)) { +CPSSkins._perspectives[p] = $A([]); } - CPSSkins.Perspectives[p].push(view); + CPSSkins._perspectives[p].push(view); }); //CPSSkins.notify(registered view + def.id, view); } @@ -308,7 +303,7 @@ }, _resolvePerspective: function(perspective) { -var path = CPSSkins.CurrentPerspective.split(/); +var path = CPSSkins._currentPerspective.split(/); var base = perspective; var ext = ; @@ -319,7 +314,7 @@ } if (perspective.substr(0,2) == ./) { - base = CPSSkins.CurrentPerspective; + base = CPSSkins._currentPerspective; if (base) { base += /; } @@ -336,7 +331,7 @@ } if (perspective == '-') { - base = CPSSkins.PreviousPerspective; + base = CPSSkins._previousPerspective; } return base + ext; @@ -347,7 +342,7 @@ var to_hide = []; perspective = CPSSkins._resolvePerspective(perspective); -CPSSkins.Perspectives.each(function(s) { +CPSSkins._perspectives.each(function(s) { var elements = s[1]; var path = perspective.split(/); path.each(function(p, index) { @@ -368,8 +363,8 @@ $A(to_hide).each(function(el) {
[Z3lab-checkins] r2432 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional tests/unit tests/zope3/functional/latency tests/zope3/functional/quiz
Author: jmorliaguet Date: Sun Feb 19 14:01:07 2006 New Revision: 2432 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_template_test.html - copied unchanged from r2430, cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Removed: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/tests.html cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt Log: - cleaned up the global namespace, all classes / objects are now located under CPSSkins.___ Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sun Feb 19 14:01:07 2006 @@ -209,7 +209,7 @@ case controller: { var controller_type = def.type || command; - var factory = Controllers[controller_type]; + var factory = CPSSkins.Controllers[controller_type]; if (factory) { var controller = factory(el, def); CPSSkins._controllers[name] = controller; @@ -238,12 +238,12 @@ widget_type = def.widget.type; if (!widget_type) { CPSSkins.warn(Must specify a widget type or a template, el); -} else if (!(widget_type in Widgets)) { +} else if (!(widget_type in CPSSkins.Widgets)) { CPSSkins.warn(Unknown widget type: + widget_type, el); } } - factory = Widgets[widget_type]; + factory = CPSSkins.Widgets[widget_type]; view = factory(def); /* create the view */ @@ -387,8 +387,8 @@ } -if (!window.Controllers) { var Controllers = new Object(); } -Object.extend(Controllers, { +if (!CPSSkins.Controllers) { CPSSkins.Controllers = new Object(); } +Object.extend(CPSSkins.Controllers, { 'command': function(node, def) { return new CPSSkins.CommandController(node, def); @@ -507,7 +507,7 @@ var view = event.publisher; var selected = event.context; if (!view.def.model) { -var model = Canvas.getModel(selected); +var model = CPSSkins.Canvas.getModel(selected); if (model) { view.observe(model); } @@ -526,8 +526,8 @@ }); // Identifiable DOM elements. -if (!window.Identifiable) var Identifiable = new Object(); -Object.extend(Identifiable, { +if (!CPSSkins.Identifiable) { CPSSkins.Identifiable = new Object() } +Object.extend(CPSSkins.Identifiable, { isIdentifiable: function(node) { node = $(node); @@ -607,13 +607,14 @@ }); -if (!window.Canvas) { - var Canvas = new Object(); - Canvas.Styles = $({}); - Canvas.Script = $({}); +if (!CPSSkins.Canvas) { + CPSSkins.Canvas = { +_styles: {}, +_scripts: {} + } } -Object.extend(Canvas, { +Object.extend(CPSSkins.Canvas, { getModel: function(node) { if (!node) return null; @@ -688,7 +689,7 @@ }, addStyleSheet: function(id, src) { -if (id in Canvas.Styles) { +if (id in this._styles) { return; } var head = document.getElementsByTagName(head)[0]; @@ -698,12 +699,12 @@ link.href = src; link.type = text/css; head.appendChild(link); -Canvas.Styles[id] = src; +this._styles[id] = src; }, removeStyleSheet: function(id) { -if (id in Canvas.Styles) { - delete Canvas.Styles[id]; +if (id in this._styles) { + delete this._styles[id]; } var style = document.getElementById(cpsskins-style- + id); if (style) { @@ -712,7 +713,7 @@ }, addScript: function(id, src) { -if (id in Canvas.Scripts) { +if (id in this._scripts) { return; } var head = document.getElementsByTagName(head)[0]; @@ -721,12 +722,12 @@ script.href = src; script.type = text/javascript; head.appendChild(script); -Canvas.Scripts[id] = src; +this._scripts[id] = src; }, removeScript: function(id) { -if (id in Canvas.Scripts) { - delete Canvas.Scripts[src]; +if (id in this._scripts) { + delete this._scripts[src]; } var script = document.getElementById(cpsskins-script- + id); if (script) { @@ -903,7 +904,7 @@ this.def.storage = storage_def;
[Z3lab-checkins] r2434 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 20 01:33:38 2006 New Revision: 2434 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - added a basic drag-and-drop controller Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 20 01:33:38 2006 @@ -404,6 +404,10 @@ 'focus observer': function(node, def) { return new CPSSkins.FocusObserver(node, def); + }, + + 'drag-and-drop': function(node, def) { +return new CPSSkins.DragAndDropController(node, def); } }); @@ -490,7 +494,6 @@ }); model.setData(form_data); - return false; } @@ -525,6 +528,40 @@ }); +CPSSkins.DragAndDropController = Class.create(); +CPSSkins.DragAndDropController.prototype = Object.extend( + new CPSSkins.Controller(), { + + register: function(view) { +var widget = view.widget; + +this.dragEvent = this.dragEvent.bindAsEventListener(this); +this.moveEvent = this.moveEvent.bindAsEventListener(this); +this.dropEvent = this.dropEvent.bindAsEventListener(this); +Event.observe(widget, mousedown, this.dragEvent); + }, + + dragEvent: function(e) { +var widget = this.view.widget; +Event.observe(document, mousemove, this.moveEvent); +Event.observe(document, mouseup, this.dropEvent); + }, + + moveEvent: function(e) { +var widget = this.view.widget; +var mouseX = Event.pointerX(e); +var mouseY = Event.pointerY(e); +CPSSkins.Canvas.moveTo(widget, parseInt(mouseX)-20, parseInt(mouseY-20)); + }, + + dropEvent: function(e) { +var widget = this.view.widget; +Event.stopObserving(document, mousemove, this.moveEvent); +Event.stopObserving(document, mouseup, this.dropEvent); + } + +}); + // Identifiable DOM elements. if (!CPSSkins.Identifiable) { CPSSkins.Identifiable = new Object() } Object.extend(CPSSkins.Identifiable, { @@ -1697,8 +1734,8 @@ // Contextual actions CPSSkins.ContextualActions = Class.create(); -Object.extend(CPSSkins.ContextualActions.prototype, new CPSSkins.View()); -Object.extend(CPSSkins.ContextualActions.prototype, CPSSkins.ContextualMenu.prototype); +Object.extend(CPSSkins.ContextualActions.prototype, + CPSSkins.ContextualMenu.prototype); Object.extend(CPSSkins.ContextualActions.prototype, { prepare: function() { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2411 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sat Feb 18 11:15:30 2006 New Revision: 2411 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - removed all back-references. With the event model they are no longer needed and they can lead to circular references and memory leaks. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 18 11:15:30 2006 @@ -273,9 +273,6 @@ var controller = event.publisher; controller.view = view; controller.register(view); -// add a back-reference -view.controller = controller; - }); CPSSkins.subscribe(evt_id, {'subscriber': view}); }); @@ -885,8 +882,6 @@ event.subscriber.display(data); }); CPSSkins.subscribe('modified', {'subscriber': view, 'publisher': model}); -// create a back-reference -view.model = model; }, removeObserver: function(view) { @@ -1197,9 +1192,6 @@ this.hide_effect = def.hide_effect || {}; this.setup(); - -// create a back-reference -this.widget.view = this; }, /* Public API */ -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2412 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 12:24:30 2006 New Revision: 2412 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - open / close nodes Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 12:24:30 2006 @@ -30,13 +30,19 @@ function openContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - debug(nodeid); + var model = CPSSkins.getModelById(tree-state); + var state_data = model.getData(); + state_data['state'][nodeid] = open; + model.setData(state_data); } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - debug(nodeid); + var model = CPSSkins.getModelById(tree-state); + var state_data = model.getData(); + delete state_data['state'][nodeid]; + model.setData(state_data); } CPSSkins.registerHandlers( -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2414 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional tests/functional/treeview tests/unit tests/zope3/functional/chat tests/zope3/functional/quiz tests/zope3
Author: jmorliaguet Date: Sat Feb 18 14:50:35 2006 New Revision: 2414 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/treeview/ Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/unit/cpsskins_storage_adapters.pt Log: - renamed 'compound storage' as 'unified storage' and 'partitions' as 'units' Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 18 14:50:35 2006 @@ -1044,8 +1044,8 @@ return new CPSSkins.RemoteStorage(model); }, - compound: function(model) { -return new CPSSkins.CompoundStorage(model); + unified: function(model) { +return new CPSSkins.UnifiedStorage(model); } }); @@ -1138,8 +1138,8 @@ }); -CPSSkins.CompoundStorage = Class.create(); -CPSSkins.CompoundStorage.prototype = Object.extend( +CPSSkins.UnifiedStorage = Class.create(); +CPSSkins.UnifiedStorage.prototype = Object.extend( new CPSSkins.StorageAdapter(), { setup: function() { @@ -1153,7 +1153,7 @@ CPSSkins.notify('stored', {'publisher': storage}); }); -$A(this.model.def.storage.partitions).each(function(p) { +$A(this.model.def.storage.units).each(function(p) { var model = CPSSkins.getModelById(p); models.push(model); CPSSkins.subscribe('stored', Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html Sat Feb 18 14:50:35 2006 @@ -110,9 +110,9 @@ !-- Controller -- script type=text/javascript -function displayChoice(info) { - var context = info.context; - var options = info.options; +function displayChoice(event) { + var context = event.context; + var options = event.options; $(message).innerHTML += context.getAttribute('id') + ' =gt; ' + options.choice + '\n'; Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html Sat Feb 18 14:50:35 2006 @@ -170,9 +170,9 @@ !-- Controller -- script type=text/javascript -function displayChoice(info) { - var context = info.context; - var options = info.options; +function displayChoice(event) { + var context = event.context; + var options = event.options; $(message).innerHTML += context.getAttribute('id') + ' =gt; ' + options.choice + '\n'; } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Sat Feb 18 14:50:35 2006 @@ -188,7 +188,7 @@ } /ins - !-- compound storages -- + !-- unified storages -- ins class=model {id: m1, data: {a: 1}, @@ -209,8 +209,8 @@ {id: c1, data: {a: 0, b: 0}, storage: { - type: compound, - partitions: [m1, m2] + type: unified, + units: [m1, m2] }} /ins @@ -422,14 +422,14 @@ $H({a: 2, c:true}).inspect()); }}, -testCompoundStoragesGetData: function() { with(this) { +testUnifiedStoragesGetData: function() { with(this) { var model_c1 = CPSSkins.getModelById('c1'); assertEqual($H(model_c1.getData()).inspect(), $H({a: 1,b: 2}).inspect()); }}, -testCompoundStoragesSetData: function() { with(this) { +
[Z3lab-checkins] r2415 - cpsskins/branches/jmo-perspectives
Author: jmorliaguet Date: Sat Feb 18 15:46:34 2006 New Revision: 2415 Modified: cpsskins/branches/jmo-perspectives/minjson.py Log: - upgraded to the latest version of minjson.py Modified: cpsskins/branches/jmo-perspectives/minjson.py == --- cpsskins/branches/jmo-perspectives/minjson.py (original) +++ cpsskins/branches/jmo-perspectives/minjson.py Sat Feb 18 15:46:34 2006 @@ -16,11 +16,24 @@ # reads minimal javascript objects. # str's objects and fixes the text to write javascript. +#UNICODE USAGE: Minjson tries hard to accommodate naive usage in a +#Do what I mean manner. Real applications should handle unicode separately. +# The right way to use minjson in an application is to provide minjson a +# python unicode string for reading and accept a unicode output from minjson's +# writing. That way, the assumptions for unicode are yours and not minjson's. + +# That said, the minjson code has some (optional) unicode handling that you +# may look at as a model for the unicode handling your application may need. + # Thanks to Patrick Logan for starting the json-py project and making so many # good test cases. -# Jim Washington 10 Oct 2005. +# Additional thanks to Balazs Ree for replacing the writing module. +# Jim Washington 30 Dec 2005. + +# 2005-12-30 writing now traverses the object tree instead of relying on +#str() or unicode() # 2005-10-10 on reading, looks for \\u and replaces with u'\u' # 2005-10-09 now tries hard to make all strings unicode when reading. # 2005-10-07 got rid of eval() completely, makes object as found by the @@ -37,17 +50,15 @@ from token import ENDMARKER, NAME, NUMBER, STRING, OP, ERRORTOKEN from tokenize import tokenize, TokenError, NL -# set to true if transmission size is much more important than speed -# only affects writing, and makes a minimal difference in output size. -alwaysStripWhiteSpace = False - -# set this to True if you want chars above 128 always expressed as /uxxx -# this is expensive. -doU = False - #Usually, utf-8 will work, set this to utf-16 if you dare. emergencyEncoding = 'utf-8' +class ReadException(Exception): +pass + +class WriteException(Exception): +pass + # # read JSON object # # @@ -76,6 +87,7 @@ class CommaToken: __slots__=[] pass + class JSONReader(object): raise SyntaxError if it is not JSON, and make the object available def __init__(self,data): @@ -85,7 +97,7 @@ self.lastOp = None self.objects = [] self.tokenize() - + def tokenize(self): try: tokenize(self._data.next,self.readTokens) @@ -143,7 +155,7 @@ if not isinstance(key,basestring): raise SyntaxError except IndexError: - + raise SyntaxError #salt the while comma = value @@ -241,8 +253,8 @@ def safeRead(aString, encoding=None): read the js, first sanitizing a bit and removing any c-style comments -If the input is a unicode string, that's OK. If the input is a byte string, -strings in the object will be produced as unicode anyway. +If the input is a unicode string, great. That's preferred. If the input +is a byte string, strings in the object will be produced as unicode anyway. # get rid of trailing null. Konqueror appends this. CHR0 = chr(0) @@ -264,7 +276,7 @@ s = aString else: if encoding: -# note: no try here. the encoding provided must work for the +# note: no try here. the encoding provided must work for the # incoming byte string. UnicodeDecode error will be raised # in that case. Often, it will be best not to provide the encoding # and allow the default @@ -294,213 +306,131 @@ # write object as JSON# # -#alwaysStripWhiteSpace is defined at the top of the module +import re, codecs +from cStringIO import StringIO -tfnTuple = (('True','true'),('False','false'),('None','null'),) +### Codec error handler -def _replaceTrueFalseNone(aString): -replace True, False, and None with javascript counterparts -for k in tfnTuple: -if k[0] in aString: -aString = aString.replace(k[0],k[1]) -return aString - -def _handleCode(subStr,stripWhiteSpace): -replace True, False, and None with javascript counterparts if - appropriate, remove unicode u's, fix long L's, make tuples - lists, and strip white space if requested - -if 'e' in subStr: -#True, False, and None have 'e' in them. :) -subStr = (_replaceTrueFalseNone(subStr)) -if stripWhiteSpace: -# re.sub might do a better job, but takes longer. -# Spaces are the majority of the whitespace,
[Z3lab-checkins] r2416 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 16:26:42 2006 New Revision: 2416 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - we only store the tree state in a cookie (not the entire tree data) now both the server and the client have access to the tree state information: the server will use the information to filter out unwanted nodes in getTreeData() Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 16:26:42 2006 @@ -1,4 +1,6 @@ +from urllib import unquote + from zope.app.publisher.browser import BrowserView from cpsskins import minjson as json @@ -18,9 +20,19 @@ class Views(BrowserView): def setTreeData(self, data): -print data +data = json.read(data) return json.write(data) def getTreeData(self): + +print self._getLocalStorageData(1) + + return json.write(data) +# TODO: moves this to an API +def _getLocalStorageData(self, id): +value = self.request.cookies.get('cpsskins_local_storage_%s' % id) +if value is not None: +return json.read(unquote(value)) +return None Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 16:26:42 2006 @@ -30,19 +30,17 @@ function openContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var model = CPSSkins.getModelById(tree); - var state_data = model.getData(); + var state_data = CPSSkins.getModelById(tree-state).getData(); state_data['state'][nodeid] = open; - model.setData(state_data); + CPSSkins.getModelById(tree).setData(state_data); } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var model = CPSSkins.getModelById(tree); - var state_data = model.getData(); + var state_data = CPSSkins.getModelById(tree-state).getData(); delete state_data['state'][nodeid]; - model.setData(state_data); + CPSSkins.getModelById(tree).setData(state_data); } CPSSkins.registerHandlers( -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2418 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 17:05:19 2006 New Revision: 2418 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - simplifications Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 17:05:19 2006 @@ -19,15 +19,13 @@ class Views(BrowserView): -def setTreeData(self, data): -data = json.read(data) -return json.write(data) - def getTreeData(self): +local_data = self._getLocalStorageData(1) +if local_data is None: +local_data = {} +tree_state = local_data.get('states', {}) -print self._getLocalStorageData(1) - - +print local_data return json.write(data) # TODO: moves this to an API Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml Sat Feb 18 17:05:19 2006 @@ -48,11 +48,6 @@ attribute=getTreeData / -browser:page -name=setTreeData -attribute=setTreeData -/ - /browser:pages /configure Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 17:05:19 2006 @@ -30,17 +30,21 @@ function openContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var state_data = CPSSkins.getModelById(tree-state).getData(); - state_data['state'][nodeid] = open; - CPSSkins.getModelById(tree).setData(state_data); + + var model = CPSSkins.getModelById(tree); + var data = model.getData(); + data['state'][nodeid] = open; + model.setData(data); } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var state_data = CPSSkins.getModelById(tree-state).getData(); - delete state_data['state'][nodeid]; - CPSSkins.getModelById(tree).setData(state_data); + + var model = CPSSkins.getModelById(tree); + var data = model.getData(); + delete data['state'][nodeid]; + model.setData(data); } CPSSkins.registerHandlers( -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2419 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 17:25:25 2006 New Revision: 2419 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - setTreeData() is not used anymore (the server already has access to the cookie information) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 17:25:25 2006 @@ -93,8 +93,7 @@ storage: { type: remote, accessors: { - get: @@getTreeData, - set: @@setTreeData + get: @@getTreeData } }} /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2420 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:00:29 2006 New Revision: 2420 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Log: - filter out closed nodes Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 18:00:29 2006 @@ -5,28 +5,47 @@ from cpsskins import minjson as json -data = { +tree_data = { 'items': [ -{'id': 1, 'title': 'item 1', 'depth': 1, 'type': 'container'}, -{'id': 2, 'title': 'item 2', 'depth': 1, 'type': 'container'}, -{'id': 3, 'title': 'item 3', 'depth': 2}, -{'id': 4, 'title': 'item 4', 'depth': 2}, -{'id': 5, 'title': 'item 5', 'depth': 2, 'position': 'last'}, -{'id': 6, 'title': 'item 6', 'depth': 1, 'type': 'container'}, -{'id': 7, 'title': 'item 7', 'depth': 1, 'type': 'container'}, +{'id': '1', 'title': 'item 1', 'depth': 1, 'type': 'container'}, +{'id': '2', 'title': 'item 2', 'depth': 1, 'type': 'container'}, +{'id': '3', 'title': 'item 3', 'depth': 2, 'type': 'item'}, +{'id': '4', 'title': 'item 4', 'depth': 2, 'type': 'item'}, +{'id': '5', 'title': 'item 5', 'depth': 2, 'type': 'item', + 'position': 'last'}, +{'id': '6', 'title': 'item 6', 'depth': 1, 'type': 'container'}, +{'id': '7', 'title': 'item 7', 'depth': 1, 'type': 'container'}, +{'id': '8', 'title': 'item 7', 'depth': 2, 'type': 'item'}, ] } +MAX_DEPTH = 10 + class Views(BrowserView): def getTreeData(self): local_data = self._getLocalStorageData(1) if local_data is None: local_data = {} -tree_state = local_data.get('states', {}) +tree_state = local_data.get('state', {}) + +filtered_items = [] +filter_depth = MAX_DEPTH +for item in tree_data['items']: + +depth = item['depth'] +if depth filter_depth: +continue +else: +filter_depth = MAX_DEPTH + +if item['type'] == 'container': +state = tree_state.get(item['id']) +if state != 'open': +filter_depth = depth -print local_data -return json.write(data) +filtered_items.append(item) +return json.write({'items': filtered_items}) # TODO: moves this to an API def _getLocalStorageData(self, id): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2421 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:03:05 2006 New Revision: 2421 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - functional tree - needs more polishing Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 18:03:05 2006 @@ -31,20 +31,24 @@ var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var model = CPSSkins.getModelById(tree); + var model = CPSSkins.getModelById(tree-state); var data = model.getData(); data['state'][nodeid] = open; model.setData(data); + + CPSSkins.getModelById(tree).getData() } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); - var model = CPSSkins.getModelById(tree); + var model = CPSSkins.getModelById(tree-state); var data = model.getData(); delete data['state'][nodeid]; model.setData(data); + + CPSSkins.getModelById(tree).getData() } CPSSkins.registerHandlers( -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2422 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:09:44 2006 New Revision: 2422 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Log: - renamed 'container' as 'inner' and 'item' as 'leaf' Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 18:09:44 2006 @@ -7,15 +7,16 @@ tree_data = { 'items': [ -{'id': '1', 'title': 'item 1', 'depth': 1, 'type': 'container'}, -{'id': '2', 'title': 'item 2', 'depth': 1, 'type': 'container'}, -{'id': '3', 'title': 'item 3', 'depth': 2, 'type': 'item'}, -{'id': '4', 'title': 'item 4', 'depth': 2, 'type': 'item'}, -{'id': '5', 'title': 'item 5', 'depth': 2, 'type': 'item', +{'id': '1', 'title': 'item 1', 'depth': 1, 'type': 'inner'}, +{'id': '2', 'title': 'item 2', 'depth': 1, 'type': 'inner'}, +{'id': '3', 'title': 'item 3', 'depth': 2, 'type': 'leaf'}, +{'id': '4', 'title': 'item 4', 'depth': 2, 'type': 'inner'}, +{'id': '5', 'title': 'item 5', 'depth': 3, 'type': 'leaf', + 'position': 'last'}, +{'id': '6', 'title': 'item 6', 'depth': 1, 'type': 'inner'}, +{'id': '7', 'title': 'item 7', 'depth': 1, 'type': 'inner'}, +{'id': '8', 'title': 'item 7', 'depth': 2, 'type': 'leaf', 'position': 'last'}, -{'id': '6', 'title': 'item 6', 'depth': 1, 'type': 'container'}, -{'id': '7', 'title': 'item 7', 'depth': 1, 'type': 'container'}, -{'id': '8', 'title': 'item 7', 'depth': 2, 'type': 'item'}, ] } @@ -39,7 +40,7 @@ else: filter_depth = MAX_DEPTH -if item['type'] == 'container': +if item['type'] == 'inner': state = tree_state.get(item['id']) if state != 'open': filter_depth = depth Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Sat Feb 18 18:09:44 2006 @@ -7,19 +7,19 @@ img class=close ctal:attributes=nodeid item/id src=/++skin++cpsskins-test/@@/++resource++container-open.png ctal:condition=javascript:state[item['id']] == 'open' - item['type'] == 'container' / + item['type'] == 'inner' / img class=open ctal:attributes=nodeid item/id src=/++skin++cpsskins-test/@@/++resource++container.png ctal:condition=javascript:state[item['id']] != 'open' - item['type'] == 'container' / + item['type'] == 'inner' / img src=/++skin++cpsskins-test/@@/node-link-branch.png - ctal:condition=javascript:item['type'] != 'container' + ctal:condition=javascript:item['type'] == 'leaf' item['position'] != 'last'/ img src=/++skin++cpsskins-test/@@/node-link-last.png - ctal:condition=javascript:item['type'] != 'container' + ctal:condition=javascript:item['type'] == 'leaf' item['position'] == 'last'/ img src=/++skin++cpsskins-test/@@/folder.png / -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2423 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:17:56 2006 New Revision: 2423 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Log: - cosmetic Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 18:17:56 2006 @@ -8,14 +8,16 @@ tree_data = { 'items': [ {'id': '1', 'title': 'item 1', 'depth': 1, 'type': 'inner'}, -{'id': '2', 'title': 'item 2', 'depth': 1, 'type': 'inner'}, +{'id': '2', 'title': 'item 2', 'depth': 2, 'type': 'inner', + 'empty': True}, {'id': '3', 'title': 'item 3', 'depth': 2, 'type': 'leaf'}, {'id': '4', 'title': 'item 4', 'depth': 2, 'type': 'inner'}, {'id': '5', 'title': 'item 5', 'depth': 3, 'type': 'leaf', 'position': 'last'}, {'id': '6', 'title': 'item 6', 'depth': 1, 'type': 'inner'}, -{'id': '7', 'title': 'item 7', 'depth': 1, 'type': 'inner'}, -{'id': '8', 'title': 'item 7', 'depth': 2, 'type': 'leaf', +{'id': '7', 'title': 'item 7', 'depth': 2, 'type': 'inner', + 'empty': True}, +{'id': '8', 'title': 'item 8', 'depth': 2, 'type': 'leaf', 'position': 'last'}, ] } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Sat Feb 18 18:17:56 2006 @@ -6,17 +6,18 @@ img class=close ctal:attributes=nodeid item/id src=/++skin++cpsskins-test/@@/++resource++container-open.png - ctal:condition=javascript:state[item['id']] == 'open' - item['type'] == 'inner' / + ctal:condition=javascript:state[item['id']] == 'open' !item['empty'] +item['type'] == 'inner' / img class=open ctal:attributes=nodeid item/id src=/++skin++cpsskins-test/@@/++resource++container.png - ctal:condition=javascript:state[item['id']] != 'open' - item['type'] == 'inner' / + ctal:condition=javascript:state[item['id']] != 'open' !item['empty'] +item['type'] == 'inner' / img src=/++skin++cpsskins-test/@@/node-link-branch.png - ctal:condition=javascript:item['type'] == 'leaf' -item['position'] != 'last'/ + ctal:condition=javascript:(item['type'] == 'leaf' +item['position'] != 'last') + || item['empty']/ img src=/++skin++cpsskins-test/@@/node-link-last.png ctal:condition=javascript:item['type'] == 'leaf' @@ -24,6 +25,6 @@ img src=/++skin++cpsskins-test/@@/folder.png / - a ctal:content=item/titleITEM/a + span ctal:content=item/titleITEM/span /div -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2424 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:32:48 2006 New Revision: 2424 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Log: - cosmetic Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 18:32:48 2006 @@ -18,16 +18,19 @@ style type=text/css + #area0 { +border: 1px solid #ddd; +padding: 1em; +width: 175px; +margin: 1em; + } .tree img { vertical-align: middle; } - - .tree a { - } /style script type=text/javascript -function openContainer(event) { +function openNode(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); @@ -39,7 +42,7 @@ CPSSkins.getModelById(tree).getData() } -function closeContainer(event) { +function closeNode(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); @@ -52,8 +55,8 @@ } CPSSkins.registerHandlers( - {'open-container': openContainer, - 'close-container': closeContainer + {'open-node': openNode, + 'close-node': closeNode } ); /script @@ -63,6 +66,15 @@ h1CPSSkins treeview/h1 + pIn this example the tree view is entirely rendered on the client. + without reloading the page/p + + pThe tree state is stored in a local storage using cookies. Hence the user + may reload the page and the tree state will be restored as long as + the cookie information does not expire/p + + pThe server uses the tree state information to generate the tree data./p + div id=area0 ins class=controller @@ -70,10 +82,10 @@ type: behaviour, rules: { img.open: { - click: open-container + click: open-node }, img.close: { - click: close-container + click: close-node } }} /ins Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt Sat Feb 18 18:32:48 2006 @@ -1,4 +1,6 @@ +div ctal:condition=javascript:items.length == 0Loading data .../div + div class=tree ctal:repeat=item items span ctal:attributes=style -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2425 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 18:37:12 2006 New Revision: 2425 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - no hardcoded data Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 18:37:12 2006 @@ -117,7 +117,7 @@ ins class=model {id: tree, data: { - state: {1: open, 2: open}, + state: {}, items: [] }, storage: { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2427 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Sat Feb 18 23:28:45 2006 New Revision: 2427 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Log: - simplified the effect API - added a 'render_effect' when the widget is rendered. 'show_effect' is when the widget is shown, and 'hide_effect' is when the widget is hidden Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Feb 18 23:28:45 2006 @@ -1191,9 +1191,6 @@ this.widget = widget; this.def = def; -this.show_effect = def.show_effect || {}; -this.hide_effect = def.hide_effect || {}; - this.setup(); }, @@ -1238,6 +1235,10 @@ display: function(data) { this.render(data); +if (this.def.render_effect) { + Element.hide(this.widget); + this.applyEffect(this.widget, this.def.render_effect) +} CPSSkins.notify(displayed, {'publisher': this}); }, @@ -1254,17 +1255,10 @@ // prepare the view this.prepare(); -if (this.effect) { - this.effect.stop(); -} - -var widget = this.widget; -var show_effect = this.show_effect; -if (show_effect) { - show_effect.transition = show_effect.transition || show; - this.effect = this.applyEffect(widget, show_effect) +if (this.def.show_effect) { + this.applyEffect(this.widget, this.def.show_effect) } else { - Element.show(widget); + Element.show(this.widget); } this.visible = true; }, @@ -1273,17 +1267,11 @@ if (!this.visible) { return; } -var widget = this.widget; -if (this.effect !this.effect.started) { - this.effect.stop(); -} -var hide_effect = this.hide_effect; -if (hide_effect) { - hide_effect.transition = hide_effect.transition || hide; - this.effect = this.applyEffect(widget, hide_effect); +if (this.def.hide_effect) { + this.applyEffect(this.widget, this.def.hide_effect); } else { - Element.hide(widget); + Element.hide(this.widget); } this.visible = false; @@ -1294,9 +1282,12 @@ }, applyEffect: function(node, options) { - if (options.transition in CPSSkins.Effects) { -return CPSSkins.Effects[options.transition](node, options) - } +if (this.effect) { + this.effect.stop(); +} +if (options.transition in CPSSkins.Effects) { + this.effect = CPSSkins.Effects[options.transition](node, options) +} } } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html Sat Feb 18 23:28:45 2006 @@ -58,8 +58,10 @@ template: ajax_widget_template.pt, replace: htmlwidget }, - model: ram-data-provider - } + model: ram-data-provider, + render_effect: { + transition: fadein + }} /ins /body Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Sat Feb 18 23:28:45 2006 @@ -70,7 +70,10 @@ {widget: { template: template.pt }, - model: template-data + model: template-data, + render_effect: { + transition: fadein + } } /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2428 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/treeview
Author: jmorliaguet Date: Sat Feb 18 23:29:25 2006 New Revision: 2428 Removed: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/treeview/ Log: - was moved -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2395 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 12:04:14 2006 New Revision: 2395 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - renamed the event's 'target' as 'publisher' since in the subscriber/publisher pattern the 'target' can be misunderstood as being the 'subscriber'. (this is still what is called 'event target' in DOM events, i.e. the event's source) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 12:04:14 2006 @@ -99,7 +99,7 @@ unsubscribe: function(eventid, event) { new_subscribers = $A([]); CPSSkins.Subscribers[eventid].each(function(e) { - if (!(event.subscriber == e.subscriber event.target == e.target)) { + if (!(event.subscriber == e.subscriber event.publisher == e.publisher)) { new_subscribers.push(e); } }); @@ -108,15 +108,15 @@ notify: function(eventid, info) { var subscribers = CPSSkins.Subscribers[eventid]; -var target = info.target; +var publisher = info.publisher; $A(subscribers).each(function(e) { - var event_target = e.target; - if (event_target == target || event_target == null) { + var event_publisher = e.publisher; + if (event_publisher == publisher || event_publisher == null) { var handler = CPSSkins.getEventHandler(eventid, e.subscriber); if (handler) { - // set the target in case no target is specified in the subscription. + // set the publisher in case no publisher is specified in the subscription. info.subscriber = e.subscriber; - info.target = target; + info.publisher = publisher; handler(info); } } @@ -161,7 +161,7 @@ var progress = new Object({'initialized': 0}); var length = elements.length; -CPSSkins.subscribe(initialized, {'subscriber': progress, 'target': null}); +CPSSkins.subscribe(initialized, {'subscriber': progress, 'publisher': null}); CPSSkins.registerEventHandler(initialized, progress, function(event) { progress.initialized += 1; if (progress.initialized = length) { @@ -175,7 +175,7 @@ var options = { onComplete: function(req) { el.innerHTML = req.responseText; -CPSSkins.notify('initialized', {target: el}); +CPSSkins.notify('initialized', {'publisher': el}); } } var parts = url.split('?'); @@ -186,7 +186,7 @@ new Ajax.Request(url, options); } else { /* the definition is written inline */ -CPSSkins.notify('initialized', {target: el}); +CPSSkins.notify('initialized', {'publisher': el}); } }); }, @@ -219,7 +219,7 @@ var controller = factory(el, def); CPSSkins.Controllers[name] = controller; CPSSkins.notify(registered controller + def.id, -{target: controller}); +{'publisher': controller}); } break; } @@ -227,7 +227,7 @@ case model: { var model = new CPSSkins.Model(el, def); CPSSkins.Models[name] = model; - CPSSkins.notify(registered model + def.id, {target: model}); + CPSSkins.notify(registered model + def.id, {'publisher': model}); break; } @@ -259,10 +259,10 @@ if (model_id) { var evt_id = registered model + model_id; CPSSkins.registerEventHandler(evt_id, view, function(event) { -var model = event.target; +var model = event.publisher; view.observe(model); }); - CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); + CPSSkins.subscribe(evt_id, {'subscriber': view, 'publisher': null}); } /* register the controllers */ @@ -270,14 +270,14 @@ $A(controllers_id).each(function(c) { var evt_id = registered controller + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { -var controller = event.target; +var controller = event.publisher; controller.view = view; controller.register(view); // add a back-reference view.controller = controller; }); - CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); + CPSSkins.subscribe(evt_id, {'subscriber': view, 'publisher': null}); }); /* insert the widget into the DOM */ @@ -419,9 +419,9 @@ var controller = this; -CPSSkins.registerEventHandler(command, view, function(info) { +
[Z3lab-checkins] r2396 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 12:19:59 2006 New Revision: 2396 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - harmonization: rename the event 'info' object as 'event' Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 12:19:59 2006 @@ -106,18 +106,18 @@ CPSSkins.Subscribers[eventid] = new_subscribers; }, - notify: function(eventid, info) { + notify: function(eventid, event) { var subscribers = CPSSkins.Subscribers[eventid]; -var publisher = info.publisher; +var publisher = event.publisher; $A(subscribers).each(function(e) { var event_publisher = e.publisher; if (event_publisher == publisher || event_publisher == null) { var handler = CPSSkins.getEventHandler(eventid, e.subscriber); if (handler) { // set the publisher in case no publisher is specified in the subscription. - info.subscriber = e.subscriber; - info.publisher = publisher; - handler(info); + event.subscriber = e.subscriber; + event.publisher = publisher; + handler(event); } } }); @@ -419,21 +419,21 @@ var controller = this; -CPSSkins.registerEventHandler(command, controller, function(info) { - var view = info.subscriber; - var controller = info.publisher; +CPSSkins.registerEventHandler(command, controller, function(event) { + var view = event.subscriber; + var controller = event.publisher; // add some contextual info - info.view = view; - info.model = view.model; + event.view = view; + event.model = view.model; - var action = info.options.action; + var action = event.options.action; // TODO: to refactor /* the event handler calls the controller's registered handler */ var handler_id = controller.def.handlers[action]; if (handler_id) { var handler = CPSSkins.Handlers[handler_id]; -if (handler) handler(info); +if (handler) handler(event); } }); @@ -477,9 +477,9 @@ var controller = this; -CPSSkins.registerEventHandler(gained focus, controller, function(info) { - var view = info.publisher; - var selected = info.context; +CPSSkins.registerEventHandler(gained focus, controller, function(event) { + var view = event.publisher; + var selected = event.context; if (!view.def.model) { var model = Canvas.getModel(selected); if (model) { @@ -488,8 +488,8 @@ } }); -CPSSkins.registerEventHandler(lost focus, controller, function(info) { - var view = info.publisher; +CPSSkins.registerEventHandler(lost focus, controller, function(event) { + var view = event.publisher; view.stopObserving(); }); @@ -1644,12 +1644,12 @@ if (!window.confirm(confirm)) return; } /* notify the controller to take action */ -var info = { +var event = { context: this.selected, publisher: this.controller, options: {'action': action, 'choice': choice} } -CPSSkins.notify(command, info); +CPSSkins.notify(command, event); this.active = false; }, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2401 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 17:03:26 2006 New Revision: 2401 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - no need to specify a subscriber as 'null' if there is no subscriber. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 17:03:26 2006 @@ -161,7 +161,7 @@ var progress = new Object({'initialized': 0}); var length = elements.length; -CPSSkins.subscribe(initialized, {'subscriber': progress, 'publisher': null}); +CPSSkins.subscribe(initialized, {'subscriber': progress}); CPSSkins.registerEventHandler(initialized, progress, function(event) { progress.initialized += 1; if (progress.initialized = length) { @@ -262,7 +262,7 @@ var model = event.publisher; view.observe(model); }); - CPSSkins.subscribe(evt_id, {'subscriber': view, 'publisher': null}); + CPSSkins.subscribe(evt_id, {'subscriber': view}); } /* register the controllers */ @@ -277,7 +277,7 @@ view.controller = controller; }); - CPSSkins.subscribe(evt_id, {'subscriber': view, 'publisher': null}); + CPSSkins.subscribe(evt_id, {'subscriber': view}); }); /* insert the widget into the DOM */ @@ -1357,7 +1357,7 @@ view.getData(); }); - CPSSkins.subscribe(evt_id, {'subscriber': view, 'publisher': null}); + CPSSkins.subscribe(evt_id, {'subscriber': view}); } }, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2402 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 17:19:03 2006 New Revision: 2402 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - added a distinction between render(data) and display(data) - render(data) triggers no event - display(data) triggers a diplayed event this is needed to attach DOM events after the widget has been rendered. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 17:19:03 2006 @@ -865,7 +865,7 @@ // observers subscribes to events on the model CPSSkins.registerEventHandler('modified', view, function(event) { var data = event.publisher.def.data; - event.subscriber.render(data); + event.subscriber.display(data); }); CPSSkins.subscribe('modified', {'subscriber': view, 'publisher': model}); // create a back-reference @@ -1224,18 +1224,20 @@ } }, - update: function() { -var data = this.getData(); -if (data) this.render(data); + display: function(data) { +this.render(data); +CPSSkins.notify(displayed, {'publisher': this}); }, show: function() { if (this.visible) return; -CPSSkins.notify(gained focus, {'publisher': this, 'context': this.selected}); +CPSSkins.notify(gained focus, {'publisher': this, + 'context': this.selected}); -// get new data -this.update(); +// get new data and display the view +var data = this.getData(); +if (data) this.display(data); // prepare the view this.prepare(); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2404 - cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour
Author: jmorliaguet Date: Fri Feb 17 18:53:06 2006 New Revision: 2404 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/template.html (contents, props changed) Log: - added functional test for behaviour (basically the same principle as in http://bennolan.com/behaviour/ with a simpler syntax for registering handlers) Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/cpsskins_behaviour_test.html Fri Feb 17 18:53:06 2006 @@ -0,0 +1,57 @@ +!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN + http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; +html xml:lang=en lang=en + xmlns=http://www.w3.org/1999/xhtml; +head + titleCPSSkins Unit test file/title + meta http-equiv=content-type content=text/html; charset=utf-8 / + script src=../../../prototype.js type=text/javascript/script + script src=../../../json.js type=text/javascript/script + script src=../../../ctal.js type=text/javascript/script + script src=../../../cpsskins.js type=text/javascript/script + link rel=stylesheet href=../../../cpsskins.css type=text/css / + + script type=text/javascript +function sayHello(event) { + alert('Hello!'); +} + +CPSSkins.registerHandlers({'say-hello': sayHello}); + + /script + +/head +body + + h1CPSSkins behaviour/h1 + + div id=area1 + +ins class=controller +{id: behaviour, + type: behaviour, + rules: { + #item1: { + click: say-hello + } +}} +/ins + +!-- dummy model (needed for rendering the view) -- +ins class=model +{id: dummy} +/ins + +ins class=view +{model: dummy, + widget: { + template: template.html + }, + controllers: [behaviour] +} +/ins + + /div + +/body +/html Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/template.html == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/behaviour/template.html Fri Feb 17 18:53:06 2006 @@ -0,0 +1,5 @@ + + ul + lispan id=item1Click me/span/li + /ul + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2405 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 19:00:52 2006 New Revision: 2405 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - optimization (avoid calling $$() several times for the same selector) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 19:00:52 2006 @@ -459,15 +459,17 @@ var widget = view.widget; $H(rules).each(function(r) { -var selector = r[0]; -$H(r[1]).each(function(s) { - var event_name = s[0]; - var handler_name = s[1]; - var handler = CPSSkins.Handlers[handler_name]; - $$(selector).each(function(el) { -Event.observe(widget, event_name, handler); - }); -}) +var selector = $$(r[0]); +if (selector) { + $H(r[1]).each(function(s) { +var event_name = s[0]; +var handler_name = s[1]; +var handler = CPSSkins.Handlers[handler_name]; +selector.each(function(el) { + Event.observe(widget, event_name, handler); +}); + }) +} }) }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2407 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Fri Feb 17 23:03:23 2006 New Revision: 2407 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - not rendering the view when it is supposed to be rendered is not a good idea, since DOM events can get registered several time. optimizations are to be made instead in the communication between the storages and the model. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Feb 17 23:03:23 2006 @@ -1390,11 +1390,7 @@ var node = document.createElement(div); node.innerHTML = this.source; ctal.process_ctal(node, data); - var old_html = this.widget.innerHTML; - var new_html = node.innerHTML; - if (new_html != old_html) { -this.widget.innerHTML = node.innerHTML; - } + this.widget.innerHTML = node.innerHTML; } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2408 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/unit
Author: jmorliaguet Date: Sat Feb 18 01:37:44 2006 New Revision: 2408 Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - bug fix: new edge case where the information from the data structure became unavailable from inside the loop the third time the repeat loop was run. we do a deepcopy of the entire data structure Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js == --- cpsskins/branches/jmo-perspectives/ui/framework/ctal.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Sat Feb 18 01:37:44 2006 @@ -163,24 +163,17 @@ iterator variable overwrites loop variable.); } + // do a deep copy of the data structure traversed by the repeat loop + // to avoid corrupting it. + var saved_data = ctal.deepcopy(data); for (var i=0; idatas.length; i++) { -// do a deep copy of the data structure traversed by the repeat loop -// to avoid corrupting it. -var saved_data = new Object(); -var current_data = data[nmx[0]]; -if (typeof current_data != undefined) { - saved_data = ctal.deepcopy(current_data); -} data[nmx[0]] = datas[i]; var newnode = tmpl.cloneNode(true); ctal.node_insertbefore(parent, newnode, marker); // recurse ctal.process_ctal(newnode, data); -// restore the original data structure -if (saved_data) { - data = ctal.deepcopy(saved_data); -} +data = ctal.deepcopy(saved_data); } parent.removeChild(tmpl); } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Sat Feb 18 01:37:44 2006 @@ -298,6 +298,10 @@ div id=e34p ctal:repeat=f f ctal:content=f.../p/div +!-- the entire data structure must be accessible from inside the loop -- +div id=e35p ctal:repeat=item fspan ctal:content=a/span/p/div + + !-- Tests follow -- script type=text/javascript // ![CDATA[ @@ -510,6 +514,10 @@ // XXX: this one does not pass yet assertEqual('', htmlOf(e34)); + + assertEqual( + 'pspan1/span/ppspan1/span/ppspan1/span/p', + htmlOf(e35)); }} }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2409 - in cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional: . treeview
Author: jmorliaguet Date: Sat Feb 18 02:11:58 2006 New Revision: 2409 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/__init__.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-last.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-open.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/folder.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-branch.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-last.png (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/treeview_widget.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml Log: - saving work: the model consists of: - tree data generated on the server (remote storage with a @@getTreeData getter) - tree states (information about which nodes are open) (local storage, the information is stored in a cookie) - a compound storage that combines the tree data and the tree state. the view: - CTAL template that renders the tree - observes the model (see above) the controller: - behaviour on each container node (close/open) - 2 handlers (openContainer() and closeContainer() - controls the view (see above) TODO: - the server must use the tree state information to avoid sending information about closed nodes - ... Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml Sat Feb 18 02:11:58 2006 @@ -12,4 +12,6 @@ include package=.latency / + include package=.treeview / + /configure Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/__init__.py == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/__init__.py Sat Feb 18 02:11:58 2006 @@ -0,0 +1 @@ +# Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/browser.py Sat Feb 18 02:11:58 2006 @@ -0,0 +1,22 @@ + +from zope.app.publisher.browser import BrowserView + +from cpsskins import minjson as json + +data = { +'items': [ +{'id': 1, 'title': 'item 1', 'depth': 1, 'type': 'container'}, +{'id': 2, 'title': 'item 2', 'depth': 1, 'type': 'container'}, +{'id': 3, 'title': 'item 3', 'depth': 2}, +{'id': 4, 'title': 'item 4', 'depth': 2}, +{'id': 5, 'title': 'item 5', 'depth': 2, 'position': 'last'}, +{'id': 6, 'title': 'item 6', 'depth': 1, 'type': 'container'}, +{'id': 7, 'title': 'item 7', 'depth': 1, 'type': 'container'}, +] +} + +class Views(BrowserView): + +def getTreeData(self): +return json.write(data) + Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml Sat Feb 18 02:11:58 2006 @@ -0,0 +1,53 @@ +configure +xmlns:browser=http://namespaces.zope.org/browser; + + browser:resource + name=container.png file=container.png + layer=cpsskins-test / + + browser:resource + name=container-open.png file=container-open.png + layer=cpsskins-test / + + browser:resource + name=node-link-branch.png file=node-link-branch.png + layer=cpsskins-test / + +
[Z3lab-checkins] r2410 - in cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview: . images
Author: jmorliaguet Date: Sat Feb 18 02:17:45 2006 New Revision: 2410 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/__init__.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/container-last.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-last.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/container-open.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-open.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/container.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/folder.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/folder.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/node-link-branch.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-branch.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/node-link-last.png - copied unchanged from r2409, cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-last.png Removed: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-last.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container-open.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/container.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/folder.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-branch.png cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/node-link-last.png Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Log: - moved images to the image folder Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/configure.zcml Sat Feb 18 02:17:45 2006 @@ -2,23 +2,23 @@ xmlns:browser=http://namespaces.zope.org/browser; browser:resource - name=container.png file=container.png + name=container.png file=images/container.png layer=cpsskins-test / browser:resource - name=container-open.png file=container-open.png + name=container-open.png file=images/container-open.png layer=cpsskins-test / browser:resource - name=node-link-branch.png file=node-link-branch.png + name=node-link-branch.png file=images/node-link-branch.png layer=cpsskins-test / browser:resource - name=node-link-last.png file=node-link-last.png + name=node-link-last.png file=images/node-link-last.png layer=cpsskins-test / browser:resource - name=folder.png file=folder.png + name=folder.png file=images/folder.png layer=cpsskins-test / browser:page Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/cpsskins_treeview.pt Sat Feb 18 02:17:45 2006 @@ -30,11 +30,13 @@ function openContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); + debug(nodeid); } function closeContainer(event) { var target = Event.element(event); var nodeid = target.getAttribute(nodeid); + debug(nodeid); } CPSSkins.registerHandlers( Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/treeview/images/__init__.py == --- (empty file) +++
[Z3lab-checkins] r2389 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency
Author: jmorliaguet Date: Thu Feb 16 10:10:18 2006 New Revision: 2389 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Log: - added typewriter demo Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py Thu Feb 16 10:10:18 2006 @@ -17,7 +17,9 @@ # this only simulates latency on the server. # network latency can be simulated with the AJAX Proxy tool # (https://sourceforge.net/projects/jpspan/) -time.sleep(random.randint(1, 4)) +latency = data.get('latency') +if latency: +time.sleep(random.randint(1, latency)) storage = data['storage'] cache.set(data, storage, {}) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml Thu Feb 16 10:10:18 2006 @@ -9,6 +9,14 @@ template=cpsskins_latency.pt / + browser:page + for=* + layer=cpsskins-test + name=cpsskins_typewriter.html + permission=zope.Public + template=cpsskins_typewriter.pt + / + browser:pages layer=cpsskins-test for=* Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Thu Feb 16 10:10:18 2006 @@ -50,7 +50,8 @@ function run(model_id, storage) { var model = CPSSkins.getModelById(model_id); $R(1,10).each(function(v) { -model.setData({'storage': storage, 'position': v, 's': v}); +model.setData({'storage': storage, 'position': v, 's': v, + 'latency': 2}); }); } Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt Thu Feb 16 10:10:18 2006 @@ -0,0 +1,187 @@ +!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN + http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; +html xml:lang=en lang=en + xmlns=http://www.w3.org/1999/xhtml; +head + titleCPSSkins Unit test file/title + meta http-equiv=content-type content=text/html; charset=utf-8 / + script src=/++skin++cpsskins/@@/++resource++prototype.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++json.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++cpsskins.js + type=text/javascript/script + link rel=stylesheet type=text/css +href=/++skin++cpsskins/@@/++resource++cpsskins.css / + + style type=text/css + table.results { +width: 100%; + } + table.results th { +background-color: #eee; +border: 1px solid #ccc; + } + table.results td { +width: 50%; +border: 1px solid #ccc; + } + .car { +font: 20px serif; + } + form { +padding: 0.5em; +margin: 2px; + } + label { +font: bold 20px Arial; + } + input { +color: #000; +border: 1px solid #ccc; +border-style: none none solid none; +font: 22px serif; +padding: 0.2em; + } + input:focus { +border-color: #000; + } + /style + + script type=text/javascript +var model, s=0; + +Event.observe(window, load, init); + +function init() { + + var onKeyPressEvent = function(e) { +var key = e.charCode; +if (!key) return; +s += 1; +var model1 = CPSSkins.getModelById(no-sequence); +var model2 = CPSSkins.getModelById(queue-sequence); +model1.setData({'storage': 1, 'position': key, 's': s, 'latency': 2}); +model2.setData({'storage': 2, 'position': key, 's': s,
[Z3lab-checkins] r2390 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Thu Feb 16 22:46:37 2006 New Revision: 2390 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Log: - test updates Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Thu Feb 16 22:46:37 2006 @@ -73,57 +73,117 @@ /div + ins class=model + {id: p1, + data: { + url: p1.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2, + data: { + url: p2.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p3, + data: { + url: p3.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p1_2, + data: { + url: p1_2.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2_3, + data: { + url: p2_3.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2_3_1, + data: { + url: p2_3_1.html +}, +storage: { + type: ram + }} + /ins + !-- panels -- ins class=view {widget: { - type: panel, - url: p1.html + type: panel }, + model: p1, perspectives: [1] } /ins ins class=view {widget: { - type: panel, - url: p2.html + type: panel }, + model: p2, perspectives: [1, 2] } /ins ins class=view {widget: { - type: panel, - url: p3.html + type: panel }, + model: p3, perspectives: [3] } /ins ins class=view {widget: { - type: panel, - url: p1_2.html + type: panel }, + model: p1_2, perspectives: [1/2] } /ins ins class=view {widget: { - type: panel, - url: p2_3.html + type: panel }, + model: p2_3, perspectives: [2/3] } /ins ins class=view {widget: { - type: panel, - url: p2_3_1.html + type: panel }, + model: p2_3_1, perspectives: [2/3/1] } /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2391 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional tests/zope3/functional/chat tests/zope3/functional/forms tests/zope3/functional/quiz
Author: jmorliaguet Date: Thu Feb 16 22:55:02 2006 New Revision: 2391 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data3.txt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_external_sources.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_tooltip.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data1.txt cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt Log: - a same view can have several controllers registered at the same time - added a Focus Observer (a controller that receives gained focus and lost focus events coming from objects that are clicked on or that temporarily get some focus. - the controller makes the view observe the model of the object that gained focus - when the object loses focus, the controller makes the view stops observing the model this is currently used with contextual menus and with tooltips Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Thu Feb 16 22:55:02 2006 @@ -265,16 +265,20 @@ CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); } -/* register the controller */ -var controller_id = def.controller || null; -if (controller_id) { - var evt_id = registered controller + controller_id; +/* register the controllers */ +var controllers_id = def.controllers || []; +$A(controllers_id).each(function(c) { + var evt_id = registered controller + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.target; -controller.control(view); +controller.view = view; +controller.register(view); +// add a back-reference +view.controller = controller; + }); CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); -} +}); /* insert the widget into the DOM */ var replace = def.widget.replace; @@ -385,7 +389,7 @@ this.def = def; }, - control: function(view) { + register: function(view) { /* to override */ } @@ -394,12 +398,16 @@ if (!window.Controllers) { var Controllers = new Object(); } Object.extend(Controllers, { - command: function(node, def) { + 'command': function(node, def) { return new CPSSkins.CommandController(node, def); }, - form: function(node, def) { + 'form': function(node, def) { return new CPSSkins.FormController(node, def); + }, + + 'focus observer': function(node, def) { +return new CPSSkins.FocusObserver(node, def); } }); @@ -407,10 +415,9 @@ CPSSkins.CommandController = Class.create(); CPSSkins.CommandController.prototype = Object.extend(new CPSSkins.Controller(), { - control: function(view) { + register: function(view) { var controller = this; -view.controller = controller; CPSSkins.registerEventHandler(command, view, function(info) { var view = info.subscriber; @@ -438,10 +445,7 @@ CPSSkins.FormController = Class.create(); CPSSkins.FormController.prototype = Object.extend(new CPSSkins.Controller(), { - control: function(view) { -this.view = view; -var controller = this; -view.controller = controller; + register: function(view) { var widget = view.widget; @@ -466,6 +470,35 @@ }); +CPSSkins.FocusObserver = Class.create(); +CPSSkins.FocusObserver.prototype = Object.extend(new CPSSkins.Controller(), { + + register: function(view) { + +var controller = this; + +CPSSkins.registerEventHandler(gained focus, controller, function(info) { + var view = info.target; + var selected = info.context; + if (!view.def.model) { +var model = Canvas.getModel(selected); +if (model) { + view.observe(model); +} + } +}); + +CPSSkins.registerEventHandler(lost focus, controller, function(info) { + var view = info.target; +
[Z3lab-checkins] r2392 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms
Author: jmorliaguet Date: Thu Feb 16 23:29:53 2006 New Revision: 2392 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt Log: - temporary fix for not submitting the form Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt Thu Feb 16 23:29:53 2006 @@ -1,4 +1,4 @@ -form action= method=post +form action= method=post onsubmit=return false p ctal:repeat=f fields label ctal:content=f/labelLABEL/label -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2393 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/unit
Author: jmorliaguet Date: Fri Feb 17 00:09:39 2006 New Revision: 2393 Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - the 'javascript:...' notation evaluates the expression in the context of the data. with: data = { items: [{'title': 'test'}, ...] } div ctal:repeat=item items span ctal:content=item/title.../span /div is equivalent to: div ctal:repeat=item items span ctal:content=javascript:item['title'].../span /div Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js == --- cpsskins/branches/jmo-perspectives/ui/framework/ctal.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Fri Feb 17 00:09:39 2006 @@ -238,7 +238,8 @@ } else if (etype == 'path') { return ctal.eval_pathexpr(data, value) } else if (etype == 'javascript') { -return eval(value) +// evaluate the expression in context +return data.eval(value); } else { throw new ctal.TALESError('TALES Expression type ' + etype + ' is not implemented') Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Fri Feb 17 00:09:39 2006 @@ -280,7 +280,7 @@ div id=e31bspan ctal:content=javascript:1+1.../span/div div id=e31cspan -ctal:content=javascript:data['k']['l']['m'].../span/div +ctal:content=javascript:k['l']['m'].../span/div !-- edge cases -- -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2394 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Fri Feb 17 00:18:21 2006 New Revision: 2394 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - added info about a test that does not pass. Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Fri Feb 17 00:18:21 2006 @@ -507,6 +507,8 @@ testEdgeCases: function() { with(this) { assertEqual('', htmlOf(e32)); assertEqual('pspan1/span/ppspan2/span/p', htmlOf(e33)); + + // XXX: this one does not pass yet assertEqual('', htmlOf(e34)); }} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2382 - in cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional: . latency
Author: jmorliaguet Date: Wed Feb 15 09:39:57 2006 New Revision: 2382 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/__init__.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml Log: - saving work: added tests to eliminate storage latency when saving data on a remote server with two types of sequences: queue and stack (not implemented yet). Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/configure.zcml Wed Feb 15 09:39:57 2006 @@ -10,4 +10,6 @@ include package=.forms / + include package=.latency / + /configure Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/__init__.py == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/__init__.py Wed Feb 15 09:39:57 2006 @@ -0,0 +1 @@ +# Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py Wed Feb 15 09:39:57 2006 @@ -0,0 +1,25 @@ + +import random +import time + +from zope.app.publisher.browser import BrowserView +from zope.app.cache.ram import RAMCache + +from cpsskins import minjson as json + +cache = RAMCache() + +class Views(BrowserView): + +def setDataWithLatency(self, data): +data = json.read(data) + +# this only simulates latency on the server. +# network latency can be simulated with the AJAX Proxy tool +# (https://sourceforge.net/projects/jpspan/) +time.sleep(random.randint(1, 4)) + +storage = data['storage'] +cache.set(data, storage, {}) +return json.write(data) + Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml Wed Feb 15 09:39:57 2006 @@ -0,0 +1,25 @@ +configure +xmlns:browser=http://namespaces.zope.org/browser; + + browser:page + for=* + layer=cpsskins-test + name=cpsskins_latency.html + permission=zope.Public + template=cpsskins_latency.pt + / + + browser:pages + layer=cpsskins-test + for=* + class=.browser.Views + permission=zope.Public + +browser:page +name=setDataWithLatency.html +attribute=setDataWithLatency +/ + + /browser:pages + +/configure Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Wed Feb 15 09:39:57 2006 @@ -0,0 +1,184 @@ +!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN + http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; +html xml:lang=en lang=en + xmlns=http://www.w3.org/1999/xhtml; +head + titleCPSSkins Unit test file/title + meta http-equiv=content-type content=text/html; charset=utf-8 / + script src=/++skin++cpsskins/@@/++resource++prototype.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++json.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++ctal.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++cpsskins.js + type=text/javascript/script + link rel=stylesheet type=text/css +href=/++skin++cpsskins/@@/++resource++cpsskins.css / + + style type=text/css + .bar { +color: #fff; +margin: 2px; +padding: 2px; +font: 12px arial, sans-serif; +border: 1px solid #003; +background-color: rgb(1, 2, 100); + } + table.results { +width: 100%; + } + table.results th { +background-color: #eee; +border:
[Z3lab-checkins] r2384 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/zope3/functional/latency
Author: jmorliaguet Date: Wed Feb 15 12:22:40 2006 New Revision: 2384 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Log: - implemented storage access sequences (in write mode): - queue: first-in first-out - stack: last-in first-out Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Wed Feb 15 12:22:40 2006 @@ -795,12 +795,12 @@ // high-level I/O getData: function() { -this.storage.requestData(); /* asynchronous call */ +this.storage.readTransaction(); /* asynchronous call */ return this.storage.read(); }, setData: function(data) { -this.storage.storeData(data); +this.storage.writeTransaction(data); }, // TODO: to rewrite: this might not work if called asynchronously. @@ -871,6 +871,30 @@ initialize: function(model) { this.model = model; this.setup(); +this._queue = $A([]); +this._queued_data = $H({}); + }, + + readTransaction: function(data) { +// TODO: implement a read access sequences +this.requestData(); + }, + + writeTransaction: function(data) { +var access = this.model.def.storage.access; +if (access) { + switch (access.type) { +case 'queue': { + this._queue.push(data[access.signature]); + break; +} +case 'stack': { + this._queue.unshift(data[access.signature]); + break; +} + } +} +this.storeData(data); }, /* Public API */ @@ -892,6 +916,27 @@ }, write: function(data) { +var access = this.model.def.storage.access; + +if (access access.type) { + var signature = data[access.signature]; + this._queued_data[signature] = data; + while (this._queue) { +var next = this._queue[0]; +if (next in this._queued_data) { + data = this._queued_data[next]; + this._writeFields(data); + this._queue.shift(); +} else { + break; +} + } +} else { + this._writeFields(data); +} + }, + + _writeFields: function(data) { // filter out fields with the wrong data type var schema = this.model.schema; var filtered_data = new Object(); Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Wed Feb 15 12:22:40 2006 @@ -45,13 +45,13 @@ function init() { run('no-sequence', 1); - run('stack-sequence', 2); - run('queue-sequence', 3); + run('queue-sequence', 2); + run('stack-sequence', 3); } function run(model_id, storage) { var model = CPSSkins.getModelById(model_id); - $R(1,20).each(function(v) { + $R(1,10).each(function(v) { model.setData({'storage': storage, 'position': v, 's': v}); }); } @@ -166,7 +166,7 @@ {widget: { type: counter }, - model: stack-sequence + model: queue-sequence } /ins /td @@ -176,7 +176,7 @@ {widget: { type: counter }, - model: queue-sequence + model: stack-sequence } /ins /td -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2385 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Wed Feb 15 12:30:39 2006 New Revision: 2385 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - test fix Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Wed Feb 15 12:30:39 2006 @@ -843,6 +843,7 @@ var storage_def = this.def.storage; if (!storage_def) { storage_def = {type: ram}; + this.def.storage = storage_def; } var model = this; var storage = Storages[storage_def.type](this); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2386 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency
Author: jmorliaguet Date: Wed Feb 15 13:00:14 2006 New Revision: 2386 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Log: - doc update Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Wed Feb 15 13:00:14 2006 @@ -9,8 +9,6 @@ type=text/javascript/script script src=/++skin++cpsskins/@@/++resource++json.js type=text/javascript/script - script src=/++skin++cpsskins/@@/++resource++ctal.js - type=text/javascript/script script src=/++skin++cpsskins/@@/++resource++cpsskins.js type=text/javascript/script link rel=stylesheet type=text/css @@ -88,7 +86,35 @@ /head body - h1CPSSkins: network latency/h1 + h1CPSSkins: controlling network latency/h1 + + pBecause they do asynchronous calls, AJAX applications often receive the + results of a series of requests in an order completely different from + the order in which the requests were originally made./p + + pIf the network or the server response latency is significant, or if the + user performs many actions in a short time, the results of these actions + user will be performed in an unpredictable sequence. + A solution is to specify access rules for the data storage:p + + dl +dtSTACK SEQUENCE (LIFO)/dt +ddThe last request gets highest priority, it will be fulfilled before +the other requests (useful when typing). +/dd + +dtQUEUE SEQUENCE (FIFO)/dt +ddThe first request is fulfilled before the other requests ./dd + /dl + + pIn the example below, some data (1 .. 10) is written in a remote storage + in the following order: 1, 2, 3, ... 10. The results are displayed as soon + as the client gets a response from the server./p + + pThe storages that specify an access sequence are guaranteed to see the data + being stored in the specifed order./p + + !-- models -- ins class=model -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2387 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency
Author: jmorliaguet Date: Wed Feb 15 13:03:24 2006 New Revision: 2387 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Log: - fixed typos Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Wed Feb 15 13:03:24 2006 @@ -93,18 +93,18 @@ the order in which the requests were originally made./p pIf the network or the server response latency is significant, or if the - user performs many actions in a short time, the results of these actions - user will be performed in an unpredictable sequence. + user performs many actions in a short time period, the results of these + actions will be presented in an unpredictable sequence. A solution is to specify access rules for the data storage:p dl dtSTACK SEQUENCE (LIFO)/dt ddThe last request gets highest priority, it will be fulfilled before -the other requests (useful when typing). +the other requests (useful when typing text, when cancelling, etc.). /dd dtQUEUE SEQUENCE (FIFO)/dt -ddThe first request is fulfilled before the other requests ./dd +ddThe request order is respected./dd /dl pIn the example below, some data (1 .. 10) is written in a remote storage @@ -112,9 +112,7 @@ as the client gets a response from the server./p pThe storages that specify an access sequence are guaranteed to see the data - being stored in the specifed order./p - - + being stored in the specified order./p !-- models -- ins class=model -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2381 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Wed Feb 15 00:22:01 2006 New Revision: 2381 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - using the API: CPSSkins.notify('stored') is called when the data is physically written in the storage Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Wed Feb 15 00:22:01 2006 @@ -942,7 +942,7 @@ requestData: function() { /* nothing to do since the data is already there */ -CPSSkins.notify('stored', {target: this}); +this.write(this.read()); }, storeData: function(data) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2375 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Mon Feb 13 15:03:53 2006 New Revision: 2375 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - optimization: widgets were rendered several times. - TODO: storage adapters could compare new data with the old data before firing a 'stored' / 'modified' event. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 13 15:03:53 2006 @@ -208,6 +208,7 @@ var name = classid + index; el.setAttribute(name, name); var def = CPSSkins.jsonParse(el); + def.name = name; switch(classid) { @@ -225,7 +226,6 @@ case model: { var model = new CPSSkins.Model(el, def); - model.id = index; CPSSkins.Models[name] = model; CPSSkins.notify(registered model + def.id, {target: model}); break; @@ -253,7 +253,6 @@ /* create the view */ if (view) { -view.id = index; /* register the observed model */ var model_id = def.model; @@ -795,8 +794,6 @@ CPSSkins.subscribe('modified', {'subscriber': view, 'target': model}); // create a back-reference view.model = model; -// initialize the view -view.update(); }, removeObserver: function(view) { @@ -1104,8 +1101,8 @@ }, update: function() { -var data = this.getData(); -if (data != null) this.render(data); +// getData() causes the view to get rendered. +this.getData(); }, show: function() { @@ -1220,7 +1217,7 @@ var view = this; if (url) { - var evt_id = loaded widget template; + var evt_id = loaded template + this.def.name; var options = { onComplete: function(req) { view.source = req.responseText; @@ -1247,7 +1244,11 @@ var node = document.createElement(div); node.innerHTML = this.source; ctal.process_ctal(node, data); - this.widget.innerHTML = node.innerHTML; + var old_html = this.widget.innerHTML; + var new_html = node.innerHTML; + if (new_html != old_html) { +this.widget.innerHTML = node.innerHTML; + } } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2378 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Mon Feb 13 17:28:16 2006 New Revision: 2378 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html Log: - updated tests - the show() method must trigger a view update before displaying the widget. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 13 17:28:16 2006 @@ -1112,6 +1112,9 @@ } } +// get new data +this.update(); + if (this.effect) { this.effect.stop(); } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_navpanel_test.html Mon Feb 13 17:28:16 2006 @@ -43,11 +43,51 @@ PANEL 1/a /div + ins class=model + {id: panel1, + data: { + url: panel1.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: panel2, + data: { + url: panel2.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: panel3, + data: { + url: panel3.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: panel4, + data: { + url: panel4.html +}, +storage: { + type: ram + }} + /ins + ins class=view {widget: { - type: panel, - url: panel1.html + type: panel }, + model: panel1, perspectives: [panels/panel1] } /ins @@ -60,9 +100,9 @@ ins class=view {widget: { - type: panel, - url: panel2.html + type: panel }, + model: panel2, perspectives: [panels/panel2] } /ins @@ -75,9 +115,9 @@ ins class=view {widget: { - type: panel, - url: panel3.html + type: panel }, + model: panel3, perspectives: [panels/panel3] } /ins @@ -90,9 +130,9 @@ ins class=view {widget: { - type: panel, - url: panel4.html + type: panel }, + model: panel4, perspectives: [panels/panel4] } /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2379 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional
Author: jmorliaguet Date: Mon Feb 13 22:42:08 2006 New Revision: 2379 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.css (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.css (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.css (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel4.css (contents, props changed) Removed: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/style1.css Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel1.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel2.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel3.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel4.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel5.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/panel6.html Log: - test updates for the panel widget - fixed the activation / deactivation of on-demand resources Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 13 22:42:08 2006 @@ -548,7 +548,12 @@ }); -if (!window.Canvas) { var Canvas = new Object(); } +if (!window.Canvas) { + var Canvas = new Object(); + Canvas.Styles = $({}); + Canvas.Script = $({}); +} + Object.extend(Canvas, { getModel: function(node) { @@ -624,29 +629,50 @@ }, addStyleSheet: function(id, src) { +if (id in Canvas.Styles) { + return; +} var head = document.getElementsByTagName(head)[0]; var link = document.createElement(link); -link.id = id; +link.id = cpsskins-style- + id; link.rel = stylesheet; link.href = src; link.type = text/css; head.appendChild(link); +Canvas.Styles[id] = src; }, removeStyleSheet: function(id) { -var style = document.getElementById(id); +if (id in Canvas.Styles) { + delete Canvas.Styles[id]; +} +var style = document.getElementById(cpsskins-style- + id); if (style) { style.parentNode.removeChild(style); } }, addScript: function(id, src) { +if (id in Canvas.Scripts) { + return; +} var head = document.getElementsByTagName(head)[0]; var script = document.createElement(script); -script.id = id; +script.id = cpsskins-script- + id; script.href = src; script.type = text/javascript; head.appendChild(script); +Canvas.Scripts[id] = src; + }, + + removeScript: function(id) { +if (id in Canvas.Scripts) { + delete Canvas.Scripts[src]; +} +var script = document.getElementById(cpsskins-script- + id); +if (script) { + script.parentNode.removeChild(script); +} } }); @@ -1097,24 +1123,28 @@ }, update: function() { -// getData() causes the view to get rendered. -this.getData(); +var data = this.getData(); +if (data) this.render(data); }, show: function() { if (this.visible) return; -this.prepare(); if (!this.def.model) { var model = Canvas.getModel(this.selected); if (model) { this.observe(model); + } else { +return; } } // get new data this.update(); +// prepare the view +this.prepare(); + if (this.effect) { this.effect.stop(); } @@ -1131,7 +1161,9 @@ }, hide: function() { -if (!this.visible) return; +if (!this.visible) { + return; +} var widget = this.widget; if (this.effect !this.effect.started) { @@ -1148,6 +1180,7 @@ this.visible = false; this.stopObserving(); +// tear down the view; this.teardown(); }, @@ -1226,7 +1259,7 @@ new Ajax.Request(url, options); CPSSkins.registerEventHandler(evt_id, view, function(event) { -view.update(); +view.getData(); }); CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); @@ -1270,13 +1303,13 @@ var url = data.url; var script = data.script; if (script) { - this.script_id = this.id; + this.script_id = this.def.name; Canvas.addScript(this.script_id, script); } var css = data.css; if (css) { - this.css_id = cpsskins-panel-css + this.id; + this.css_id = this.def.model; Canvas.addStyleSheet(this.css_id, css); } @@ -1298,13 +1331,15 @@ }, prepare: function() { -this.update(); },
[Z3lab-checkins] r2380 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator
Author: jmorliaguet Date: Mon Feb 13 23:45:45 2006 New Revision: 2380 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/feedbox.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/cpsskins_aggregator.pt Log: - converted the feed aggregator to templates Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/browser.py Mon Feb 13 23:45:45 2006 @@ -7,19 +7,25 @@ feeds_model_def = { id: feed%(id)s, -data: { -%(id)s: {text: } - }, - storage: { - type: remote, - refresh: %(id)s, - accessors: { - get: @@getFeed?id=%(id)s - } +data: {title: , text: , updated: }, +storage: { +type: remote, +refresh: %(id)s, +accessors: { +get: @@getFeed?id=%(id)s +} } } +feeds_view_def = { +widget: { +template: feedbox.html +}, +model: feed%(id)s +} + + feeds_data = { '1': May you live every day of your life. Jonathan Swift, '2': Only two things are infinite, the universe and human stupidity, @@ -34,15 +40,18 @@ class Views(BrowserView): -def citeFeed(self, id=1): +def citeFeedModel(self, id=1): return feeds_model_def % {'id': id} +def citeFeedView(self, id=1): +return feeds_view_def % {'id': id} + def getFeed(self, id=1): time.sleep(1) -data = {id: { -'text': feeds_data[id], -'updated': time.strftime(%a, %d %b %Y %H:%M:%S, time.gmtime()) -} +data = { + 'title': u'Feed #%s' % id, + 'text': feeds_data[id], + 'updated': time.strftime(%a, %d %b %Y %H:%M:%S, time.gmtime()) } return json.write(data) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/configure.zcml Mon Feb 13 23:45:45 2006 @@ -3,21 +3,34 @@ browser:page for=* - layer=cpsskins + layer=cpsskins-test name=cpsskins_aggregator.html permission=zope.Public template=cpsskins_aggregator.pt / + browser:page + for=* + layer=cpsskins-test + name=feedbox.html + permission=zope.Public + template=feedbox.pt + / + browser:pages - layer=cpsskins + layer=cpsskins-test for=* class=.browser.Views permission=zope.Public browser:page -name=citeFeed -attribute=citeFeed +name=citeFeedModel +attribute=citeFeedModel +/ + +browser:page +name=citeFeedView +attribute=citeFeedView / browser:page Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/cpsskins_aggregator.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/cpsskins_aggregator.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/aggregator/cpsskins_aggregator.pt Mon Feb 13 23:45:45 2006 @@ -9,6 +9,8 @@ type=text/javascript/script script src=/++skin++cpsskins/@@/++resource++json.js type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++ctal.js + type=text/javascript/script script src=/++skin++cpsskins/@@/++resource++cpsskins.js type=text/javascript/script link rel=stylesheet type=text/css @@ -31,52 +33,6 @@ } /style - script type=text/javascript - -Object.extend(Widgets, { - - feedbox: function(def) { -var widget = Canvas.createNode({ - tag: div, - classes: feeds -}); - -return new FeedBox(widget, def); - } - -}); - -FeedBox = Class.create(); -FeedBox.prototype = Object.extend(new CPSSkins.View(), { - - render: function(data) { -var widget = this.widget; -widget.innerHTML = ''; - -$R(1, 6).each(function(feed) { - var info = data[feed]; - - var box = Canvas.createNode({ -
[Z3lab-checkins] r2365 - cpsskins/branches/jmo-perspectives/ui/framework
Author: jmorliaguet Date: Sun Feb 12 15:53:53 2006 New Revision: 2365 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log: - fixed the form controller to make it work with templates Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js == --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sun Feb 12 15:53:53 2006 @@ -241,10 +241,13 @@ } else { /* generic widget type */ widget_type = def.widget.type; +if (!widget_type) { + CPSSkins.warn(Must specify a widget type or a template, el); +} else if (!(widget_type in Widgets)) { + CPSSkins.warn(Unknown widget type: + widget_type, el); +} } - if (widget_type !(widget_type in Widgets)) { -CPSSkins.warn(Unknown widget type: + widget_type, el); - } + factory = Widgets[widget_type]; view = factory(def); @@ -261,6 +264,8 @@ view.observe(model); }); CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); +} else { + CPSSkins.warn(Must specify a model for + view.inspect(), el); } /* register the controller */ @@ -269,7 +274,7 @@ var evt_id = registered controller + controller_id; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.target; -controller.register(view); +controller.control(view); }); CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); } @@ -280,6 +285,8 @@ var replaced = $(replace); if (replaced) { replaced.parentNode.replaceChild(view.widget, replaced); + } else { +CPSSkins.warn(Unknown node id: + replace, el); } } else { el.parentNode.insertBefore(view.widget, el); @@ -381,7 +388,7 @@ this.def = def; }, - register: function(view) { + control: function(view) { /* to override */ } @@ -403,7 +410,7 @@ CPSSkins.CommandController = Class.create(); CPSSkins.CommandController.prototype = Object.extend(new CPSSkins.Controller(), { - register: function(view) { + control: function(view) { var controller = this; view.controller = controller; @@ -434,26 +441,21 @@ CPSSkins.FormController = Class.create(); CPSSkins.FormController.prototype = Object.extend(new CPSSkins.Controller(), { - register: function(view) { + control: function(view) { +this.view = view; var controller = this; view.controller = controller; -var form = view.widget; - -// prevent the browser from posting the form directly -form.setAttribute(onsubmit, return false); - -if (form.tagName.toLowerCase() != 'form') { - CPSSkins.warn(A form controller requires a form widget., form); -} +var widget = view.widget; this.submitEvent = this.submitEvent.bindAsEventListener(this); -Event.observe(form, submit, this.submitEvent); +Event.observe(widget, submit, this.submitEvent); }, submitEvent: function(e) { -var widget = Event.element(e); -var model = widget.view.model; +var view = this.view; +var model = this.view.model; +var widget = this.view.widget; var form_data = {}; $A(Form.getInputs(widget)).each(function(i) { @@ -465,7 +467,6 @@ }); - // Identifiable DOM elements. if (!window.Identifiable) var Identifiable = new Object(); Object.extend(Identifiable, { @@ -1237,6 +1238,10 @@ }, + inspect: function() { +return [Widget + this.def.widget.template + ]; + }, + render: function(data) { if (this.source) { this.widget.innerHTML = this.source; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2366 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat
Author: jmorliaguet Date: Sun Feb 12 15:54:34 2006 New Revision: 2366 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt Log: - updated the chat demo to make it work with templates Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css Sun Feb 12 15:54:34 2006 @@ -0,0 +1,55 @@ + +div.chatbox { + padding: 0.5em; + border: 1px solid #999; + background-color: #cd9; +} + +form { + border: 1px solid #ccc; + background-color: #eee; + padding: 0.7em; + margin: 1em 0; +} + +label { + font: 14px arial, sans-serif; +} + +input { + border: 1px solid #999; + padding: 0.2em; + margin: 0 1em 0 0; + font: 14px arial, sans-serif; +} + +input:focus { + background-color: #efc; +} + +button { + background-color: #efc; + border: 1px solid #999; + padding: 0.2em; + margin: 0 1em 0 0; + font: 15px arial, sans-serif; +} + +div.message { + border: 1px solid #999; + background-color: #efc; + padding: 0.5em; + margin: 0.2em; + font: 13px arial, sans-serif; +} + +div.status { + border: 1px solid #000; + background-color: #fc0; + padding: 0.5em; + margin: 0.3em 0; + margin-bottom: 1em; + position: absolute; + top: 40px; + right: 20px; +} Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt Sun Feb 12 15:54:34 2006 @@ -1,3 +1,18 @@ -form method=post - not done yet +form action= method=post onsubmit=return false + + div class=status ctal:condition=status + ctal:content=statusstatus message/div + + input type=hidden name=status value=Sending message... / + + labelYour message: +input id=messagearea type=text name=input size=40 / + /label + + labelChat as: +input type=text name=user ctal:attributes=value user / + /label + + button type=submitSEND!/button + /form Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml Sun Feb 12 15:54:34 2006 @@ -1,9 +1,13 @@ configure xmlns:browser=http://namespaces.zope.org/browser; + browser:resource + name=chat.css file=chat.css + layer=cpsskins-test / + browser:page for=* - layer=cpsskins + layer=cpsskins-test name=cpsskins_chat.html permission=zope.Public template=cpsskins_chat.pt @@ -11,22 +15,22 @@ browser:page for=* - layer=cpsskins - name=chatinput.html + layer=cpsskins-test + name=chatbox.html permission=zope.Public - template=chatinput.pt + template=chatbox.pt / browser:page for=* - layer=cpsskins - name=chatbox.html + layer=cpsskins-test + name=chatinput.html permission=zope.Public - template=chatbox.pt + template=chatinput.pt / browser:pages - layer=cpsskins + layer=cpsskins-test for=* class=.browser.Views permission=zope.Public Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt Sun Feb 12 15:54:34 2006 @@ -16,134 +16,8 @@ link rel=stylesheet type=text/css href=/++skin++cpsskins/@@/++resource++cpsskins.css / - style type=text/css -div.chatbox { - padding: 0.5em; - border: 1px solid #999; - background-color: #cd9; -} - -form { - padding: 1em 0; -} - -input { - border: 1px solid #999; - padding: 0.2em; - margin: 0 1em 0 0; - font: 15px verdana, arial, sans-serif; -} - -input:focus { - background-color: #efc; -} - -button { -