show concept states on listings (if appropriate)
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2922 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
79def88b57
commit
13fe5fd4d8
13 changed files with 69 additions and 24 deletions
|
@ -39,7 +39,7 @@ from zope.formlib.namedtemplate import NamedTemplate
|
||||||
from zope.interface import Interface, implements
|
from zope.interface import Interface, implements
|
||||||
from zope.proxy import removeAllProxies
|
from zope.proxy import removeAllProxies
|
||||||
from zope.publisher.browser import applySkin
|
from zope.publisher.browser import applySkin
|
||||||
from zope.publisher.interfaces.browser import IBrowserSkinType
|
from zope.publisher.interfaces.browser import IBrowserSkinType, IBrowserView
|
||||||
from zope import schema
|
from zope import schema
|
||||||
from zope.schema.vocabulary import SimpleTerm
|
from zope.schema.vocabulary import SimpleTerm
|
||||||
from zope.security import canAccess, checkPermission
|
from zope.security import canAccess, checkPermission
|
||||||
|
@ -139,6 +139,9 @@ class BaseView(GenericView, I18NView):
|
||||||
self.checkLanguage()
|
self.checkLanguage()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def registerPortlets(self):
|
||||||
|
pass
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def target(self):
|
def target(self):
|
||||||
# allow for having a separate object the view acts upon
|
# allow for having a separate object the view acts upon
|
||||||
|
@ -289,6 +292,8 @@ class BaseView(GenericView, I18NView):
|
||||||
request = self.request
|
request = self.request
|
||||||
for o in objs:
|
for o in objs:
|
||||||
view = component.queryMultiAdapter((o, request), name='index.html')
|
view = component.queryMultiAdapter((o, request), name='index.html')
|
||||||
|
#if view is None:
|
||||||
|
# view = component.queryMultiAdapter((o, request), IBrowserView)
|
||||||
if view is None:
|
if view is None:
|
||||||
view = BaseView(o, request)
|
view = BaseView(o, request)
|
||||||
yield view
|
yield view
|
||||||
|
|
|
@ -208,6 +208,14 @@
|
||||||
menu="zmi_views" title="View"
|
menu="zmi_views" title="View"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<page
|
||||||
|
name="index.html"
|
||||||
|
for="loops.interfaces.IConcept"
|
||||||
|
class=".concept.ConceptView"
|
||||||
|
template="concept.pt"
|
||||||
|
permission="zope.View"
|
||||||
|
/>
|
||||||
|
|
||||||
<defaultView
|
<defaultView
|
||||||
for="loops.interfaces.IConcept"
|
for="loops.interfaces.IConcept"
|
||||||
name="concept.html"
|
name="concept.html"
|
||||||
|
|
|
@ -210,6 +210,8 @@ class ResourceRelationView(ResourceView, ConceptRelationView):
|
||||||
def __init__(self, relation, request, contextIsSecond=False):
|
def __init__(self, relation, request, contextIsSecond=False):
|
||||||
ConceptRelationView.__init__(self, relation, request, contextIsSecond)
|
ConceptRelationView.__init__(self, relation, request, contextIsSecond)
|
||||||
|
|
||||||
|
getActions = ResourceView.getActions
|
||||||
|
|
||||||
|
|
||||||
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
||||||
|
|
||||||
|
|
|
@ -371,6 +371,7 @@ class ChildRelationSetProperty(RelationSetProperty):
|
||||||
|
|
||||||
|
|
||||||
class ParentRelation(object):
|
class ParentRelation(object):
|
||||||
|
# TODO: provide special method for supplying relevance and order
|
||||||
|
|
||||||
def __init__(self, predicateName):
|
def __init__(self, predicateName):
|
||||||
self.predicateName = predicateName
|
self.predicateName = predicateName
|
||||||
|
@ -388,7 +389,7 @@ class ParentRelation(object):
|
||||||
if current != value:
|
if current != value:
|
||||||
s.remove(current)
|
s.remove(current)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
s.add(value)
|
s.add(value) # how to supply additional parameters?
|
||||||
|
|
||||||
|
|
||||||
# caching (TBD)
|
# caching (TBD)
|
||||||
|
|
|
@ -33,7 +33,8 @@ from cybertools.meta.config import GlobalOptions as BaseGlobalOptions
|
||||||
from cybertools.meta.interfaces import IOptions
|
from cybertools.meta.interfaces import IOptions
|
||||||
from cybertools.meta.namespace import Executor, ExecutionError
|
from cybertools.meta.namespace import Executor, ExecutionError
|
||||||
from cybertools.typology.interfaces import IType
|
from cybertools.typology.interfaces import IType
|
||||||
from loops.interfaces import ILoops
|
from loops.interfaces import ILoops, ILoopsObject
|
||||||
|
from loops.query import IQueryConcept
|
||||||
from loops import util
|
from loops import util
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ class GlobalOptions(BaseGlobalOptions):
|
||||||
|
|
||||||
class LoopsOptions(Options):
|
class LoopsOptions(Options):
|
||||||
|
|
||||||
adapts(ILoops)
|
adapts(ILoopsObject)
|
||||||
|
|
||||||
builtins = Options.builtins + ('True', 'False')
|
builtins = Options.builtins + ('True', 'False')
|
||||||
True, False = True, False
|
True, False = True, False
|
||||||
|
@ -86,3 +87,9 @@ class LoopsOptions(Options):
|
||||||
rc = Executor(self).execute(code)
|
rc = Executor(self).execute(code)
|
||||||
if rc:
|
if rc:
|
||||||
raise ExecutionError('\n' + rc)
|
raise ExecutionError('\n' + rc)
|
||||||
|
|
||||||
|
|
||||||
|
class QueryOptions(LoopsOptions):
|
||||||
|
|
||||||
|
adapts(IQueryConcept)
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,9 @@
|
||||||
<allow interface="cybertools.meta.interfaces.IOptions" />
|
<allow interface="cybertools.meta.interfaces.IOptions" />
|
||||||
</zope:class>
|
</zope:class>
|
||||||
|
|
||||||
|
<zope:adapter factory="loops.config.base.QueryOptions" trusted="True" />
|
||||||
|
<zope:class class="loops.config.base.QueryOptions">
|
||||||
|
<allow interface="cybertools.meta.interfaces.IOptions" />
|
||||||
|
</zope:class>
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
||||||
|
|
||||||
"Project-Id-Version: $Id$\n"
|
"Project-Id-Version: $Id$\n"
|
||||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||||
"PO-Revision-Date: 2008-08-22 12:00 CET\n"
|
"PO-Revision-Date: 2008-10-15 12:00 CET\n"
|
||||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@ -374,3 +374,6 @@ msgstr "Ende"
|
||||||
msgid "Create loops Note"
|
msgid "Create loops Note"
|
||||||
msgstr "loops-Notiz anlegen"
|
msgstr "loops-Notiz anlegen"
|
||||||
|
|
||||||
|
msgid "State information for $definition: $title"
|
||||||
|
msgstr "Status ($definition): $title"
|
||||||
|
|
||||||
|
|
|
@ -348,10 +348,15 @@ Events listing
|
||||||
... )
|
... )
|
||||||
|
|
||||||
>>> from loops.organize.browser.event import Events
|
>>> from loops.organize.browser.event import Events
|
||||||
>>> listing = Events(johnC, TestRequest())
|
>>> events = addAndConfigureObject(concepts, Concept, 'events', title=u'Events',
|
||||||
|
... conceptType=concepts['query'])
|
||||||
|
>>> listing = Events(events, TestRequest())
|
||||||
>>> listing.getActions('portlet')
|
>>> listing.getActions('portlet')
|
||||||
[<loops.browser.action.DialogAction ...>]
|
[<loops.browser.action.DialogAction ...>]
|
||||||
|
|
||||||
|
>>> from loops.config.base import QueryOptions
|
||||||
|
>>> component.provideAdapter(QueryOptions)
|
||||||
|
|
||||||
>>> list(listing.events())
|
>>> list(listing.events())
|
||||||
[<loops.browser.concept.ConceptRelationView ...>]
|
[<loops.browser.concept.ConceptRelationView ...>]
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,12 @@ Definition of view classes and other browser related stuff for tasks.
|
||||||
$Id$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from zope import interface, component
|
from zope import interface, component
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
|
from cybertools.meta.interfaces import IOptions
|
||||||
from loops.browser.action import DialogAction
|
from loops.browser.action import DialogAction
|
||||||
from loops.browser.concept import ConceptView
|
from loops.browser.concept import ConceptView
|
||||||
from loops.common import adapted
|
from loops.common import adapted
|
||||||
|
@ -62,10 +63,13 @@ class Events(ConceptView):
|
||||||
tEvent = cm['event']
|
tEvent = cm['event']
|
||||||
hasType = cm.getTypePredicate()
|
hasType = cm.getTypePredicate()
|
||||||
now = datetime.today()
|
now = datetime.today()
|
||||||
|
delta = int(self.request.get('delta',
|
||||||
|
IOptions(adapted(self.context))('delta', [0])[0]))
|
||||||
sort = lambda x: x.adapted.start or now
|
sort = lambda x: x.adapted.start or now
|
||||||
relViews = (self.childViewFactory(r, self.request, contextIsSecond=True)
|
relViews = (self.childViewFactory(r, self.request, contextIsSecond=True)
|
||||||
for r in tEvent.getChildRelations([hasType], sort=None))
|
for r in tEvent.getChildRelations([hasType], sort=None))
|
||||||
return sorted((rv for rv in relViews
|
return sorted((rv for rv in relViews
|
||||||
if not rv.adapted.end or rv.adapted.end >= now),
|
if not rv.adapted.end or
|
||||||
|
rv.adapted.end >= now - timedelta(delta)),
|
||||||
key=sort)
|
key=sort)
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,9 @@ class StateAction(Action):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def description(self):
|
def description(self):
|
||||||
return (u'State information for %s: %s' %
|
return _(u'State information for $definition: $title',
|
||||||
(self.definition, self.stateObject.title))
|
mapping=dict(definition=self.definition,
|
||||||
|
title=self.stateObject.title))
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def stateObject(self):
|
def stateObject(self):
|
||||||
|
|
|
@ -21,21 +21,25 @@
|
||||||
tal:content="deftype"
|
tal:content="deftype"
|
||||||
i18n:translate="" />
|
i18n:translate="" />
|
||||||
</td>
|
</td>
|
||||||
<td tal:content="def/name"
|
<td valign="top"
|
||||||
|
tal:content="def/name"
|
||||||
i18n:translate=""></td>
|
i18n:translate=""></td>
|
||||||
<td>
|
<td>
|
||||||
<tal:state repeat="state def/states">
|
<tal:states repeat="state def/states">
|
||||||
|
<tal:state define="name string:state.$deftype.${def/name};
|
||||||
|
value state/name">
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
tal:define="name string:state.$deftype.${def/name};
|
|
||||||
value state/name"
|
|
||||||
tal:attributes="name string:$name:list;
|
tal:attributes="name string:$name:list;
|
||||||
value value;
|
value value;
|
||||||
checked python:
|
checked python:
|
||||||
value in item.selectedStates.get(name, ())"
|
value in item.selectedStates.get(name, ());
|
||||||
/><span tal:content="state/title"
|
id string:$name.$value"
|
||||||
i18n:translate="" />
|
/> <label tal:content="state/title"
|
||||||
|
i18n:translate=""
|
||||||
|
tal:attributes="for string:$name.$value" />
|
||||||
|
|
||||||
</tal:state>
|
</tal:state>
|
||||||
|
</tal:states>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tal:def>
|
</tal:def>
|
||||||
|
|
|
@ -266,7 +266,7 @@
|
||||||
url="listConceptsForComboBox.js?searchType=" >
|
url="listConceptsForComboBox.js?searchType=" >
|
||||||
</div>
|
</div>
|
||||||
<input dojoType="dijit.form.FilteringSelect" store="conceptSearch"
|
<input dojoType="dijit.form.FilteringSelect" store="conceptSearch"
|
||||||
autoComplete="False" labelAttr="label"
|
autoComplete="False" labelAttr="label" style="height: 16px"
|
||||||
name="concept.search.text" id="concept.search.text"
|
name="concept.search.text" id="concept.search.text"
|
||||||
tal:attributes="name string:$namePrefix.text;
|
tal:attributes="name string:$namePrefix.text;
|
||||||
id string:$idPrefix.text" />
|
id string:$idPrefix.text" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue