[Z3lab-checkins] r3607 - in cpsskins/branches/paris-sprint-2006: browser/rendering browser/skin browser/tree setup standard/negotiation ui/screens ui/screens/common ui/screens/common/icons ui/screens/
Author: jmorliaguet Date: Tue Jul 4 09:57:23 2006 New Revision: 3607 Added: cpsskins/branches/paris-sprint-2006/ui/screens/common/icons/align-16.png (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py cpsskins/branches/paris-sprint-2006/browser/skin/template.pt cpsskins/branches/paris-sprint-2006/browser/tree/slot.py cpsskins/branches/paris-sprint-2006/setup/snapshot.py cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.js cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/icons/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - saving work: - added an align (left, cengter, right) option to the context menu - negotiation fixes, removed session-based negotiation, using cookies instead Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py Tue Jul 4 09:57:23 2006 @@ -77,15 +77,11 @@ tmutil = getThemeManager(element) relations = tmutil.getRelationStorage() -negotiation = getMultiAdapter((rendering.location, request), - INegotiation, 'negotiation') -perspective = negotiation.getPerspective() resources = getUtility(IResourceManager) # set other global variables rendering.update({ 'request': request, -'perspective': perspective, 'relations': relations, 'resources': resources, }) Modified: cpsskins/branches/paris-sprint-2006/browser/skin/template.pt == --- cpsskins/branches/paris-sprint-2006/browser/skin/template.pt (original) +++ cpsskins/branches/paris-sprint-2006/browser/skin/template.ptTue Jul 4 09:57:23 2006 @@ -6,6 +6,7 @@ html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en tal:define=negotiation nocall:context/@@negotiation; engine negotiation/getEngine; + perspective negotiation/getPerspective; page negotiation/getPage; pageviewer nocall:page/@@viewer head @@ -17,6 +18,8 @@ tal:content=string:@import url(./styles.css); / /head tal:block content=structure python:pageviewer(location=context, -view=view, template=template, engine=engine) / +view=view, template=template, engine=engine, +perspective=perspective) / + tal:block content=perspective / /html /metal:block Modified: cpsskins/branches/paris-sprint-2006/browser/tree/slot.py == --- cpsskins/branches/paris-sprint-2006/browser/tree/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/browser/tree/slot.pyTue Jul 4 09:57:23 2006 @@ -50,17 +50,8 @@ request = self.request relations = getRelationStorage(context) -# The slot can override the perspective from which portlets are looked -# up unless the assigned perspective is '.' -slot_perspective = context.perspective -if slot_perspective == u'': +if context.perspective == u'': perspective = None -elif slot_perspective != u'.': -perspective = slot_perspective -else: -negotiation = getMultiAdapter((context, request), INegotiation, - name='negotiation') -perspective = negotiation.getPerspective() if perspective is None: portlets = relations.getSeconds(predicate=hasPortlet, first=context) Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py == --- cpsskins/branches/paris-sprint-2006/setup/snapshot.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/snapshot.py Tue Jul 4 09:57:23 2006 @@ -31,7 +31,7 @@ filename = TextLine( title=uFilename, description=uThe snapshot's filename
[Z3lab-checkins] r3609 - cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters
Author: jmorliaguet Date: Tue Jul 4 10:23:09 2006 New Revision: 3609 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Log: - fix: otherwise moving portlets between slots can fail Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Tue Jul 4 10:23:09 2006 @@ -11,6 +11,7 @@ tal:attributes=id id; targetid id div class=slotFrameTitle tal:content=slot_title|slot_name / div class=slotFrameBody tal:condition=markup + tal:attributes=id id; targetid id tal:content=structure markup / /div /tal:block -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3600 - in cpsskins/branches/paris-sprint-2006: setup ui/screens/sitemanager
Author: jmorliaguet Date: Mon Jul 3 10:50:43 2006 New Revision: 3600 Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - using the snapshot's filename instead of the id Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py == --- cpsskins/branches/paris-sprint-2006/setup/snapshot.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/snapshot.py Mon Jul 3 10:50:43 2006 @@ -20,13 +20,19 @@ import time from zope.app.container.contained import Contained -from zope.interface import implements from zope.app.file import File from zope.app.file.interfaces import IFile +from zope.interface import implements +from zope.schema import TextLine class ISnapshot(IFile): A site snapshot +filename = TextLine( +title=uFilename, +description=uThe snapshot's filename, +) + def read(): Return the file's data Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/io_section.pt Mon Jul 3 10:50:43 2006 @@ -1,6 +1,7 @@ div class=sections tal:define=section request/form/section|nothing; - snapshot request/form/snapshot|nothing + snapshot request/form/snapshot|nothing; + snapshots context/@@listSnapshots div tal:condition=section div tal:condition=python: section == 'export' @@ -29,8 +30,11 @@ form action=@@importSnapshot method=post enctype=multipart/form-data select name=filename - option tal:repeat=snapshot context/@@listSnapshots -tal:content=snapshot / + tal:block tal:repeat=id snapshots +option tal:define=snapshot snapshots/?id +tal:attributes=value id +tal:content=snapshot/filename / + /tal:block /select button type=submitLoad/button /form @@ -49,9 +53,11 @@ /form ul -li tal:repeat=snapshot context/@@listSnapshots - a tal:attributes=href string:@@downloadSnapshot?filename=$snapshot - tal:content=snapshot / +li tal:repeat=id snapshots + a tal:define=snapshot snapshots/?id; + filename snapshot/filename + tal:attributes=href string:@@downloadSnapshot?id=$idfilename=$filename + tal:content=filename / /li /ul /div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Mon Jul 3 10:50:43 2006 @@ -117,9 +117,9 @@ }}) def listSnapshots(self): -return list(self.getSnapshotStorage()) +return dict(self.getSnapshotStorage()) -def downloadSnapshot(self, filename=u''): +def downloadSnapshot(self, id=u'', filename=u''): if not filename: raise ValueError(No snaphost filename specified.) @@ -129,7 +129,7 @@ 'attachment; filename=%s' % filename) snapshots = self.getSnapshotStorage() -return snapshots[filename].read() +return snapshots[id].read() def importSnapshot(self, filename=u''): if not filename: -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3602 - in cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor: . filters
Author: jmorliaguet Date: Mon Jul 3 11:35:45 2006 New Revision: 3602 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Log: - the slot frame's title CSS property conflicted with slot's content own markup Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css Mon Jul 3 11:35:45 2006 @@ -19,7 +19,7 @@ padding-bottom: 13px; } -.slotFrame .title { +.slotFrameTitle { font: 13px Arial, Helvetica, sans-serif; font-weight: bold; text-align: center; @@ -30,3 +30,5 @@ background-color: #fce94f; } +.slotFrameBody { +} Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Mon Jul 3 11:35:45 2006 @@ -9,8 +9,8 @@ id context/identifier div class=slotFrame container portletTarget tal:attributes=id id; targetid id -div class=title tal:content=slot_title|slot_name / -div class=body tal:condition=markup +div class=slotFrameTitle tal:content=slot_title|slot_name / +div class=slotFrameBody tal:condition=markup tal:content=structure markup / /div /tal:block -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3603 - in cpsskins/branches/paris-sprint-2006: browser/negotiation doc
Author: jmorliaguet Date: Mon Jul 3 11:51:30 2006 New Revision: 3603 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt cpsskins/branches/paris-sprint-2006/doc/portlets.txt Log: - set the REQUEST_URI in the test request since the negotiation module uses that information Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt Mon Jul 3 11:51:30 2006 @@ -67,7 +67,6 @@ Test setup: from zope.publisher.browser import TestRequest - request = TestRequest() root = getRootFolder() @@ -92,6 +91,7 @@ If nothing is specified, the default theme is returned: + request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}) page = negotiation.getPage() page.theme, page (Theme('Theme 1'), ThemePage('A page')) @@ -100,7 +100,8 @@ The page's name can be specified in the URL, by writing ...?page=Theme-2:ThemePage - request.form[u'page'] = u'Theme-2:ThemePage' + request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}, + form={'page': u'Theme-2:ThemePage'}) page = negotiation.getPage() page.theme, page (Theme('Theme 2'), ThemePage('A page')) @@ -110,6 +111,7 @@ The theme's name can also be specified in a cookie: + request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}) request.response.setCookie('cpsskins_page', u'Theme-3:ThemePage') page = negotiation.getPage() page.theme, page @@ -118,4 +120,3 @@ request.response.expireCookie('cpsskins_page') - Modified: cpsskins/branches/paris-sprint-2006/doc/portlets.txt == --- cpsskins/branches/paris-sprint-2006/doc/portlets.txt(original) +++ cpsskins/branches/paris-sprint-2006/doc/portlets.txtMon Jul 3 11:51:30 2006 @@ -12,7 +12,7 @@ from zope.publisher.browser import TestRequest from zope.publisher.interfaces import IRequest - request = TestRequest() + request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}) root = getRootFolder() Portlets use a *context info* structure to transmit data through the -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3604 - cpsskins/branches/paris-sprint-2006/browser/negotiation
Author: jmorliaguet Date: Mon Jul 3 11:55:17 2006 New Revision: 3604 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt Log: - test fixes Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt Mon Jul 3 11:55:17 2006 @@ -81,8 +81,6 @@ from zope.component import getMultiAdapter from cpsskins.browser.negotiation.interfaces import INegotiation - negotiation = getMultiAdapter((root, request), INegotiation, -... name='negotiation') Pages - @@ -92,6 +90,8 @@ If nothing is specified, the default theme is returned: request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}) + negotiation = getMultiAdapter((root, request), INegotiation, +... name='negotiation') page = negotiation.getPage() page.theme, page (Theme('Theme 1'), ThemePage('A page')) @@ -101,7 +101,9 @@ ...?page=Theme-2:ThemePage request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}, - form={'page': u'Theme-2:ThemePage'}) +... form={'page': u'Theme-2:ThemePage'}) + negotiation = getMultiAdapter((root, request), INegotiation, +... name='negotiation') page = negotiation.getPage() page.theme, page (Theme('Theme 2'), ThemePage('A page')) @@ -113,6 +115,8 @@ request = TestRequest(environ={'REQUEST_URI': u'/++skin++cpsskins/123'}) request.response.setCookie('cpsskins_page', u'Theme-3:ThemePage') + negotiation = getMultiAdapter((root, request), INegotiation, +... name='negotiation') page = negotiation.getPage() page.theme, page (Theme('Theme 3'), ThemePage('A page')) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3606 - in cpsskins/branches/paris-sprint-2006: browser/negotiation standard/formats
Author: jmorliaguet Date: Mon Jul 3 14:54:04 2006 New Revision: 3606 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Log: - test updates / fixes Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/README.txt Mon Jul 3 14:54:04 2006 @@ -93,6 +93,7 @@ negotiation = getMultiAdapter((root, request), INegotiation, ... name='negotiation') print negotiation.strategy +default page = negotiation.getPage() page.theme, page Modified: cpsskins/branches/paris-sprint-2006/standard/formats/layout.py == --- cpsskins/branches/paris-sprint-2006/standard/formats/layout.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Mon Jul 3 14:54:04 2006 @@ -78,6 +78,15 @@ ... KeyError: u'No such property: width' +layout types can be combined: + + layout = Layout(types=[u'contained', u'alignable']) + layout +Layout of type: contained, alignable + + dict(layout) +{u'padding': u'', u'align': u'', u'margin': u''} + _layout_types = { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3583 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Sun Jul 2 10:21:15 2006 New Revision: 3583 Modified: cpsskins/branches/paris-sprint-2006/utils.py Log: - New pages should not be called 'Default page' Modified: cpsskins/branches/paris-sprint-2006/utils.py == --- cpsskins/branches/paris-sprint-2006/utils.py(original) +++ cpsskins/branches/paris-sprint-2006/utils.pySun Jul 2 10:21:15 2006 @@ -81,8 +81,9 @@ from cpsskins.elements.interfaces import IFormattable # Add a page -page = ThemePage(u'Default page') -context.addPage(theme, page) +page = ThemePage() +name = context.addPage(theme, page) +page.title = name.replace('-', ' ') # Add the page blocks page[u'top'] = PageBlock(u'Top') -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3587 - in cpsskins/branches/paris-sprint-2006: browser/negotiation browser/tree locations standard/negotiation
Author: jmorliaguet Date: Sun Jul 2 17:26:35 2006 New Revision: 3587 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py cpsskins/branches/paris-sprint-2006/browser/tree/slot.py cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py Log: - fixed the setting of the negotiation strategy Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/views.pySun Jul 2 17:26:35 2006 @@ -32,6 +32,9 @@ def __init__(self, context, request): self.context = context self.request = request +strategy = self.strategy +if strategy is None: +self.strategy = u'default' def negotiate(self, name): context = self.context @@ -51,7 +54,7 @@ self.request.annotations['cpsskins.strategy'] = name def getStrategy(self): -return self.request.annotations.get('cpsskins.strategy', u'default') +return self.request.annotations.get('cpsskins.strategy') strategy = property(getStrategy, setStrategy) Modified: cpsskins/branches/paris-sprint-2006/browser/tree/slot.py == --- cpsskins/branches/paris-sprint-2006/browser/tree/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/browser/tree/slot.pySun Jul 2 17:26:35 2006 @@ -60,8 +60,6 @@ else: negotiation = getMultiAdapter((context, request), INegotiation, name='negotiation') -# FIXME: hardcoded negotiation strategy -negotiation.strategy = u'content-author' perspective = negotiation.getPerspective() if perspective is None: Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pySun Jul 2 17:26:35 2006 @@ -65,7 +65,7 @@ choices = {} # allow for empty string values -choices[''] = u'(no value)' +choices[u''] = u'(no value)' if root == u'pages': for theme in tmutil.getThemes(): Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.pySun Jul 2 17:26:35 2006 @@ -89,7 +89,7 @@ def __call__(self): path = guessPath(self.context, self.request) -location = self.manager.getLocation(path, root=u'pages') +location = self.manager.getLocationStorage().find(path, u'pages') if location is not None: page_name = location() return self.manager.getPageByName(page_name) Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py Sun Jul 2 17:26:35 2006 @@ -36,7 +36,7 @@ def __call__(self): path = guessPath(self.context, self.request) -location = self.manager.getLocation(path, root=u'perspectives') +location = self.manager.getLocationStorage().find(path, u'perspectives') if location is not None: return location() -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3588 - in cpsskins/branches/paris-sprint-2006: setup/io standard/formats standard/io storage
Author: jmorliaguet Date: Sun Jul 2 18:06:49 2006 New Revision: 3588 Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py cpsskins/branches/paris-sprint-2006/standard/formats/layout.py cpsskins/branches/paris-sprint-2006/standard/io/layout.py cpsskins/branches/paris-sprint-2006/standard/io/relation.py cpsskins/branches/paris-sprint-2006/storage/locations.py Log: - fixed the import of locations Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py == --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Sun Jul 2 18:06:49 2006 @@ -164,7 +164,6 @@ if contentname != typename: factory_name = u'%s.%s' % (factory_name, contentname) obj = createObject(factory_name) -storage.add(obj) importer = getMultiAdapter((obj, el), IDOMAdapter) importer.archive = archive @@ -173,6 +172,9 @@ importer.updateURIMapping() importer.load() +# add the object to the storage afterwards +storage.add(obj) + uri_mapping.update(importer.mapping) document.unlink() Modified: cpsskins/branches/paris-sprint-2006/standard/formats/layout.py == --- cpsskins/branches/paris-sprint-2006/standard/formats/layout.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Sun Jul 2 18:06:49 2006 @@ -99,8 +99,7 @@ def __setitem__(self, k, v): if not isinstance(v, basestring): raise TypeError(Only strings can be stored in the layout objects.) -# types may not have been initialized -if self.types and k not in self: +if k not in self: raise KeyError(No such property: %s % k) self.data[k] = v @@ -134,8 +133,8 @@ A vocabulary that contains the list of widgets. layout_types = [ -(u('Container'), u'container'), -(u('Contained'), u'contained'), +(_(u'Container'), u'container'), +(_(u'Contained'), u'contained'), ] return SimpleVocabulary.fromItems(layout_types) Modified: cpsskins/branches/paris-sprint-2006/standard/io/layout.py == --- cpsskins/branches/paris-sprint-2006/standard/io/layout.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/io/layout.py Sun Jul 2 18:06:49 2006 @@ -18,16 +18,20 @@ __docformat__ = reStructuredText from zope.interface import implements +from zope.schema import getFields from cpsskins.setup.io import BaseDOMAdapter -from cpsskins.setup.io.interfaces import IDOMAdapter +from cpsskins.setup.io.interfaces import IDOMAdapter, IFieldIO from cpsskins.relations.interfaces import IRelatable +from cpsskins.standard.formats.layout import ILayout class DOMAdapter(BaseDOMAdapter): DOM adapter for layouts implements(IDOMAdapter) +fields = getFields(ILayout) + def save(self): context = self.context node = self.node @@ -37,6 +41,9 @@ layout_el = document.createElement(u'layout') layout_el.setAttribute(u'id', unicode(IRelatable(context))) +field_io = IFieldIO(self.fields['types'], None) +layout_el.setAttribute(u'types', field_io.dump(context.types)) + for name, value in context.items(): prop_el = document.createElement(u'property') prop_el.setAttribute(u'name', name) @@ -49,6 +56,9 @@ context = self.context node = self.node +field_io = IFieldIO(self.fields['types'], None) +context.types = field_io.load(node.getAttribute('types')) + for prop in node.getElementsByTagName(u'property'): name = prop.getAttribute(u'name') value = prop.getAttribute(u'value') Modified: cpsskins/branches/paris-sprint-2006/standard/io/relation.py == --- cpsskins/branches/paris-sprint-2006/standard/io/relation.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/io/relation.py Sun Jul 2 18:06:49 2006 @@ -57,7 +57,12 @@ relates = () for relate_el in node.getElementsByTagName(u'relate'): uri = relate_el.getAttribute(u'uri') -obj = self.mapping[uri] +try: +obj = self.mapping[uri] +# the uri is a simple string which cannot be used to resolve +# elements +except KeyError: +obj = unicode(uri) relates += obj, Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py
[Z3lab-checkins] r3589 - cpsskins/branches/paris-sprint-2006/standard/formats
Author: jmorliaguet Date: Sun Jul 2 18:21:49 2006 New Revision: 3589 Modified: cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Log: - added missing '_' Modified: cpsskins/branches/paris-sprint-2006/standard/formats/layout.py == --- cpsskins/branches/paris-sprint-2006/standard/formats/layout.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Sun Jul 2 18:21:49 2006 @@ -21,6 +21,7 @@ from persistent import Persistent from zope.interface import implements, alsoProvides from zope.interface.common.mapping import IMapping +from zope.i18nmessageid import MessageFactory from zope.schema import List, Choice from zope.schema.interfaces import IVocabularyFactory from zope.schema.vocabulary import SimpleVocabulary @@ -30,6 +31,8 @@ from cpsskins.elements.interfaces import IFormat from cpsskins.relations import Predicate +_ = MessageFactory(cpsskins) + hasLayout = Predicate('_ has layout _') class ILayout(IFormat, IMapping): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3590 - in cpsskins/branches/paris-sprint-2006: locations setup/io storage
Author: jmorliaguet Date: Sun Jul 2 18:26:05 2006 New Revision: 3590 Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt cpsskins/branches/paris-sprint-2006/setup/io/README.txt cpsskins/branches/paris-sprint-2006/storage/relations.py Log: - test fix - optimization in the relation storage Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt == --- cpsskins/branches/paris-sprint-2006/locations/sources.txt (original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.txt Sun Jul 2 18:26:05 2006 @@ -56,10 +56,10 @@ data_choice_in_context = data_choice_in_context.bind(l) [t.value for t in data_choice_in_context.source] -[u'Theme:ThemePage'] +[u'', u'Theme:ThemePage'] len(data_choice_in_context.source) -1 +2 u'Theme:ThemePage' in data_choice_in_context.source True Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt == --- cpsskins/branches/paris-sprint-2006/setup/io/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/README.txt Sun Jul 2 18:26:05 2006 @@ -281,7 +281,7 @@ /portlets BLANKLINE - archive[u'image_data_120x120.png'] == portlet.data + archive[u'standard.image_data_120x120.png'] == portlet.data True Export of fields Modified: cpsskins/branches/paris-sprint-2006/storage/relations.py == --- cpsskins/branches/paris-sprint-2006/storage/relations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/relations.pySun Jul 2 18:26:05 2006 @@ -277,6 +277,8 @@ raise ValueError(Must specify the relation id(s) to remove) if isinstance(ids, basestring): ids = [ids] +if not ids: +return for id in ids: if id not in self: raise KeyError(No such relation (%s) in the storage. % id) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3591 - in cpsskins/branches/paris-sprint-2006: browser/rendering configuration configuration/engines locations standard/filters/effect standard/filters/widget
Author: jmorliaguet Date: Sun Jul 2 22:38:26 2006 New Revision: 3591 Removed: cpsskins/branches/paris-sprint-2006/configuration/engines/configure.zcml Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/__init__.py cpsskins/branches/paris-sprint-2006/browser/rendering/configure.zcml cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py cpsskins/branches/paris-sprint-2006/configuration/configure.zcml cpsskins/branches/paris-sprint-2006/configuration/engines/__init__.py cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/standard/filters/effect/__init__.py cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.css cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.py Log: - fixed bugs in the rendering of widgets - moved the ++engine++ traversal adapter to browser/rendering Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/__init__.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/__init__.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/__init__.py Sun Jul 2 22:38:26 2006 @@ -17,3 +17,13 @@ __docformat__ = reStructuredText +from zope.traversing.namespace import view + +# ++engine++ traverser + +class engine(view): + +def traverse(self, name, ignored): +self.request.annotations['cpsskins.engine'] = name +return self.context + Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/configure.zcml == --- cpsskins/branches/paris-sprint-2006/browser/rendering/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/configure.zcml Sun Jul 2 22:38:26 2006 @@ -10,4 +10,21 @@ permission=zope.Public / + !-- /++engine++.../ traverser -- + + adapter +for=* +name=engine +provides=zope.traversing.interfaces.ITraversable +factory=.engine + / + + view +for=* +name=engine +type=cpsskins.browser.skin.cpsskins +provides=zope.traversing.interfaces.ITraversable +factory=.engine + / + /configure Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py Sun Jul 2 22:38:26 2006 @@ -70,6 +70,8 @@ # apply all the filters in sequence for f in self._getFilters(info): markup = f(markup, info) +if not isinstance(markup, unicode): +logger.warning(%s did not return a unicode string., f) return markup @@ -85,7 +87,7 @@ # look for renderers associated to the element's content type type = IType(element) iface = type.getContentType() -name = engine + '.renderer' +name = engine + u'.renderer' renderer = queryUtility(iface, name) if renderer is None: # fall back to the element's resource type @@ -126,7 +128,7 @@ # the adapted object is a URI which must be resolved if isinstance(adapted, basestring): -adapted = resources.resolve(adapted, element) +adapted = resources.resolve(uri=adapted, context=element) # get the adapter filter = queryMultiAdapter((adapted,), IFilterView, Modified: cpsskins/branches/paris-sprint-2006/configuration/configure.zcml == --- cpsskins/branches/paris-sprint-2006/configuration/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/configuration/configure.zcmlSun Jul 2 22:38:26 2006 @@ -2,6 +2,4 @@ include package=.i18n / - include package=.engines / - /configure Modified: cpsskins/branches/paris-sprint-2006/configuration/engines/__init__.py == --- cpsskins/branches/paris-sprint-2006/configuration/engines/__init__.py (original) +++ cpsskins/branches/paris-sprint-2006/configuration/engines/__init__.py Sun Jul 2 22:38:26 2006 @@ -11,20 +11,10 @@ # FOR A PARTICULAR PURPOSE. # ## -Rendering engine traverser /++engine++name + $Id$ __docformat__ = reStructuredText -from zope.traversing.namespace import view - -# ++engine++ traverser -class engine(view): - -def traverse(self, name, ignored): -self.request.annotations['cpsskins.engine'] = name - -return self.context - Modified
[Z3lab-checkins] r3594 - cpsskins/branches/paris-sprint-2006/doc
Author: jmorliaguet Date: Sun Jul 2 22:58:10 2006 New Revision: 3594 Modified: cpsskins/branches/paris-sprint-2006/doc/portlets.txt Log: - test update Modified: cpsskins/branches/paris-sprint-2006/doc/portlets.txt == --- cpsskins/branches/paris-sprint-2006/doc/portlets.txt(original) +++ cpsskins/branches/paris-sprint-2006/doc/portlets.txtSun Jul 2 22:58:10 2006 @@ -255,7 +255,7 @@ --- widget = Widget([u'standard.horizontal_scrollbar']) test_render(widget, rendered, info) -u'div style=overflow-x:scroll; class=standardHorizontalScrollbarh1Test of HTML/h1/div' +u'div class=standardHorizontalScrollbarh1Test of HTML/h1/div' c) pageblock frame -- -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3579 - in cpsskins/branches/paris-sprint-2006: . doc elements locations perspectives setup storage tests ui/screens/common ui/screens/pagedesigner/layout ui/screens/sitemanager
Author: jmorliaguet Date: Sat Jul 1 15:24:22 2006 New Revision: 3579 Modified: cpsskins/branches/paris-sprint-2006/configure.zcml cpsskins/branches/paris-sprint-2006/doc/portlets.txt cpsskins/branches/paris-sprint-2006/elements/interfaces.py cpsskins/branches/paris-sprint-2006/elements/slot.py cpsskins/branches/paris-sprint-2006/locations/README.txt cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/perspectives/configure.zcml cpsskins/branches/paris-sprint-2006/perspectives/interfaces.py cpsskins/branches/paris-sprint-2006/perspectives/perspective.py cpsskins/branches/paris-sprint-2006/setup/README.txt cpsskins/branches/paris-sprint-2006/setup/adapters.py cpsskins/branches/paris-sprint-2006/setup/interfaces.py cpsskins/branches/paris-sprint-2006/setup/utils.py cpsskins/branches/paris-sprint-2006/storage/relations.py cpsskins/branches/paris-sprint-2006/tests/test_storages.py cpsskins/branches/paris-sprint-2006/thememanager.py cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - saving work - added a UI for creating presets - cosmetic Modified: cpsskins/branches/paris-sprint-2006/configure.zcml == --- cpsskins/branches/paris-sprint-2006/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/configure.zcml Sat Jul 1 15:24:22 2006 @@ -97,6 +97,8 @@ include package=.setup / + include package=.perspectives / + include package=.storage / include package=.lib / Modified: cpsskins/branches/paris-sprint-2006/doc/portlets.txt == --- cpsskins/branches/paris-sprint-2006/doc/portlets.txt(original) +++ cpsskins/branches/paris-sprint-2006/doc/portlets.txtSat Jul 1 15:24:22 2006 @@ -421,7 +421,7 @@ Finally we clear the storage: - relations.clear() + relations.purge() Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py == --- cpsskins/branches/paris-sprint-2006/elements/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/interfaces.py Sat Jul 1 15:24:22 2006 @@ -37,9 +37,6 @@ class INode(IElement): A generic tree node -def getSiblings(self): -Return the list of siblings - class IInnerNode(INode, IOrderedContainer): An inner node has children @@ -183,6 +180,9 @@ Return true if the page is the default one. +def getSiblings(): +Return the list of siblings + def name(): Return the page's name (used when registering the page as a utility.) @@ -226,6 +226,9 @@ Set the theme as the default theme. +def getSiblings(): +Return the list of siblings + def name(): Return the theme's name (used when registering the theme as a utility.) Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py == --- cpsskins/branches/paris-sprint-2006/elements/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/elements/slot.pySat Jul 1 15:24:22 2006 @@ -114,8 +114,8 @@ tmutil = getThemeManager(context) perspectives = [(_(u'Do not use perspectives'), u''), (_(u'Always use the current perspective'), u'.')] -for name, title in tmutil.listPerspectives(): -perspectives.append((_(title), name)) +for name in tmutil.listPerspectives(): +perspectives.append((name, name)) return SimpleVocabulary.fromItems(perspectives) Modified: cpsskins/branches/paris-sprint-2006/locations/README.txt == --- cpsskins/branches/paris-sprint-2006/locations/README.txt(original) +++ cpsskins/branches/paris-sprint-2006/locations/README.txtSat Jul 1 15:24:22 2006 @@ -318,9 +318,9 @@ to obtain all the paths we use: locations.getAllPaths() # doctest: +NORMALIZE_WHITESPACE -[(u'', u'f1'), (u'', u'f1', u'f6'), (u'', u'f1', u'f2'), - (u
[Z3lab-checkins] r3580 - cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
Author: jmorliaguet Date: Sat Jul 1 16:02:03 2006 New Revision: 3580 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css Log: - cosmetic Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt Sat Jul 1 16:02:03 2006 @@ -7,11 +7,12 @@ form action=@@submitLocation method=post - table style=width: 100%, border-bottom: 1px solid #ccc class=items + table style=width: 100%; border-bottom: 1px solid #ccc class=items tr th style=width: 30%path/th th style=width: 30%scope/th - th style=width: 40%data/th + th style=width: 30%data/th + th style=width: 10%/th /tr tr tal:repeat=path infos tal:block define=location python:infos[path]; @@ -27,35 +28,38 @@ tal:block condition=edit tal:block define=widgets nocall:context/@@getLocationWidgets repeat=widget python: widgets(location_path, section) -td style=padding-top: 5px; padding-bottom: 5px; background-color: #efc tal:content=structure widget / +td tal:content=structure widget / /tal:block /tal:block +td + a class=button style=float: right tal:condition=edited + tal:attributes=href string:@@submitLocation?root=$sectionlocation_path=$location_pathaction=delete + [delete] + /a +/td + /tal:block /tr /table - div style=margin-top: 10px tal:condition=not:edited -input type=hidden name=root tal:attributes=value section / -input type=hidden name=action value=add / -input type=text name=location_path value=/ / -input class=submit default type=submit value=add / - /div + div style=margin-top: 10px +tal:block condition=not:edited + input type=hidden name=root tal:attributes=value section / + input type=hidden name=action value=add / + input type=text name=location_path value=/ / + input class=submit type=submit value=[add] / +/tal:block - div style=margin-top: 10px; float: right tal:condition=edited -a class=button - tal:attributes=href string:@@submitLocation?root=$sectionlocation_path=$editedaction=delete - delete -/a - /div - div tal:condition=edited style=margin-top: 10px -input type=hidden name=action value=edit / -input type=hidden name=root tal:attributes=value section / -input type=hidden name=location_path tal:attributes=value edited / -input class=submit default type=submit value=save / -a class=button i18n:translate= +tal:block condition=edited + input type=hidden name=action value=edit / + input type=hidden name=root tal:attributes=value section / + input type=hidden name=location_path tal:attributes=value edited / + input class=submit type=submit value=[save] / + a class=button i18n:translate= tal:attributes=href string:javascript:CPSSkins.getModelById('negotiation-section').setData({'form': {'section': '$section'}})cancel/a +/tal:block /div /form Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets_section.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets_section.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/presets_section.pt Sat Jul 1 16:02:03 2006 @@ -8,9 +8,11 @@ tal:block define=name info/name; uri info/uri; readonly info/readonly -a tal:attributes=href string:@@removePreset?uri=$uri +a class=button + tal:attributes=href string:@@removePreset?uri=$uri tal:condition=not:readonly[remove]/a -a href=javascript:void(0) +a class=button + href=javascript:void(0) tal:attributes=onclick string:editPreset('$uri') tal:condition=not:readonly[edit]/a /tal:block @@ -22,7 +24,7 @@ form action=@@addPreset method=post input type=hidden name=type_name tal:attributes=value section / input type=text name=name value= / -input class=submit default type=submit value=add / +input class=submit type=submit value=[add] / /form /div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
[Z3lab-checkins] r3581 - in cpsskins/branches/paris-sprint-2006: . elements locations setup/io standard/fields standard/io ui/screens/common ui/screens/pagedesigner/layout ui/screens/sitemanager
Author: jmorliaguet Date: Sat Jul 1 18:43:07 2006 New Revision: 3581 Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py cpsskins/branches/paris-sprint-2006/locations/location.py cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/setup/io/adapters.py cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml cpsskins/branches/paris-sprint-2006/standard/io/relation.py cpsskins/branches/paris-sprint-2006/thememanager.py cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt Log: - saving work Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py == --- cpsskins/branches/paris-sprint-2006/elements/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/interfaces.py Sat Jul 1 18:43:07 2006 @@ -52,7 +52,7 @@ class ICanvas(IElement): A canvas element -class IField(IElement): +class IField(Interface): A field element class IFormat(IElement): Modified: cpsskins/branches/paris-sprint-2006/locations/location.py == --- cpsskins/branches/paris-sprint-2006/locations/location.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/location.py Sat Jul 1 18:43:07 2006 @@ -17,12 +17,13 @@ __docformat__ = reStructuredText +from persistent import Persistent from zope.component.factory import Factory from zope.interface import implements from cpsskins.locations.interfaces import ILocation -class Location(object): +class Location(Persistent): A location implements(ILocation) Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pySat Jul 1 18:43:07 2006 @@ -69,7 +69,7 @@ theme_name = theme.name for page in theme.getPages(): page_id = u'%s:%s' % (theme_name, page.name) -choices[page_id] = u'%s / %s' % (theme.title, page.title) +choices[page_id] = u'%s %s' % (theme.title, page.title) elif root == u'perspectives': for perspective in tmutil.listPerspectives(): Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pySat Jul 1 18:43:07 2006 @@ -134,7 +134,7 @@ # the value stored in the DOM is the name of the attachment in # the archive. if IBinaryFieldIO.providedBy(field_io): -value = u'%s_%s%s' % (element_id, attr, value) +value = u'%s_%s%s' % (type.contentname, attr, value) archive[value] = obj # set the property as an attribute, @@ -211,11 +211,9 @@ continue type = child_el.getAttribute(u'type') - contentname = type or child_el.tagName factory_name = u'cpsskins.%s.%s' % (self.object_type, contentname) - # create the object element = createObject(factory_name) Modified: cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml == --- cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/fields/color.zcml Sat Jul 1 18:43:07 2006 @@ -9,10 +9,4 @@ class=.color.WebColor / - cpsskins:preset -name=color -schema=.color.IWebColor -class=.color.WebColor - / - /configure Modified: cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml == --- cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/fields/image.zcml Sat Jul 1 18:43:07 2006 @@ -9,10 +9,4 @@ class=.image.WebImage / - cpsskins:preset -name=image -schema=.image.IWebImage -class=.image.WebImage - / - /configure Modified: cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml
[Z3lab-checkins] r3573 - cpsskins/branches/paris-sprint-2006/standard/filters/style
Author: jmorliaguet Date: Fri Jun 30 10:33:33 2006 New Revision: 3573 Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py Log: - added assertion for debugging Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py == --- cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/filters/style/__init__.py Fri Jun 30 10:33:33 2006 @@ -40,5 +40,6 @@ def __call__(self, markup, info): Apply the style to the markup. +assert isinstance(markup, basestring), style filter: string required return utils.insertCSSClass(markup, str(ICSSRenderer(self.context))) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3574 - cpsskins/branches/paris-sprint-2006/browser/rendering
Author: jmorliaguet Date: Fri Jun 30 15:09:26 2006 New Revision: 3574 Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py Log: - optimization Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py Fri Jun 30 15:09:26 2006 @@ -80,6 +80,7 @@ engine = info.rendering.engine relations = info.rendering.relations +resources = info.rendering.resources # look for renderers associated to the element's content type type = IType(element) @@ -125,8 +126,7 @@ # the adapted object is a URI which must be resolved if isinstance(adapted, basestring): -uri = adapted -adapted = info.rendering.resources.resolve(uri, element) +adapted = resources.resolve(adapted, element) # get the adapter filter = queryMultiAdapter((adapted,), IFilterView, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3575 - in cpsskins/branches/paris-sprint-2006: configuration/widgets standard/filters/widget
Author: jmorliaguet Date: Fri Jun 30 15:10:10 2006 New Revision: 3575 Modified: cpsskins/branches/paris-sprint-2006/configuration/widgets/metaconfigure.py cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py Log: - register the basic widget view correctly Modified: cpsskins/branches/paris-sprint-2006/configuration/widgets/metaconfigure.py == --- cpsskins/branches/paris-sprint-2006/configuration/widgets/metaconfigure.py (original) +++ cpsskins/branches/paris-sprint-2006/configuration/widgets/metaconfigure.py Fri Jun 30 15:10:10 2006 @@ -46,7 +46,8 @@ widget_name = '%s-%s' % (engine, name) if basic: -classImplements(view, IBasicWidgetView) +adapter(_context=_context, factory=(view,), provides=IBasicWidgetView, +for_=(for_, IBrowserRequest)) # register widgets utility(_context=_context, provides=configuration.IWidget, Modified: cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py == --- cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py Fri Jun 30 15:10:10 2006 @@ -80,12 +80,11 @@ Falling back to the basic widget view., repr(info.element), repr(data)) -factory = queryMultiAdapter(objects=(data, request), -interface=IBasicWidgetView) +factory = queryMultiAdapter((data, request), IBasicWidgetView) if factory is None: logger.warning(No basic widget view found for '%s'., -repr(info.element)) + repr(info.element)) return markup markup = factory(markup=markup, info=info) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3576 - in cpsskins/branches/paris-sprint-2006: standard/filters/widget ui/screens ui/screens/contentauthor/filters
Author: jmorliaguet Date: Fri Jun 30 15:10:52 2006 New Revision: 3576 Modified: cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.py cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Log: - UI updates (slots) - updated the HTML widget preview markup Modified: cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.py == --- cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/filters/widget/widgets.py Fri Jun 30 15:10:52 2006 @@ -67,13 +67,19 @@ class PlainHTML(WidgetView): Display the markup with minimal formatting -preview = u'div' \ - 'h1 label=H1Header level 1/h1' \ - 'h2 label=H2Header level 2/h2' \ - 'h3 label=H3Header level 3/h3' \ - 'h4 label=H4Header level 4/h4' \ - 'p label=paragraphSome paragraph/p' \ - '/div' +preview = udiv + h1 label=H1Header level 1/h1 + h2 label=H2Header level 2/h2 + h3 label=H3Header level 3/h3 + h4 label=H4Header level 4/h4 + p label=paragraphSome paragraph/p + a href= label=linkA link/a + ul label=unordered list + liList item 1/li + liList item 2/li + /ul + /div + def __call__(self, markup, info, **kw): return 'div%s/div' % markup Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Fri Jun 30 15:10:52 2006 @@ -1,3 +1,7 @@ +ins class=model + tal:define=info options/info; model nocall:context/@@getModelInfo + tal:content=python: model(info) / + tal:block define= markup options/markup; slot_title context/title; Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Fri Jun 30 15:10:52 2006 @@ -359,7 +359,7 @@ 'type': 'panel', }, 'model': 'page-mode-selector', -'perspectives': ['page-designer', 'content-author'], +'perspectives': ['page-designer'], 'controllers': ['main-editor-perspectives'], }, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3578 - in cpsskins/branches/paris-sprint-2006: . standard/negotiation
Author: jmorliaguet Date: Fri Jun 30 21:53:52 2006 New Revision: 3578 Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py cpsskins/branches/paris-sprint-2006/utils.py Log: - added a guessPath function to guess the relative path + the method name from the context and the request Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.pyFri Jun 30 21:53:52 2006 @@ -19,8 +19,6 @@ from zope.component import queryUtility from zope.interface import implements -from zope.traversing.api import getPath -from zope.traversing.interfaces import IPhysicallyLocatable from cpsskins.browser.negotiation.scheme import NegotiationScheme from cpsskins.elements.interfaces import IThemePage @@ -31,6 +29,7 @@ from cpsskins.standard.negotiation import IContextNegotiationScheme from cpsskins.standard.negotiation import ILocationNegotiationScheme from cpsskins.standard.negotiation import ICookieLocationNegotiationScheme +from cpsskins.utils import guessPath class QueryParameter(NegotiationScheme): Look for a page whose name is passed as a URL query parameter: @@ -89,10 +88,7 @@ implements(ILocationNegotiationScheme) def __call__(self): -context = self.context -nearest_site = IPhysicallyLocatable(context).getNearestSite() -path_info = self.request['PATH_INFO'] -path = path_info[len(getPath(nearest_site)):] +path = guessPath(self.context, self.request) location = self.manager.getLocation(path, root=u'pages') if location is not None: page_name = location() Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py Fri Jun 30 21:53:52 2006 @@ -26,6 +26,7 @@ from cpsskins.standard.negotiation import ISessionNegotiationScheme from cpsskins.standard.negotiation import ILocationNegotiationScheme from cpsskins.standard.negotiation import ICookieLocationNegotiationScheme +from cpsskins.utils import guessPath class Location(NegotiationScheme): Look for a perspective among locations. The path is obtained from @@ -34,9 +35,7 @@ implements(ILocationNegotiationScheme) def __call__(self): -context = self.context -nearest_site = IPhysicallyLocatable(context).getNearestSite() -path = getPath(context)[len(getPath(nearest_site)):] +path = guessPath(self.context, self.request) location = self.manager.getLocation(path, root=u'perspectives') if location is not None: return location() Modified: cpsskins/branches/paris-sprint-2006/utils.py == --- cpsskins/branches/paris-sprint-2006/utils.py(original) +++ cpsskins/branches/paris-sprint-2006/utils.pyFri Jun 30 21:53:52 2006 @@ -22,7 +22,8 @@ from zope.component import getSiteManager, getGlobalSiteManager from zope.location.pickling import locationCopy from zope.security.proxy import removeSecurityProxy -from zope.traversing.api import getParent +from zope.traversing.api import getParent, getPath +from zope.traversing.interfaces import IPhysicallyLocatable startTag = re.compile('.*?') classAttr = re.compile(' class=(.*?)') @@ -120,6 +121,15 @@ res.append(part) return u''.join(res) +def guessPath(context, request): +path = getPath(context) + u'/' +uri = request['REQUEST_URI'] +pos = uri.find(path) +if pos 0: +path = uri[pos:] +nearest_site = IPhysicallyLocatable(context).getNearestSite() +return path[len(getPath(nearest_site)):] + def insertCSSClass(markup, css_class): Insert a CSS class in the first tag of some HTML markup. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3558 - in cpsskins/branches/paris-sprint-2006: . controllers doc elements ftests ui/screens/common
Author: jmorliaguet Date: Thu Jun 29 16:44:00 2006 New Revision: 3558 Added: cpsskins/branches/paris-sprint-2006/ftests/test_themestructure.py (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt cpsskins/branches/paris-sprint-2006/elements/element.py cpsskins/branches/paris-sprint-2006/elements/interfaces.py cpsskins/branches/paris-sprint-2006/elements/theme.py cpsskins/branches/paris-sprint-2006/elements/themepage.py cpsskins/branches/paris-sprint-2006/thememanager.py cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt Log: - added some tests on default themes / pages Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py == --- cpsskins/branches/paris-sprint-2006/controllers/themepage.py (original) +++ cpsskins/branches/paris-sprint-2006/controllers/themepage.pyThu Jun 29 16:44:00 2006 @@ -18,7 +18,7 @@ __docformat__ = reStructuredText from zope.interface import implements -from zope.traversing.api import getName, getParent +from zope.traversing.api import getName from cpsskins.controllers import Controller from cpsskins.controllers.interfaces import IController @@ -35,12 +35,11 @@ element = self.element tmutil = getThemeManager(element) -if tmutil.getDefaultPage() is None: +theme = element.getTheme() +if tmutil.getDefaultPage(theme) is None: tmutil.setAsDefault(element) -theme = getParent(element) theme.registerUtility(element, IThemePage, getName(element)) - IPresentable(element).addPresentation() def removed(self): @@ -49,5 +48,6 @@ element = self.element getThemeManager(element).removeFormats(element) -theme = getParent(element) +theme = element.getTheme() theme.unregisterUtility(element, IThemePage, getName(element)) + Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt == --- cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt (original) +++ cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Thu Jun 29 16:44:00 2006 @@ -3,7 +3,9 @@ THEME MANAGEMENT FOLDER === -:: +Themes are located inside a Theme Management Folder. + +The folder structure is:: + themes ( .../++etc++site/defaut/themes ) | @@ -28,5 +30,127 @@ + Presets | + Snapshots + | + + Locations + +Setup: + + root = getRootFolder() + + from cpsskins.tests.setup import addThemeManager + from cpsskins.tests.setup import makeSite + from cpsskins.utils import addThemeSkeleton + + tmutil = addThemeManager(root, makeSite(root)) + + def inspect(): +... for theme in tmutil.getThemes(): +... print '- %s (default: %s)' % (theme.title, +... tmutil.isDefault(theme)) +... for page in theme.getPages(): +... print ' |_ %s (default: %s)' % \ +... (page.title, tmutil.isDefault(page)) + + +We add a theme skeleton, this creates a default theme with a default page. + + themes = addThemeSkeleton(tmutil) + + inspect() +- Theme (default: True) + |_ Default page (default: True) + + theme1 = tmutil.getDefaultTheme() + theme1 +Theme('Theme') + +we create and add a second theme: + + from cpsskins.elements.theme import Theme + theme2 = Theme(u'Theme 2') + + tmutil.addTheme(theme2) +u'Theme-2' + + inspect() +- Theme (default: True) + |_ Default page (default: True) +- Theme 2 (default: False) + +the default theme is still the first theme: + + tmutil.getDefaultTheme() +Theme('Theme') + + theme1.isDefault(), theme2.isDefault() +(True, False) + +themes have siblings: + + theme2.getSiblings() +[Theme('Theme')] + + theme1.getSiblings() +[Theme('Theme 2')] + +a theme has pages: + + theme1.getPages() +[ThemePage('Default page')] + +we create and add a page to the second theme: + + from cpsskins.elements.themepage import ThemePage + page1 = ThemePage('Page 1') + tmutil.addPage(theme2, page1) +'ThemePage' + + inspect() +- Theme (default: True) + |_ Default page (default: True) +- Theme 2 (default: False) + |_ Page 1 (default: True) + +we add a second page to the second theme: + + page2 = ThemePage('Page 2') + tmutil.addPage(theme2, page2) +'ThemePage-2' + + inspect() +- Theme (default: True) + |_ Default page (default: True) +- Theme 2 (default: False) + |_ Page 2 (default: False) + |_ Page 1 (default: True) + +pages have siblings: + + page1.getSiblings() +[ThemePage('Page 2')] + + page2.getSiblings
[Z3lab-checkins] r3559 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 29 16:44:21 2006 New Revision: 3559 Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt Log: - test fix Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt == --- cpsskins/branches/paris-sprint-2006/setup/io/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/README.txt Thu Jun 29 16:44:21 2006 @@ -337,13 +337,14 @@ --- from cpsskins.locations import Location - location = Location(path=u'/folder/A', scope=(1, 3), data=u'd1') + location = Location(path=u'/folder/A', scope=(1, 3), data=u'd1', +... root=u'pages') archive = {} print toXML(location, u'locations', archive=archive, ... attributes=(u'path', u'scope', u'data', u'root')) ?xml version=1.0 encoding=utf-8? locations - location data=d1 path=/folder/A scope=(1, 3)/ + location data=d1 path=/folder/A root=pages scope=(1, 3)/ /locations BLANKLINE -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3560 - in cpsskins/branches/paris-sprint-2006: . doc
Author: jmorliaguet Date: Thu Jun 29 18:58:29 2006 New Revision: 3560 Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt cpsskins/branches/paris-sprint-2006/thememanager.py Log: - fixes, the isDefault() method was broken - do not default to empty values when function parameters are required Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt == --- cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt (original) +++ cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Thu Jun 29 18:58:29 2006 @@ -115,7 +115,7 @@ page2 = ThemePage('Page 2') tmutil.addPage(theme2, page2) -'ThemePage-2' +u'ThemePage-2' inspect() - Theme (default: True) Modified: cpsskins/branches/paris-sprint-2006/thememanager.py == --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Thu Jun 29 18:58:29 2006 @@ -223,7 +223,7 @@ # Themes and pages ### -def addTheme(self, theme=None, name=u''): +def addTheme(self, theme, name=u''): if not ITheme.providedBy(theme): raise(Must specify a theme.) @@ -231,7 +231,7 @@ self[name] = theme return name -def addPage(self, theme=None, page=None, name=u''): +def addPage(self, theme, page, name=u''): if not IThemePage.providedBy(page): raise(Must specify a theme page.) @@ -245,7 +245,7 @@ def getPages(self, theme): return [page for name, page in theme.getUtilitiesFor(IThemePage)] -def deleteTheme(self, name=u''): +def deleteTheme(self, name): for k, v in self.getUtilitiesFor(ITheme): if k == name: del self[getName(v)] @@ -257,13 +257,13 @@ for k, v in self.getUtilitiesFor(ITheme): del self[getName(v)] -def getThemeByName(self, name=u''): +def getThemeByName(self, name): for k, v in self.getUtilitiesFor(ITheme): if k == name: return v return None -def getPageByName(self, name=u''): +def getPageByName(self, name): theme_name, page_name = name.split(u':') theme = self.getThemeByName(theme_name) if theme is None: @@ -273,18 +273,18 @@ return v return None -def isDefault(self, object=None): +def isDefault(self, object): relations = self.getRelationStorage() res = relations.search(predicate=isDefault, first=object) -return res is not [] +return bool(res) -def setAsDefault(self, object=None): +def setAsDefault(self, object): relations = self.getRelationStorage() relations.add(MonadicRelation(isDefault, object)) defaults = [] for o in object.getSiblings(): defaults.extend(relations.search(predicate=isDefault, first=o)) -relations.remove(defaults) +relations.remove(defaults) def getDefaultTheme(self): for theme in self.getThemes(): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3561 - in cpsskins/branches/paris-sprint-2006: controllers doc
Author: jmorliaguet Date: Thu Jun 29 19:05:19 2006 New Revision: 3561 Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Log: - reset the default page of a theme if the default page is removed Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py == --- cpsskins/branches/paris-sprint-2006/controllers/themepage.py (original) +++ cpsskins/branches/paris-sprint-2006/controllers/themepage.pyThu Jun 29 19:05:19 2006 @@ -46,8 +46,13 @@ What to do when the element has been removed. element = self.element -getThemeManager(element).removeFormats(element) +tmutil = getThemeManager(element) +tmutil.removeFormats(element) theme = element.getTheme() theme.unregisterUtility(element, IThemePage, getName(element)) +if tmutil.getDefaultPage(theme) is None: +pages = tmutil.getPages(theme) +if pages: +tmutil.setAsDefault(pages[0]) Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt == --- cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt (original) +++ cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Thu Jun 29 19:05:19 2006 @@ -153,4 +153,23 @@ |_ Page 1 (default: False) +if we remove a page that was used by default, the first page of the theme +will be use by default instead: + + del theme2[u'ThemePage-2'] + + inspect() +- Theme (default: False) + |_ Default page (default: True) +- Theme 2 (default: True) + |_ Page 1 (default: True) + +we can also remove the only page of a theme: + + del theme2[u'ThemePage'] + + inspect() +- Theme (default: False) + |_ Default page (default: True) +- Theme 2 (default: True) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3562 - in cpsskins/branches/paris-sprint-2006: controllers doc standard/negotiation
Author: jmorliaguet Date: Thu Jun 29 20:23:02 2006 New Revision: 3562 Modified: cpsskins/branches/paris-sprint-2006/controllers/theme.py cpsskins/branches/paris-sprint-2006/controllers/themepage.py cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py Log: - fixed the behaviour of default themes Modified: cpsskins/branches/paris-sprint-2006/controllers/theme.py == --- cpsskins/branches/paris-sprint-2006/controllers/theme.py(original) +++ cpsskins/branches/paris-sprint-2006/controllers/theme.pyThu Jun 29 20:23:02 2006 @@ -43,6 +43,10 @@ def removed(self): element = self.element tmutil = getThemeManager(element) - tmutil.unregisterUtility(element, ITheme, getName(element)) +if element.isDefault(): +themes = tmutil.getThemes() +if themes: +tmutil.setAsDefault(themes[0]) + Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py == --- cpsskins/branches/paris-sprint-2006/controllers/themepage.py (original) +++ cpsskins/branches/paris-sprint-2006/controllers/themepage.pyThu Jun 29 20:23:02 2006 @@ -52,7 +52,8 @@ theme = element.getTheme() theme.unregisterUtility(element, IThemePage, getName(element)) -if tmutil.getDefaultPage(theme) is None: +if element.isDefault(): pages = tmutil.getPages(theme) if pages: tmutil.setAsDefault(pages[0]) + Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt == --- cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt (original) +++ cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Thu Jun 29 20:23:02 2006 @@ -54,14 +54,13 @@ We add a theme skeleton, this creates a default theme with a default page. - themes = addThemeSkeleton(tmutil) + theme1 = addThemeSkeleton(tmutil) inspect() - Theme (default: True) |_ Default page (default: True) - theme1 = tmutil.getDefaultTheme() - theme1 + tmutil.getDefaultTheme() Theme('Theme') we create and add a second theme: @@ -173,3 +172,16 @@ |_ Default page (default: True) - Theme 2 (default: True) +if we remove a theme that is a default theme, the first theme will become +the default theme: + + del tmutil[u'Theme-2'] + inspect() +- Theme (default: True) + |_ Default page (default: True) + +we can delete the only theme left: + + + del tmutil[u'Theme'] + inspect() Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.pyThu Jun 29 20:23:02 2006 @@ -69,7 +69,8 @@ implements(IDefaultNegotiationScheme) def __call__(self): -return self.manager.getDefaultPage() +theme = self.manager.getDefaultTheme() +return self.manager.getDefaultPage(theme) class Context(NegotiationScheme): Look for a page in the context -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3563 - cpsskins/branches/paris-sprint-2006/ui/screens/common
Author: jmorliaguet Date: Thu Jun 29 20:40:18 2006 New Revision: 3563 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt Log: - underline the default theme Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt Thu Jun 29 20:40:18 2006 @@ -16,7 +16,9 @@ img tal:attributes=id string:t${theme/identifier} alt= width=12 height=12 src=++resource++edit-12.png / a tal:content=python: theme.title or 'No title' - tal:attributes=href string:@@setPage?name=${theme/name} / + tal:attributes=href string:@@setPage?name=${theme/name}; + style python: tmutil.isDefault(theme) and + 'text-decoration: underline' or nothing / /td td tal:attributes=class python: selected and 'rtabselected' or 'rtab' img alt= width=5 height=5 src=++resource++rtab.png / -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3564 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Thu Jun 29 20:55:31 2006 New Revision: 3564 Modified: cpsskins/branches/paris-sprint-2006/thememanager.py Log: - added missing interface methods Modified: cpsskins/branches/paris-sprint-2006/thememanager.py == --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Thu Jun 29 20:55:31 2006 @@ -56,6 +56,9 @@ The methods may be moved to other classes. +def registerUtilities(): +Register the various components. + def getIdRegistry(): Return the unique id registry. @@ -68,14 +71,14 @@ def getFormatStorage(): Return the format storage. -def getSnapshotStorage(): -Return the snapshot storage. +def getPortletStorage(): +Return the portlet storage. def getLocationStorage(): Return the location storage. -def getPortletStorage(): -Return the portlet storage. +def getSnapshotStorage(): +Return the snapshot storage. def getPresets(): Return the presets. @@ -95,12 +98,12 @@ def addPage(theme, page, name): Add a page. -def isDefault(object): -Return true if the object is used by default. - def getThemes(): Return the list of available themes. +def getPages(theme): +Return the list of available pages in a theme. + def deleteTheme(name): Delete a theme. @@ -113,6 +116,12 @@ def getPageByName(name): Return a page by its name. +def isDefault(object): +Return true if the object is used by default. + +def setAsDefault(object): +Set the object as a default object. + def getDefaultTheme(): Return the default theme. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3566 - in cpsskins/branches/paris-sprint-2006/browser: . skin
Author: jmorliaguet Date: Thu Jun 29 22:53:55 2006 New Revision: 3566 Removed: cpsskins/branches/paris-sprint-2006/browser/skin/add.pt cpsskins/branches/paris-sprint-2006/browser/skin/addform.pt cpsskins/branches/paris-sprint-2006/browser/skin/popup_macros.pt cpsskins/branches/paris-sprint-2006/browser/skin/widget_macros.pt Modified: cpsskins/branches/paris-sprint-2006/browser/configure.zcml cpsskins/branches/paris-sprint-2006/browser/skin/configure.zcml cpsskins/branches/paris-sprint-2006/browser/skin/standardmacros.py cpsskins/branches/paris-sprint-2006/browser/skin/template.pt Log: - removed unused templates Modified: cpsskins/branches/paris-sprint-2006/browser/configure.zcml == --- cpsskins/branches/paris-sprint-2006/browser/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/browser/configure.zcml Thu Jun 29 22:53:55 2006 @@ -6,30 +6,6 @@ include package=.skin / - view - for=cpsskins.elements.interfaces.IElementContainer - name=+ - menu=zmi_actions title=Add - class=zope.app.container.browser.adding.Adding - permission=zope.ManageContent - layer=cpsskins.browser.skin.cpsskins - - page name=index.html template=skin/add.pt / - page name=action.html attribute=action / - - /view - - !-- Container views for elements -- - - !-- - containerViews - for=cpsskins.elements.interfaces.IElement - contents=zope.ManageContent - index=zope.View - add=zope.ManageContent - / - -- - !-- Theme management utility -- addMenuItem Modified: cpsskins/branches/paris-sprint-2006/browser/skin/configure.zcml == --- cpsskins/branches/paris-sprint-2006/browser/skin/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/browser/skin/configure.zcml Thu Jun 29 22:53:55 2006 @@ -28,20 +28,4 @@ layer=cpsskins.browser.skin.cpsskins / - browser:page - for=* - name=popup_macros - permission=zope.View - template=popup_macros.pt - layer=cpsskins.browser.skin.cpsskins - / - - browser:page - for=* - name=widget_macros - permission=zope.View - template=widget_macros.pt - layer=cpsskins.browser.skin.cpsskins - / - /configure Modified: cpsskins/branches/paris-sprint-2006/browser/skin/standardmacros.py == --- cpsskins/branches/paris-sprint-2006/browser/skin/standardmacros.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/skin/standardmacros.py Thu Jun 29 22:53:55 2006 @@ -19,5 +19,4 @@ from zope.app.basicskin.standardmacros import StandardMacros as BaseMacros class StandardMacros(BaseMacros): -macro_pages = ('skin_macros', 'view_macros', 'dialog_macros', - 'navigation_macros', 'widget_macros') +macro_pages = ('skin_macros',) Modified: cpsskins/branches/paris-sprint-2006/browser/skin/template.pt == --- cpsskins/branches/paris-sprint-2006/browser/skin/template.pt (original) +++ cpsskins/branches/paris-sprint-2006/browser/skin/template.ptThu Jun 29 22:53:55 2006 @@ -4,22 +4,19 @@ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; /metal:block html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en - tal:define=negotiation nocall:context/@@negotiation; - engine negotiation/getEngine; - page negotiation/getPage; - pageviewer nocall:page/@@viewer + tal:define=negotiation nocall:context/@@negotiation; + engine negotiation/getEngine; + page negotiation/getPage; + pageviewer nocall:page/@@viewer head title metal:define-slot=titleCPSSkins for Zope3/title meta http-equiv=Content-Type content=text/html;charset=utf-8 / style type=text/css media=all - tal:content=string:@import url(${context/++resource++widgets.css});/style + tal:content=string:@import url(${context/++resource++widgets.css}); / style type=text/css media=all - tal:content=string:@import url(./styles.css);/style + tal:content=string:@import url(./styles.css); / /head -tal:block content=structure python:pageviewer( - location=context, - view=view, - template=template, - engine=engine) / +tal:block content=structure python:pageviewer(location=context, +view=view, template=template, engine=engine) / /html /metal:block -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3567 - in cpsskins/branches/paris-sprint-2006/ui/screens: contentauthor/filters pagedesigner/layout
Author: jmorliaguet Date: Fri Jun 30 00:01:47 2006 New Revision: 3567 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/portlet.pt Log: - make portlets located in slot movable Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt Fri Jun 30 00:01:47 2006 @@ -1,20 +1,9 @@ -div - tal:define= -parent context/@@getParent; -info options/info; -perspective info/perspective; -formats context/formattable:getFormatNames|python:[]; -parent_type parent/type:getElementName; -editable python: str(parent_type) == 'ISlot' and 1 or 0; -title context/title; -id context/identifier - tal:attributes= -editable editable; -formattable python: formats and 1 or 0; -formats python: ' '.join(formats); -class python: editable and 'editable draggable hover' or nothing; -id id +ins class=model + tal:define=info options/info; model nocall:context/@@getModelInfo + tal:content=python: model(info) / - div tal:content=structure options/markup / +tal:block content=python: options['info'] / -/div +div class=elementEditable elementMovable elementShiftable portletTarget + tal:attributes=id context/identifier + tal:content=structure options/markup / Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt Fri Jun 30 00:01:47 2006 @@ -2,18 +2,11 @@ markup options/markup; slot_title context/title; slot_name context; - id context/identifier; - icon context/@@getIcon - - ins class=model - tal:define=info options/info; model nocall:context/@@getModelInfo - tal:content=python: model(info) / - + id context/identifier div class=slotFrame container portletTarget tal:attributes=id id; targetid id div class=title tal:content=slot_title|slot_name / div class=body tal:condition=markup tal:content=structure markup / /div - /tal:block Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/portlet.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/portlet.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/portlet.pt Fri Jun 30 00:01:47 2006 @@ -3,10 +3,9 @@ tal:content=python: model(info) / div i18n:domain=cpsskins class=elementEditable elementMovable elementShiftable portletTarget - tal:define= -title context/title; -id context/identifier; -type_name context/type:contentname + tal:define=title context/title; + id context/identifier; + type_name context/type:contentname tal:attributes=id id div class=portletBox span class=typeName i18n:domain=cpsskins i18n:translate= -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3568 - in cpsskins/branches/paris-sprint-2006: browser/rendering doc standard/filters/accesskeys standard/filters/widget standard/portlets/actions standard/portlets/breadcrumbs stand
Author: jmorliaguet Date: Fri Jun 30 00:04:56 2006 New Revision: 3568 Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py cpsskins/branches/paris-sprint-2006/doc/portlets.txt cpsskins/branches/paris-sprint-2006/standard/filters/accesskeys/__init__.py cpsskins/branches/paris-sprint-2006/standard/filters/widget/__init__.py cpsskins/branches/paris-sprint-2006/standard/portlets/actions/portlet.py cpsskins/branches/paris-sprint-2006/standard/portlets/breadcrumbs/portlet.py cpsskins/branches/paris-sprint-2006/standard/portlets/custom/portlet.py cpsskins/branches/paris-sprint-2006/standard/portlets/macroslot/portlet.py cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/wysiwyg/pageblock.pt Log: - renamed the renderer's global structure as 'rendering', e.g. info.rendering.engine, info.rendering.location instead of 'globals' to avoid locally overriding globals() Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/renderer.py Fri Jun 30 00:04:56 2006 @@ -77,9 +77,9 @@ Get the list of filters associated to the element element, request = self.element, self.request -engine = info.globals.engine +engine = info.rendering.engine -relations = info.globals.relations +relations = info.rendering.relations # look for renderers associated to the element's content type type = IType(element) @@ -126,7 +126,7 @@ # the adapted object is a URI which must be resolved if isinstance(adapted, basestring): uri = adapted -adapted = info.globals.resources.resolve(uri, element) +adapted = info.rendering.resources.resolve(uri, element) # get the adapter filter = queryMultiAdapter((adapted,), IFilterView, Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py Fri Jun 30 00:04:56 2006 @@ -66,24 +66,24 @@ notify(ViewNodeEvent(element)) # update global context info variables passed as keyword parameters -globals = ContextInfo(kw) +rendering = ContextInfo(kw) # set the current location unless specified -if globals.location is None: -globals.location = IPhysicallyLocatable(element).getNearestSite() +if rendering.location is None: +rendering.location = IPhysicallyLocatable(element).getNearestSite() -if globals.engine is None: -globals.engine = u'default' +if rendering.engine is None: +rendering.engine = u'default' tmutil = getThemeManager(element) relations = tmutil.getRelationStorage() -negotiation = getMultiAdapter((globals.location, request), +negotiation = getMultiAdapter((rendering.location, request), INegotiation, 'negotiation') perspective = negotiation.getPerspective() resources = getUtility(IResourceManager) # set other global variables -globals.update({ +rendering.update({ 'request': request, 'perspective': perspective, 'relations': relations, @@ -91,17 +91,17 @@ }) # XXX -globals.accesskeys = [] +rendering.accesskeys = [] # build the tree and store it in the request contexts = {} tree = contexts['tree'] = {} -_updateTreeInfo(tree=tree, node=element, globals=globals) +_updateTreeInfo(tree=tree, node=element, rendering=rendering) # render the tree return getMultiAdapter((element, request), IRendererView)(tree) -def _updateTreeInfo(tree={}, node=None, order=0, globals=None): +def _updateTreeInfo(tree={}, node=None, order=0, rendering=None): Build the tree info for an element. @@ -111,9 +111,9 @@ node_index = tree[node.identifier] = {} -perspective = globals.perspective +perspective = rendering.perspective -traverser = getMultiAdapter((node, globals.request), INodeTraversing) +traverser = getMultiAdapter((node, rendering.request), INodeTraversing) children = traverser.getChildNodes(perspective=perspective) info = ContextInfo({ @@ -125,7 +125,7 @@ }) # set global variables
[Z3lab-checkins] r3569 - in z3ecm/trunk/src/ecm/cpsskins: example4 example6
Author: jmorliaguet Date: Fri Jun 30 00:05:18 2006 New Revision: 3569 Modified: z3ecm/trunk/src/ecm/cpsskins/example4/actions.py z3ecm/trunk/src/ecm/cpsskins/example6/counter.py Log: - renamed 'globals' as 'rendering' Modified: z3ecm/trunk/src/ecm/cpsskins/example4/actions.py == --- z3ecm/trunk/src/ecm/cpsskins/example4/actions.py(original) +++ z3ecm/trunk/src/ecm/cpsskins/example4/actions.pyFri Jun 30 00:05:18 2006 @@ -46,8 +46,8 @@ self.category = category def __call__(self, info): -location = info.globals.location -request = info.globals.request +location = info.rendering.location +request = info.rendering.request try: menu = getMenu(self.category, location, request) Modified: z3ecm/trunk/src/ecm/cpsskins/example6/counter.py == --- z3ecm/trunk/src/ecm/cpsskins/example6/counter.py(original) +++ z3ecm/trunk/src/ecm/cpsskins/example6/counter.pyFri Jun 30 00:05:18 2006 @@ -39,12 +39,12 @@ self.title = title def __call__(self, info): -request = info.globals.request +request = info.rendering.request count = request.annotations.get(COUNTER_NAME, 0) return uThere are b%s/b portlet(s) on this page. % str(count) def update(self, info): -request = info.globals.request +request = info.rendering.request if COUNTER_NAME not in request.annotations: request.annotations[COUNTER_NAME] = 0 -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3571 - in cpsskins/branches/paris-sprint-2006: browser/tree ui/screens/contentauthor/filters
Author: jmorliaguet Date: Fri Jun 30 00:43:28 2006 New Revision: 3571 Modified: cpsskins/branches/paris-sprint-2006/browser/tree/slot.py cpsskins/branches/paris-sprint-2006/browser/tree/views.py cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt Log: - fixes to make it possible to move portlets between slots. Modified: cpsskins/branches/paris-sprint-2006/browser/tree/slot.py == --- cpsskins/branches/paris-sprint-2006/browser/tree/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/browser/tree/slot.pyFri Jun 30 00:43:28 2006 @@ -18,11 +18,13 @@ __docformat__ = reStructuredText import logging -from zope.component import getMultiAdapter from zope.app.container.browser.adding import Adding +from zope.component import getMultiAdapter +from zope.interface import implements +from zope.location.location import locate from zope.publisher.browser import BrowserView from zope.traversing.api import getName, getParent -from zope.interface import implements +from zope.security.proxy import removeSecurityProxy from cpsskins.browser.negotiation.interfaces import INegotiation from cpsskins.browser.tree.interfaces import INodeAdding, INodeRemoving @@ -124,8 +126,10 @@ def move(self, content): request = self.request +content = removeSecurityProxy(content) src_container = getParent(content) -dest_container = self.context +# FIXME: shouldn't have to removeSecurityProxy() +dest_container = removeSecurityProxy(self.context) if dest_container == src_container: return content @@ -155,7 +159,7 @@ # remove old src_slot - portlet relations relations.remove(old_relations) # set the portlet's parent explicitly -content.__parent__ = dest_container +locate(object=content, parent=dest_container) return content class SlotRemoving(BrowserView): Modified: cpsskins/branches/paris-sprint-2006/browser/tree/views.py == --- cpsskins/branches/paris-sprint-2006/browser/tree/views.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/tree/views.py Fri Jun 30 00:43:28 2006 @@ -17,12 +17,13 @@ __docformat__ = reStructuredText -from zope.component import getMultiAdapter -from zope.publisher.browser import BrowserView from zope.app.container.browser.adding import Adding from zope.app.copypastemove.interfaces import IObjectCopier, IObjectMover -from zope.traversing.api import getName, getParent +from zope.component import getMultiAdapter from zope.interface import implements +from zope.publisher.browser import BrowserView +from zope.traversing.api import getName, getParent +from zope.security.proxy import removeSecurityProxy from cpsskins.elements.interfaces import ILeaf from cpsskins.browser.tree.interfaces import INodeAdding, INodeRemoving Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/portlet.pt Fri Jun 30 00:43:28 2006 @@ -2,8 +2,6 @@ tal:define=info options/info; model nocall:context/@@getModelInfo tal:content=python: model(info) / -tal:block content=python: options['info'] / - div class=elementEditable elementMovable elementShiftable portletTarget tal:attributes=id context/identifier tal:content=structure options/markup / -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3534 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Wed Jun 28 10:51:00 2006 New Revision: 3534 Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py Log: - raise an exception if no content type has been registered Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pyWed Jun 28 10:51:00 2006 @@ -111,6 +111,8 @@ # properties schema = type.getContentType() +if schema is None: +raise TypeError(%s has no content type, repr(context)) for attr, field in zope.schema.getFieldsInOrder(schema): if attr in self.ignored_fields: continue -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3535 - in cpsskins/branches/paris-sprint-2006: locations setup/io standard/io
Author: jmorliaguet Date: Wed Jun 28 11:32:16 2006 New Revision: 3535 Added: cpsskins/branches/paris-sprint-2006/standard/io/location.py (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/setup/io/README.txt cpsskins/branches/paris-sprint-2006/setup/io/adapters.py cpsskins/branches/paris-sprint-2006/setup/io/utils.py cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml Log: - added a DOM adapter for exporting / importing locations Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml == --- cpsskins/branches/paris-sprint-2006/locations/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/locations/configure.zcmlWed Jun 28 11:32:16 2006 @@ -28,4 +28,21 @@ name=location data / + !-- Typing -- + interface + interface=.interfaces.ILocation + type=cpsskins.setup.interfaces.IResourceType + / + + interface + interface=.interfaces.ILocation + type=zope.app.content.interfaces.IContentType + / + + interface + name=location + interface=.interfaces.ILocation + type=cpsskins.setup.interfaces.INameType + / + /configure Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt == --- cpsskins/branches/paris-sprint-2006/setup/io/README.txt (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/README.txt Wed Jun 28 11:32:16 2006 @@ -198,15 +198,17 @@ root = getRootFolder() theme = addThemeSkeleton(tmutil) - print toXML(theme, u'themes', attributes=(u'title', ), -... ignored=(u'slot',)) + print toXML(theme, u'themes', attributes=(u'title', )) ?xml version=1.0 encoding=utf-8? themes theme id=... title=A theme +author value=/ +copyright value=/ +license value=/ themepage id=... title=A page pageblock id=... title=A page block cell id=... title=A cell/ - /pageblock + /pageblock /themepage /theme /themes @@ -331,6 +333,20 @@ BLANKLINE +Export of locations +--- + + from cpsskins.locations import Location + location = Location(path=u'/folder/A', scope=(1, 3), data=u'd1') + archive = {} + print toXML(location, u'locations', archive=archive, +... attributes=(u'path', u'scope', u'data', u'root')) +?xml version=1.0 encoding=utf-8? +locations + location data=d1 path=/folder/A scope=(1, 3)/ +/locations +BLANKLINE + Teardown: for k in root: Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pyWed Jun 28 11:32:16 2006 @@ -103,8 +103,11 @@ type = IType(context) element_el = document.createElement(type.resourcename) -element_id = unicode(IRelatable(context)) -element_el.setAttribute(u'id', element_id) + +relatable = IRelatable(context, None) +if relatable is not None: +element_id = unicode(relatable) +element_el.setAttribute(u'id', element_id) if type.contentname != type.resourcename: element_el.setAttribute(u'type', unicode(type.contentname)) Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py == --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Wed Jun 28 11:32:16 2006 @@ -48,7 +48,7 @@ uri_mapping.update(importPresets(archive, context)) # storages -for name in u'formats', u'portlets': +for name in u'formats', u'portlets', 'locations': uri_mapping.update(importStorage(name, archive, context)) # relations @@ -84,7 +84,7 @@ exportThemes(archive, context) exportPresets(archive, context) -for name in u'formats', u'portlets', u'relations': +for name in u'formats', u'portlets', u'locations', u'relations': exportStorage(name, archive, context) return archive() Modified: cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml == --- cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/io/configure.zcml Wed Jun 28 11:32:16 2006 @@ -57,4 +57,12 @@ provides=cpsskins.setup.io.interfaces.IDOMAdapter / + !-- locations -- + adapter
[Z3lab-checkins] r3536 - in cpsskins/branches/paris-sprint-2006: locations setup/io storage
Author: jmorliaguet Date: Wed Jun 28 13:58:07 2006 New Revision: 3536 Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/setup/io/adapters.py cpsskins/branches/paris-sprint-2006/setup/io/utils.py cpsskins/branches/paris-sprint-2006/storage/configure.zcml Log: - fixed the export of locations Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml == --- cpsskins/branches/paris-sprint-2006/locations/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/locations/configure.zcmlWed Jun 28 13:58:07 2006 @@ -16,6 +16,13 @@ /class + !-- factory -- + utility + name=cpsskins.location + component=cpsskins.locations.location.Location + provides=zope.component.interfaces.IFactory + / + utility provides=zope.schema.interfaces.IVocabularyFactory component=.interfaces.ScopesVocabulary @@ -31,6 +38,11 @@ !-- Typing -- interface interface=.interfaces.ILocation + type=cpsskins.elements.interfaces.IElementType + / + + interface + interface=.interfaces.ILocation type=cpsskins.setup.interfaces.IResourceType / Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pyWed Jun 28 13:58:07 2006 @@ -101,8 +101,11 @@ document = self.document type = IType(context) +resourcename = type.resourcename +if not resourcename: +raise TypeError(%s has no resource type % repr(context)) -element_el = document.createElement(type.resourcename) +element_el = document.createElement(resourcename) relatable = IRelatable(context, None) if relatable is not None: Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py == --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Wed Jun 28 13:58:07 2006 @@ -160,7 +160,9 @@ continue contentname = el.getAttribute('type') or el.tagName -factory_name = u'cpsskins.%s.%s' % (typename, contentname) +factory_name = u'cpsskins.%s' % typename +if contentname != typename: +factory_name = u'%s.%s' % (factory_name, contentname) obj = createObject(factory_name) storage.add(obj) Modified: cpsskins/branches/paris-sprint-2006/storage/configure.zcml == --- cpsskins/branches/paris-sprint-2006/storage/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/storage/configure.zcml Wed Jun 28 13:58:07 2006 @@ -49,7 +49,7 @@ !-- Location storage -- cpsskins:storage - id=location + id=locations title=Location storage description=A location storage contains local information about the site class=.locations.LocationStorage -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3537 - cpsskins/branches/paris-sprint-2006/storage
Author: jmorliaguet Date: Wed Jun 28 14:48:27 2006 New Revision: 3537 Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py Log: - fix Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/locations.pyWed Jun 28 14:48:27 2006 @@ -142,8 +142,9 @@ locations.append(value) return locations -def getLocation(self, root=u'', path=u'', method=u''): +def getLocation(self, root=u'', path=u''): path = tuple(path.split(u'/')) +path, method = path[:-1], path[-1] key = (root, method) + path return self[key] -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3538 - in cpsskins/branches/paris-sprint-2006: . locations
Author: jmorliaguet Date: Wed Jun 28 14:50:05 2006 New Revision: 3538 Added: cpsskins/branches/paris-sprint-2006/schema.py (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py Log: - added an IntCoupleChoice field for location scopes Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Wed Jun 28 14:50:05 2006 @@ -24,6 +24,7 @@ from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from cpsskins.utils import getThemeManager +from cpsskins.schema import IntCoupleChoice _ = MessageFactory(cpsskins) @@ -38,7 +39,7 @@ title=uPath, ) -scope = Choice( +scope = IntCoupleChoice( title=uScope, vocabulary=location scopes, ) Added: cpsskins/branches/paris-sprint-2006/schema.py == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/schema.py Wed Jun 28 14:50:05 2006 @@ -0,0 +1,37 @@ +## +# +# Copyright (c) 2005-2006 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 zope.interface import implements +from zope.schema.interfaces import IField +from zope.schema import Choice + +class IIntCoupleChoice(IField): +A choice field containing couples of integers e.g. (0, 1) + +class IntCoupleChoice(Choice): +implements(IIntCoupleChoice) + +def fromUnicode(self, text): +self.validate(text) +a, b = text[1:-1].split(u', ') +return (a, b) + +def validate(self, value): +return True + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3539 - in cpsskins/branches/paris-sprint-2006: . locations storage ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 14:56:40 2006 New Revision: 3539 Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py cpsskins/branches/paris-sprint-2006/schema.py cpsskins/branches/paris-sprint-2006/storage/interfaces.py cpsskins/branches/paris-sprint-2006/storage/locations.py cpsskins/branches/paris-sprint-2006/storage/storage.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - added a delete() method to storage to delete objects Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Wed Jun 28 14:56:40 2006 @@ -31,7 +31,9 @@ class ILocation(Interface): Location -_path_tuple = Attribute(representation of the path as a tuple) +_path_tuple = Attribute(Representation of the path as a tuple) + +_method = Attribute(Path's method name.) root = Attribute(Location root) Modified: cpsskins/branches/paris-sprint-2006/schema.py == --- cpsskins/branches/paris-sprint-2006/schema.py (original) +++ cpsskins/branches/paris-sprint-2006/schema.py Wed Jun 28 14:56:40 2006 @@ -33,5 +33,6 @@ return (a, b) def validate(self, value): +# FIXME return True Modified: cpsskins/branches/paris-sprint-2006/storage/interfaces.py == --- cpsskins/branches/paris-sprint-2006/storage/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/interfaces.py Wed Jun 28 14:56:40 2006 @@ -24,6 +24,9 @@ def add(object, name): Add an object to the storage. Return the added object. +def delete(object): +Delete an object + def remove(ids): Remove objects from the storage. Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/locations.pyWed Jun 28 14:56:40 2006 @@ -73,13 +73,17 @@ locate(object=location, parent=self, name=u'-'.join(key)) notify(ObjectAddedEvent(location)) -def remove(self, locations): -if not isinstance(locations, (list, tuple)): -locations = [locations] -for location in locations: -if location not in list(self): +def delete(self, location): +key = (location.root, location._method) + location._path_tuple +self.remove(key) + +def remove(self, ids): +if not isinstance(ids, (list, tuple)): +ids = [ids] +for id in ids: +if id not in list(self): continue -del self[location] +del self[id] def find(self, path, root=u''): if isinstance(path, basestring): Modified: cpsskins/branches/paris-sprint-2006/storage/storage.py == --- cpsskins/branches/paris-sprint-2006/storage/storage.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/storage.py Wed Jun 28 14:56:40 2006 @@ -60,6 +60,9 @@ notify(ObjectAddedEvent(object)) return self[name] +def delete(self, object): +raise NotImplementedError + def remove(self, ids): Remove objects from the storage. Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Wed Jun 28 14:56:40 2006 @@ -182,7 +182,7 @@ if action == u'delete': location = locations.getLocation(root, path) -locations.remove(location) +locations.delete(location) elif action == u'add': location = Location(path=path, root=root) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3540 - cpsskins/branches/paris-sprint-2006/storage
Author: jmorliaguet Date: Wed Jun 28 14:57:51 2006 New Revision: 3540 Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py Log: - optimization / don't mask key errors Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/locations.pyWed Jun 28 14:57:51 2006 @@ -81,8 +81,6 @@ if not isinstance(ids, (list, tuple)): ids = [ids] for id in ids: -if id not in list(self): -continue del self[id] def find(self, path, root=u''): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3541 - in cpsskins/branches/paris-sprint-2006: ftests locations
Author: jmorliaguet Date: Wed Jun 28 17:24:03 2006 New Revision: 3541 Added: cpsskins/branches/paris-sprint-2006/ftests/test_location.py (contents, props changed) cpsskins/branches/paris-sprint-2006/locations/sources.txt (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/locations/interfaces.py Log: - added a context binder for data sources (not 100% done) Added: cpsskins/branches/paris-sprint-2006/ftests/test_location.py == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/ftests/test_location.py Wed Jun 28 17:24:03 2006 @@ -0,0 +1,32 @@ +## +# +# Copyright (c) 2005-2006 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. +# +## +Location tests + +$Id$ + +__docformat__ = reStructuredText + +import unittest + +from zope.app.testing.functional import FunctionalDocFileSuite + +from cpsskins.tests.setup import setUp + +def test_suite(): +return unittest.TestSuite(( +FunctionalDocFileSuite('../locations/sources.txt', setUp=setUp), +)) + +if __name__ == '__main__': +unittest.main(defaultTest='test_suite') Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml == --- cpsskins/branches/paris-sprint-2006/locations/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/locations/configure.zcmlWed Jun 28 17:24:03 2006 @@ -25,16 +25,10 @@ utility provides=zope.schema.interfaces.IVocabularyFactory - component=.interfaces.ScopesVocabulary + component=.interfaces.scopesVocabulary name=location scopes / - utility - provides=zope.schema.interfaces.IVocabularyFactory - component=.interfaces.DataVocabulary - name=location data - / - !-- Typing -- interface interface=.interfaces.ILocation Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Wed Jun 28 17:24:03 2006 @@ -17,10 +17,12 @@ __docformat__ = reStructuredText -from zope.interface import Interface, alsoProvides, Attribute +from zope.interface import Interface, alsoProvides, Attribute, implements from zope.i18nmessageid import MessageFactory from zope.schema import TextLine, Tuple, Choice, Int -from zope.schema.interfaces import IVocabularyFactory +from zope.schema.interfaces import ISource +from zope.schema.interfaces import IVocabularyFactory, IContextSourceBinder +from zope.schema.interfaces import IBaseVocabulary, IContextSourceBinder from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from cpsskins.utils import getThemeManager @@ -28,6 +30,62 @@ _ = MessageFactory(cpsskins) +def scopesVocabulary(context): +A vocabulary that contains a list of scopes + +return SimpleVocabulary( +[SimpleTerm(value, token, title) for value, token, title in ( +((0, 0), u'0-0', _(uthere and in all sub-folders)), +((0, 1), u'0-1', _(uonly there)), +((1, 0), u'1-0', _(uin all sub-folders)), +)]) + +alsoProvides(scopesVocabulary, IVocabularyFactory) + +class DataSource(object): +Source for the 'data' field + +implements(ISource) + +def __init__(self): +self.context = None + +def __iter__(self): +context = self.context +if context is None: +return iter([]) +tmutil = getThemeManager(context) +root = context.root +choices = {} + +if root == u'pages': +for theme in tmutil.getThemes(): +theme_name = theme.name +for page in theme.getPages(): +page_id = u'%s:%s' % (theme_name, page.name) +choices[page_id] = u'%s / %s' % (theme.title, page.title) + +elif root == u'perspectives': +for perspective in tmutil.listPerspectives(): +choices[perspective.name] = perspective.title + +elif root == u'engines': +# FIXME +choices[u'default'] = u'default' + +return iter( +[SimpleTerm(value=k, title=v) for k, v
[Z3lab-checkins] r3542 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Wed Jun 28 20:03:52 2006 New Revision: 3542 Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt Log: - test fix Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt == --- cpsskins/branches/paris-sprint-2006/locations/sources.txt (original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.txt Wed Jun 28 20:03:52 2006 @@ -9,7 +9,10 @@ from cpsskins.tests.setup import addThemeManager from cpsskins.tests.setup import makeSite + from cpsskins.utils import addThemeSkeleton + tmutil = addThemeManager(root, makeSite(root)) + themes = addThemeSkeleton(tmutil) from zope.schema import Choice from cpsskins.locations.interfaces import DataSource @@ -44,12 +47,11 @@ from cpsskins.locations import Location l = Location(root=u'pages') - root[u'location'] = l - - data_choice_in_context = data_choice_in_context.bind(l) - print list(data_choice_in_context.source) + tmutil.getLocationStorage().add(l) +in the context of the location the data source returns a list of pages: -clean up: + data_choice_in_context = data_choice_in_context.bind(l) + print [t.value for t in data_choice_in_context.source] +[u'Theme:ThemePage'] - del root[u'location'] -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3543 - in cpsskins/branches/paris-sprint-2006: locations setup/io ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 20:26:09 2006 New Revision: 3543 Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/locations/interfaces.py cpsskins/branches/paris-sprint-2006/locations/sources.txt cpsskins/branches/paris-sprint-2006/setup/io/fields.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - moved sources to a a separate file - disabled the validation of Choice fields during XML imports since their sources depend on a context which doesn't exist yet. Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml == --- cpsskins/branches/paris-sprint-2006/locations/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/locations/configure.zcmlWed Jun 28 20:26:09 2006 @@ -25,7 +25,7 @@ utility provides=zope.schema.interfaces.IVocabularyFactory - component=.interfaces.scopesVocabulary + component=.sources.scopesVocabulary name=location scopes / Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Wed Jun 28 20:26:09 2006 @@ -17,75 +17,15 @@ __docformat__ = reStructuredText -from zope.interface import Interface, alsoProvides, Attribute, implements +from zope.interface import Interface, Attribute from zope.i18nmessageid import MessageFactory -from zope.schema import TextLine, Tuple, Choice, Int -from zope.schema.interfaces import ISource -from zope.schema.interfaces import IVocabularyFactory, IContextSourceBinder -from zope.schema.interfaces import IBaseVocabulary, IContextSourceBinder -from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm +from zope.schema import TextLine, Choice -from cpsskins.utils import getThemeManager +from cpsskins.locations.sources import data_source_binder from cpsskins.schema import IntCoupleChoice _ = MessageFactory(cpsskins) -def scopesVocabulary(context): -A vocabulary that contains a list of scopes - -return SimpleVocabulary( -[SimpleTerm(value, token, title) for value, token, title in ( -((0, 0), u'0-0', _(uthere and in all sub-folders)), -((0, 1), u'0-1', _(uonly there)), -((1, 0), u'1-0', _(uin all sub-folders)), -)]) - -alsoProvides(scopesVocabulary, IVocabularyFactory) - -class DataSource(object): -Source for the 'data' field - -implements(ISource) - -def __init__(self): -self.context = None - -def __iter__(self): -context = self.context -if context is None: -return iter([]) -tmutil = getThemeManager(context) -root = context.root -choices = {} - -if root == u'pages': -for theme in tmutil.getThemes(): -theme_name = theme.name -for page in theme.getPages(): -page_id = u'%s:%s' % (theme_name, page.name) -choices[page_id] = u'%s / %s' % (theme.title, page.title) - -elif root == u'perspectives': -for perspective in tmutil.listPerspectives(): -choices[perspective.name] = perspective.title - -elif root == u'engines': -# FIXME -choices[u'default'] = u'default' - -return iter( -[SimpleTerm(value=k, title=v) for k, v in choices.items()]) - -def data_source_binder(context): -source = DataSource() -if not ILocation.providedBy(context): -raise ValueError(The data source must be bound with a location as a - context.) -source.context = context -return source - -alsoProvides(data_source_binder, IContextSourceBinder) - class ILocation(Interface): Location Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt == --- cpsskins/branches/paris-sprint-2006/locations/sources.txt (original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.txt Wed Jun 28 20:26:09 2006 @@ -15,7 +15,7 @@ themes = addThemeSkeleton(tmutil) from zope.schema import Choice - from cpsskins.locations.interfaces import DataSource + from cpsskins.locations.sources import DataSource data_choice = Choice( ... title=uData, ... source=DataSource(), @@ -27,7 +27,7 @@ let us create a source binder and bind the field to the context: - from cpsskins.locations.interfaces import data_source_binder + from cpsskins.locations.sources import data_source_binder data_choice_in_context = Choice( ... title=uData, Modified: cpsskins/branches/paris-sprint-2006/setup/io/fields.py
[Z3lab-checkins] r3544 - in cpsskins/branches/paris-sprint-2006/ui/screens: common contentauthor elementeditor sitemanager
Author: jmorliaguet Date: Wed Jun 28 21:00:48 2006 New Revision: 3544 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element-editor.css cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css Log: - cosmetic: removed fixed font sizes Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css Wed Jun 28 21:00:48 2006 @@ -7,7 +7,7 @@ padding: 0; overflow-y: expression('auto'); /* IE */ height: expression('100%'); /* IE */ - font: 12px Arial, Helvetica, sans-serif; + font: 13px Arial, Helvetica, sans-serif; } :root { @@ -40,7 +40,6 @@ /* toolbar buttons */ div.locationSelector { background-color: #eee; - font-size: 12px; padding: 0.2em; border-bottom: 1px solid #ccc; margin-bottom: 0.5em; @@ -67,7 +66,6 @@ border-top: 1px solid #666; height: 18px; z-index: 20; - font: 13px arial; padding: 2px; } @@ -95,7 +93,7 @@ background-color: #f0f0f0; background: #f0f0f0 url(++resource++bg-header.png) repeat-x; padding: 2px 0px 2px 30px; - font: 14px arial; + font-size: 1.1em; } .toolbox .header .button { @@ -108,7 +106,7 @@ .toolbox .section { border-top: 1px solid #fff; border-bottom: 1px solid #999; - font: bold 11px arial; + font-weight: bold; padding: 4px 0px 3px 30px; display: block; color: #333; @@ -145,7 +143,7 @@ .toolbox .title { font-weight: bold; - font-size: 90%; + font-size: 0.9em; color: #333; } @@ -159,7 +157,6 @@ } .actionPad a { - font-size: 12px; color: #000 !important; background: #f3f0f0; text-decoration: none; @@ -192,7 +189,6 @@ .tabs { text-align: left; text-decoration: none; - font-size: 11px; padding-left: 1px; margin: 0; } @@ -232,7 +228,6 @@ .topTabs, .topTabs a { text-decoration: none; - font-size: 11px; color: #000; } @@ -281,6 +276,7 @@ padding-top: 15px; padding-left: 9px; margin-left: 0; + font-size: 0.9em; } .pageTabs li { @@ -313,7 +309,6 @@ /* edit form tabs */ .editTabs { - font-size: 13px; } .editTabs li { @@ -376,7 +371,6 @@ position: absolute; right: 13px; top: 8px; - font-size: 11px; background-repeat: no-repeat; background-position: 5% 50%; background-color: #fff; @@ -410,7 +404,7 @@ /* Macro slots */ .mainContentAreaFrame { - font: 14px Trebuchet MS, Verdana, Arial, Sans-Serif; + font-size: 1.3em; text-align: center; background-color: #ffe; padding: 0.5em; @@ -438,7 +432,7 @@ } a.back { - font-size: 14px; + font-size: 1.2em; color: #000; } @@ -463,6 +457,5 @@ form input { padding: 0.1em; - font-size: 11px; border: 1px solid #ccc; } Modified: cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/content_author.css Wed Jun 28 21:00:48 2006 @@ -20,7 +20,7 @@ } .slotFrame .title { - font: bold 11px Arial, Sans-Serif; + font-weight: bold; text-align: center; padding: 0 0 1px 0; border-style: solid; Modified: cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element-editor.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element-editor.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element-editor.css Wed Jun 28 21:00:48 2006 @@ -40,7 +40,6 @@ background-color: #ffd; position: absolute; width: 100px; - font-size: 1em; } fieldset.panel { Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css Wed Jun 28 21:00:48 2006 @@ -46,10 +46,6 @@ margin: 2px 2px 2px 0; } -.sections { - font: 13px Arial, sans-serif; -} - .sections a:hover { background-color: #fcc; color: #006; @@ -86,11 +82,11 @@ } table.panel td.section { - width: 30%; + width: 25%; } table.panel td.subsection { - width: 70%; + width: 75%; } table.panel td.icon { @@ -113,11 +109,9 @@ .sections table.items { margin: 0; padding: 0; - font-size: 12px; } .sections table.items th { - font
[Z3lab-checkins] r3545 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Wed Jun 28 21:01:08 2006 New Revision: 3545 Added: cpsskins/branches/paris-sprint-2006/locations/sources.py (contents, props changed) Log: - added missing file Added: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pyWed Jun 28 21:01:08 2006 @@ -0,0 +1,86 @@ +## +# +# Copyright (c) 2005-2006 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 zope.interface import alsoProvides, implements +from zope.i18nmessageid import MessageFactory +from zope.schema.interfaces import ISource +from zope.schema.interfaces import IVocabularyFactory, IContextSourceBinder +from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm + +from cpsskins.utils import getThemeManager + +_ = MessageFactory(cpsskins) + +def scopesVocabulary(context): +A vocabulary that contains a list of scopes + +return SimpleVocabulary( +[SimpleTerm(value, token, title) for value, token, title in ( +((0, 0), u'0-0', _(uthere and in all sub-folders)), +((0, 1), u'0-1', _(uonly there)), +((1, 0), u'1-0', _(uin all sub-folders)), +)]) + +alsoProvides(scopesVocabulary, IVocabularyFactory) + +class DataSource(object): +Source for the 'data' field + +implements(ISource) + +def __init__(self): +self.context = None + +def __iter__(self): +context = self.context +if context is None: +return iter([]) +tmutil = getThemeManager(context) +root = context.root +choices = {} + +if root == u'pages': +for theme in tmutil.getThemes(): +theme_name = theme.name +for page in theme.getPages(): +page_id = u'%s:%s' % (theme_name, page.name) +choices[page_id] = u'%s / %s' % (theme.title, page.title) + +elif root == u'perspectives': +for perspective in tmutil.listPerspectives(): +choices[perspective.name] = perspective.title + +elif root == u'engines': +# FIXME +choices[u'default'] = u'default' + +return iter( +[SimpleTerm(value=k, title=v) for k, v in choices.items()]) + +def data_source_binder(context): +source = DataSource() +from cpsskins.locations.interfaces import ILocation +if not ILocation.providedBy(context): +raise ValueError(The data source must be bound with a location as a + context.) +source.context = context +return source + +alsoProvides(data_source_binder, IContextSourceBinder) + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3546 - cpsskins/branches/paris-sprint-2006/lib/prototype/src
Author: jmorliaguet Date: Wed Jun 28 21:09:46 2006 New Revision: 3546 Modified: cpsskins/branches/paris-sprint-2006/lib/prototype/src/prototype.js Log: - added the $$() method optimizer to prototype.js Modified: cpsskins/branches/paris-sprint-2006/lib/prototype/src/prototype.js == --- cpsskins/branches/paris-sprint-2006/lib/prototype/src/prototype.js (original) +++ cpsskins/branches/paris-sprint-2006/lib/prototype/src/prototype.js Wed Jun 28 21:09:46 2006 @@ -2005,4 +2005,166 @@ return [valueL, valueT]; } -} \ No newline at end of file +}/ + * + * An add-on to Prototype 1.5 to speed up the $$ function in usual cases. + * + * http://www.sylvainzimmer.com/index.php/archives/2006/06/25/speeding-up-prototypes-selector/ + * + * Authors: + *- Sylvain ZIMMER sylvain _at_ jamendo.com + * + * Changelog: + * v1 (2006/06/25) + * - Initial release + * + * License: AS-IS + * + * Trivia: Check out www.jamendo.com for some great Creative Commons music ;-) + * + / + + + +// We don't extend the Selector class because we want +// to be able to use it if the expression is too complicated. +var SelectorLiteAddon=Class.create(); + + +SelectorLiteAddon.prototype = { + + // This is the constructor. It parses the stack of selectors. + initialize: function(stack) { + +this.r=[]; //results +this.s=[]; //stack of selectors +this.i=0; //stack pointer + +//Parse the selectors +for (var i=stack.length-1;i=0;i--) { + + //This is the parsed selector. Format is : [tagname, id, classnames] + var s=[*,,[]]; + + //The unparsed current selector + var t=stack[i]; + + //Parse the selector backwards + var cursor=t.length-1; + do { + +var d=t.lastIndexOf(#); +var p=t.lastIndexOf(.); +cursor=Math.max(d,p); + +//Found a tagName +if (cursor==-1) { + s[0]=t.toUpperCase(); + +//Found a className +} else if (d==-1 || p==cursor) { + s[2].push(t.substring(p+1)); + +//Found an ID +} else if (!s[1]) { + s[1]=t.substring(d+1); +} +t=t.substring(0,cursor); + } while (cursor0); + this.s[i]=s; +} + }, + + //Returns a list of matched elements below a given root. + get:function(root) { +this.explore(root || document,this.i==(this.s.length-1)); +return this.r; + }, + + //Recursive function where the actual search is being done. + // elt: current root element + // leaf: boolean, are we in a leaf of the search tree? + explore:function(elt,leaf) { + +//Parsed selector +var s=this.s[this.i]; + +//Results +var r=[]; + +//Selector has an ID, use it! +if (s[1]) { + + e=$(s[1]); + if (e (s[0]==* || e.tagName==s[0]) e.childOf(elt)) { + r=[e]; + } + +//Selector has no ID, search by tagname. +} else { + r=$A(elt.getElementsByTagName(s[0])); +} + + +//Filter the results by classnames. +//Todo: by attributes too? +//Sidenote: The performance hit is often here. + +//Single className : that's fast! +if (s[2].length==1) { //single classname + r=r.findAll(function(o) { + +//If the element has only one classname too, the test is simple! +if (o.className.indexOf( )==-1) { + return o.className==s[2][0]; +} else { + return o.className.split(/\s+/).include(s[2][0]); +} + }); + +//Multipe classNames, a bit slower. +} else if (s[2].length0) { + r=r.findAll(function(o) { + +//If the elemtn has only one classname, we can drop it. +if (o.className.indexOf( )==-1) { + return false; +} else { + + //Check that all required classnames are present. + var q=o.className.split(/\s+/); + return s[2].all(function(c) { +return q.include(c); + }); +} + }); +} + + +//Append the results if we're in a leaf +if (leaf) { + this.r=this.r.concat(r); + +//Continue exploring the tree otherwise +} else { + ++this.i; + r.each(function(o) { +this.explore(o,this.i==(this.s.length-1)); + }.bind(this)); +} + } + +} + + +//Overwrite the $$ function. +var $$old=$$; + +var $$=function(a,b) { + + //expression is too complicated, forward the call to prototype's function! + if (b || a.indexOf([)=0) return $$old.apply(this,arguments); + + //Otherwise use our addon! + return new SelectorLiteAddon(a.split(/\s+/)).get(); +} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3547 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Wed Jun 28 21:51:09 2006 New Revision: 3547 Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/locations/interfaces.py cpsskins/branches/paris-sprint-2006/locations/sources.py Log: - added missing ITerms view for the data source Modified: cpsskins/branches/paris-sprint-2006/locations/configure.zcml == --- cpsskins/branches/paris-sprint-2006/locations/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/locations/configure.zcmlWed Jun 28 21:51:09 2006 @@ -1,6 +1,6 @@ configure xmlns=http://namespaces.zope.org/zope; - +xmlns:browser=http://namespaces.zope.org/browser; class class=.location.Location @@ -51,4 +51,12 @@ type=cpsskins.setup.interfaces.INameType / + !-- views -- + browser:view + provides=zope.app.form.browser.interfaces.ITerms + for=cpsskins.locations.sources.IDataSource + class=cpsskins.locations.sources.DataTerms + permission=zope.ManageContent + / + /configure Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Wed Jun 28 21:51:09 2006 @@ -21,7 +21,7 @@ from zope.i18nmessageid import MessageFactory from zope.schema import TextLine, Choice -from cpsskins.locations.sources import data_source_binder +from cpsskins.locations.sources import data_source_binder, scopesVocabulary from cpsskins.schema import IntCoupleChoice _ = MessageFactory(cpsskins) @@ -41,7 +41,7 @@ scope = IntCoupleChoice( title=uScope, -vocabulary=location scopes, +vocabulary=scopesVocabulary(object()), ) data = Choice( Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pyWed Jun 28 21:51:09 2006 @@ -17,10 +17,11 @@ __docformat__ = reStructuredText -from zope.interface import alsoProvides, implements +from zope.app.form.browser.interfaces import ITerms +from zope.interface import alsoProvides, implements, Interface from zope.i18nmessageid import MessageFactory -from zope.schema.interfaces import ISource from zope.schema.interfaces import IVocabularyFactory, IContextSourceBinder +from zope.schema.interfaces import IIterableSource from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from cpsskins.utils import getThemeManager @@ -39,10 +40,13 @@ alsoProvides(scopesVocabulary, IVocabularyFactory) +class IDataSource(IIterableSource): +Data source interface + class DataSource(object): Source for the 'data' field -implements(ISource) +implements(IDataSource) def __init__(self): self.context = None @@ -84,3 +88,23 @@ alsoProvides(data_source_binder, IContextSourceBinder) +class DataTerms(object): +ITerms adapter for the data source + +implements(ITerms) + +def __init__(self, source, request): +self.source = source +self.request = request + +def getTerm(self, value): +for term in self.source: +if term.value == value.value: +return term +raise LookupError(value not found in the source: %s % value.value) + +def getValue(self, token): +for term in self.source: +if term.token == token: +return term.value +raise LookupError(token not found in the source: %s % token) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3548 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Wed Jun 28 21:57:06 2006 New Revision: 3548 Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py Log: - use str(value) as token Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pyWed Jun 28 21:57:06 2006 @@ -32,10 +32,10 @@ A vocabulary that contains a list of scopes return SimpleVocabulary( -[SimpleTerm(value, token, title) for value, token, title in ( -((0, 0), u'0-0', _(uthere and in all sub-folders)), -((0, 1), u'0-1', _(uonly there)), -((1, 0), u'1-0', _(uin all sub-folders)), +[SimpleTerm(value, title=title) for value, title in ( +((0, 0), _(uthere and in all sub-folders)), +((0, 1), _(uonly there)), +((1, 0), _(uin all sub-folders)), )]) alsoProvides(scopesVocabulary, IVocabularyFactory) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3549 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Wed Jun 28 21:57:17 2006 New Revision: 3549 Modified: cpsskins/branches/paris-sprint-2006/schema.py Log: - conversion fix Modified: cpsskins/branches/paris-sprint-2006/schema.py == --- cpsskins/branches/paris-sprint-2006/schema.py (original) +++ cpsskins/branches/paris-sprint-2006/schema.py Wed Jun 28 21:57:17 2006 @@ -30,7 +30,7 @@ def fromUnicode(self, text): self.validate(text) a, b = text[1:-1].split(u', ') -return (a, b) +return (int(a), int(b)) def validate(self, value): # FIXME -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3550 - cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 21:59:33 2006 New Revision: 3550 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - simplifications now that we have a field for Choices containing couples with integers. Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Wed Jun 28 21:59:33 2006 @@ -19,13 +19,11 @@ from zope.component import getUtility from zope.formlib import form -from zope.schema import getFields -from zope.schema.interfaces import IVocabularyFactory, IVocabularyTokenized -from zope.schema.interfaces import ConstraintNotSatisfied from cpsskins import minjson as json from cpsskins.locations import Location from cpsskins.locations.interfaces import ILocation +from cpsskins.locations.sources import data_source_binder, scopesVocabulary from cpsskins.setup.interfaces import IType, IIdentifiable from cpsskins.setup.interfaces import IResourceManager, IResource from cpsskins.setup.io import importSite, exportSite @@ -143,14 +141,12 @@ tmutil = getThemeManager(self.context) locations = tmutil.getLocationStorage() -scopes_factory = getUtility(IVocabularyFactory, u'location scopes') - info = {} +scopes = scopesVocabulary(object()) for root in locations.getRoots(): info[root] = {} for location in locations.getLocations(root): -scopes = scopes_factory(location) -data_choices = data_choices_factory(location) +data_choices = data_source_binder(location) path = location.path displayed_path = path if (u'/' in path and path[-1:] != u'/') or (u'/' not in path): @@ -197,7 +193,6 @@ class LocationForm(object): form_fields = form.Fields(ILocation, omit_readonly=True, render_context=True) - prefix = u'form' def __init__(self, context, request): @@ -209,21 +204,10 @@ def submit(self, data): context = self.context -scopes_factory = getUtility(IVocabularyFactory, u'location scopes') -data_choices_factory = getUtility(IVocabularyFactory, u'location data') -scopes = scopes_factory(context) -data_choices = data_choices_factory(context) for form_field in self.form_fields: field = form_field.field name = form_field.__name__ value = data[u'%s.%s' % (self.prefix, name)] -if name == u'scope': -value = scopes.getTermByToken(value).value -field.validate(value) -elif name == u'data': -if value not in data_choices: -raise ConstraintNotSatisfied(value) -else: -value = field.fromUnicode(value) +value = field.fromUnicode(value) field.set(context, value) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3551 - cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 22:02:21 2006 New Revision: 3551 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - fix: must bind the field to the context Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Wed Jun 28 22:02:21 2006 @@ -205,7 +205,7 @@ def submit(self, data): context = self.context for form_field in self.form_fields: -field = form_field.field +field = form_field.field.bind(context) name = form_field.__name__ value = data[u'%s.%s' % (self.prefix, name)] value = field.fromUnicode(value) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3552 - in cpsskins/branches/paris-sprint-2006: locations tests ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 22:31:56 2006 New Revision: 3552 Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/tests/test_locations.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - added __contains__ to the data source. working implementation Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pyWed Jun 28 22:31:56 2006 @@ -45,6 +45,11 @@ class DataSource(object): Source for the 'data' field + + from zope.interface.verify import verifyClass + verifyClass(IDataSource, DataSource) +True + implements(IDataSource) @@ -77,6 +82,15 @@ return iter( [SimpleTerm(value=k, title=v) for k, v in choices.items()]) +def __len__(self): +return len(list(self)) + +def __contains__(self, value): +for term in self: +if term.value == value: +return True +return False + def data_source_binder(context): source = DataSource() from cpsskins.locations.interfaces import ILocation @@ -89,8 +103,13 @@ alsoProvides(data_source_binder, IContextSourceBinder) class DataTerms(object): -ITerms adapter for the data source +ITerms adapter for the data source + + from zope.interface.verify import verifyClass + verifyClass(ITerms, DataTerms) +True + implements(ITerms) def __init__(self, source, request): Modified: cpsskins/branches/paris-sprint-2006/tests/test_locations.py == --- cpsskins/branches/paris-sprint-2006/tests/test_locations.py (original) +++ cpsskins/branches/paris-sprint-2006/tests/test_locations.py Wed Jun 28 22:31:56 2006 @@ -19,11 +19,12 @@ import unittest -from zope.testing.doctestunit import DocFileSuite +from zope.testing.doctestunit import DocFileSuite, DocTestSuite def test_suite(): return unittest.TestSuite(( DocFileSuite('../locations/README.txt'), +DocTestSuite('cpsskins.locations.sources'), )) if __name__ == '__main__': Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Wed Jun 28 22:31:56 2006 @@ -206,8 +206,7 @@ context = self.context for form_field in self.form_fields: field = form_field.field.bind(context) -name = form_field.__name__ -value = data[u'%s.%s' % (self.prefix, name)] +value = data[u'%s.%s' % (self.prefix, form_field.__name__)] value = field.fromUnicode(value) field.set(context, value) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3553 - in cpsskins/branches/paris-sprint-2006: . locations
Author: jmorliaguet Date: Wed Jun 28 22:36:46 2006 New Revision: 3553 Added: cpsskins/branches/paris-sprint-2006/schema.py (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py cpsskins/branches/paris-sprint-2006/locations/sources.txt Log: - fixed infinite recursion - test updates Modified: cpsskins/branches/paris-sprint-2006/locations/sources.py == --- cpsskins/branches/paris-sprint-2006/locations/sources.py(original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.pyWed Jun 28 22:36:46 2006 @@ -83,7 +83,7 @@ [SimpleTerm(value=k, title=v) for k, v in choices.items()]) def __len__(self): -return len(list(self)) +return len([t for t in self]) def __contains__(self, value): for term in self: Modified: cpsskins/branches/paris-sprint-2006/locations/sources.txt == --- cpsskins/branches/paris-sprint-2006/locations/sources.txt (original) +++ cpsskins/branches/paris-sprint-2006/locations/sources.txt Wed Jun 28 22:36:46 2006 @@ -22,9 +22,12 @@ ... ) if the field is not bound to a context, no choices will be made available: - print list(data_choice.source) + list(data_choice.source) [] + len(data_choice.source) +0 + let us create a source binder and bind the field to the context: from cpsskins.locations.sources import data_source_binder @@ -52,6 +55,15 @@ in the context of the location the data source returns a list of pages: data_choice_in_context = data_choice_in_context.bind(l) - print [t.value for t in data_choice_in_context.source] + [t.value for t in data_choice_in_context.source] [u'Theme:ThemePage'] + len(data_choice_in_context.source) +1 + + u'Theme:ThemePage' in data_choice_in_context.source +True + + u'unknown' in data_choice_in_context.source +False + Added: cpsskins/branches/paris-sprint-2006/schema.py == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/schema.py Wed Jun 28 22:36:46 2006 @@ -0,0 +1,38 @@ +## +# +# Copyright (c) 2005-2006 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 zope.interface import implements +from zope.schema.interfaces import IField +from zope.schema import Choice + +class IIntCoupleChoice(IField): +A choice field containing couples of integers e.g. (0, 1) + +class IntCoupleChoice(Choice): +implements(IIntCoupleChoice) + +def fromUnicode(self, text): +self.validate(text) +a, b = text[1:-1].split(u', ') +return (int(a), int(b)) + +def validate(self, value): +# FIXME +return True + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3554 - cpsskins/branches/paris-sprint-2006/storage
Author: jmorliaguet Date: Wed Jun 28 22:47:09 2006 New Revision: 3554 Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py Log: - don't count empty strings as method names Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/locations.pyWed Jun 28 22:47:09 2006 @@ -120,7 +120,7 @@ if key[0] != root: continue methods.add(key[1]) -return list(methods) +return list(methods - Set([u''])) def getPaths(self, root=u''): paths = Set() -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3556 - cpsskins/branches/paris-sprint-2006/ui/screens/common
Author: jmorliaguet Date: Wed Jun 28 23:11:03 2006 New Revision: 3556 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/action_pad.pt Log: - optimizations Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/action_pad.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/action_pad.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/action_pad.pt Wed Jun 28 23:11:03 2006 @@ -1,16 +1,14 @@ -div class=actionPad - - ins class=model cite=@@getHint?msgid=hint-site-manager/ins +div class=actionPad + tal:define=hint nocall:context/@@getHint; + view nocall:context/@@getView; + controller nocall:context/@@getController + ins class=model tal:content=python: hint('hint-site-manager') / a href=javascript:CPSSkins.getControllerById('main-editor-perspectives').switchTo('site-manager')Site manager/a - - ins class=model cite=@@getHint?msgid=hint-page-designer/ins + ins class=model tal:content=python: hint('hint-page-designer') / a href=javascript:CPSSkins.getControllerById('main-editor-perspectives').switchTo('page-designer')Page designer/a - - ins class=model cite=@@getHint?msgid=hint-content-author/ins + ins class=model tal:content=python: hint('hint-content-author') / a href=javascript:CPSSkins.getControllerById('main-editor-perspectives').switchTo('content-author')Content author/a - !-- tooltip -- - ins class=view cite=@@getView?id=tooltip/ins - ins class=controller cite=@@getController?id=show-hide-tooltip/ins - + ins class=view tal:content=python: view('tooltip')/ins + ins class=controller tal:content=python: controller('show-hide-tooltip')/ins /div -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3531 - in cpsskins/branches/paris-sprint-2006: locations standard/negotiation storage ui/screens/sitemanager
Author: jmorliaguet Date: Wed Jun 28 00:40:48 2006 New Revision: 3531 Modified: cpsskins/branches/paris-sprint-2006/locations/README.txt cpsskins/branches/paris-sprint-2006/locations/location.py cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py cpsskins/branches/paris-sprint-2006/storage/locations.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - added support for method names in locations: /sections/url.html will match only /sections/url.html while /sections/ will match /sections/url.html, /sections/urlB.html, /sections/ ... Modified: cpsskins/branches/paris-sprint-2006/locations/README.txt == --- cpsskins/branches/paris-sprint-2006/locations/README.txt(original) +++ cpsskins/branches/paris-sprint-2006/locations/README.txtWed Jun 28 00:40:48 2006 @@ -88,24 +88,24 @@ All location information will be looked up from a given context which can considered as the sublocation of a nearest location. -For instance in the context of folder1/folder2/folder3, among the following +For instance in the context of folder1/folder2/folder3/, among the following locations: - - folder1 + - /folder1/ - - folder1/folder2 + - /folder1/folder2/ the former is the nearest location, because the location context is contained in it and because it is contained in all other locations. We can sort locations as: - folder1 folder1/folder2 folder1/folder2/folder3 + /folder1/ /folder1/folder2/ /folder1/folder2/folder3/ (with '' meaning 'contains') the rules associated with the location 'folder1' will shadow the rules -of associated with 'folder1/folder2' +of associated with '/folder1/folder2/' If no nearest locations can be found in a given context then no rules will be applied, and the context will contain no local information. @@ -125,13 +125,13 @@ from cpsskins.locations import Location - l1 = Location(title=u'folder 1', path=u'/f1', data=u'd1') + l1 = Location(path=u'/f1/', data=u'd1') l1 -Location 'folder 1' at /f1 +Location at /f1/ - l2 = Location(title=u'folder 1/2', path=u'/f1/f2', data=u'd1/2') + l2 = Location(path=u'/f1/f2/', data=u'd1/2') l2 -Location 'folder 1/2' at /f1/f2 +Location at /f1/f2/ to get the location's data, we call the location: @@ -154,8 +154,8 @@ if two locations have a same path, they are equal: - lA = Location(title=u'A', path=u'/f1/f2', data=u'A') - lB = Location(title=u'B', path=u'/f1/f2', data=u'B') + lA = Location(path=u'/f1/f2/', data=u'A') + lB = Location(path=u'/f1/f2/', data=u'B') lA == lB True @@ -172,8 +172,8 @@ from pprint import pprint pprint(dict(locations)) -{(u'', u'', u'f1'): Location 'folder 1' at /f1, - (u'', u'', u'f1', u'f2'): Location 'folder 1/2' at /f1/f2} +{(u'', u'', u'', u'f1'): Location at /f1/, + (u'', u'', u'', u'f1', u'f2'): Location at /f1/f2/} we can obtain the list of locations with: @@ -183,20 +183,20 @@ now we want to find the location of '/f1/f2/f3': - locations.find(u'/f1/f2/f3') -Location 'folder 1/2' at /f1/f2 + locations.find(u'/f1/f2/f3/') +Location at /f1/f2/ -or get the location of '/f1/f2' +or get the location of '/f1/f2/' - locations.find(u'/f1/f2') -Location 'folder 1/2' at /f1/f2 + locations.find(u'/f1/f2/') +Location at /f1/f2/ or '/f1': - locations.find(u'/f1') -Location 'folder 1' at /f1 + locations.find(u'/f1/') +Location at /f1/ - locations.find(u'/f2') is None + locations.find(u'/f2/') is None True scopes @@ -210,93 +210,94 @@ By specifying a scope we can restrict the paths covered by a location, for instance: - l3 = Location(title=u'C', path=u'/f1/f3', data=u'C', scope=(0, 1)) + l3 = Location(path=u'/f1/f3/', data=u'C', scope=(0, 1)) locations.add(l3) l3 -Location 'C' at /f1/f3 +Location at /f1/f3/ means that the 'l3' location has a scope covering /f1/f3 and all immediate sublocation paths (/f1/f3/...) but not (/f1/f3/.../...) - locations.find(u'/f1/f3') -Location 'C' at /f1/f3 + locations.find(u'/f1/f3/') +Location at /f1/f3/ - locations.find(u'/f1/f3/f4') -Location 'C' at /f1/f3 + locations.find(u'/f1/f3/f4/') +Location at /f1/f3/ - locations.find(u'/f1/f3/f4/f5') -Location 'folder 1' at /f1 + locations.find(u'/f1/f3/f4/f5/') +Location at /f1/ -l4 has a scope covering '/f1/f4' and sublocations of level 1 and 2: +l4 has a scope covering '/f1/f4/' and sublocations of level 1 and 2: - l4 = Location(title=u'D', path=u'/f1/f4', data=u'D', scope=(0, 2)) + l4 = Location(path=u'/f1/f4/', data=u'D', scope=(0, 2)) locations.add(l4) - locations.find(u'/f1/f4') -Location
[Z3lab-checkins] r3533 - in cpsskins/branches/paris-sprint-2006: elements relations
Author: jmorliaguet Date: Wed Jun 28 01:15:23 2006 New Revision: 3533 Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py cpsskins/branches/paris-sprint-2006/relations/relations.py Log: - misc test fix Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py == --- cpsskins/branches/paris-sprint-2006/elements/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/elements/slot.pyWed Jun 28 01:15:23 2006 @@ -37,7 +37,7 @@ slot = Slot(u'slotA', u'Some slot') slot -Slot('slotA', 'Some slot') +Slot('Some slot', 'slotA') from cpsskins.elements.interfaces import ILeaf ILeaf.providedBy(slot) Modified: cpsskins/branches/paris-sprint-2006/relations/relations.py == --- cpsskins/branches/paris-sprint-2006/relations/relations.py (original) +++ cpsskins/branches/paris-sprint-2006/relations/relations.py Wed Jun 28 01:15:23 2006 @@ -24,7 +24,7 @@ from zope.interface import implements from cpsskins.relations.predicates import Predicate -from cpsskins.relations.interfaces import IRelation +from cpsskins.relations.interfaces import IRelation, IRelatable from cpsskins.relations.interfaces import IMonadicRelation, IDyadicRelation from cpsskins.relations.interfaces import ITriadicRelation -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3526 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Mon Jun 26 20:53:21 2006 New Revision: 3526 Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py Log: - fixed the scope vocabulary to use value, token, and title Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Mon Jun 26 20:53:21 2006 @@ -21,7 +21,7 @@ from zope.i18nmessageid import MessageFactory from zope.schema import TextLine, Tuple, Choice, Int from zope.schema.interfaces import IVocabularyFactory -from zope.schema.vocabulary import SimpleVocabulary +from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm _ = MessageFactory(cpsskins) @@ -51,16 +51,15 @@ def __str__(): Return the location's path -scopes = { -_(uIn this folder and all sub-folders): (0, 0), -_(uOnly in this folder): (0, 1), -_(uIn all sub-folders): (1, 0), -} - def ScopesVocabulary(context): A vocabulary that contains a list of scopes -return SimpleVocabulary.fromItems(scopes.items()) +return SimpleVocabulary( +[SimpleTerm(value, token, title) for value, token, title in ( +((0, 0), u'0-0', _(uIn this folder and all sub-folders)), +((0, 1), u'0-1', _(uOnly in this folder)), +((1, 0), u'1-0', _(uIn all sub-folders)), +)]) alsoProvides(ScopesVocabulary, IVocabularyFactory) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3527 - cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
Author: jmorliaguet Date: Mon Jun 26 22:03:58 2006 New Revision: 3527 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - added a submit form handler for locations - not very generic though Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Mon Jun 26 22:03:58 2006 @@ -20,7 +20,7 @@ from zope.component import getUtility from zope.formlib import form from zope.schema import getFields -from zope.schema.interfaces import IVocabularyFactory +from zope.schema.interfaces import IVocabularyFactory, IVocabularyTokenized from cpsskins import minjson as json from cpsskins.locations import Location @@ -152,7 +152,7 @@ info[root][location.path] = { 'path': location.path, 'data': location.data, -'scope': scopes.getTerm(location.scope).token, +'scope': scopes.getTerm(location.scope).title, 'object': location, } return info @@ -160,16 +160,16 @@ def getLocationWidgets(self, path, root): locations = self.getLocationInfo() location = locations[root][path][u'object'] -return LocationForm(location, self.request)() +return LocationForm(location, self.request).widgets def submitLocation(self): request = self.request -form = request.form -root = form[u'root'] -path = form[u'location_path'] +form_data = request.form +root = form_data[u'root'] +path = form_data[u'location_path'] locations = getThemeManager(self.context).getLocationStorage() -action = form[u'action'] +action = form_data[u'action'] if action == u'delete': location = locations.getLocation(root, path) @@ -181,9 +181,7 @@ elif action == u'edit': location = locations.getLocation(root, path) -location.path = form[u'form.path'] -location.data = form[u'form.data'] -location.scope = form[u'form.scope'] +LocationForm(location, request).submit(form_data) self.request.response.setHeader('content-type', 'text/x-json') return json.write({'form': {'section': root}}) @@ -192,12 +190,27 @@ form_fields = form.Fields(ILocation, omit_readonly=True, render_context=True) +prefix = u'form' + def __init__(self, context, request): self.context = context self.request = request -def __call__(self): -widgets = form.setUpWidgets(self.form_fields, 'form', self.context, -self.request) -return widgets +self.widgets = form.setUpWidgets(self.form_fields, self.prefix, + context, request) + +def submit(self, data): +context = self.context +scopes_factory = getUtility(IVocabularyFactory, u'location scopes') +scopes = scopes_factory(context) +for form_field in self.form_fields: +field = form_field.field +name = form_field.__name__ +value = data[u'%s.%s' % (self.prefix, name)] +if name == u'scope': +value = scopes.getTermByToken(value).value +field.validate(value) +else: +value = field.fromUnicode(value) +field.set(context, value) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3528 - cpsskins/branches/paris-sprint-2006/storage
Author: jmorliaguet Date: Mon Jun 26 22:34:19 2006 New Revision: 3528 Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py Log: - set the location's location.. Modified: cpsskins/branches/paris-sprint-2006/storage/locations.py == --- cpsskins/branches/paris-sprint-2006/storage/locations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/locations.pyMon Jun 26 22:34:19 2006 @@ -19,7 +19,10 @@ from sets import Set from zope.app.container.constraints import contains +from zope.event import notify from zope.interface import implements +from zope.app.container.contained import ObjectAddedEvent +from zope.location.location import locate from cpsskins.locations.location import ILocation from cpsskins.storage import Storage @@ -62,6 +65,8 @@ if key in self: del self[key] self[key] = location +locate(object=location, parent=self, name=u'-'.join(key)) +notify(ObjectAddedEvent(location)) def remove(self, locations): if not isinstance(locations, (list, tuple)): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3518 - in cpsskins/branches/paris-sprint-2006: . browser/negotiation browser/tree controllers elements locations relations standard/screens/styleeditor storage tests ui/screens ui/sc
Author: jmorliaguet Date: Sun Jun 25 11:49:00 2006 New Revision: 3518 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py cpsskins/branches/paris-sprint-2006/browser/tree/slot.py cpsskins/branches/paris-sprint-2006/controllers/portlet.py cpsskins/branches/paris-sprint-2006/elements/interfaces.py cpsskins/branches/paris-sprint-2006/elements/presentation.py cpsskins/branches/paris-sprint-2006/elements/slot.py cpsskins/branches/paris-sprint-2006/locations/configure.zcml cpsskins/branches/paris-sprint-2006/locations/interfaces.py cpsskins/branches/paris-sprint-2006/locations/location.py cpsskins/branches/paris-sprint-2006/relations/relations.py cpsskins/branches/paris-sprint-2006/standard/screens/styleeditor/views.py cpsskins/branches/paris-sprint-2006/storage/storage.py cpsskins/branches/paris-sprint-2006/tests/setup.py cpsskins/branches/paris-sprint-2006/tests/test_renderers.py cpsskins/branches/paris-sprint-2006/thememanager.py cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/utils.py Log: - removed unused imports - added a vocabulary for location scopes - removed the fadein transition on the location panel Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/views.pySun Jun 25 11:49:00 2006 @@ -20,7 +20,6 @@ from zope.component import getMultiAdapter, getUtility from zope.interface import implements -from cpsskins.browser.rendering.interfaces import IViewer from cpsskins.browser.negotiation.interfaces import INegotiation from cpsskins.browser.negotiation.interfaces import INegotiationStrategy from cpsskins.utils import getThemeManager Modified: cpsskins/branches/paris-sprint-2006/browser/tree/slot.py == --- cpsskins/branches/paris-sprint-2006/browser/tree/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/browser/tree/slot.pySun Jun 25 11:49:00 2006 @@ -30,7 +30,6 @@ from cpsskins.browser.tree.interfaces import INodeDuplicating, INodeTraversing from cpsskins.elements.interfaces import IPortlet, IFormattable from cpsskins.ontology import hasPortlet, hasPortletFromPerspective -from cpsskins.ontology import hasPerspective from cpsskins.relations import DyadicRelation, TriadicRelation from cpsskins.utils import getThemeManager, getRelationStorage Modified: cpsskins/branches/paris-sprint-2006/controllers/portlet.py == --- cpsskins/branches/paris-sprint-2006/controllers/portlet.py (original) +++ cpsskins/branches/paris-sprint-2006/controllers/portlet.py Sun Jun 25 11:49:00 2006 @@ -24,7 +24,6 @@ from cpsskins.controllers.interfaces import IController from cpsskins.elements.interfaces import ICell from cpsskins.elements.interfaces import IPresentable -from cpsskins.utils import getThemeManager class PortletController(Controller): Event handler for portlets. Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py == --- cpsskins/branches/paris-sprint-2006/elements/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/interfaces.py Sun Jun 25 11:49:00 2006 @@ -25,7 +25,7 @@ from zope.i18nmessageid import MessageFactory from zope.interface import Interface, Attribute from zope.interface.interfaces import IInterface -from zope.schema import TextLine, List, Choice +from zope.schema import TextLine, Choice _ = MessageFactory(cpsskins) Modified: cpsskins/branches/paris-sprint-2006/elements/presentation.py == --- cpsskins/branches/paris-sprint-2006/elements/presentation.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/presentation.pySun Jun 25 11:49:00 2006 @@ -19,14 +19,11 @@ from zope.traversing.interfaces import IPathAdapter from zope.interface import implements -from zope.component import getUtility, queryUtility +from zope.component import queryUtility from cpsskins.elements.interfaces import IFormattable from cpsskins.elements.interfaces import IPresentable -from cpsskins.ontology import hasFormat -from cpsskins.ontology import IFormatPredicate from cpsskins.setup.interfaces import IType -from cpsskins.utils import getThemeManager, getRelationStorage class Presentable(object): This adapter makes elements presentable, i.e. formattable Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py
[Z3lab-checkins] r3522 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Sun Jun 25 22:06:04 2006 New Revision: 3522 Modified: cpsskins/branches/paris-sprint-2006/utils.py Log: - no longer needed now that there is a UI for creating locations Modified: cpsskins/branches/paris-sprint-2006/utils.py == --- cpsskins/branches/paris-sprint-2006/utils.py(original) +++ cpsskins/branches/paris-sprint-2006/utils.pySun Jun 25 22:06:04 2006 @@ -70,17 +70,6 @@ name = context.addTheme(theme) theme.title = name.replace('-', ' ') page = addPageSkeleton(context, theme) - -# XXX testing -from cpsskins.locations import Location -l1 = Location(path=u'/sections', root=u'pages', data=u'Theme:ThemePage') -l2 = Location(path=u'/sections/section1', root=u'pages', data=u'Theme-2:ThemePage') -l3 = Location(path=u'/workspaces', root=u'pages', data=u'Theme-3:ThemePage') -locations = context.getLocationStorage() -locations.add(l1) -locations.add(l2) -locations.add(l3) - return theme def addPageSkeleton(context, theme): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3523 - in cpsskins/branches/paris-sprint-2006/ui/screens: common sitemanager
Author: jmorliaguet Date: Sun Jun 25 22:07:22 2006 New Revision: 3523 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/site_manager.css cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - UI updates: made the locations on the location screen directly clickable to simplify the edition. Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt Sun Jun 25 22:07:22 2006 @@ -8,9 +8,9 @@ tal:block repeat=page pages li tal:define=selected python: page == effective_page tal:attributes=class python: selected and 'selected' or None -ins class=model tal:content=page/@@getModelInfo / -img tal:attributes=id string:p${page/identifier} - alt= width=12 height=12 src=++resource++edit-12.png / + ins class=model tal:content=page/@@getModelInfo / + img tal:attributes=id string:p${page/identifier} + alt= width=12 height=12 src=++resource++edit-12.png / a tal:attributes=href string:@@setPage?name=${theme/name}:${page/name} tal:content=python: page.title or 'No title' //li /tal:block Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/configure.zcml == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/configure.zcml Sun Jun 25 22:07:22 2006 @@ -93,18 +93,8 @@ / page -name=addLocation -attribute=addLocation -/ - -page -name=deleteLocation -attribute=deleteLocation -/ - -page -name=updateLocation -attribute=updateLocation +name=submitLocation +attribute=submitLocation / /pages Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt Sun Jun 25 22:07:22 2006 @@ -3,14 +3,16 @@ edited request/form/edited|nothing; add request/form/add|nothing; location_info context/@@getLocationInfo; - infos location_info/?section|nothing + infos location_info/?section|nothing; + +form action=@@submitLocation method=post - form action=@@updateLocation method=post table style=width: 100%; class=items tr - thpath/th - thscope/th - thdata/th + th style=width: 30%path/th + th style=width: 30%scope/th + th style=width: 30%data/th + th/th th/th /tr tr tal:repeat=path infos @@ -18,44 +20,52 @@ location_path location/path; edit python: edited == location_path -tal:block condition=not:edit - td tal:content=location_path / - td tal:content=location/scope / - td tal:content=location/data / - a class=button i18n:translate= - tal:attributes=href string:javascript:CPSSkins.getModelById('negotiation-section').setData({'form': {'section': '$section', 'edited': '${location/path}' }})edit/a +tal:block condition=not:edit tal:define=edit_url string:javascript:CPSSkins.getModelById('negotiation-section').setData({'form': {'section': '$section', 'edited': '${location/path}' }}) + tda tal:attributes=href edit_url tal:content=location_path //td + tda tal:attributes=href edit_url tal:content=location/scope //td + tda tal:attributes=href edit_url tal:content=location/data //td /tal:block tal:block condition=edit tal:block define=widgets nocall:context/@@getLocationWidgets - repeat=widget python: widgets(location['path'], section) + repeat=widget python: widgets(location_path, section) td tal:content=structure widget / /tal:block - input type=hidden name=root tal:attributes=value section / - input type=hidden name=location_path - tal:attributes=value location_path / - input class=submit type=submit value=save / /tal:block - -a class=button - tal:attributes=href string:@@deleteLocation?root
[Z3lab-checkins] r3524 - cpsskins/branches/paris-sprint-2006/locations
Author: jmorliaguet Date: Sun Jun 25 22:36:19 2006 New Revision: 3524 Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py Log: - fix: the value comes first, then the token Modified: cpsskins/branches/paris-sprint-2006/locations/interfaces.py == --- cpsskins/branches/paris-sprint-2006/locations/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/locations/interfaces.py Sun Jun 25 22:36:19 2006 @@ -52,9 +52,9 @@ Return the location's path scopes = { -(0, 0): _(uIn this folder and all sub-folders), -(0, 1): _(uOnly in this folder), -(1, 0): _(uIn all sub-folders), +_(uIn this folder and all sub-folders): (0, 0), +_(uOnly in this folder): (0, 1), +_(uIn all sub-folders): (1, 0), } def ScopesVocabulary(context): @@ -63,3 +63,4 @@ return SimpleVocabulary.fromItems(scopes.items()) alsoProvides(ScopesVocabulary, IVocabularyFactory) + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3525 - cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager
Author: jmorliaguet Date: Sun Jun 25 23:47:31 2006 New Revision: 3525 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - display vocabulary tokens for location scopes Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/negotiation_section.pt Sun Jun 25 23:47:31 2006 @@ -53,7 +53,8 @@ input type=hidden name=root tal:attributes=value section / input type=hidden name=action value=add / input type=text name=location_path value=/ / -input class=submit type=submit value=add / +input style=background-color: #ccf + class=submit type=submit value=add / a class=button i18n:translate= tal:attributes=href string:javascript:CPSSkins.getModelById('negotiation-section').setData({'form': {'section': '$section'}})cancel/a /td @@ -61,7 +62,8 @@ input type=hidden name=action value=edit / input type=hidden name=root tal:attributes=value section / input type=hidden name=location_path tal:attributes=value edited / -input class=submit type=submit value=save / +input style=background-color: #ccf class=submit + type=submit value=save / a class=button i18n:translate= tal:attributes=href string:javascript:CPSSkins.getModelById('negotiation-section').setData({'form': {'section': '$section'}})cancel/a /td Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Sun Jun 25 23:47:31 2006 @@ -20,6 +20,7 @@ from zope.component import getUtility from zope.formlib import form from zope.schema import getFields +from zope.schema.interfaces import IVocabularyFactory from cpsskins import minjson as json from cpsskins.locations import Location @@ -141,14 +142,17 @@ tmutil = getThemeManager(self.context) locations = tmutil.getLocationStorage() +scopes_factory = getUtility(IVocabularyFactory, u'location scopes') + info = {} for root in locations.getRoots(): info[root] = {} for location in locations.getLocations(root): +scopes = scopes_factory(location) info[root][location.path] = { 'path': location.path, 'data': location.data, -'scope': location.scope, +'scope': scopes.getTerm(location.scope).token, 'object': location, } return info -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3511 - CPSSkins4Five/trunk
Author: jmorliaguet Date: Sat Jun 24 13:40:59 2006 New Revision: 3511 Removed: CPSSkins4Five/trunk/security.py Modified: CPSSkins4Five/trunk/configure.zcml Log: - no longer needed Modified: CPSSkins4Five/trunk/configure.zcml == --- CPSSkins4Five/trunk/configure.zcml (original) +++ CPSSkins4Five/trunk/configure.zcml Sat Jun 24 13:40:59 2006 @@ -49,12 +49,6 @@ include file=views.zcml / - - subscriber - for=zope.app.publication.interfaces.BeforeTraverseEvent - handler=.security.ensureInteraction - / - !-- zope2 -- five:traversable class=OFS.Folder.Folder / -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3512 - in cpsskins/branches/paris-sprint-2006: . ui/screens/common ui/screens/contentauthor/filters ui/screens/pagedesigner/layout ui/screens/pagedesigner/wysiwyg
Author: jmorliaguet Date: Sat Jun 24 14:56:13 2006 New Revision: 3512 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py cpsskins/branches/paris-sprint-2006/ui/screens/contentauthor/filters/slot.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/cell.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/pageblock.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/portlet.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/slot.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/wysiwyg/portlet.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/wysiwyg/slot.pt cpsskins/branches/paris-sprint-2006/utils.py Log: - renamed getModel as getModelInfo to avoid name conflicts Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css Sat Jun 24 14:56:13 2006 @@ -302,6 +302,10 @@ padding-right: 10px; } +.pageTabs img { + border: none +} + .pageTabs li.selected a { background: url(++resource++r-tab-sel.png) top right no-repeat; } Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml Sat Jun 24 14:56:13 2006 @@ -145,8 +145,8 @@ / page -name=getModel -attribute=getModel + name=getModelInfo + attribute=getModelInfo / /pages Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt Sat Jun 24 14:56:13 2006 @@ -8,8 +8,10 @@ tal:block repeat=page pages li tal:define=selected python: page == effective_page tal:attributes=class python: selected and 'selected' or None - a tal:content=python: page.title or 'No title' - tal:attributes=href string:@@setPage?name=${theme/name}:${page/name} //li +ins class=model tal:content=page/@@getModelInfo / +img alt= width=12 height=12 src=++resource++edit-12.png / + a tal:attributes=href string:@@setPage?name=${theme/name}:${page/name} + tal:content=python: page.title or 'No title' //li /tal:block lia tal:attributes=href string:./@@addPage?theme_name=${theme/name}+/a/li /ul Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt Sat Jun 24 14:56:13 2006 @@ -12,9 +12,10 @@ img alt= width=5 height=5 src=++resource++ltab.png / /td td tal:attributes=class python: selected and 'tabselected' or 'tab' + ins class=model tal:content=theme/@@getModelInfo / + img alt= width=12 height=12 src=++resource++edit-12.png / a tal:content=python: theme.title or 'No title' tal:attributes=href string:@@setPage?name=${theme/name} / - img alt= width=12 height=12 src=++resource++edit-12.png / /td td tal:attributes=class python: selected and 'rtabselected' or 'rtab' img alt= width=5 height=5 src=++resource++rtab.png / Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py Sat Jun 24 14:56:13 2006 @@ -90,7 +90,7 @@ icon_url = icon.url() return icon_url -def getModel(self, info): +def getModelInfo(self, info=None): context = self.context request = self.request id = context.identifier @@ -102,7 +102,7 @@ 'data': { 'id': id, 'editable': True, -'order': info.order, +'order': info is not None and info.order or 0, 'container
[Z3lab-checkins] r3513 - in cpsskins/branches/paris-sprint-2006/ui/screens: . common
Author: jmorliaguet Date: Sat Jun 24 15:31:00 2006 New Revision: 3513 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt Log: - added a contextual menu to edit themes and tabs Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt Sat Jun 24 15:31:00 2006 @@ -9,7 +9,8 @@ li tal:define=selected python: page == effective_page tal:attributes=class python: selected and 'selected' or None ins class=model tal:content=page/@@getModelInfo / -img alt= width=12 height=12 src=++resource++edit-12.png / +img tal:attributes=id string:p${page/identifier} + alt= width=12 height=12 src=++resource++edit-12.png / a tal:attributes=href string:@@setPage?name=${theme/name}:${page/name} tal:content=python: page.title or 'No title' //li /tal:block Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt Sat Jun 24 15:31:00 2006 @@ -13,7 +13,8 @@ /td td tal:attributes=class python: selected and 'tabselected' or 'tab' ins class=model tal:content=theme/@@getModelInfo / - img alt= width=12 height=12 src=++resource++edit-12.png / + img tal:attributes=id string:t${theme/identifier} + alt= width=12 height=12 src=++resource++edit-12.png / a tal:content=python: theme.title or 'No title' tal:attributes=href string:@@setPage?name=${theme/name} / /td Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Sat Jun 24 15:31:00 2006 @@ -316,7 +316,8 @@ 'subviews': ['page-tabs'], 'model': 'theme-tabs', 'perspectives': ['page-designer'], -'controllers': ['main-editor-perspectives', 'main-editor-actions'], +'controllers': ['main-editor-perspectives', 'main-editor-actions', +'menu-actions'], }, # the horizontal tabs to select the work page @@ -328,7 +329,8 @@ 'subviews': ['wysiwyg-mode', 'layout-mode'], 'model': 'page-tabs', 'perspectives': ['page-designer'], -'controllers': ['main-editor-perspectives', 'main-editor-actions'], +'controllers': ['main-editor-perspectives', 'main-editor-actions', +'menu-actions'], }, # the page designer panel @@ -573,6 +575,43 @@ ], }, }, + +'tab-context-menu': { +'id': 'tab-context-menu', +'area': 'topArea', +'noicon': '++resource++noicon-16.png', +'perspectives': ['page-designer'], +'controllers': ['menu-actions', 'main-editor-perspectives', +'show-hide-menu'], +'widget': { + 'type': 'contextmenu', + 'items': [ + {'type': 'item', +'label': _('Edit'), +'icon': '++resource++edit-16.png', +'action': 'edit element', +'visible': 'editable', + }, + {'type': 'separator', + }, + {'type': 'item', +'label': _('Duplicate'), +'icon': '++resource++duplicate-16.png', +'action': 'duplicate element', +'visible': 'editable', + }, + {'type': 'separator', + }, + {'type': 'item', +'label': _('Delete'), +'icon': '++resource++delete-16.png', +'action': 'delete element', +'confirm': _('Deleting, are you sure?'), + } + ], + }, +}, + } CONTROLLERS = { Modified: cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt(original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/editor.ptSat Jun 24 15:31:00 2006 @@ -48,10 +48,12 @@ tal:content=python: controller('disable-links') / !-- top tabs -- - ins class=model tal:content=python: model('theme-tabs') / - ins class=view tal:content=python
[Z3lab-checkins] r3514 - cpsskins/branches/paris-sprint-2006/lib/cpsskins/src
Author: jmorliaguet Date: Sat Jun 24 23:04:30 2006 New Revision: 3514 Modified: cpsskins/branches/paris-sprint-2006/lib/cpsskins/src/cpsskins.js Log: - drag-and-drop fix: we want to make it possible to drag elements from one controller and drop it into another controller (e.g. portlet factory) Modified: cpsskins/branches/paris-sprint-2006/lib/cpsskins/src/cpsskins.js == --- cpsskins/branches/paris-sprint-2006/lib/cpsskins/src/cpsskins.js (original) +++ cpsskins/branches/paris-sprint-2006/lib/cpsskins/src/cpsskins.jsSat Jun 24 23:04:30 2006 @@ -789,15 +789,15 @@ var shifting = this.def.shifting; if (shifting) { if (shifting.element) { -this._shiftablezones = getElements(shifting.element, widget); +this._shiftablezones = getElements(shifting.element); } if (shifting.container) { -this._containerzones = getElements(shifting.container, widget) +this._containerzones = getElements(shifting.container) } } if (this.def.dropping) { if (this.def.dropping.target) { -this._dropzones = getElements(this.def.dropping.target, widget) +this._dropzones = getElements(this.def.dropping.target) } } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3515 - in cpsskins/branches/paris-sprint-2006/ui/screens: . common pagedesigner
Author: jmorliaguet Date: Sat Jun 24 23:27:57 2006 New Revision: 3515 Added: cpsskins/branches/paris-sprint-2006/ui/screens/common/add_portlet_pad.pt (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/page_modes.pt cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/page_designer.pt Log: - added a separate button that opens the portlet factory box Added: cpsskins/branches/paris-sprint-2006/ui/screens/common/add_portlet_pad.pt == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/add_portlet_pad.pt Sat Jun 24 23:27:57 2006 @@ -0,0 +1,3 @@ +div style=padding: 1px 8px + a href=javascript:CPSSkins.getControllerById('panel-perspectives').switchTo('content-factory')Add a portlet/a +/div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml Sat Jun 24 23:27:57 2006 @@ -79,6 +79,11 @@ / page + name=addPortletPad.html + template=add_portlet_pad.pt +/ + +page name=selectPortletProvider attribute=selectPortletProvider / Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/page_modes.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/common/page_modes.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/common/page_modes.pt Sat Jun 24 23:27:57 2006 @@ -4,6 +4,4 @@ a href=javascript:CPSSkins.getControllerById('page-mode-perspectives').switchTo('layout')Layout/a a href=javascript:CPSSkins.getControllerById('page-mode-perspectives').switchTo('wysiwyg')WYSIWYG/a /div - - a href=javascript:CPSSkins.getControllerById('panel-perspectives').switchTo('content-factory')Add a portlet/a /div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Sat Jun 24 23:27:57 2006 @@ -98,6 +98,14 @@ } }, +# the portlet factory button at the bottom of the screen +'add-portlet-pad': { +'id': 'add-portlet-pad', +'data': { +'url': '@@addPortletPad.html', +} +}, + # the location selection widget at the top of the canvas editing area 'location-selector': { 'id': 'location-selector', @@ -355,6 +363,17 @@ 'controllers': ['main-editor-perspectives'], }, +# the page mode selection widget +'add-portlet-pad': { +'id': 'add-portlet-pad', +'widget': { +'type': 'panel', +}, +'model': 'add-portlet-pad', +'perspectives': ['page-designer', 'content-author'], +'controllers': ['main-editor-perspectives'], +}, + # the location selection widget 'location-selector': { 'id': 'location-selector', Modified: cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt(original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/editor.ptSat Jun 24 23:27:57 2006 @@ -97,6 +97,8 @@ div class=floatingFooter ins class=model tal:content=python: model('page-mode-selector') / ins class=view tal:content=python: view('page-mode-selector') / + ins class=model tal:content=python: model('add-portlet-pad') / + ins class=view tal:content=python: view('add-portlet-pad') / ins class=controller tal:content=python: controller('page-mode-perspectives') / /div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/page_designer.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/page_designer.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/page_designer.pt Sat Jun 24 23:27:57 2006 @@ -1,8 +1,8 @@ tal:block define=model nocall:context/@@getModel; view nocall:context/@@getView; - ins class=model tal:content=python: model('layout-mode') / ins class=view tal:content=python: view('layout-mode') / ins class=model tal:content=python: model('wysiwyg-mode') / ins class=view
[Z3lab-checkins] r3516 - in cpsskins/branches/paris-sprint-2006: browser/rendering ui/screens/pagedesigner ui/screens/pagedesigner/layout
Author: jmorliaguet Date: Sun Jun 25 00:02:23 2006 New Revision: 3516 Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/views.py Log: - added an 'add pageblock' button at the bottom of the layout designer screen Modified: cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py == --- cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/rendering/viewer.py Sun Jun 25 00:02:23 2006 @@ -119,6 +119,7 @@ info = ContextInfo({ 'element': node, 'order': order, +'children': children, 'data': None, 'metadata': None, }) Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css Sun Jun 25 00:02:23 2006 @@ -3,9 +3,9 @@ /* Page blocks */ .pageBlockEdit { margin-top: 7px; - margin-bottom: 1px; - margin-left: 1px; - margin-right: 1px; + margin-bottom: 1px; + margin-left: 1px; + margin-right: 1px; } .pageBlockEditHeader { @@ -48,13 +48,21 @@ } .pageBlockAddButton { - text-align: left; - padding-left: 3px; - margin-top: 4px; + text-align: right; + padding-right: 4px; + margin-top: 5px; + margin-bottom: 5px; } .pageBlockAddButton img { border: none; + vertical-align: middle; + padding-right: 0.2em; +} + +.pageBlockAddButton a { + color: #006; + font-size: 1.1em; } /* cell */ @@ -62,16 +70,16 @@ padding: 0; margin: 0; height: 25px; - background: url(++resource++sizer_line.png); + background: url(++resource++sizer_line.png); background-repeat: repeat-x; background-position: center top; - text-align: center; + text-align: center; } .sizer .left { float: left; margin-left: 1px; - background: url(/++skin++cpsskins/@@/sizer_left.png); - background-repeat: no-repeat; + background: url(/++skin++cpsskins/@@/sizer_left.png); + background-repeat: no-repeat; height: 10px; width: 7px; } @@ -79,8 +87,8 @@ .sizer .right { float: right; margin-right: 1px; - background: url(++resource++sizer_right.png); - background-repeat: no-repeat; + background: url(++resource++sizer_right.png); + background-repeat: no-repeat; height: 10px; width: 7px; } Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt Sun Jun 25 00:02:23 2006 @@ -1,13 +1,24 @@ -div tal:define=id context/identifier +div tal:define=id context/identifier; + children options/info/children; + len python: len(children) tal:attributes=id id div class=pageBlockAddButton a title=Add a page block - tal:attributes=href string:@@addPageBlock?id=$id + tal:attributes=href string:@@addPageBlock?id=$idorder=0 img style=width: 46px; height: 18px - src=++resource++add-pageblock.png //a + src=++resource++add-pageblock.png / + Add a page block/a /div div tal:content=structure options/markup / + div class=pageBlockAddButton + a title=Add a page block + tal:attributes=href string:@@addPageBlock?id=$idorder=$len +img style=width: 46px; height: 18px + src=++resource++add-pageblock.png / + Add a page block/a + /div + /div Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/views.py Sun Jun 25 00:02:23 2006 @@ -36,7 +36,7 @@ self.request = request self.tmutil = getThemeManager(context) -def addPageBlock(self, id): +def addPageBlock(self, id, order=0): Add a page block containing one cell at the top of a given page request = self.request @@ -53,7 +53,7 @@ getMultiAdapter((pageblock, request), INodeAdding).add(cell) ordering = getMultiAdapter((page, request), INodeOrdering) -ordering.setOrder(pageblock, 0) +ordering.setOrder(pageblock, int(order
[Z3lab-checkins] r3517 - cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout
Author: jmorliaguet Date: Sun Jun 25 00:10:22 2006 New Revision: 3517 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt Log: - cosmetic Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/layout_mode.css Sun Jun 25 00:10:22 2006 @@ -48,8 +48,8 @@ } .pageBlockAddButton { - text-align: right; - padding-right: 4px; + text-align: left; + padding-left: 4px; margin-top: 5px; margin-bottom: 5px; } Modified: cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt == --- cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/pagedesigner/layout/themepage.pt Sun Jun 25 00:10:22 2006 @@ -4,21 +4,21 @@ tal:attributes=id id div class=pageBlockAddButton - a title=Add a page block + a title=Insert a page block tal:attributes=href string:@@addPageBlock?id=$idorder=0 img style=width: 46px; height: 18px src=++resource++add-pageblock.png / - Add a page block/a + insert a block/a /div div tal:content=structure options/markup / div class=pageBlockAddButton - a title=Add a page block + a title=Insert a page block tal:attributes=href string:@@addPageBlock?id=$idorder=$len img style=width: 46px; height: 18px src=++resource++add-pageblock.png / - Add a page block/a + insert a block/a /div /div -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3495 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Fri Jun 23 11:43:07 2006 New Revision: 3495 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - fixes Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Fri Jun 23 11:43:07 2006 @@ -43,11 +43,9 @@ 'Page Block': ('',), } -def __init__(self, file): +def __init__(self, file, themes): self.file = file - -self.themes = ThemeManagementFolder() -self.themes.registerUtilities() +self.themes = themes self.archive = TarArchive(mode='r', data=file.read()) self.resources = getUtility(IResourceManager) @@ -56,12 +54,9 @@ def __call__(self): theme_names = self.getThemeNames() for theme_name in theme_names: -#self.importStyles(theme_name) self.importTheme(theme_name) self.importImages(theme_name) -return self.themes - def getThemeNames(self): names = [] for item in self.archive['themes/']: @@ -97,7 +92,7 @@ # add slots into cells for slot_name in self.getObjects(pageblock_node, - u'Portal Box Group Templet'): + (u'Portal Box Group Templet',)): slot_path = '%s/%s.xml' % (pageblock_info['path'], slot_name) slot_doc = parseString(archive[slot_path]) slot_node = slot_doc.childNodes[0] @@ -119,7 +114,7 @@ meta_type = node.getAttribute('meta_type') meta_types = self.meta_types children_types = self.children_types[meta_type] -names = self.getObjects(node, children_types).keys() +names = self.getObjects(node, children_types) self.objects.setdefault(meta_type, []).append({ 'path': current_path, @@ -133,8 +128,8 @@ child_node = child_doc.childNodes[0] child_type = child_node.getAttribute('meta_type') props = self.getProperties(child_node, 'title') -self.addObject(meta_types[child_type], container, **props) -self.importObject(child_node, container, current_path + '/' + name) +object = self.addObject(meta_types[child_type], container, **props) +self.importObject(child_node, object, current_path + '/' + name) def importImages(self, theme_name): resources = self.resources @@ -162,14 +157,14 @@ return info def getObjects(self, node=None, types=()): -info = {} +objects = [] for obj in node.getElementsByTagName('object'): -name = obj.getAttribute('name') meta_type = obj.getAttribute('meta_type') -if type and meta_type not in types: +if meta_type and meta_type not in types: continue -info[name] = meta_type -return info +name = obj.getAttribute('name') +objects.append(name) +return objects def getFileName(self, path): return path.split('/')[-1] -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3496 - cpsskins/branches/paris-sprint-2006/elements
Author: jmorliaguet Date: Fri Jun 23 13:55:00 2006 New Revision: 3496 Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py Log: - the first parameter is the element's title as with other element types Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py == --- cpsskins/branches/paris-sprint-2006/elements/slot.py(original) +++ cpsskins/branches/paris-sprint-2006/elements/slot.pyFri Jun 23 13:55:00 2006 @@ -43,10 +43,10 @@ implements(ISlot) -def __init__(self, name=u'', title=u'', description=u'', perspective=u''): +def __init__(self, title=u'', name=u'', description=u'', perspective=u''): super(Slot, self).__init__() -self.name = name self.title = title +self.name = name self.description = description self.perspective = perspective -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3497 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Fri Jun 23 13:55:31 2006 New Revision: 3497 Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py cpsskins/branches/paris-sprint-2006/setup/io/utils.py Log: - IO fixes Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pyFri Jun 23 13:55:31 2006 @@ -60,8 +60,9 @@ raise NotImplementedError def updateURIMapping(self): -uri = u'cpsskins://%s:%s' % (IType(self.context).name, +uri = u'cpsskins://%s:%s' % (str(IType(self.context)), self.node.getAttribute(u'id')) +print uri self.mapping.update({uri: self.context}) def clone(self, other): @@ -91,7 +92,7 @@ implements(IDOMAdapter) -reserved_attrs = u'id', u'type', u'value' +reserved_attrs = u'id', u'type', u'value', u'perspective' def save(self): context = self.context Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py == --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Fri Jun 23 13:55:31 2006 @@ -53,7 +53,7 @@ # relations relations = mgr.getRelationStorage() -relations.purge() +#relations.purge() document = parseString(archive[u'relations.xml']) root = document.documentElement @@ -130,8 +130,8 @@ exporter = getMultiAdapter((theme, root), IDOMAdapter) exporter.archive = archive exporter.document = document -exporter.fields_as_attributes = u'title', u'description' -exporter.ignored_fields = u'name', +exporter.fields_as_attributes = (u'title', u'description', + u'perspective', u'name') exporter.save() archive[u'themes.xml'] = document.toprettyxml(indent=u' ', -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3498 - in cpsskins/branches/paris-sprint-2006: setup/io storage
Author: jmorliaguet Date: Fri Jun 23 19:55:59 2006 New Revision: 3498 Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py cpsskins/branches/paris-sprint-2006/storage/interfaces.py cpsskins/branches/paris-sprint-2006/storage/relations.py cpsskins/branches/paris-sprint-2006/storage/storage.py Log: - API fix: storage.remove() takes object ids as a parameter, not a list of objects. Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py == --- cpsskins/branches/paris-sprint-2006/setup/io/utils.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py Fri Jun 23 19:55:59 2006 @@ -53,7 +53,7 @@ # relations relations = mgr.getRelationStorage() -#relations.purge() +relations.purge() document = parseString(archive[u'relations.xml']) root = document.documentElement Modified: cpsskins/branches/paris-sprint-2006/storage/interfaces.py == --- cpsskins/branches/paris-sprint-2006/storage/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/interfaces.py Fri Jun 23 19:55:59 2006 @@ -24,8 +24,8 @@ def add(object, name): Add an object to the storage. Return the added object. -def remove(objects): -Remove an object from the storage. +def remove(ids): +Remove objects from the storage. def duplicate(object, name): Duplicated an object in the storage. Modified: cpsskins/branches/paris-sprint-2006/storage/relations.py == --- cpsskins/branches/paris-sprint-2006/storage/relations.py(original) +++ cpsskins/branches/paris-sprint-2006/storage/relations.pyFri Jun 23 19:55:59 2006 @@ -280,7 +280,7 @@ Remove relations for the storage. if ids is None: -raise ValueError(Must specify a list of relation ids to remove) +raise ValueError(Must specify the relation id(s) to remove) if isinstance(ids, basestring): ids = [ids] for id in ids: Modified: cpsskins/branches/paris-sprint-2006/storage/storage.py == --- cpsskins/branches/paris-sprint-2006/storage/storage.py (original) +++ cpsskins/branches/paris-sprint-2006/storage/storage.py Fri Jun 23 19:55:59 2006 @@ -61,17 +61,15 @@ notify(ObjectAddedEvent(object)) return self[name] -def remove(self, objects): -Remove an object from the storage. +def remove(self, ids): +Remove objects from the storage. -if not isinstance(objects, (list, tuple)): -objects = [objects] -for obj in objects: -if IElement.providedBy(obj): -obj = getName(obj) -if obj not in self: -raise KeyError(%s not in the storage. % obj) -del self[obj] +if not isinstance(ids, (list, tuple)): +ids = [ids] +for id in ids: +if id not in self: +raise KeyError(%s not in the storage. % id) +del self[id] def duplicate(self, object, name=u''): Duplicate an object in the storage. @@ -95,7 +93,7 @@ return self[name] def purge(self): -self.remove(list(self.values())) +self.remove(list(self.keys())) def __setitem__(self, key, object): self._SampleContainer__data[key] = object -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3499 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Fri Jun 23 20:43:17 2006 New Revision: 3499 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - pass parameters in a dict - fixed slot properties Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Fri Jun 23 20:43:17 2006 @@ -55,7 +55,7 @@ theme_names = self.getThemeNames() for theme_name in theme_names: self.importTheme(theme_name) -self.importImages(theme_name) +#self.importImages(theme_name) def getThemeNames(self): names = [] @@ -96,13 +96,18 @@ slot_path = '%s/%s.xml' % (pageblock_info['path'], slot_name) slot_doc = parseString(archive[slot_path]) slot_node = slot_doc.childNodes[0] -slot_props = self.getProperties(slot_node, 'name', 'xpos') +slot_props = self.getProperties(slot_node, 'title', 'box_group', +'xpos') xpos = int(slot_props['xpos']) +slot_props['name'] = slot_props['box_group'] del slot_props['xpos'] -self.addObject('cpsskins.canvas.slot', cells[xpos], - **slot_props) - -def addObject(self, type, container, name=u'', **props): +del slot_props['box_group'] +print slot_props +self.addObject('cpsskins.canvas.slot', cells[xpos], slot_props) + +def addObject(self, type, container, props=None, name=u''): +if props is None: +props = {} object = createObject(type, **props) namechooser = INameChooser(container) new_name = namechooser.chooseName(name, object) @@ -128,7 +133,7 @@ child_node = child_doc.childNodes[0] child_type = child_node.getAttribute('meta_type') props = self.getProperties(child_node, 'title') -object = self.addObject(meta_types[child_type], container, **props) +object = self.addObject(meta_types[child_type], container, props) self.importObject(child_node, object, current_path + '/' + name) def importImages(self, theme_name): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3500 - in cpsskins/branches/paris-sprint-2006: setup/io standard/formats
Author: jmorliaguet Date: Fri Jun 23 21:20:00 2006 New Revision: 3500 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Log: - set pageblock and cell layout (width, height) Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Fri Jun 23 21:20:00 2006 @@ -21,6 +21,7 @@ from zope.app.container.interfaces import INameChooser from zope.component import getUtility, createObject +from cpsskins.elements.interfaces import IFormattable from cpsskins.setup.archives import TarArchive from cpsskins.setup.interfaces import IResourceManager from cpsskins.standard.fields.image import WebImage @@ -81,15 +82,42 @@ # first stage: import themes pages page blocks self.importObject(theme_node, theme, 'themes/%s' % theme_name) -# second stage: create cells in pageblocks +# second stage: create cells inside pageblocks for pageblock_info in self.objects['Page Block']: pageblock_node = pageblock_info['node'] -props = self.getProperties(pageblock_node, 'maxcols') +pageblock_path = pageblock_info['path'] +props = self.getProperties(pageblock_node, 'maxcols', 'width', + 'height') container = pageblock_info['object'] cells = {} + +# set pageblock width +pageblock = pageblock_info['object'] +IFormattable(pageblock).getFormat('layout').update({ +'width': props['width'], +'height': props['height'], +}) + +# add cells for c in range(int(props['maxcols'])): cells[c] = self.addObject('cpsskins.canvas.cell', container) +# set cell size +for sizer_name in self.getObjects(pageblock_node, (u'Cell Sizer',)): +sizer_path = '%s/%s.xml' % (pageblock_path, sizer_name) +sizer_doc = parseString(archive[sizer_path]) +sizer_node = sizer_doc.childNodes[0] +sizer_props = self.getProperties(sizer_node, 'cellwidth', + 'xpos') +xpos = int(sizer_props['xpos']) +# the sizer is outside the screen +if xpos = len(cells): +continue +cell = cells[xpos] +IFormattable(cell).getFormat('layout').update({ +'width': sizer_props['cellwidth'], +}) + # add slots into cells for slot_name in self.getObjects(pageblock_node, (u'Portal Box Group Templet',)): @@ -102,9 +130,9 @@ slot_props['name'] = slot_props['box_group'] del slot_props['xpos'] del slot_props['box_group'] -print slot_props self.addObject('cpsskins.canvas.slot', cells[xpos], slot_props) + def addObject(self, type, container, props=None, name=u''): if props is None: props = {} Modified: cpsskins/branches/paris-sprint-2006/standard/formats/layout.py == --- cpsskins/branches/paris-sprint-2006/standard/formats/layout.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/formats/layout.py Fri Jun 23 21:20:00 2006 @@ -86,5 +86,9 @@ def items(self): return self.data.items() +def update(self, items): +for k in items: +self[k] = items[k] + has_key = __contains__ -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3501 - in cpsskins/branches/paris-sprint-2006: . controllers
Author: jmorliaguet Date: Fri Jun 23 22:26:51 2006 New Revision: 3501 Modified: cpsskins/branches/paris-sprint-2006/controllers/theme.py cpsskins/branches/paris-sprint-2006/thememanager.py Log: - register themes / pages as utilities using events Modified: cpsskins/branches/paris-sprint-2006/controllers/theme.py == --- cpsskins/branches/paris-sprint-2006/controllers/theme.py(original) +++ cpsskins/branches/paris-sprint-2006/controllers/theme.pyFri Jun 23 22:26:51 2006 @@ -18,9 +18,11 @@ __docformat__ = reStructuredText from zope.interface import implements +from zope.traversing.api import getName from cpsskins.controllers import Controller from cpsskins.controllers.interfaces import IController +from cpsskins.elements.interfaces import ITheme from cpsskins.utils import getThemeManager class ThemeController(Controller): @@ -34,6 +36,13 @@ element = self.element tmutil = getThemeManager(element) +tmutil.registerUtility(element, ITheme, getName(element)) if tmutil.getDefaultTheme() is None: tmutil.setAsDefault(element) +def removed(self): +element = self.element +tmutil = getThemeManager(element) + +tmutil.unregisterUtility(element, ITheme, getName(element)) + Modified: cpsskins/branches/paris-sprint-2006/thememanager.py == --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Fri Jun 23 22:26:51 2006 @@ -130,6 +130,9 @@ def getLocation(context): Return the location in a given context +def inspect(): +Inspect themes + class ThemeManagementFolder(BTreeContainer, PersistentComponents): A theme management utility that can contain multiple . themes @@ -228,7 +231,6 @@ name = INameChooser(self).chooseName(name, theme) self[name] = theme -self.registerUtility(theme, ITheme, name) return name def addPage(self, theme=None, page=None, name=u''): @@ -237,7 +239,6 @@ name = INameChooser(theme).chooseName(name, page) theme[name] = page -theme.registerUtility(page, IThemePage, name) return name def getThemes(self): @@ -249,7 +250,6 @@ def deleteTheme(self, name=u''): for k, v in self.getUtilitiesFor(ITheme): if k == name: -self.unregisterUtility(v, ITheme, k) del self[getName(v)] return @@ -257,7 +257,6 @@ def deleteAllThemes(self): for k, v in self.getUtilitiesFor(ITheme): -self.unregisterUtility(v, ITheme, k) del self[getName(v)] def getThemeByName(self, name=u''): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3502 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Sat Jun 24 00:17:25 2006 New Revision: 3502 Modified: cpsskins/branches/paris-sprint-2006/thememanager.py Log: - removed debug method Modified: cpsskins/branches/paris-sprint-2006/thememanager.py == --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Sat Jun 24 00:17:25 2006 @@ -130,9 +130,6 @@ def getLocation(context): Return the location in a given context -def inspect(): -Inspect themes - class ThemeManagementFolder(BTreeContainer, PersistentComponents): A theme management utility that can contain multiple . themes -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3503 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Sat Jun 24 00:17:57 2006 New Revision: 3503 Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py Log: - fixed the DOM adapter: some nodes got imported several times Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pySat Jun 24 00:17:57 2006 @@ -62,7 +62,6 @@ def updateURIMapping(self): uri = u'cpsskins://%s:%s' % (str(IType(self.context)), self.node.getAttribute(u'id')) -print uri self.mapping.update({uri: self.context}) def clone(self, other): @@ -159,7 +158,11 @@ # properties schema = IType(context).getContentType() + +fields = {} for name, field in zope.schema.getFieldsInOrder(schema): +fields[name] = field + if name in self.ignored_fields: continue @@ -178,40 +181,42 @@ value = archive[filename] setattr(context, name, value) -# child nodes -for child_el in node.childNodes: -if child_el.nodeType != Node.ELEMENT_NODE: -continue - -if child_el.hasAttribute(u'value'): -field_name = child_el.tagName -if name == field_name: -text = child_el.getAttribute(u'value') -value = field_io.load(text) -if IBinaryFieldIO.providedBy(field_io): -filename = value -value = archive[filename] -setattr(context, name, value) -continue - -type = child_el.getAttribute(u'type') -contentname = type or child_el.tagName -factory_name = u'cpsskins.%s.%s' % (self.object_type, -contentname) - -# create the object -element = createObject(factory_name) - -if IStorage.providedBy(context): -context.add(element, contentname) -else: -namechooser = INameChooser(context) -name = namechooser.chooseName(contentname, element) -context[name] = element - -# load data into the object -importer = getMultiAdapter((element, child_el), IDOMAdapter) -importer.clone(self) -importer.updateURIMapping() -importer.load() +# child nodes +for child_el in node.childNodes: +if child_el.nodeType != Node.ELEMENT_NODE: +continue + +if child_el.hasAttribute(u'value'): +field_name = child_el.tagName +if field_name in fields: +text = child_el.getAttribute(u'value') +field_io = IFieldIO(fields[name], None) +value = field_io.load(text) +if IBinaryFieldIO.providedBy(field_io): +filename = value +value = archive[filename] +setattr(context, field_name, value) +continue + +type = child_el.getAttribute(u'type') + +contentname = type or child_el.tagName +factory_name = u'cpsskins.%s.%s' % (self.object_type, +contentname) + +# create the object +element = createObject(factory_name) + +if IStorage.providedBy(context): +context.add(element, contentname) +else: +namechooser = INameChooser(context) +name = namechooser.chooseName(contentname, element) +context[name] = element + +# load data into the object +importer = getMultiAdapter((element, child_el), IDOMAdapter) +importer.clone(self) +importer.updateURIMapping() +importer.load() -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3504 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Sat Jun 24 00:30:54 2006 New Revision: 3504 Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py Log: - fixed typo - raise an error if no IO adapter exists for the field Modified: cpsskins/branches/paris-sprint-2006/setup/io/adapters.py == --- cpsskins/branches/paris-sprint-2006/setup/io/adapters.py(original) +++ cpsskins/branches/paris-sprint-2006/setup/io/adapters.pySat Jun 24 00:30:54 2006 @@ -190,7 +190,10 @@ field_name = child_el.tagName if field_name in fields: text = child_el.getAttribute(u'value') -field_io = IFieldIO(fields[name], None) +field = fields[field_name] +field_io = IFieldIO(field, None) +if field_io is None: +raise TypeError(No field adapter found for '%s'. % field) value = field_io.load(text) if IBinaryFieldIO.providedBy(field_io): filename = value -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3505 - cpsskins/branches/paris-sprint-2006/elements
Author: jmorliaguet Date: Sat Jun 24 00:53:26 2006 New Revision: 3505 Modified: cpsskins/branches/paris-sprint-2006/elements/format.py Log: - 'types' belongs to class' instance Modified: cpsskins/branches/paris-sprint-2006/elements/format.py == --- cpsskins/branches/paris-sprint-2006/elements/format.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/format.py Sat Jun 24 00:53:26 2006 @@ -41,8 +41,6 @@ implements(IFormat) -types = [] - def __init__(self, types=None): self.types = types or [] -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3506 - in cpsskins/branches/paris-sprint-2006: setup ui/screens/sitemanager
Author: jmorliaguet Date: Sat Jun 24 01:13:39 2006 New Revision: 3506 Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Log: - using more official mime-type Modified: cpsskins/branches/paris-sprint-2006/setup/snapshot.py == --- cpsskins/branches/paris-sprint-2006/setup/snapshot.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/snapshot.py Sat Jun 24 01:13:39 2006 @@ -37,7 +37,7 @@ def __init__(self, data): self.data = data -self.contentType = 'application/tgz' +self.contentType = 'application/x-gzip' self.filename = 'site-%4d-%02d-%02d-%02d.%02d.%02d.tgz' % \ time.gmtime()[:6] Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Sat Jun 24 01:13:39 2006 @@ -107,7 +107,7 @@ raise ValueError(No snaphost filename specified.) response = self.request.response -response.setHeader('content-type', 'application/tgz') +response.setHeader('content-type', 'application/x-gzip') response.setHeader('Content-disposition', 'attachment; filename=%s' % filename) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3507 - in CPSSkins4Five/trunk: . doc tests
Author: jmorliaguet Date: Sat Jun 24 01:22:23 2006 New Revision: 3507 Added: CPSSkins4Five/trunk/doc/migration.txt (contents, props changed) CPSSkins4Five/trunk/migration.py (contents, props changed) CPSSkins4Five/trunk/tests/ CPSSkins4Five/trunk/tests/__init__.py (contents, props changed) CPSSkins4Five/trunk/tests/setup-v2.tgz (contents, props changed) CPSSkins4Five/trunk/tests/test_migration.py (contents, props changed) Log: - moved the migration stuff here Added: CPSSkins4Five/trunk/doc/migration.txt == --- (empty file) +++ CPSSkins4Five/trunk/doc/migration.txt Sat Jun 24 01:22:23 2006 @@ -0,0 +1,29 @@ + += +MIGRATION OF ZOPE 2 SITES += + + import os + import Products.CPSSkins4Five.tests + + from Products.CPSSkins4Five.migration import Migration + + test_dir = os.path.dirname(Products.CPSSkins4Five.tests.__file__) + file = open(os.path.join(test_dir, u'setup-v2.tgz')) + + from cpsskins.tests.setup import addThemeManager + from cpsskins.tests.setup import makeSite + + root = getRootFolder() + themes = addThemeManager(root, makeSite(root)) + + migrator = Migrator(themes) + migrator.migrate(file) + + themes.getThemes() +[Theme('CPS3 Default Theme')] + + themes.getPages(themes['default']) +[ThemePage('Front'), ThemePage('Default')] + + Added: CPSSkins4Five/trunk/migration.py == --- (empty file) +++ CPSSkins4Five/trunk/migration.pySat Jun 24 01:22:23 2006 @@ -0,0 +1,199 @@ +## +# +# Copyright (c) 2005-2006 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 xml.dom.minidom import parseString +from zope.app.container.interfaces import INameChooser +from zope.component import getUtility, createObject + +from cpsskins.elements.interfaces import IFormattable +from cpsskins.setup.archives import TarArchive +from cpsskins.setup.interfaces import IResourceManager +from cpsskins.standard.fields.image import WebImage +from cpsskins.thememanager import ThemeManagementFolder + +class Migrator(object): +Migration utility for importing CPSSkins v2 themes + +meta_types = { +'Portal Theme': 'cpsskins.canvas.theme', +'Theme Page': 'cpsskins.canvas.themepage', +'Page Block': 'cpsskins.canvas.pageblock', +'Portal Box Group Templet': 'cpsskins.canvas.slot', +} +children_types = { +'Portal Theme': ('Theme Page',), +'Theme Page': ('Page Block',), +'Page Block': ('',), +} + +def __init__(self, themes): +self.themes = themes +self.resources = getUtility(IResourceManager) + +def migrate(self, file): +self.archive = TarArchive(mode='r', data=file.read()) +self.objects = {} +for theme_name in self.getThemeNames(): +self.importTheme(theme_name) +self.importImages(theme_name) + +def getThemeNames(self): +names = [] +for item in self.archive['themes/']: +if item.endswith(u'.xml'): +continue +names.append(item[len('themes/'):-1]) +return names + +def importTheme(self, theme_name=u''): +themes = self.themes +archive = self.archive +path = 'themes/%s.xml' % theme_name + +doc = parseString(archive[path]) +theme_node = doc.childNodes[0] +theme_name = theme_node.getAttribute('name') +props = self.getProperties(theme_node, 'title', 'author', 'copyright', + 'license') +theme = createObject('cpsskins.canvas.theme', **props) +self.themes.addTheme(theme, name=theme_name) + +# first stage: import themes pages page blocks +self.importObject(theme_node, theme, 'themes/%s' % theme_name) + +# second stage: create cells inside pageblocks +for pageblock_info in self.objects['Page Block']: +pageblock_node = pageblock_info['node'] +pageblock_path = pageblock_info['path'] +props = self.getProperties(pageblock_node, 'maxcols', 'width', + 'height') +container = pageblock_info['object'] +cells
[Z3lab-checkins] r3508 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Sat Jun 24 01:23:35 2006 New Revision: 3508 Removed: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - has moved -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3488 - cpsskins/branches/paris-sprint-2006
Author: jmorliaguet Date: Thu Jun 22 11:58:04 2006 New Revision: 3488 Modified: cpsskins/branches/paris-sprint-2006/thememanager.py Log: - addTheme and addPage can take a name argument Modified: cpsskins/branches/paris-sprint-2006/thememanager.py == --- cpsskins/branches/paris-sprint-2006/thememanager.py (original) +++ cpsskins/branches/paris-sprint-2006/thememanager.py Thu Jun 22 11:58:04 2006 @@ -91,10 +91,10 @@ def getElementById(id): Return an element by its unique id. -def addTheme(theme): +def addTheme(theme, name): Add a theme. -def addPage(theme, page): +def addPage(theme, page, name): Add a page. def getThemes(): @@ -222,20 +222,20 @@ # Themes and pages ### -def addTheme(self, theme=None): +def addTheme(self, theme=None, name=u''): if not ITheme.providedBy(theme): raise(Must specify a theme.) -name = INameChooser(self).chooseName(u'', theme) +name = INameChooser(self).chooseName(name, theme) self[name] = theme self.registerUtility(theme, ITheme, name) return name -def addPage(self, theme=None, page=None): +def addPage(self, theme=None, page=None, name=u''): if not IThemePage.providedBy(page): raise(Must specify a theme page.) -name = INameChooser(theme).chooseName(u'', page) +name = INameChooser(theme).chooseName(name, page) theme[name] = page theme.registerUtility(page, IThemePage, name) return name -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3489 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 22 14:49:55 2006 New Revision: 3489 Added: cpsskins/branches/paris-sprint-2006/setup/io/migration.py (contents, props changed) Log: - prototype of CPSSkins v2 theme importer Added: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- (empty file) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Thu Jun 22 14:49:55 2006 @@ -0,0 +1,93 @@ +## +# +# Copyright (c) 2005-2006 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 xml.dom.minidom import parseString +from zope.component import getUtility + +from cpsskins.elements.theme import Theme +from cpsskins.setup.archives import TarArchive +from cpsskins.setup.interfaces import IResourceManager +from cpsskins.standard.fields.image import WebImage +from cpsskins.thememanager import ThemeManagementFolder + +class Migration(object): +Migration utility for importing CPSSkins v2 themes + +def __init__(self, file): +self.file = file + +self.themes = ThemeManagementFolder() +self.themes.registerUtilities() + +self.archive = TarArchive(mode='r', data=file.read()) +self.resources = getUtility(IResourceManager) + +def __call__(self): +theme_names = self.getThemeNames() +for theme_name in theme_names: +self.importTheme(theme_name) +self.importImages(theme_name) +return self.themes + +def getThemeNames(self): +names = [] +for item in self.archive['themes/']: +if item.endswith(u'.xml'): +continue +names.append(item[len('themes/'):-1]) +return names + +def importTheme(self, name=u''): +path = 'themes/%s.xml' % name +doc = parseString(self.archive[path]) + +theme_node = doc.childNodes[0] +theme_name = theme_node.getAttribute('name') +props = self.getProperties(theme_node, 'title', 'author', 'copyright', + 'license') +theme = Theme(**props) +self.themes.addTheme(theme, name=theme_name) + +def importImages(self, name): +resources = self.resources +archive = self.archive +themes = self.themes +for item in archive['themes/%s/icons/' % name]: +image = WebImage(data=archive[item]) +name = self.getFileName(item) +resources.register(name=name, resource=image, context=themes) + +### utilities + +def getProperties(self, node=None, *props): +info = {} +for property in node.getElementsByTagName('property'): +nodes = property.childNodes +name = property.getAttribute('name') +if name not in props: +continue +value = u'' +if nodes: +value = nodes[0].nodeValue +info[str(name)] = value +return info + +def getFileName(self, path): +return path.split('/')[-1] + -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3490 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 22 15:07:08 2006 New Revision: 3490 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - import pages Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Thu Jun 22 15:07:08 2006 @@ -21,6 +21,7 @@ from zope.component import getUtility from cpsskins.elements.theme import Theme +from cpsskins.elements.themepage import ThemePage from cpsskins.setup.archives import TarArchive from cpsskins.setup.interfaces import IResourceManager from cpsskins.standard.fields.image import WebImage @@ -43,6 +44,7 @@ for theme_name in theme_names: self.importTheme(theme_name) self.importImages(theme_name) + return self.themes def getThemeNames(self): @@ -53,10 +55,12 @@ names.append(item[len('themes/'):-1]) return names -def importTheme(self, name=u''): -path = 'themes/%s.xml' % name -doc = parseString(self.archive[path]) +def importTheme(self, theme_name=u''): +themes = self.themes +archive = self.archive +path = 'themes/%s.xml' % theme_name +doc = parseString(archive[path]) theme_node = doc.childNodes[0] theme_name = theme_node.getAttribute('name') props = self.getProperties(theme_node, 'title', 'author', 'copyright', @@ -64,14 +68,22 @@ theme = Theme(**props) self.themes.addTheme(theme, name=theme_name) -def importImages(self, name): +page_names = self.getObjects(doc.childNodes[0], 'Theme Page').keys() +for page_name in page_names: +page_path = 'themes/%s/%s.xml' % (theme_name, page_name) +page_node = parseString(archive[page_path]) +props = self.getProperties(page_node, 'title') +page = ThemePage(**props) +themes.addPage(theme, page) + +def importImages(self, theme_name): resources = self.resources archive = self.archive themes = self.themes -for item in archive['themes/%s/icons/' % name]: +for item in archive['themes/%s/icons/' % theme_name]: image = WebImage(data=archive[item]) name = self.getFileName(item) -resources.register(name=name, resource=image, context=themes) +resources.register(name=theme_name, resource=image, context=themes) ### utilities @@ -88,6 +100,16 @@ info[str(name)] = value return info +def getObjects(self, node=None, type=u''): +info = {} +for obj in node.getElementsByTagName('object'): +name = obj.getAttribute('name') +meta_type = obj.getAttribute('meta_type') +if type and type != meta_type: +continue +info[name] = meta_type +return info + def getFileName(self, path): return path.split('/')[-1] -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3491 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 22 16:09:37 2006 New Revision: 3491 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - trying to be more generic - recurse through the entire theme Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Thu Jun 22 16:09:37 2006 @@ -18,10 +18,8 @@ __docformat__ = reStructuredText from xml.dom.minidom import parseString -from zope.component import getUtility +from zope.component import getUtility, createObject -from cpsskins.elements.theme import Theme -from cpsskins.elements.themepage import ThemePage from cpsskins.setup.archives import TarArchive from cpsskins.setup.interfaces import IResourceManager from cpsskins.standard.fields.image import WebImage @@ -30,6 +28,22 @@ class Migration(object): Migration utility for importing CPSSkins v2 themes + +meta_types = { +'Portal Theme': 'cpsskins.canvas.theme', +'Theme Page': 'cpsskins.canvas.themepage', +'Page Block': 'cpsskins.canvas.pageblock', +'Cell': 'cpsskins.canvas.cell', +'Slot': 'cpsskins.canvas.slot', +} + +children_types = { +'Portal Theme': ('Theme Page',), +'Theme Page': ('Page Block',), +'Page Block': ('Cell',), +'Cell': ('Slot',), +} + def __init__(self, file): self.file = file @@ -65,16 +79,26 @@ theme_name = theme_node.getAttribute('name') props = self.getProperties(theme_node, 'title', 'author', 'copyright', 'license') -theme = Theme(**props) +theme = createObject('cpsskins.canvas.theme', **props) self.themes.addTheme(theme, name=theme_name) -page_names = self.getObjects(doc.childNodes[0], 'Theme Page').keys() -for page_name in page_names: -page_path = 'themes/%s/%s.xml' % (theme_name, page_name) -page_node = parseString(archive[page_path]) -props = self.getProperties(page_node, 'title') -page = ThemePage(**props) -themes.addPage(theme, page) +self.importObject(theme_node, theme, 'themes/%s' % theme_name) + +def importObject(self, node, obj, current_path): +archive = self.archive +meta_type = node.getAttribute('meta_type') +meta_types = self.meta_types +children_types = self.children_types[meta_type] +names = self.getObjects(node, children_types).keys() +for name in names: +path = '%s/%s.xml' % (current_path, name) +child_doc = parseString(archive[path]) +child_node = child_doc.childNodes[0] +child_type = child_node.getAttribute('meta_type') +props = self.getProperties(child_node, 'title') +obj[name] = createObject(meta_types[child_type], **props) + +self.importObject(child_node, obj, current_path + '/' + name) def importImages(self, theme_name): resources = self.resources @@ -100,12 +124,12 @@ info[str(name)] = value return info -def getObjects(self, node=None, type=u''): +def getObjects(self, node=None, types=()): info = {} for obj in node.getElementsByTagName('object'): name = obj.getAttribute('name') meta_type = obj.getAttribute('meta_type') -if type and type != meta_type: +if type and meta_type not in types: continue info[name] = meta_type return info -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3492 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 22 18:48:28 2006 New Revision: 3492 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - added a name chooser Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Thu Jun 22 18:48:28 2006 @@ -18,6 +18,7 @@ __docformat__ = reStructuredText from xml.dom.minidom import parseString +from zope.app.container.interfaces import INameChooser from zope.component import getUtility, createObject from cpsskins.setup.archives import TarArchive @@ -90,14 +91,16 @@ meta_types = self.meta_types children_types = self.children_types[meta_type] names = self.getObjects(node, children_types).keys() +namechooser = INameChooser(obj) for name in names: path = '%s/%s.xml' % (current_path, name) child_doc = parseString(archive[path]) child_node = child_doc.childNodes[0] child_type = child_node.getAttribute('meta_type') props = self.getProperties(child_node, 'title') -obj[name] = createObject(meta_types[child_type], **props) - +child = createObject(meta_types[child_type], **props) +name = namechooser.chooseName(name, child) +obj[name] = child self.importObject(child_node, obj, current_path + '/' + name) def importImages(self, theme_name): -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3493 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Thu Jun 22 23:43:10 2006 New Revision: 3493 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - cells are created (not imported since there are no Cell objects in v2) Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Thu Jun 22 23:43:10 2006 @@ -34,15 +34,13 @@ 'Portal Theme': 'cpsskins.canvas.theme', 'Theme Page': 'cpsskins.canvas.themepage', 'Page Block': 'cpsskins.canvas.pageblock', -'Cell': 'cpsskins.canvas.cell', -'Slot': 'cpsskins.canvas.slot', +'Portal Box Group Templet': 'cpsskins.canvas.slot', } children_types = { 'Portal Theme': ('Theme Page',), 'Theme Page': ('Page Block',), -'Page Block': ('Cell',), -'Cell': ('Slot',), +'Page Block': ('',), } def __init__(self, file): @@ -53,10 +51,12 @@ self.archive = TarArchive(mode='r', data=file.read()) self.resources = getUtility(IResourceManager) +self.objects = {} def __call__(self): theme_names = self.getThemeNames() for theme_name in theme_names: +#self.importStyles(theme_name) self.importTheme(theme_name) self.importImages(theme_name) @@ -83,31 +83,50 @@ theme = createObject('cpsskins.canvas.theme', **props) self.themes.addTheme(theme, name=theme_name) +# first stage: import themes pages page blocks self.importObject(theme_node, theme, 'themes/%s' % theme_name) -def importObject(self, node, obj, current_path): +# second stage: create cells in pageblocks +for pageblock_info in self.objects['Page Block']: +info = self.getProperties(pageblock_info['node'], 'maxcols') +container = pageblock_info['object'] +for c in range(int(info['maxcols'])): +self.addObject('cpsskins.canvas.cell', container) + +def addObject(self, type, container, name=u'', **props): +object = createObject(type, **props) +namechooser = INameChooser(container) +new_name = namechooser.chooseName(name, object) +container[new_name] = object + +def importObject(self, node, container, current_path): archive = self.archive meta_type = node.getAttribute('meta_type') meta_types = self.meta_types children_types = self.children_types[meta_type] names = self.getObjects(node, children_types).keys() -namechooser = INameChooser(obj) + +self.objects.setdefault(meta_type, []).append({ +'path': current_path, +'object': container, +'node': node, +}) + for name in names: path = '%s/%s.xml' % (current_path, name) child_doc = parseString(archive[path]) child_node = child_doc.childNodes[0] child_type = child_node.getAttribute('meta_type') props = self.getProperties(child_node, 'title') -child = createObject(meta_types[child_type], **props) -name = namechooser.chooseName(name, child) -obj[name] = child -self.importObject(child_node, obj, current_path + '/' + name) +self.addObject(meta_types[child_type], container, **props) +self.importObject(child_node, container, current_path + '/' + name) def importImages(self, theme_name): resources = self.resources archive = self.archive themes = self.themes -for item in archive['themes/%s/icons/' % theme_name]: +for item in archive['themes/%s/icons/' % theme_name] + \ +archive['themes/%s/backgrounds/' % theme_name]: image = WebImage(data=archive[item]) name = self.getFileName(item) resources.register(name=theme_name, resource=image, context=themes) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3494 - cpsskins/branches/paris-sprint-2006/setup/io
Author: jmorliaguet Date: Fri Jun 23 00:53:11 2006 New Revision: 3494 Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py Log: - add slots into cells Modified: cpsskins/branches/paris-sprint-2006/setup/io/migration.py == --- cpsskins/branches/paris-sprint-2006/setup/io/migration.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/io/migration.py Fri Jun 23 00:53:11 2006 @@ -88,16 +88,31 @@ # second stage: create cells in pageblocks for pageblock_info in self.objects['Page Block']: -info = self.getProperties(pageblock_info['node'], 'maxcols') +pageblock_node = pageblock_info['node'] +props = self.getProperties(pageblock_node, 'maxcols') container = pageblock_info['object'] -for c in range(int(info['maxcols'])): -self.addObject('cpsskins.canvas.cell', container) +cells = {} +for c in range(int(props['maxcols'])): +cells[c] = self.addObject('cpsskins.canvas.cell', container) + +# add slots into cells +for slot_name in self.getObjects(pageblock_node, + u'Portal Box Group Templet'): +slot_path = '%s/%s.xml' % (pageblock_info['path'], slot_name) +slot_doc = parseString(archive[slot_path]) +slot_node = slot_doc.childNodes[0] +slot_props = self.getProperties(slot_node, 'name', 'xpos') +xpos = int(slot_props['xpos']) +del slot_props['xpos'] +self.addObject('cpsskins.canvas.slot', cells[xpos], + **slot_props) def addObject(self, type, container, name=u'', **props): object = createObject(type, **props) namechooser = INameChooser(container) new_name = namechooser.chooseName(name, object) container[new_name] = object +return object def importObject(self, node, container, current_path): archive = self.archive -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3482 - cpsskins/branches/paris-sprint-2006/ui/screens
Author: jmorliaguet Date: Wed Jun 21 14:59:50 2006 New Revision: 3482 Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Log: - update the main screen when the location changes Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py == --- cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py (original) +++ cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py Wed Jun 21 14:59:50 2006 @@ -371,6 +371,7 @@ 'type': 'panel', }, 'model': 'location-chooser', +'subviews': ['content-author'], 'perspectives': ['content-author'], 'controllers': ['main-editor-perspectives', 'main-editor-actions'], }, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3484 - in cpsskins/branches/paris-sprint-2006: browser/negotiation standard/negotiation ui/screens ui/screens/common
Author: jmorliaguet Date: Wed Jun 21 16:09:50 2006 New Revision: 3484 Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml cpsskins/branches/paris-sprint-2006/ui/screens/common/page_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/theme_tabs.pt cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt Log: - using 3 different negotiation strategies: - default (view mode) - content-author (content author mode) - page-designer (page designer mode) Modified: cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py == --- cpsskins/branches/paris-sprint-2006/browser/negotiation/views.py (original) +++ cpsskins/branches/paris-sprint-2006/browser/negotiation/views.pyWed Jun 21 16:09:50 2006 @@ -52,7 +52,7 @@ self.request.annotations['cpsskins.strategy'] = name def getStrategy(self): -return self.request.annotations.get('cpsskins.strategy', u'editor') +return self.request.annotations.get('cpsskins.strategy', u'default') strategy = property(getStrategy, setStrategy) Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml Wed Jun 21 16:09:50 2006 @@ -3,7 +3,7 @@ !-- view mode -- - negotiationchain name=engine + negotiationchain name=engine strategy=default scheme class=.engine.Request @@ -13,14 +13,16 @@ /negotiationchain - !-- editor mode -- + !-- content author -- - negotiationchain name=engine strategy=editor + negotiationchain name=engine strategy=content-author -scheme -class=.engine.Request -interface=.interfaces.IRequestNegotiationScheme -/ + /negotiationchain + + + !-- page designer -- + + negotiationchain name=engine strategy=page-designer /negotiationchain Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.pyWed Jun 21 16:09:50 2006 @@ -112,8 +112,6 @@ location = self.manager.getLocationStorage().find(path, u'pages') if location is not None: page_name = location() -print page_name -print self.manager.getPageByName(page_name) return self.manager.getPageByName(page_name) return None Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml Wed Jun 21 16:09:50 2006 @@ -3,7 +3,7 @@ !-- view mode -- - negotiationchain name=page + negotiationchain name=page strategy=default scheme class=.page.QueryParameter @@ -11,13 +11,13 @@ / scheme -class=.page.Location -interface=.interfaces.ILocationNegotiationScheme +class=.page.Cookie +interface=.interfaces.ICookieNegotiationScheme / scheme -class=.page.Cookie -interface=.interfaces.ICookieNegotiationScheme +class=.page.Location +interface=.interfaces.ILocationNegotiationScheme / scheme @@ -28,9 +28,9 @@ /negotiationchain - !-- editor mode -- + !-- content author mode -- - negotiationchain name=page strategy=editor + negotiationchain name=page strategy=content-author scheme class=.page.CookieLocation @@ -38,19 +38,22 @@ / scheme -class=.page.Cookie -interface=.interfaces.ICookieNegotiationScheme +class=.page.Default +interface=.interfaces.IDefaultNegotiationScheme / -scheme -class=.page.Local -interface=.interfaces.ILocalNegotiationScheme -/ + /negotiationchain + + + !-- page designer -- + + negotiationchain name=page strategy=page-designer scheme -class=.page.Context -interface=.interfaces.IContextNegotiationScheme
[Z3lab-checkins] r3485 - cpsskins/branches/paris-sprint-2006/elements
Author: jmorliaguet Date: Wed Jun 21 20:26:15 2006 New Revision: 3485 Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py cpsskins/branches/paris-sprint-2006/elements/theme.py Log: - added some theme information found in CPSSkins v2 Modified: cpsskins/branches/paris-sprint-2006/elements/interfaces.py == --- cpsskins/branches/paris-sprint-2006/elements/interfaces.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/interfaces.py Wed Jun 21 20:26:15 2006 @@ -193,7 +193,19 @@ title = TextLine( -title=_(uTheme name), +title=_(uTheme title), +required=False) + +author = TextLine( +title=_(uAuthor), +required=False) + +copyright = TextLine( +title=_(uCopyright), +required=False) + +license = TextLine( +title=_(uLicense), required=False) def getPages(): Modified: cpsskins/branches/paris-sprint-2006/elements/theme.py == --- cpsskins/branches/paris-sprint-2006/elements/theme.py (original) +++ cpsskins/branches/paris-sprint-2006/elements/theme.py Wed Jun 21 20:26:15 2006 @@ -35,10 +35,13 @@ implements(ITheme) -def __init__(self, title=u''): +def __init__(self, title=u'', author=u'', copyright=u'', license=u''): super(Theme, self).__init__() PersistentComponents.__init__(self) self.title = title +self.author = author +self.copyright = copyright +self.license = license def __repr__(self): return Theme('%s') % self.title -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3487 - cpsskins/branches/paris-sprint-2006/setup
Author: jmorliaguet Date: Wed Jun 21 23:01:44 2006 New Revision: 3487 Modified: cpsskins/branches/paris-sprint-2006/setup/archives.py Log: - return the list of items in a directory: for instance: archive['themes/'] returns ['themes/default.xml', 'themes/sci.xml', 'themes/sci/', 'themes/default/'] Modified: cpsskins/branches/paris-sprint-2006/setup/archives.py == --- cpsskins/branches/paris-sprint-2006/setup/archives.py (original) +++ cpsskins/branches/paris-sprint-2006/setup/archives.py Wed Jun 21 23:01:44 2006 @@ -20,6 +20,7 @@ import os import time +from sets import Set from StringIO import StringIO from tarfile import TarFile from tarfile import TarInfo @@ -59,6 +60,9 @@ def __getitem__(self, k): if self.mode == 'w': raise IOError(This tar archive is write-only.) +# if the item is a directory return the list of files in the directory +if k[-1:] == '/': +return self._dir(k) file = self.archive.extractfile(k) return file.read() @@ -75,6 +79,26 @@ def keys(self): return self.archive.getnames() +def items(self): +return [(k, self[k]) for k in self.keys()] + +def _dir(self, k): +Return the list of items in a directory including directories +depth = k.count('/') +items = [] +dirs = Set() +for f, v in self.items(): +f_depth = f.count('/') +if not f.startswith(k): +continue +if f_depth == depth +1: +dirs.add('/'.join(f.split('/')[:f_depth]) + '/') +if f.count('/') depth: +continue +items.append(f) +items.extend(list(dirs)) +return items + class FileSystemArchive(object): An archive that reads data from the file-system. -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3470 - cpsskins/branches/paris-sprint-2006/configuration/negotiation
Author: jmorliaguet Date: Tue Jun 20 19:11:23 2006 New Revision: 3470 Modified: cpsskins/branches/paris-sprint-2006/configuration/negotiation/metaconfigure.py Log: - made it possible to register several strategies for a same chain Modified: cpsskins/branches/paris-sprint-2006/configuration/negotiation/metaconfigure.py == --- cpsskins/branches/paris-sprint-2006/configuration/negotiation/metaconfigure.py (original) +++ cpsskins/branches/paris-sprint-2006/configuration/negotiation/metaconfigure.py Tue Jun 20 19:11:23 2006 @@ -27,7 +27,8 @@ from cpsskins.browser.negotiation.strategy import NegotiationStrategy from cpsskins.thememanager import IThemeManagementFolder -registered_utilities = {} +registered_strategies = {} +registered_schemes = [] class negotiationchain(object): @@ -35,14 +36,14 @@ self.name = name self.chain = NegotiationChain() -st = registered_utilities.get(strategy) +st = registered_strategies.get(strategy) if st is None: st = NegotiationStrategy() -if strategy not in registered_utilities: +if strategy not in registered_strategies: utility(_context=_context, provides=INegotiationStrategy, component=st, name=strategy) -registered_utilities[strategy] = st +registered_strategies[strategy] = st st.addChain(self.chain, name) @@ -69,10 +70,12 @@ raise ConfigurationError( A negotiation scheme must implement INegotiationScheme.) -# register the negotition scheme -adapts = (None, IThemeManagementFolder, IBrowserRequest) - -# zope:adapter -adapter(_context=_context, factory=(class_,), provides=interface, -for_=adapts, name=name) +if name not in registered_schemes: +# register the negotition scheme +adapts = (None, IThemeManagementFolder, IBrowserRequest) + +# zope:adapter +adapter(_context=_context, factory=(class_,), provides=interface, +for_=adapts, name=name) +registered_schemes.append(name) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r3471 - cpsskins/branches/paris-sprint-2006/standard/negotiation
Author: jmorliaguet Date: Tue Jun 20 19:14:42 2006 New Revision: 3471 Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml Log: - register different negotiation strategies depending on the diplay mode (view mode / editor mode) Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/engine.zcml Tue Jun 20 19:14:42 2006 @@ -1,6 +1,8 @@ configure xmlns=http://namespaces.zope.org/cpsskins; + !-- view mode -- + negotiationchain name=engine scheme @@ -10,4 +12,16 @@ /negotiationchain + + !-- editor mode -- + + negotiationchain name=engine strategy=editor + +scheme +class=.engine.Request +interface=.interfaces.IRequestNegotiationScheme +/ + + /negotiationchain + /configure Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.zcml Tue Jun 20 19:14:42 2006 @@ -1,6 +1,8 @@ configure xmlns=http://namespaces.zope.org/cpsskins; + !-- view mode -- + negotiationchain name=page scheme @@ -19,19 +21,40 @@ / scheme -class=.page.Local -interface=.interfaces.ILocalNegotiationScheme +class=.page.Default +interface=.interfaces.IDefaultNegotiationScheme / + /negotiationchain + + + !-- editor mode -- + + negotiationchain name=page strategy=editor + scheme -class=.page.Default -interface=.interfaces.IDefaultNegotiationScheme +class=.page.Location +interface=.interfaces.ILocationNegotiationScheme +/ + +scheme +class=.page.Cookie +interface=.interfaces.ICookieNegotiationScheme +/ + +scheme +class=.page.Local +interface=.interfaces.ILocalNegotiationScheme / scheme class=.page.Context interface=.interfaces.IContextNegotiationScheme / +scheme +class=.page.Default +interface=.interfaces.IDefaultNegotiationScheme +/ /negotiationchain Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml == --- cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml (original) +++ cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.zcml Tue Jun 20 19:14:42 2006 @@ -1,6 +1,8 @@ configure xmlns=http://namespaces.zope.org/cpsskins; + !-- view mode -- + negotiationchain name=perspective scheme @@ -15,4 +17,21 @@ /negotiationchain + + !-- editor mode -- + + negotiationchain name=perspective strategy=editor + +scheme +class=.perspective.Session +interface=.interfaces.ISessionNegotiationScheme +/ + +scheme +class=.perspective.Location +interface=.interfaces.ILocationNegotiationScheme +/ + + /negotiationchain + /configure -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins