work in progress: page layout for 'book' compound objects
This commit is contained in:
parent
c74af2b960
commit
dbc720c54a
8 changed files with 65 additions and 39 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_g3"
|
name="lobo_g3"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.Grid3"
|
factory="loops.browser.lobo.standard.Grid3"
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_lt"
|
name="lobo_lt"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.ListThumbs"
|
factory="loops.browser.lobo.standard.ListThumbs"
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_l1"
|
name="lobo_l1"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.List1"
|
factory="loops.browser.lobo.standard.List1"
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_l3"
|
name="lobo_l3"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.List3"
|
factory="loops.browser.lobo.standard.List3"
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_l2"
|
name="lobo_l2"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.List2"
|
factory="loops.browser.lobo.standard.List2"
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_ht"
|
name="lobo_ht"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.HeaderThumbs"
|
factory="loops.browser.lobo.standard.HeaderThumbs"
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_h0"
|
name="lobo_h0"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.Header0"
|
factory="loops.browser.lobo.standard.Header0"
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_h1"
|
name="lobo_h1"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.Header1"
|
factory="loops.browser.lobo.standard.Header1"
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_h2"
|
name="lobo_h2"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.Header2"
|
factory="loops.browser.lobo.standard.Header2"
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_h3"
|
name="lobo_h3"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.Header3"
|
factory="loops.browser.lobo.standard.Header3"
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="lobo_ig3"
|
name="lobo_ig3"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConceptSchema
|
||||||
loops.browser.skin.Lobo"
|
loops.browser.skin.Lobo"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.browser.lobo.standard.ImageGrid3"
|
factory="loops.browser.lobo.standard.ImageGrid3"
|
||||||
|
|
|
@ -165,7 +165,7 @@ class Layout(Base, ConceptView):
|
||||||
result = []
|
result = []
|
||||||
for p in parts:
|
for p in parts:
|
||||||
viewName = 'lobo_' + p
|
viewName = 'lobo_' + p
|
||||||
view = component.queryMultiAdapter((self.context, self.request),
|
view = component.queryMultiAdapter((self.adapted, self.request),
|
||||||
name=viewName)
|
name=viewName)
|
||||||
if view is not None:
|
if view is not None:
|
||||||
view.parent = self
|
view.parent = self
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
loops - Linked Objects for Organization and Processing Services
|
loops - Linked Objects for Organization and Processing Services
|
||||||
===============================================================
|
===============================================================
|
||||||
|
|
||||||
($Id$)
|
|
||||||
|
|
||||||
>>> from zope import component
|
>>> from zope import component
|
||||||
>>> from zope.traversing.api import getName
|
>>> from zope.traversing.api import getName
|
||||||
|
|
||||||
|
@ -349,6 +347,17 @@ Micro Articles
|
||||||
u'Systemic KM talks about organizational knowledge.'
|
u'Systemic KM talks about organizational knowledge.'
|
||||||
|
|
||||||
|
|
||||||
|
Books, Sections, and Pages
|
||||||
|
==========================
|
||||||
|
|
||||||
|
>>> import os
|
||||||
|
>>> from loops.setup import importData
|
||||||
|
>>> importPath = os.path.join(os.path.dirname(__file__), 'book')
|
||||||
|
>>> importData(loopsRoot, importPath, 'loops_book_de.dmp')
|
||||||
|
|
||||||
|
>>> from loops.compound.book.browser import PageLayout
|
||||||
|
|
||||||
|
|
||||||
Fin de partie
|
Fin de partie
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Compound objects like articles, blog posts, storyboard items, ...
|
Compound objects like articles, blog posts, storyboard items, ...
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
@ -27,35 +25,40 @@ from zope.interface import implements
|
||||||
from zope.traversing.api import getName
|
from zope.traversing.api import getName
|
||||||
|
|
||||||
from loops.common import AdapterBase
|
from loops.common import AdapterBase
|
||||||
from loops.compound.interfaces import ICompound, compoundPredicateName
|
from loops.compound.interfaces import ICompound, compoundPredicateNames
|
||||||
|
|
||||||
|
|
||||||
class Compound(AdapterBase):
|
class Compound(AdapterBase):
|
||||||
|
|
||||||
implements(ICompound)
|
implements(ICompound)
|
||||||
|
|
||||||
|
compoundPredicateNames = compoundPredicateNames
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def compoundPredicate(self):
|
def compoundPredicates(self):
|
||||||
return self.context.getConceptManager()[compoundPredicateName]
|
return [self.context.getConceptManager()[n]
|
||||||
|
for n in self.compoundPredicateNames]
|
||||||
|
|
||||||
def getParts(self):
|
def getParts(self):
|
||||||
if self.context.__parent__ is None:
|
if self.context.__parent__ is None:
|
||||||
return []
|
return []
|
||||||
return self.context.getResources([self.partOf])
|
return self.context.getResources(self.compoundPredicates)
|
||||||
|
|
||||||
def add(self, obj, position=None):
|
def add(self, obj, position=None):
|
||||||
if position is None:
|
if position is None:
|
||||||
order = self.getMaxOrder() + 1
|
order = self.getMaxOrder() + 1
|
||||||
else:
|
else:
|
||||||
order = self.getOrderForPosition(position)
|
order = self.getOrderForPosition(position)
|
||||||
self.context.assignResource(obj, self.partOf, order=order)
|
self.context.assignResource(obj, self.partOf,
|
||||||
|
order=order)
|
||||||
|
|
||||||
def remove(self, obj, position=None):
|
def remove(self, obj, position=None):
|
||||||
if position is None:
|
if position is None:
|
||||||
self.context.deassignResource(obj, [self.partOf])
|
self.context.deassignResource(obj, self.compoundPredicates)
|
||||||
else:
|
else:
|
||||||
rel = self.getPartRelations()[position]
|
rel = self.getPartRelations()[position]
|
||||||
self.context.deassignResource(obj, [self.partOf], order=rel.order)
|
self.context.deassignResource(obj, self.compoundPredicates,
|
||||||
|
order=rel.order)
|
||||||
|
|
||||||
def reorder(self, parts):
|
def reorder(self, parts):
|
||||||
existing = list(self.getPartRelations())
|
existing = list(self.getPartRelations())
|
||||||
|
@ -77,7 +80,7 @@ class Compound(AdapterBase):
|
||||||
# helper methods and properties
|
# helper methods and properties
|
||||||
|
|
||||||
def getPartRelations(self):
|
def getPartRelations(self):
|
||||||
return self.context.getResourceRelations([self.partOf])
|
return self.context.getResourceRelations(self.compoundPredicates)
|
||||||
|
|
||||||
def getMaxOrder(self):
|
def getMaxOrder(self):
|
||||||
rels = self. getPartRelations()
|
rels = self. getPartRelations()
|
||||||
|
@ -117,5 +120,5 @@ class Compound(AdapterBase):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def partOf(self):
|
def partOf(self):
|
||||||
return self.conceptManager[compoundPredicateName]
|
return self.compoundPredicates[0]
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,31 @@
|
||||||
|
type(u'documenttype', u'Dokumentenart', options=u'qualifier:assign',
|
||||||
|
viewName=u'')
|
||||||
|
|
||||||
|
# book types
|
||||||
type(u'book', u'Buch', viewName=u'', typeInterface=u'',
|
type(u'book', u'Buch', viewName=u'', typeInterface=u'',
|
||||||
options=u'action.portlet:create_subtype,edit_concept')
|
options=u'action.portlet:create_subtype,edit_concept')
|
||||||
type(u'page', u'Seite', viewName=u'', typeInterface=u'',
|
type(u'page', u'Seite', viewName=u'page_layout',
|
||||||
|
typeInterface=u'loops.compound.book.interfaces.IPage',
|
||||||
options=u'action.portlet:edit_concept')
|
options=u'action.portlet:edit_concept')
|
||||||
type(u'section', u'Kapitel', viewName=u'', typeInterface=u'',
|
type(u'section', u'Kapitel', viewName=u'', typeInterface=u'',
|
||||||
options=u'action.portlet:create_subtype,edit_concept')
|
options=u'action.portlet:create_subtype,edit_concept')
|
||||||
|
|
||||||
concept(u'ispartof', u'is Part of', u'predicate', options=u'', predicateInterface=u'')
|
concept(u'system', u'System', u'domain')
|
||||||
concept(u'issubtype', u'is Subtype', u'predicate', options=u'', predicateInterface=u'')
|
|
||||||
|
# predicates
|
||||||
|
concept(u'ispartof', u'is Part of', u'predicate', options=u'',
|
||||||
|
predicateInterface=u'')
|
||||||
|
concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children',
|
||||||
|
predicateInterface='loops.interfaces.IIsSubtype')
|
||||||
|
|
||||||
|
# document types
|
||||||
|
concept(u'keyquestions', u'Leitfragen', u'documenttype')
|
||||||
concept(u'maintext', u'Haupttext', u'documenttype')
|
concept(u'maintext', u'Haupttext', u'documenttype')
|
||||||
concept(u'quote', u'Zitat', u'documenttype')
|
concept(u'quote', u'Zitat', u'documenttype')
|
||||||
|
concept(u'story', u'Geschichte', u'documenttype')
|
||||||
|
concept(u'usecase', u'Fallbeispiel', u'documenttype')
|
||||||
|
|
||||||
child(u'book', u'section', u'issubtype')
|
# book structure
|
||||||
child(u'section', u'section', u'issubtype')
|
child(u'book', u'section', u'issubtype', usePredicate=u'ispartof')
|
||||||
child(u'section', u'page', u'issubtype')
|
child(u'section', u'section', u'issubtype', usePredicate=u'ispartof')
|
||||||
child(u'system', u'personal_info', u'standard')
|
child(u'section', u'page', u'issubtype', usePredicate=u'ispartof')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Compound objects like articles, blog posts, storyboard items, ...
|
Compound objects like articles, blog posts, storyboard items, ...
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#TODO: move generic stuff to cybertools.composer
|
#TODO: move generic stuff to cybertools.composer
|
||||||
|
@ -31,7 +29,7 @@ from loops.interfaces import IConceptSchema
|
||||||
from loops.util import _
|
from loops.util import _
|
||||||
|
|
||||||
|
|
||||||
compoundPredicateName = 'ispartof'
|
compoundPredicateNames = ['ispartof']
|
||||||
|
|
||||||
|
|
||||||
class ICompound(IConceptSchema):
|
class ICompound(IConceptSchema):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# $Id$
|
# tests.py
|
||||||
|
# Package loops.compound
|
||||||
|
|
||||||
import unittest, doctest
|
import unittest, doctest
|
||||||
from zope.testing.doctestunit import DocFileSuite
|
from zope.testing.doctestunit import DocFileSuite
|
||||||
|
|
|
@ -480,6 +480,7 @@
|
||||||
<include package=".browser" />
|
<include package=".browser" />
|
||||||
<include package=".classifier" />
|
<include package=".classifier" />
|
||||||
<include package=".compound.blog" />
|
<include package=".compound.blog" />
|
||||||
|
<include package=".compound.book" />
|
||||||
<include package=".compound.microart" />
|
<include package=".compound.microart" />
|
||||||
<include package=".config" />
|
<include package=".config" />
|
||||||
<include package=".constraint" />
|
<include package=".constraint" />
|
||||||
|
@ -492,7 +493,6 @@
|
||||||
<include package=".media" />
|
<include package=".media" />
|
||||||
<include package=".organize" />
|
<include package=".organize" />
|
||||||
<include package=".rest" />
|
<include package=".rest" />
|
||||||
<!--<include package=".search" />-->
|
|
||||||
<include package=".security" />
|
<include package=".security" />
|
||||||
<include package=".system" />
|
<include package=".system" />
|
||||||
<include package=".versioning" />
|
<include package=".versioning" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue