Author: jmorliaguet Date: Tue Apr 18 10:17:25 2006 New Revision: 2862 Added: cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor_form.ctal (contents, props changed) cpsskins/branches/jmo-perspectives/ui/framework/misc.js (contents, props changed) cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/green-arrow-left.png (contents, props changed) Removed: cpsskins/branches/jmo-perspectives/standard/filters/effect/effect_editor.pt cpsskins/branches/jmo-perspectives/standard/filters/effect/views.py cpsskins/branches/jmo-perspectives/standard/filters/widget/widget_editor.pt cpsskins/branches/jmo-perspectives/ui/editing/edit_control.pt cpsskins/branches/jmo-perspectives/ui/editing/edit_menu.pt cpsskins/branches/jmo-perspectives/ui/editing/edit_panel.pt cpsskins/branches/jmo-perspectives/ui/editing/editing.css cpsskins/branches/jmo-perspectives/ui/editing/portlet_editor.js cpsskins/branches/jmo-perspectives/ui/editing/portlet_editor.pt Modified: cpsskins/branches/jmo-perspectives/configuration/portlets/metaconfigure.py cpsskins/branches/jmo-perspectives/doc/local-portlets.txt cpsskins/branches/jmo-perspectives/doc/portlet-ordering.txt cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt cpsskins/branches/jmo-perspectives/locales/custom.pot cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.mo cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.po cpsskins/branches/jmo-perspectives/locales/fr/LC_MESSAGES/cpsskins.po cpsskins/branches/jmo-perspectives/standard/filters/effect/configure.zcml cpsskins/branches/jmo-perspectives/standard/filters/style/configure.zcml cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.js cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.pt cpsskins/branches/jmo-perspectives/standard/filters/style/views.py cpsskins/branches/jmo-perspectives/standard/filters/widget/configure.zcml cpsskins/branches/jmo-perspectives/standard/formats/effect.py cpsskins/branches/jmo-perspectives/standard/formats/layout.py cpsskins/branches/jmo-perspectives/standard/io/element.py cpsskins/branches/jmo-perspectives/standard/io/page.py cpsskins/branches/jmo-perspectives/standard/io/setting.py cpsskins/branches/jmo-perspectives/standard/io/settings.py cpsskins/branches/jmo-perspectives/standard/io/theme.py cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py cpsskins/branches/jmo-perspectives/ui/authoring/views.py cpsskins/branches/jmo-perspectives/ui/editing/configure.zcml cpsskins/branches/jmo-perspectives/ui/editing/edit.pt cpsskins/branches/jmo-perspectives/ui/editing/views.py cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/panels/element_editor.pt cpsskins/branches/jmo-perspectives/ui/screens/editor.pt cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/configure.zcml cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/element-editor.css cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/cell.pt cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/pageblock.pt cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/slot.pt Log:
- saving yesterday's work Modified: cpsskins/branches/jmo-perspectives/configuration/portlets/metaconfigure.py ============================================================================== --- cpsskins/branches/jmo-perspectives/configuration/portlets/metaconfigure.py (original) +++ cpsskins/branches/jmo-perspectives/configuration/portlets/metaconfigure.py Tue Apr 18 10:17:25 2006 @@ -67,19 +67,8 @@ for_=schema, file=icon) - # browser:editform - from zope.app.menus import zmi_views, cpsskins_add_portlet - EditFormDirective(_context=_context, - schema = schema, - name = 'edit.html', - title = 'Edit', - template = ui_path + '/editing/portlet_editor.pt', - permission="zope.ManageContent", - menu=zmi_views, - )() - - # browser:addMenuItem + from zope.app.menus import cpsskins_add_portlet addMenuItem(_context=_context, menu=cpsskins_add_portlet, for_=Interface, Modified: cpsskins/branches/jmo-perspectives/doc/local-portlets.txt ============================================================================== --- cpsskins/branches/jmo-perspectives/doc/local-portlets.txt (original) +++ cpsskins/branches/jmo-perspectives/doc/local-portlets.txt Tue Apr 18 10:17:25 2006 @@ -12,7 +12,7 @@ Let us create a slot: - >>> slot = Slot(_slot=u'Right') + >>> slot = Slot(slot=u'Right') >>> slot.identifier = 2 And a perspective: @@ -80,9 +80,9 @@ If two *different* slots have the *same slot name*, they will display the same portlets: - >>> slotA = Slot(_slot=u'Some slot') + >>> slotA = Slot(slot=u'Some slot') >>> slotA.identifier = 5 - >>> slotB = Slot(_slot=u'Some slot') + >>> slotB = Slot(slot=u'Some slot') >>> slotB.identifier = 6 >>> relationA = Triad( Modified: cpsskins/branches/jmo-perspectives/doc/portlet-ordering.txt ============================================================================== --- cpsskins/branches/jmo-perspectives/doc/portlet-ordering.txt (original) +++ cpsskins/branches/jmo-perspectives/doc/portlet-ordering.txt Tue Apr 18 10:17:25 2006 @@ -1,3 +1,4 @@ +================ PORTLET ORDERING ================ @@ -15,8 +16,8 @@ >>> from cpsskins.elements.slot import Slot >>> theme = addThemeSkeleton(tmutil) - >>> slot_A = Slot(_slot=u'A') - >>> slot_B = Slot(_slot=u'B') + >>> slot_A = Slot(slot=u'A') + >>> slot_B = Slot(slot=u'B') >>> theme[u'page'][u'block'][u'cell'][u'slot_a'] = slot_A >>> theme[u'page'][u'block'][u'cell'][u'slot_b'] = slot_B Modified: cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt ============================================================================== --- cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt (original) +++ cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt Tue Apr 18 10:17:25 2006 @@ -199,6 +199,8 @@ ... return widget_filter(rendered, info) >>> rendered = u'<h1>Test of HTML</h1>' + >>> info.data = None + >>> test_render(widget, rendered, info) u'<div><h1>Test of HTML</h1></div>' @@ -246,6 +248,7 @@ Widgets displaying HTML markup ------------------------------ + >>> info.data = None >>> rendered = '<h1>Test of HTML</h1>' a) frame box Modified: cpsskins/branches/jmo-perspectives/locales/custom.pot ============================================================================== --- cpsskins/branches/jmo-perspectives/locales/custom.pot (original) +++ cpsskins/branches/jmo-perspectives/locales/custom.pot Tue Apr 18 10:17:25 2006 @@ -29,6 +29,15 @@ # Portlets +msgid "canvas-portlet-standard.custom" +msgstr "" + +msgid "canvas-portlet-standard.breadcrumbs" +msgstr "" + +msgid "canvas-portlet-standard.image" +msgstr "" + msgid "canvas-portlet-standard.actions" msgstr "" Modified: cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.mo ============================================================================== Binary files. No diff available. Modified: cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.po ============================================================================== --- cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.po (original) +++ cpsskins/branches/jmo-perspectives/locales/en/LC_MESSAGES/cpsskins.po Tue Apr 18 10:17:25 2006 @@ -391,9 +391,8 @@ # Portlets #: src/cpsskins/elements/formats/interfaces.py:73 -#, fuzzy msgid "Image format" -msgstr "Image portlet" +msgstr "Image format" #: src/cpsskins/elements/formats/interfaces.py:74 msgid "The format used for displaying the image." @@ -598,6 +597,18 @@ msgstr "Effect" # Portlets +msgid "canvas-portlet-standard.custom" +msgstr "Custom portlet" + +# Portlets +msgid "canvas-portlet-standard.breadcrumbs" +msgstr "Breadcrumbs portlet" + +# Portlets +msgid "canvas-portlet-standard.image" +msgstr "Image portlet" + +# Portlets msgid "canvas-portlet-standard.actions" msgstr "Actions portlet" Modified: cpsskins/branches/jmo-perspectives/locales/fr/LC_MESSAGES/cpsskins.po ============================================================================== --- cpsskins/branches/jmo-perspectives/locales/fr/LC_MESSAGES/cpsskins.po (original) +++ cpsskins/branches/jmo-perspectives/locales/fr/LC_MESSAGES/cpsskins.po Tue Apr 18 10:17:25 2006 @@ -622,6 +622,18 @@ msgstr "" # Portlets +msgid "canvas-portlet-standard.custom" +msgstr "" + +# Portlets +msgid "canvas-portlet-standard.breadcrumbs" +msgstr "" + +# Portlets +msgid "canvas-portlet-standard.image" +msgstr "" + +# Portlets msgid "canvas-portlet-standard.actions" msgstr "" Modified: cpsskins/branches/jmo-perspectives/standard/filters/effect/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/effect/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/effect/configure.zcml Tue Apr 18 10:17:25 2006 @@ -3,14 +3,6 @@ xmlns:browser="http://namespaces.zope.org/browser" xmlns:cpsskins="http://namespaces.zope.org/cpsskins"> - <browser:page - name="edit.html" - for="cpsskins.standard.formats.effect.IEffect" - class=".views.EffectEditor" - template="effect_editor.pt" - permission="zope.ManageContent" - /> - <!-- Effect filter: transforms images --> <cpsskins:filter Modified: cpsskins/branches/jmo-perspectives/standard/filters/style/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/style/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/style/configure.zcml Tue Apr 18 10:17:25 2006 @@ -66,8 +66,25 @@ attribute="renderPreview" /> + <browser:page + name="getData" + attribute="getData" + /> + + <browser:page + name="setData" + attribute="setData" + /> + </browser:pages> + <browser:page + for="*" + name="style-editor-form.html" + permission="zope.Public" + template="style_editor_form.ctal" + /> + <!-- Stylesheets --> <adapter Modified: cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.js ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.js (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.js Tue Apr 18 10:17:25 2006 @@ -259,6 +259,7 @@ /* Setup */ function setupEditor(widget_type) { + alert('123'); message_box = $('messageBox'); preview_area = $('previewArea'); widget_area = $('widgetArea'); Modified: cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.pt (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor.pt Tue Apr 18 10:17:25 2006 @@ -1,68 +1,33 @@ -<html metal:use-macro="context/@@popup_macros/page"> - <head> - <tal:style metal:fill-slot="style"> - <link rel="Stylesheet" type="text/css" - href="/++skin++cpsskins/@@/++resource++widgets.css" /> - <link rel="Stylesheet" type="text/css" - href="/++skin++cpsskins/@@/++resource++style_editor.css" /> - </tal:style> - <tal:script metal:fill-slot="script"> - <script type="text/javascript" - src="/++skin++cpsskins/@@/++resource++prototype.js"></script> - <script type="text/javascript" - src="/++skin++cpsskins/@@/++resource++utils.js"></script> - <script type="text/javascript" - src="/++skin++cpsskins/@@/++resource++json.js"></script> - <script type="text/javascript" - src="/++skin++cpsskins/@@/++resource++style_editor.js"></script> - </tal:script> - <tal:head metal:fill-slot="head"> - <style type="text/css" id="style"> - - </style> - </tal:head> - </head> - - <body metal:fill-slot="body" i18n:domain="cpsskins" +<div i18n:domain="cpsskins" tal:define="displays context/findDisplays; display python: displays[0]; + id context/identifier; widget display/formattable:widget; - widget_type widget/type"> - - <div class="editArea"> - <h1>Style editor</h1> - </div> - - <!-- the style editor --> - <div id="editor"> - <div class="left"> - <!-- Style preview --> - <div class="header">Preview</div> - <div id="previewArea"> - <div id="widgetArea"> - </div> - </div> - </div> - <div class="right"> - <!-- Edit form --> - <div class="header">Style properties</div> - <div id="formArea" style="text-align: left"> - Click on the preview. - </div> - </div> - </div> - - <!-- information area --> - <div id="messageBox"> - </div> + widget_types widget/types; + widget_type python:widget_types[0]"> - <!-- tooltip --> - <div id="tooltipBox"> - </div> + <ins class="model" tal:content="python: view.getModel(id)" /> - <!-- Set up the editor --> - <script type="text/javascript" - tal:content="string:setupEditor('${widget_type}')" /> + <a tal:repeat="type widget_types" + tal:content="type" + tal:attributes="href string:javascript:CPSSkins.getModelById('style-editor').updateData({'widget': '$type'});" /> + + <table width="100%"> + <tr> + <td width="50%" valign="top" + tal:content="structure python: view.renderPreview(widget_type)" /> + + <td width="50%" valign="top"> + <ins class="view"> + {"id": "style-editor", + "widget": { + "template": "@@style-editor-form.html" + }, + "model": "style-editor" + } + </ins> + </td> + </tr> + </table> - </body> -</html> +</div> Added: cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor_form.ctal ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/standard/filters/style/style_editor_form.ctal Tue Apr 18 10:17:25 2006 @@ -0,0 +1,15 @@ +<form action="" method="post" onsubmit="return false"> + + <p ctal:repeat="f fields"> + + <label ctal:content="f/label">LABEL</label> + <input ctal:attributes="value f/value; name f/name" /> + <span class="status" ctal:condition="f/status" + ctal:content="f/status">STATUS</span> + </p> + + <p> + <button type="submit">Save</button> + </p> + +</form> Modified: cpsskins/branches/jmo-perspectives/standard/filters/style/views.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/style/views.py (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/style/views.py Tue Apr 18 10:17:25 2006 @@ -18,17 +18,41 @@ __docformat__ = "reStructuredText" from zope.component import getUtility -from zope.app.form.browser.editview import EditView +from zope.app import zapi from zope.app.publisher.browser import BrowserView from cpsskins import configuration from cpsskins import minjson as json from cpsskins.standard.formats.style import IStyle +from cpsskins.utils import getThemeManager -class StyleEditor(EditView): +class StyleEditor(BrowserView): """Style editor view""" - schema = IStyle + def renderPreview(self, widget_type): + """Render a style preview based on the specified widget. + """ + widget = getUtility(configuration.IWidget, widget_type) + return widget.view(None, None).renderPreview() + + def getModel(self, id): + tmutil = getThemeManager() + style = tmutil.getElementById(id) + style_path = zapi.getPath(style) + return json.write({ + 'id': 'style-editor', + 'storage': { + 'type': 'remote', + 'accessors': { + 'get': '/++skin++cpsskins/%s/@@getData' % style_path, + 'set': '/++skin++cpsskins/%s/@@setData' % style_path, + } + }, + 'data': { + 'widget': '', + 'fields': [], + }, + }) class JSONView(BrowserView): """JSON methods @@ -56,6 +80,9 @@ {u'div.body': {'color': 'red'}} """ + def getWidgetType(self): + return + def getWidgetStyle(self): return json.write(dict(self.context)) @@ -87,3 +114,22 @@ widget = getUtility(configuration.IWidget, widget_type) return widget.view(None, None).renderPreview() + def setData(self, data): + print data + + def getData(self): + fields = [] + for f in u'color', u'background-color', u'padding', u'border': + fields.append({ + 'name': f, + 'label': f, + 'value': self.context.get(f, default=u''), + 'disabled': False, + 'status': u'', + }) + data = { + 'fields': fields, + 'widget': '' + } + self.request.response.setHeader('content-type', 'text/x-json') + return json.write(data) Modified: cpsskins/branches/jmo-perspectives/standard/filters/widget/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/filters/widget/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/standard/filters/widget/configure.zcml Tue Apr 18 10:17:25 2006 @@ -3,14 +3,6 @@ xmlns:browser="http://namespaces.zope.org/browser" xmlns:cpsskins="http://namespaces.zope.org/cpsskins"> - <browser:page - name="edit.html" - for="cpsskins.standard.formats.widget.IWidget" - class=".views.WidgetEditor" - template="widget_editor.pt" - permission="zope.ManageContent" - /> - <!-- Widget filter: presents data by means of widgets --> <cpsskins:filter Modified: cpsskins/branches/jmo-perspectives/standard/formats/effect.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/formats/effect.py (original) +++ cpsskins/branches/jmo-perspectives/standard/formats/effect.py Tue Apr 18 10:17:25 2006 @@ -37,7 +37,7 @@ types = List( title=_(u"Effect"), description=_(u"The type of effect to apply."), - #vocabulary="effects bytype") + value_type=Choice(vocabulary='effects by type'), ) format = Choice( Modified: cpsskins/branches/jmo-perspectives/standard/formats/layout.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/formats/layout.py (original) +++ cpsskins/branches/jmo-perspectives/standard/formats/layout.py Tue Apr 18 10:17:25 2006 @@ -83,6 +83,9 @@ def __contains__(self, k): return k in self.data + def keys(self): + return list(self.data.keys()) + def items(self): return self.data.items() Modified: cpsskins/branches/jmo-perspectives/standard/io/element.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/io/element.py (original) +++ cpsskins/branches/jmo-perspectives/standard/io/element.py Tue Apr 18 10:17:25 2006 @@ -69,5 +69,4 @@ def load(self, xml=u''): context = self.context dom = parseString(xml) - print dom Modified: cpsskins/branches/jmo-perspectives/standard/io/page.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/io/page.py (original) +++ cpsskins/branches/jmo-perspectives/standard/io/page.py Tue Apr 18 10:17:25 2006 @@ -65,5 +65,4 @@ context = self.context dom = parseString(xml) # TODO - print dom Modified: cpsskins/branches/jmo-perspectives/standard/io/setting.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/io/setting.py (original) +++ cpsskins/branches/jmo-perspectives/standard/io/setting.py Tue Apr 18 10:17:25 2006 @@ -67,5 +67,4 @@ def load(self, dom): context = self.context - print dom Modified: cpsskins/branches/jmo-perspectives/standard/io/settings.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/io/settings.py (original) +++ cpsskins/branches/jmo-perspectives/standard/io/settings.py Tue Apr 18 10:17:25 2006 @@ -59,5 +59,4 @@ def load(self, dom): context = self.context - print dom Modified: cpsskins/branches/jmo-perspectives/standard/io/theme.py ============================================================================== --- cpsskins/branches/jmo-perspectives/standard/io/theme.py (original) +++ cpsskins/branches/jmo-perspectives/standard/io/theme.py Tue Apr 18 10:17:25 2006 @@ -65,5 +65,4 @@ context = self.context dom = parseString(xml) # TODO - print dom 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.js Tue Apr 18 10:17:25 2006 @@ -25,22 +25,51 @@ } var options = { 'parameters': $H(args).toQueryString(), - 'onComplete': function(req) { - } }; new Ajax.Request(url, options); } function editElement(info) { var id = info.target.getAttribute('targetid'); - CPSSkins.getModelById('element-editor').setData({'form': {'id': id, 'format': ''} }); + CPSSkins.getModelById('element-editor').updateData({'form': {'id': id, 'format': ''} }); CPSSkins.getControllerById('main-editor-perspectives').switchTo('element-editor') } +function duplicateElement(info) { + var url = '@@duplicateElement' + var args = { + 'id': info.target.getAttribute('id') + } + var options = { + 'parameters': $H(args).toQueryString(), + 'onComplete': function(req) { + var controller = info.context; + controller.refreshViews(); + } + } + new Ajax.Request(url, options); +} + +function deleteElement(info) { + var url = '@@deleteElement' + var args = { + 'id': info.target.getAttribute('id') + } + var options = { + 'parameters': $H(args).toQueryString(), + 'onComplete': function(req) { + var controller = info.context; + controller.refreshViews(); + } + } + new Ajax.Request(url, options); +} + /* Register actions */ CPSSkins.addActions({ 'insert portlet': insertPortlet, 'move element': moveElement, + 'duplicate element': duplicateElement, 'edit element': editElement }); 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 Tue Apr 18 10:17:25 2006 @@ -19,6 +19,7 @@ 'form': { 'id': '', 'format': '', + 'data': {} }, } }, Modified: cpsskins/branches/jmo-perspectives/ui/authoring/views.py ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/authoring/views.py (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/views.py Tue Apr 18 10:17:25 2006 @@ -152,7 +152,7 @@ """ return getThemeManager().getElementById(id) - def renderElement(self, id='1700182219', engine=u'default'): + def renderElement(self, id=u'', engine=u'default'): """Render the element and return the markup """ element = self._getElementById(id) @@ -165,7 +165,12 @@ """Edit the element: assign a value to an attribute (name). """ element = self._getElementById(id) - element.name = value + _marker = object() + + if getattr(element, name, _marker) is not _marker: + setattr(element, name, value) + else: + element[name] = value def copyElement(self, id): """Copy an element to the clipboard. Modified: cpsskins/branches/jmo-perspectives/ui/editing/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/editing/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/editing/configure.zcml Tue Apr 18 10:17:25 2006 @@ -9,31 +9,6 @@ <!--.editing.Editing pages --> - <resource - name="editing.css" file="editing.css" - layer="cpsskins.browser.skin.cpsskins" /> - - <page - for="*" - name="edit-panel.html" - permission="zope.ManageContent" - template="edit_panel.pt" - /> - - <page - for="*" - name="edit-menu.html" - permission="zope.ManageContent" - template="edit_menu.pt" - /> - - <page - for="*" - name="edit-control.html" - permission="zope.ManageContent" - template="edit_control.pt" - /> - <page for="*" name="create-setting.html" @@ -109,6 +84,14 @@ </pages> + <page + for="cpsskins.elements.interfaces.IElement" + layer="cpsskins.browser.skin.cpsskins" + name="edit.html" + permission="zope.ManageContent" + template="edit.pt" + /> + <pages for="cpsskins.elements.interfaces.IElement" layer="cpsskins.browser.skin.cpsskins" @@ -130,13 +113,6 @@ <include package=".icons" /> - <!-- Portlet editor --> - - <resource - name="portlet_editor.js" file="portlet_editor.js" - layer="cpsskins.browser.skin.cpsskins" /> - - <!-- Presentation editor --> <page @@ -154,51 +130,4 @@ action="@@edit-menu.html?main_url=@@presentation-editor.html" /> - <!-- Canvas element editor --> - - <editform - schema="cpsskins.elements.interfaces.ITheme" - for="cpsskins.elements.interfaces.ITheme" - layer="cpsskins.browser.skin.cpsskins" - name="edit.html" - template="edit.pt" - permission="zope.ManageContent" - /> - - <editform - schema="cpsskins.elements.interfaces.IThemePage" - for="cpsskins.elements.interfaces.IThemePage" - layer="cpsskins.browser.skin.cpsskins" - name="edit.html" - template="edit.pt" - permission="zope.ManageContent" - /> - - <editform - schema="cpsskins.elements.interfaces.IPageBlock" - for="cpsskins.elements.interfaces.IPageBlock" - layer="cpsskins.browser.skin.cpsskins" - name="edit.html" - template="edit.pt" - permission="zope.ManageContent" - /> - - <editform - schema="cpsskins.elements.interfaces.ICell" - for="cpsskins.elements.interfaces.ICell" - layer="cpsskins.browser.skin.cpsskins" - name="edit.html" - template="edit.pt" - permission="zope.ManageContent" - /> - - <editform - schema="cpsskins.elements.interfaces.ISlot" - for="cpsskins.elements.interfaces.ISlot" - layer="cpsskins.browser.skin.cpsskins" - name="edit.html" - template="edit.pt" - permission="zope.ManageContent" - /> - </configure> Modified: cpsskins/branches/jmo-perspectives/ui/editing/edit.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/editing/edit.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/editing/edit.pt Tue Apr 18 10:17:25 2006 @@ -1,24 +1,11 @@ -<html metal:use-macro="context/@@popup_macros/page"> - <body metal:fill-slot="body" i18n:domain="cpsskins"> - <div class="editArea"> - <h1 tal:define="title context/title|context|nothing" - tal:condition="title">Edit <tal:block content="title" /></h1> - <p class="statusMsg" - tal:define="status view/update" - tal:condition="status" - tal:content="status" /> - <div class="main"> - <form enctype="multipart/form-data" method="post" - action="." tal:attributes="action request/URL"> - <tal:block metal:use-macro="context/@@form_macros/widget_rows" /> - <p> - <button type="submit" class="submitButton" name="UPDATE_SUBMIT" - i18n:translate="save-button">Save</button> - </p> - </form> - </div> - </div> - </body> -</html> + <form action="." tal:attributes="action string:${context/@@absolute_url}/@@submitFormData"> + <table> + <tr tal:repeat="formdata context/@@getFormData"> + <td tal:content="formdata/label" /> + <td tal:content="structure formdata" /> + </tr> + </table> + <button type="submit">SAVE</button> + </form> Modified: cpsskins/branches/jmo-perspectives/ui/editing/views.py ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/editing/views.py (original) +++ cpsskins/branches/jmo-perspectives/ui/editing/views.py Tue Apr 18 10:17:25 2006 @@ -107,6 +107,7 @@ changed = form.applyChanges(self.context, self.form_fields, data) + print changed return '' Modified: cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml Tue Apr 18 10:17:25 2006 @@ -26,6 +26,10 @@ name="ctal.js" file="ctal.js" layer="cpsskins.browser.skin.cpsskins" /> + <resource + name="misc.js" file="misc.js" + layer="cpsskins.browser.skin.cpsskins" /> + <!-- Testing --> <resource 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 Apr 18 10:17:25 2006 @@ -284,10 +284,10 @@ controller = factory(node, def); this._controllers[id] = controller; } + CPSSkins.notify("registered controller", + {'publisher': controller, 'scope': id} + ); } - CPSSkins.notify("registered controller", - {'publisher': controller, 'scope': id} - ); break; } @@ -296,10 +296,10 @@ if (!model) { model = new CPSSkins.Model(node, def); this._models[id] = model; + CPSSkins.notify("registered model", + {'publisher': model, 'scope': id} + ); } - CPSSkins.notify("registered model", - {'publisher': model, 'scope': id} - ); break; } @@ -608,7 +608,7 @@ unregister: function(view) { Event.stopObserving(view.widget, "click", this.clickEvent); - Event.stopObserving(view.widget, "submit", this.clickEvent); + Event.stopObserving(view.widget, "submit", this.submitEvent); }, submitEvent: function(e) { @@ -1776,6 +1776,7 @@ this.widget = widget; this.def = def; this._visible = false; + this._displayed = true; this.setup(); }, @@ -1871,13 +1872,19 @@ } }, + focus: function() { + CPSSkins.notify("gained focus", {'publisher': this, + 'context': this.selected}); + }, + + defocus: function() { + CPSSkins.notify("lost focus", {'publisher': this}); + }, + show: function() { if (this._visible || !this._displayed) return; var widget = $(this.widget); - CPSSkins.notify("gained focus", {'publisher': this, - 'context': this.selected}); - this._visible = true; // refresh the view @@ -1902,8 +1909,6 @@ } else { widget.hide(); } - CPSSkins.notify("lost focus", {'publisher': this}); - // tear down the view; this.teardown(); this._visible = false; @@ -2016,6 +2021,7 @@ ); } + this._visible = true; }, inspect: function() { @@ -2039,10 +2045,6 @@ CPSSkins.Panel = Class.create(); CPSSkins.Panel.prototype = Object.extend(new CPSSkins.View(), { - setup: function() { - this._displayed = true; - }, - inspect: function() { return '[CPSSkins Panel]'; }, @@ -2304,11 +2306,13 @@ this.selected = selected; this._displayed = true; + this.focus(); this.show(); }, hideEvent: function(e) { this._displayed = false; + this.defocus(); this.hide(); }, @@ -2444,6 +2448,7 @@ } this._displayed = true; + this.focus(); this.show(); Event.stop(e); }, @@ -2464,6 +2469,7 @@ } this._displayed = false; + this.defocus(); this.hide(); Event.stop(e); } Added: cpsskins/branches/jmo-perspectives/ui/framework/misc.js ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/misc.js Tue Apr 18 10:17:25 2006 @@ -0,0 +1,136 @@ + +function moveItems(from, to) + { + // shortcuts for selection fields + var src = document.getElementById(from); + var tgt = document.getElementById(to); + + if (src.selectedIndex == -1) selectionError(); + else + { + // iterate over all selected items + // --> attribute "selectedIndex" doesn't support multiple selection. + // Anyway, it works here, as a moved item isn't selected anymore, + // thus "selectedIndex" indicating the "next" selected item :) + while (src.selectedIndex > -1) + if (src.options[src.selectedIndex].selected) + { + // create a new virtal object with values of item to copy + temp = new Option(src.options[src.selectedIndex].text, + src.options[src.selectedIndex].value); + // append virtual object to targe + tgt.options[tgt.length] = temp; + // want to select newly created item + temp.selected = true; + // delete moved item in source + src.options[src.selectedIndex] = null; + } + } + } + +// move item from "from" selection to "to" selection +function from2to(name) + { + moveItems(name+".from", name+".to"); + copyDataForSubmit(name); + } + +// move item from "to" selection back to "from" selection +function to2from(name) + { + moveItems(name+".to", name+".from"); + copyDataForSubmit(name); + } + +function swapFields(a, b) + { + // swap text + var temp = a.text; + a.text = b.text; + b.text = temp; + // swap value + temp = a.value; + a.value = b.value; + b.value = temp; + // swap selection + temp = a.selected; + a.selected = b.selected; + b.selected = temp; + } + +// move selected item in "to" selection one up +function moveUp(name) + { + // shortcuts for selection field + var toSel = document.getElementById(name+".to"); + + if (toSel.selectedIndex == -1) + selectionError(); + else if (toSel.options[0].selected) + alert("Cannot move further up!"); + else for (var i = 0; i < toSel.length; i++) + if (toSel.options[i].selected) + { + swapFields(toSel.options[i-1], toSel.options[i]); + copyDataForSubmit(name); + } + } + +// move selected item in "to" selection one down +function moveDown(name) + { + // shortcuts for selection field + var toSel = document.getElementById(name+".to"); + + if (toSel.selectedIndex == -1) { + selectionError(); + } else if (toSel.options[toSel.length-1].selected) { + alert("Cannot move further down!"); + } else { + for (var i = toSel.length-1; i >= 0; i--) { + if (toSel.options[i].selected) { + swapFields(toSel.options[i+1], toSel.options[i]); + } + } + copyDataForSubmit(name); + } + } + +// copy each item of "toSel" into one hidden input field +function copyDataForSubmit(name) + { + // shortcuts for selection field and hidden data field + var toSel = document.getElementById(name+".to"); + var toDataContainer = document.getElementById(name+".toDataContainer"); + + // delete all child nodes (--> complete content) of "toDataContainer" span + while (toDataContainer.hasChildNodes()) + toDataContainer.removeChild(toDataContainer.firstChild); + + // create new hidden input fields - one for each selection item of + // "to" selection + for (var i = 0; i < toSel.options.length; i++) + { + // create virtual node with suitable attributes + var newNode = document.createElement("input"); + var newAttr = document.createAttribute("name"); + newAttr.nodeValue = name; + newNode.setAttributeNode(newAttr); + + newAttr = document.createAttribute("type"); + newAttr.nodeValue = "hidden"; + newNode.setAttributeNode(newAttr); + + newAttr = document.createAttribute("value"); + newAttr.nodeValue = toSel.options[i].value; + newNode.setAttributeNode(newAttr); + + // actually append virtual node to DOM tree + toDataContainer.appendChild(newNode); + } + } + +// error message for missing selection +function selectionError() + {alert("Must select something!")} + Modified: cpsskins/branches/jmo-perspectives/ui/panels/element_editor.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/panels/element_editor.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/panels/element_editor.pt Tue Apr 18 10:17:25 2006 @@ -7,34 +7,33 @@ edited nocall:info/edited"> <a class="back" - href="javascript:CPSSkins.getControllerById('main-editor-perspectives').goBack()">< Back to the editor</a> + href="javascript:CPSSkins.getControllerById('main-editor-perspectives').goBack()">Back to the editor</a> - <h1 tal:content="element/title" /> - - <p class="description" tal:content="element/description" /> + <h1 class="title" tal:define="title element/title"> + <tal:block condition="not:title" i18n:translate="" + content="info/element/name" /> + <tal:block condition="title" + content="title" /> + </h1> + + <p class="description" tal:define="description element/description|nothing" + tal:condition="description" + tal:content="description" /> <div class="tabs"> <a i18n:translate="" tal:attributes=" - href string:javascript:CPSSkins.getModelById('element-editor').updateData({'form': {'id': $id, 'format': ''}})" + href string:javascript:CPSSkins.getModelById('element-editor').updateData({'form': {'id': '$id', 'format': ''}})" tal:content="info/element/name" /> <a i18n:translate="" tal:repeat="format info/formats" tal:attributes=" - href string:javascript:CPSSkins.getModelById('element-editor').updateData({'form': {'id': $id, 'format': '${format/id}'}})" + href string:javascript:CPSSkins.getModelById('element-editor').updateData({'form': {'id': '$id', 'format': '${format/id}'}})" tal:content="format/name" /> </div> - <form action="." tal:attributes="action string:${edited/@@absolute_url}/@@submitFormData"> - <table> - <tr tal:repeat="formdata edited/@@getFormData"> - <td tal:content="formdata/label" /> - <td tal:content="structure formdata" /> - </tr> - </table> - - <button type="submit">SAVE</button> - </form> + <div class="form" + tal:content="structure edited/@@edit.html" /> </tal:block> Modified: cpsskins/branches/jmo-perspectives/ui/screens/editor.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/editor.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/editor.pt Tue Apr 18 10:17:25 2006 @@ -10,6 +10,9 @@ href="/++skin++cpsskins/@@/++resource++widgets.css" /> <script type="text/javascript" + src="/++skin++cpsskins/@@/++resource++misc.js"></script> + + <script type="text/javascript" src="/++skin++cpsskins/@@/++resource++prototype.js"></script> <script type="text/javascript" src="/++skin++cpsskins/@@/++resource++json.js"></script> Modified: cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/configure.zcml Tue Apr 18 10:17:25 2006 @@ -9,4 +9,10 @@ layer="cpsskins.browser.skin.cpsskins" /> + <resource + name="green-arrow-left.png" + file="green-arrow-left.png" + layer="cpsskins.browser.skin.cpsskins" + /> + </configure> Modified: cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/element-editor.css ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/element-editor.css (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/element-editor.css Tue Apr 18 10:17:25 2006 @@ -1,5 +1,5 @@ -h1 { +h1.title { letter-spacing: -0.03em; font-size: 160%; font-weight: normal; @@ -22,8 +22,11 @@ a.back { border: 1px solid #ccc; background-color: #efc; - padding: 0.2em; + padding: 0.2em 4px 0.2em 18px; + font: 11px verdana; float: right; + background-image: url(/++skin++cpsskins/@@/++resource++green-arrow-left.png); + background-repeat: no-repeat; } div.tabs a { @@ -35,12 +38,12 @@ margin-right: 2px; } -form { +div.form { border: 1px solid #666; padding: 1em; } -button, input { +div.form button, div.form input, div.form textarea { border: 1px solid #999; padding: 0.2em; } Added: cpsskins/branches/jmo-perspectives/ui/screens/elementeditor/green-arrow-left.png ============================================================================== Binary file. No diff available. Modified: cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/cell.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/cell.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/cell.pt Tue Apr 18 10:17:25 2006 @@ -1,41 +1,37 @@ <td class="editable draggable" destination="cell" style="vertical-align:top" tal:define=" info options/info; - globals info/globals; display info/display; - perspective globals/perspective; - formats display/formattable:getFormatNames; title context/title; - id context/identifier; + cell_id context/identifier; layout display/formattable:layout; layout_id layout/identifier; width layout/width" tal:attributes=" - editable python:1; - formattable python: formats and 1 or 0; - formats python: ' '.join(formats); - id id; + id cell_id; + targetid cell_id; width width;"> <div class="cellEditHeader"> - <form action="javascript:void(0)" grip="1"> - <input name="title" type="text" size="12" class="editable" - tal:attributes="value title; - model_id id" /> + <form action="@@editElement"> + <input type="hidden" name="id" tal:attributes="value cell_id" /> + <input type="hidden" name="name" value="title" /> + <input name="value" type="text" size="12" class="editable" + tal:attributes="value title" /> </form> </div> - <form class="sizer" action="javascript:void(0)"> + <form class="sizer" action="@@editElement"> <b class="left"></b> <b class="right"></b> - <input class="input editable" name="width" type="text" size="4" - tal:attributes="value python: width and width or '?'; - model_id layout_id; - view_id id" /> + <input type="hidden" name="id" tal:attributes="value layout_id" /> + <input type="hidden" name="name" value="width" /> + <input class="input editable" name="value" type="text" size="4" + tal:attributes="value python: width and width or '?'" /> </form> <div class="container portletTarget" focus="1" destination="cellcontained" - tal:attributes="targetid id" + tal:attributes="targetid cell_id" tal:content="structure options/markup" /> </td> Modified: cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/pageblock.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/pageblock.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/pageblock.pt Tue Apr 18 10:17:25 2006 @@ -3,58 +3,50 @@ info options/info; globals info/globals; display info/display; - perspective globals/perspective; - formats display/formattable:getFormatNames; title context/title; layout display/formattable:layout; - this_id context/identifier; + pageblock_id context/identifier; layout_id layout/identifier; width layout/width"> - <table cellpadding="0" cellspacing="0" destination="pageblock" - class="pageBlockEdit editable draggable" + <table cellpadding="0" cellspacing="0" class="pageBlockEdit" tal:attributes=" - editable python:1; - formattable python: formats and 1 or 0; - formats python: ' '.join(formats); - folder_editable python:1; width width; - id this_id"> + id pageblock_id; + targetid pageblock_id"> <tr> <td> - <form class="pageBlockEditHeader" grip="1" action="javascript:void(0)"> + <form class="pageBlockEditHeader" action="@@editElement"> <span style="float:right"> - <a href="" tal:attributes="href string:@@moveUp?id=$this_id"> + <a href="" tal:attributes="href string:@@moveUp?id=$pageblock_id"> <img width="12" height="12" src="/++skin++cpsskins/@@/moveup-12.png" /> </a> - <a href="" tal:attributes="href string:@@moveDown?id=$this_id"> + <a href="" tal:attributes="href string:@@moveDown?id=$pageblock_id"> <img width="12" height="12" src="/++skin++cpsskins/@@/movedown-12.png" /> </a> </span> - <input class="editable" name="title" type="text" size="15" - tal:attributes="value title; - model_id this_id" /> + <input type="hidden" name="id" tal:attributes="value pageblock_id" /> + <input type="hidden" name="name" value="title" /> + <input class="editable" name="value" type="text" size="15" + tal:attributes="value title" /> </form> - <form class="sizer" action="javascript:void(0)"> + <form class="sizer" action="@@editElement"> <b class="left"></b> <b class="right"></b> - <input class="input editable" name="width" type="text" size="4" - tal:attributes="value python: width and width or '?'; - model_id layout_id; - view_id this_id" /> + <input type="hidden" name="id" tal:attributes="value layout_id" /> + <input type="hidden" name="name" value="width" /> + <input class="input editable" name="value" type="text" size="4" + tal:attributes="value python: width and width or '?'" /> </form> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" width="100%" - tal:define="markup options/markup" - tal:attributes="editable python:1; - folder_editable python:1; - id this_id"> + tal:define="markup options/markup"> <tr tal:content="structure markup" /> </table> </td> Modified: cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/slot.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/slot.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/screens/layoutdesigner/filters/slot.pt Tue Apr 18 10:17:25 2006 @@ -1,21 +1,13 @@ <tal:block define=" info options/info; - perspective info/perspective; - display info/display; - formats display/formattable:getFormatNames; slot_title context/title; - slot_name context; + slot_name python: str(context); id context/identifier; icon context/@@getIcon"> - <div class="slotFrame editable draggable" destination="cellcontained" - tal:attributes=" - editable python:1; - formattable python: formats and 1 or 0; - formats python: ' '.join(formats); - id id"> - <div class="title" grip="1" tal:content="slot_title|slot_name" /> - <div class="body" grip="1"><img src="" tal:attributes="src icon" /> + <div class="slotFrame" tal:attributes="id id"> + <div class="title" tal:content="slot_title|slot_name" /> + <div class="body"><img src="" tal:attributes="src icon" /> <tal:block content="slot_name" /> </div> </div> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins