work in progress: state queries
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2584 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
a22d020e6b
commit
b26f322a3b
4 changed files with 45 additions and 2 deletions
|
@ -23,10 +23,15 @@ $Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.browser.action import Action, actions
|
from cybertools.browser.action import Action, actions
|
||||||
from cybertools.stateful.interfaces import IStateful
|
from cybertools.stateful.interfaces import IStateful
|
||||||
|
from loops.browser.common import BaseView
|
||||||
|
from loops.browser.concept import ConceptView
|
||||||
|
from loops.expert import query
|
||||||
|
from loops.search.browser import template as search_template
|
||||||
from loops.util import _
|
from loops.util import _
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,3 +69,24 @@ for std in statefulActions:
|
||||||
definition = std,
|
definition = std,
|
||||||
cssClass='icon-action',
|
cssClass='icon-action',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#class StateQuery(ConceptView):
|
||||||
|
class StateQuery(BaseView):
|
||||||
|
|
||||||
|
template = ViewPageTemplateFile('view_macros.pt')
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def search_macros(self):
|
||||||
|
return search_template.macros
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def macro(self):
|
||||||
|
return self.template.macros['query']
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def results(self):
|
||||||
|
uids = query.State('loops.classification_quality',
|
||||||
|
#['new', 'unclassified', 'classified']).apply()
|
||||||
|
['new', 'unclassified']).apply()
|
||||||
|
return self.viewIterator(query.getObjects(uids, self.loopsRoot))
|
||||||
|
|
|
@ -42,6 +42,14 @@
|
||||||
set_schema="cybertools.stateful.interfaces.IStateful" />
|
set_schema="cybertools.stateful.interfaces.IStateful" />
|
||||||
</zope:class>
|
</zope:class>
|
||||||
|
|
||||||
|
<!-- views -->
|
||||||
|
|
||||||
|
<browser:page
|
||||||
|
for="loops.interfaces.IConcept"
|
||||||
|
name="select_state.html"
|
||||||
|
class="loops.organize.stateful.browser.StateQuery"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
<!-- event handlers -->
|
<!-- event handlers -->
|
||||||
|
|
||||||
<zope:subscriber handler="loops.organize.stateful.base.handleTransition" />
|
<zope:subscriber handler="loops.organize.stateful.base.handleTransition" />
|
||||||
|
|
6
organize/stateful/view_macros.pt
Normal file
6
organize/stateful/view_macros.pt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
|
||||||
|
<metal:query define-macro="query">
|
||||||
|
<metal:results use-macro="item/search_macros/results" />
|
||||||
|
</metal:query>
|
|
@ -43,9 +43,11 @@
|
||||||
|
|
||||||
<div metal:define-macro="search_results" id="1.search.results"
|
<div metal:define-macro="search_results" id="1.search.results"
|
||||||
tal:attributes="id resultsId | request/search.resultsId"
|
tal:attributes="id resultsId | request/search.resultsId"
|
||||||
i18n:domain="loops">
|
i18n:domain="loops"
|
||||||
|
tal:define="item nocall:view">
|
||||||
<fieldset class="box"
|
<fieldset class="box"
|
||||||
tal:condition="request/search.submitted | nothing">
|
tal:condition="request/search.submitted | nothing">
|
||||||
|
<metal:results define-macro="results">
|
||||||
<h2 i18n:translate="">Search results</h2>
|
<h2 i18n:translate="">Search results</h2>
|
||||||
<table class="listing" summary="Search results"
|
<table class="listing" summary="Search results"
|
||||||
i18n:attributes="summary">
|
i18n:attributes="summary">
|
||||||
|
@ -61,7 +63,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tal:items tal:repeat="row view/results">
|
<tal:items tal:repeat="row item/results">
|
||||||
<tal:item define="class python: repeat['row'].odd() and 'even' or 'odd';
|
<tal:item define="class python: repeat['row'].odd() and 'even' or 'odd';
|
||||||
description row/description">
|
description row/description">
|
||||||
<tr tal:attributes="class class">
|
<tr tal:attributes="class class">
|
||||||
|
@ -91,6 +93,7 @@
|
||||||
</tal:items>
|
</tal:items>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</metal:results>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue