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.proxy import removeAllProxies
|
||||
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.schema.vocabulary import SimpleTerm
|
||||
from zope.security import canAccess, checkPermission
|
||||
|
@ -139,6 +139,9 @@ class BaseView(GenericView, I18NView):
|
|||
self.checkLanguage()
|
||||
return result
|
||||
|
||||
def registerPortlets(self):
|
||||
pass
|
||||
|
||||
@Lazy
|
||||
def target(self):
|
||||
# allow for having a separate object the view acts upon
|
||||
|
@ -289,6 +292,8 @@ class BaseView(GenericView, I18NView):
|
|||
request = self.request
|
||||
for o in objs:
|
||||
view = component.queryMultiAdapter((o, request), name='index.html')
|
||||
#if view is None:
|
||||
# view = component.queryMultiAdapter((o, request), IBrowserView)
|
||||
if view is None:
|
||||
view = BaseView(o, request)
|
||||
yield view
|
||||
|
|
|
@ -208,6 +208,14 @@
|
|||
menu="zmi_views" title="View"
|
||||
/>
|
||||
|
||||
<page
|
||||
name="index.html"
|
||||
for="loops.interfaces.IConcept"
|
||||
class=".concept.ConceptView"
|
||||
template="concept.pt"
|
||||
permission="zope.View"
|
||||
/>
|
||||
|
||||
<defaultView
|
||||
for="loops.interfaces.IConcept"
|
||||
name="concept.html"
|
||||
|
|
|
@ -210,6 +210,8 @@ class ResourceRelationView(ResourceView, ConceptRelationView):
|
|||
def __init__(self, relation, request, contextIsSecond=False):
|
||||
ConceptRelationView.__init__(self, relation, request, contextIsSecond)
|
||||
|
||||
getActions = ResourceView.getActions
|
||||
|
||||
|
||||
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
||||
|
||||
|
|
|
@ -371,6 +371,7 @@ class ChildRelationSetProperty(RelationSetProperty):
|
|||
|
||||
|
||||
class ParentRelation(object):
|
||||
# TODO: provide special method for supplying relevance and order
|
||||
|
||||
def __init__(self, predicateName):
|
||||
self.predicateName = predicateName
|
||||
|
@ -388,7 +389,7 @@ class ParentRelation(object):
|
|||
if current != value:
|
||||
s.remove(current)
|
||||
if value is not None:
|
||||
s.add(value)
|
||||
s.add(value) # how to supply additional parameters?
|
||||
|
||||
|
||||
# caching (TBD)
|
||||
|
|
|
@ -33,7 +33,8 @@ from cybertools.meta.config import GlobalOptions as BaseGlobalOptions
|
|||
from cybertools.meta.interfaces import IOptions
|
||||
from cybertools.meta.namespace import Executor, ExecutionError
|
||||
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
|
||||
|
||||
|
||||
|
@ -46,7 +47,7 @@ class GlobalOptions(BaseGlobalOptions):
|
|||
|
||||
class LoopsOptions(Options):
|
||||
|
||||
adapts(ILoops)
|
||||
adapts(ILoopsObject)
|
||||
|
||||
builtins = Options.builtins + ('True', 'False')
|
||||
True, False = True, False
|
||||
|
@ -86,3 +87,9 @@ class LoopsOptions(Options):
|
|||
rc = Executor(self).execute(code)
|
||||
if rc:
|
||||
raise ExecutionError('\n' + rc)
|
||||
|
||||
|
||||
class QueryOptions(LoopsOptions):
|
||||
|
||||
adapts(IQueryConcept)
|
||||
|
||||
|
|
|
@ -12,4 +12,9 @@
|
|||
<allow interface="cybertools.meta.interfaces.IOptions" />
|
||||
</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>
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: $Id$\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"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -374,3 +374,6 @@ msgstr "Ende"
|
|||
msgid "Create loops Note"
|
||||
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
|
||||
>>> listing = Events(johnC, TestRequest())
|
||||
>>> events = addAndConfigureObject(concepts, Concept, 'events', title=u'Events',
|
||||
... conceptType=concepts['query'])
|
||||
>>> listing = Events(events, TestRequest())
|
||||
>>> listing.getActions('portlet')
|
||||
[<loops.browser.action.DialogAction ...>]
|
||||
|
||||
>>> from loops.config.base import QueryOptions
|
||||
>>> component.provideAdapter(QueryOptions)
|
||||
|
||||
>>> list(listing.events())
|
||||
[<loops.browser.concept.ConceptRelationView ...>]
|
||||
|
||||
|
|
|
@ -22,11 +22,12 @@ Definition of view classes and other browser related stuff for tasks.
|
|||
$Id$
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from zope import interface, component
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
|
||||
from cybertools.meta.interfaces import IOptions
|
||||
from loops.browser.action import DialogAction
|
||||
from loops.browser.concept import ConceptView
|
||||
from loops.common import adapted
|
||||
|
@ -62,10 +63,13 @@ class Events(ConceptView):
|
|||
tEvent = cm['event']
|
||||
hasType = cm.getTypePredicate()
|
||||
now = datetime.today()
|
||||
delta = int(self.request.get('delta',
|
||||
IOptions(adapted(self.context))('delta', [0])[0]))
|
||||
sort = lambda x: x.adapted.start or now
|
||||
relViews = (self.childViewFactory(r, self.request, contextIsSecond=True)
|
||||
for r in tEvent.getChildRelations([hasType], sort=None))
|
||||
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)
|
||||
|
||||
|
|
|
@ -51,8 +51,9 @@ class StateAction(Action):
|
|||
|
||||
@Lazy
|
||||
def description(self):
|
||||
return (u'State information for %s: %s' %
|
||||
(self.definition, self.stateObject.title))
|
||||
return _(u'State information for $definition: $title',
|
||||
mapping=dict(definition=self.definition,
|
||||
title=self.stateObject.title))
|
||||
|
||||
@Lazy
|
||||
def stateObject(self):
|
||||
|
|
|
@ -21,21 +21,25 @@
|
|||
tal:content="deftype"
|
||||
i18n:translate="" />
|
||||
</td>
|
||||
<td tal:content="def/name"
|
||||
<td valign="top"
|
||||
tal:content="def/name"
|
||||
i18n:translate=""></td>
|
||||
<td>
|
||||
<tal:state repeat="state def/states">
|
||||
<input type="checkbox"
|
||||
tal:define="name string:state.$deftype.${def/name};
|
||||
value state/name"
|
||||
tal:attributes="name string:$name:list;
|
||||
value value;
|
||||
checked python:
|
||||
value in item.selectedStates.get(name, ())"
|
||||
/><span tal:content="state/title"
|
||||
i18n:translate="" />
|
||||
|
||||
</tal:state>
|
||||
<tal:states repeat="state def/states">
|
||||
<tal:state define="name string:state.$deftype.${def/name};
|
||||
value state/name">
|
||||
<input type="checkbox"
|
||||
tal:attributes="name string:$name:list;
|
||||
value value;
|
||||
checked python:
|
||||
value in item.selectedStates.get(name, ());
|
||||
id string:$name.$value"
|
||||
/> <label tal:content="state/title"
|
||||
i18n:translate=""
|
||||
tal:attributes="for string:$name.$value" />
|
||||
|
||||
</tal:state>
|
||||
</tal:states>
|
||||
</td>
|
||||
</tr>
|
||||
</tal:def>
|
||||
|
|
|
@ -266,7 +266,7 @@
|
|||
url="listConceptsForComboBox.js?searchType=" >
|
||||
</div>
|
||||
<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"
|
||||
tal:attributes="name string:$namePrefix.text;
|
||||
id string:$idPrefix.text" />
|
||||
|
|
Loading…
Add table
Reference in a new issue