Author: jmorliaguet Date: Thu Oct 13 17:39:26 2005 New Revision: 28265 Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/effect/configure.zcml (contents, props changed) z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/htmlcleaner/configure.zcml (contents, props changed) z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/layout/configure.zcml (contents, props changed) z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/style/configure.zcml (contents, props changed) z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.py (contents, props changed) z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.zcml (contents, props changed) Log:
- added missing files Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/effect/configure.zcml ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/effect/configure.zcml Thu Oct 13 17:39:26 2005 @@ -0,0 +1,25 @@ +<configure + xmlns="http://namespaces.zope.org/cpsskins" + xmlns:browser="http://namespaces.zope.org/browser" + xmlns:zope="http://namespaces.zope.org/zope"> + + <!-- Effect filter: transforms images --> + + <filter + name="effect" + predicate="cpsskins.ontology.hasEffect" + for="cpsskins.elements.formats.interfaces.IEffect" + factory=".EffectFilter" + /> + + <zope:vocabulary + name="effects by type" + factory=".EffectsByTypeVocabulary" + /> + + <zope:vocabulary + name="web image formats" + factory=".WebImageFormatVocabulary" + /> + +</configure> Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/htmlcleaner/configure.zcml ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/htmlcleaner/configure.zcml Thu Oct 13 17:39:26 2005 @@ -0,0 +1,14 @@ +<configure + xmlns="http://namespaces.zope.org/cpsskins" + xmlns:browser="http://namespaces.zope.org/browser" + xmlns:zope="http://namespaces.zope.org/zope"> + + <!-- HTML Cleaner filter: cleans the html code --> + + <filter + name="htmlcleaner" + for="cpsskins.elements.displays.interfaces.IDisplay" + factory=".HTMLCleaner" + /> + +</configure> Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/layout/configure.zcml ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/layout/configure.zcml Thu Oct 13 17:39:26 2005 @@ -0,0 +1,16 @@ +<configure + xmlns="http://namespaces.zope.org/cpsskins" + xmlns:browser="http://namespaces.zope.org/browser" + xmlns:zope="http://namespaces.zope.org/zope"> + + <!-- Layout filter: adds inline CSS properties to control the layout of + an element --> + + <filter + name="layout" + predicate="cpsskins.ontology.hasLayout" + for="cpsskins.elements.formats.interfaces.ILayout" + factory=".LayoutFilter" + /> + +</configure> Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/style/configure.zcml ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/style/configure.zcml Thu Oct 13 17:39:26 2005 @@ -0,0 +1,15 @@ +<configure + xmlns="http://namespaces.zope.org/cpsskins" + xmlns:browser="http://namespaces.zope.org/browser" + xmlns:zope="http://namespaces.zope.org/zope"> + + <!-- Style filter: adds CSS classes to control the style of elements --> + + <filter + name="style" + predicate="cpsskins.ontology.hasStyle" + for="cpsskins.elements.formats.interfaces.IStyle" + factory=".StyleFilter" + /> + +</configure> Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.py ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.py Thu Oct 13 17:39:26 2005 @@ -0,0 +1,260 @@ +############################################################################## +# +# Copyright (c) 2005 Nuxeo and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" + +$Id$ +""" +__docformat__ = "reStructuredText" + +from cpsskins.engines.common.filters.widget import WidgetView + +# Base classes divided into categories. + +class HTMLView(WidgetView): + """Simple HTML markup wrapped around some content. + """ + _markup = '' # the content will be inserted in %(content)s + + def __call__(self, data, **kw): + content = data.content + rendered = self._markup % {'content': content()} + # TODO: rendering optional link + return rendered + +class MenuView(WidgetView): + """A menu view display a list of clickable items. + """ + _start = '' # Optional + _repeat = '' # Mandatory + _separator = '' # Optional + _end = '' # Optional + + def __call__(self, data, **kw): + content = data.content + start = self._start + repeat = self._repeat + separator = self._separator + end = self._end + + rendered = [] + rendered_append = rendered.append + if start: + rendered_append(start) + for item in content: + rendered_append(repeat % { + 'url': item['url'], + 'title': item['title'], + }) + if separator: + rendered_append(separator) + if end: + rendered_append(end) + # TODO: rendering optional link + return ''.join(rendered) + + +# The actual widget views + +# Basic views + +class BasicHTMLView(WidgetView): + """Display the data with minimal formatting. + """ + + _preview = '<div>' \ + '<h1 label="H1">Header level 1</h1>' \ + '<h2 label="H2">Header level 2</h2>' \ + '<h3 label="H3">Header level 3</h3>' \ + '<h4 label="H4">Header level 4</h4>' \ + '<p label="paragraph">Some paragraph</p>' \ + '</div>' + + def __call__(self, data, **kw): + return '<div>%s</div>' % data.content() + +class BasicImageView(WidgetView): + """Display an image with minimal formatting + """ + def __call__(self, data, **kw): + return Image(self.context, self.request)(data) + +class BasicItemView(WidgetView): + """Display an item with minimal formatting + """ + def __call__(self, data, **kw): + content = data.content + return '<a href="%s">%s</a>' % (content['url'], content['title']) + +class BasicItemsView(WidgetView): + """Display a series of items with minimal formatting + """ + def __call__(self, data, **kw): + markup = [] + items_append = markup.append + for item in data.content: + items_append('<a href="%s">%s</a>' % (item['url'], item['title'])) + return ''.join(markup) + + +# Advanced views + +class Image(WidgetView): + """Display an image + """ + _preview = '<img src="#" alt="" style="border: none" />' + + def __call__(self, data, **kw): + markup = '' + content = data.content + url = content.path or content.url + if url: + markup = '<img src="%s" alt="" style="border: none" />' % url + else: + markup = '<div>No image</div>' # XXX use an image. + # TODO: rendering optional link + return markup + +class PageBody(HTMLView): + """The page's <body> tag + """ + _markup = '<body>%(content)s</body>' + _preview = '<body>Page content</body>' + +class VerticalMenu(MenuView): + _start = '<ul class="verticalMenu">' + _repeat = '<li><a href="%(url)s">%(title)s</a></li>' + _end = '</ul>' + _preview = '<ul label="menu box" class="verticalMenu">' \ + '<li label="menu item">' \ + '<a label="link" href="#">First item</a></li>' \ + '<li label="menu item">' \ + '<a label="link" href="#">Second item</a></li>' \ + '<li label="menu item">' \ + '<a label="link" href="#">Third item</a></li>' \ + '</ul>' + +class HorizontalTabs(MenuView): + _start = '<ul class="horizontalTabs">' + _repeat = '<li><a href="%(url)s">%(title)s</a></li>' + _end = '</ul>' + _preview = '<ul label="menu box" class="horizontalTabs">' \ + '<li label="menu tab">' \ + '<a label="link" href="#">First item</a></li>' \ + '<li label="menu tab">' \ + '<a label="link" href="#">Second item</a></li>' \ + '<li label="menu tab">' \ + '<a label="link" href="#">Third item</a></li>' \ + '</ul>' + +class MenuBar(MenuView): + _start = '<div class="menuBar">' + _repeat = '<a href="%(url)s">%(title)s</a>' + _end = '</div>' + _preview = '<ul label="menu bar" class="menuBar">' \ + '<li label="menu item">' \ + '<a label="link" href="#">First item</a></li>' \ + '<li label="menu item">' \ + '<a label="link" href="#">Second item</a></li>' \ + '<li label="menu item">' \ + '<a label="link" href="#">Third item</a></li>' \ + '</ul>' + +class HorizontalTrail(MenuView): + _start = '<div class="horizontalTrail">' + _repeat = '<a href="%(url)s">%(title)s</a>' + _separator = '<span class="sep">></span>' + _end = '</div>' + _preview = '<div label="box" class="horizontalTrail">' \ + '<a label="trail item" href="#">First item</a>' \ + '<span label="separator" class="sep">></span>' \ + '<a label="trail item" href="#">Second item</a>' \ + '<span label="separator" class="sep">></span>' \ + '<a label="trail item" href="#">Third item</a>' \ + '<span label="separator" class="sep">></span>' \ + '</div>' + +class DropDownList(MenuView): + _start = '<form action="@@cpsskins_redirect" method="post">' \ + '<select onchange="submit()" name="url">' \ + '<option value="./"></option>' + _repeat = '<option value="%(url)s">%(title)s</option>' + _end = '</select></form>' + _preview = '<form label="selector"><select label="item selector">' \ + '<option label="list item">First item</option>' \ + '<option label="list item">Second item</option>' \ + '<option label="list item">Third item</option>' \ + '</select></form>' + +class FrameBox(HTMLView): + _preview = '<fieldset label="box">' \ + '<legend label="legend">Box title</legend>' \ + 'Sample content.' \ + '<a label="link" href="#">some link</a>' \ + '</fieldset>' + + def __call__(self, data, **kw): + title = data.title + return '<fieldset><legend>%s</legend>%s</fieldset>' % ( + title, BasicHTMLView(self.context, self.request)(data)) + + +class HorizontalScrollBar(HTMLView): + """Display horizontal scroll bars in case of horizontal overflow + """ + _markup = '<div style="overflow-x:scroll;">%(content)s</div>' + _preview = '<div label="box" style="overflow-x:scroll;">Box content</div>' + +class TableFrame(HTMLView): + """Display a <table><tr> tag + """ + _markup = '<table summary=""><tr>%(content)s</tr></table>' + _preview = '<table summary="" label="table frame">' \ + '<tbody inactive="1"><tr inactive="1">' \ + '<td inactive="1">Sample content</td>' \ + '</tr></tbody></table>' + +class TableCell(HTMLView): + """Display a <td> tag + """ + _markup = '<td style="vertical-align:top;">%(content)s</td>' + _preview = '<table summary="" ignore="1" inactive="1">' \ + '<tbody ignore="1" inactive="1">' \ + '<tr ignore="1" inactive="1">' \ + '<td label="cell">Cell content</td>' \ + '</tr></tbody></table>' + +class DivFrame(HTMLView): + """Display a <div> frame + """ + _markup = '<div>%(content)s<br style="clear:left"/></div>' \ + '<div style="clear:left"></div>' + _preview = '<div label="frame box">Frame content</div>' + +class DivCell(HTMLView): + """Display a floating <div> cell + """ + _markup = '<div style="float:left;overflow-x:hidden">%(content)s</div>' + _preview = '<div label="cell">Cell content</div>' + +class MonthlyCalendar(WidgetView): + """Display a monthly calendar + """ + _markup = 'Not done yet' + _preview = '<table label="calendar" class="calendar">' \ + '<thead><tr label="header">' \ + '<th>Mo</th><th>Tu</th><th>We</th><th>Th</th>' \ + '<th>Fr</th><th>Sa</th><th>Su</th></tr></thead>' \ + '<tbody></tbody></table>' + + Added: z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.zcml ============================================================================== --- (empty file) +++ z3lab/cpsskins/branches/jmo-perspectives/engines/common/filters/widget/widgets.zcml Thu Oct 13 17:39:26 2005 @@ -0,0 +1,172 @@ +<configure + xmlns:zope="http://namespaces.zope.org/zope" + xmlns="http://namespaces.zope.org/cpsskins"> + + <!-- Plain widget views --> + + <widget + id="plain_html" + type=".interfaces.IBasicWidgetView" + model="cpsskins.model.interfaces.IHTML" + factory=".widgets.BasicHTMLView" + title="Basic HTML view" + /> + + <widget + id="plain_image" + type=".interfaces.IBasicWidgetView" + model="cpsskins.model.interfaces.IImage" + factory=".widgets.BasicImageView" + title="Basic image view" + /> + + <widget + id="plain_item" + type=".interfaces.IBasicWidgetView" + model="cpsskins.model.interfaces.IItem" + factory=".widgets.BasicItemView" + title="Basic item view" + /> + + <widget + id="plain_items" + type=".interfaces.IBasicWidgetView" + model="cpsskins.model.interfaces.IItems" + factory=".widgets.BasicItemsView" + title="Basic items view" + /> + + + <!-- Page widget views --> + + <widget + id="page_body" + type=".interfaces.IPageView" + model="cpsskins.model.interfaces.IHTML" + title="Page body" + factory=".widgets.PageBody" + /> + + + <!-- Frame widget views --> + + <widget + id="table_frame" + type=".interfaces.IFrameView" + model="cpsskins.model.interfaces.IHTML" + title="Table frame" + factory=".widgets.TableFrame" + /> + + <widget + id="div_frame" + type=".interfaces.IFrameView" + model="cpsskins.model.interfaces.IHTML" + title="Div frame" + factory=".widgets.DivFrame" + /> + + + <!-- Cell widget views --> + + <widget + id="table_cell" + type=".interfaces.ICellView" + model="cpsskins.model.interfaces.IHTML" + title="Table cell" + factory=".widgets.TableCell" + /> + + <widget + id="div_cell" + type=".interfaces.ICellView" + model="cpsskins.model.interfaces.IHTML" + title="Div cell" + factory=".widgets.DivCell" + /> + + <widget + id="horizontal_scrollbar" + type=".interfaces.ICellView" + model="cpsskins.model.interfaces.IHTML" + title="Horizontal scroll bar" + factory=".widgets.HorizontalScrollBar" + /> + + + <!-- Menu widget views --> + + <widget + id="vertical_menu" + type=".interfaces.IMenuView" + model="cpsskins.model.interfaces.IItems" + title="Vertical menu" + factory=".widgets.VerticalMenu" + /> + + <widget + id="horizontal_tabs" + type=".interfaces.IMenuView" + model="cpsskins.model.interfaces.IItems" + title="Horizontal tabs" + factory=".widgets.HorizontalTabs" + /> + + <widget + id="menu_bar" + type=".interfaces.IMenuView" + model="cpsskins.model.interfaces.IItems" + title="Menu bar" + factory=".widgets.MenuBar" + /> + + <widget + id="horizontal_trail" + type=".interfaces.IMenuView" + model="cpsskins.model.interfaces.IItems" + title="Horizontal trail" + factory=".widgets.HorizontalTrail" + /> + + <widget + id="dropdown_list" + type=".interfaces.IMenuView" + model="cpsskins.model.interfaces.IItems" + title="Drop-down list" + factory=".widgets.DropDownList" + /> + + + <!-- Plain views --> + + <widget + id="frame_box" + type=".interfaces.IPlainView" + model="cpsskins.model.interfaces.IHTML" + title="Frame box" + factory=".widgets.FrameBox" + /> + + + <!-- Calendar widget views --> + + <widget + id="monthly_calendar" + type=".interfaces.ICalendarView" + model="cpsskins.model.interfaces.IItems" + title="Monthly calendar" + factory=".widgets.MonthlyCalendar" + /> + + + <!-- Image widget views --> + + <widget + id="image" + type=".interfaces.IImageView" + model="cpsskins.model.interfaces.IImage" + title="Image" + factory=".widgets.Image" + /> + +</configure> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins