added package knowledge.glossary
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2178 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
bee421bece
commit
9ad4c68809
7 changed files with 78 additions and 2 deletions
|
@ -82,7 +82,7 @@ and follow the classifier step by step.
|
||||||
extractor: filename
|
extractor: filename
|
||||||
|
|
||||||
>>> infoSet
|
>>> infoSet
|
||||||
{'filename': 'cust_im_contract_webbg_20071015.txt'}
|
{'filename': 'cust_im_contract_webbg_20071015'}
|
||||||
|
|
||||||
Let's now use the sample analyzer - an example that interprets very carefully
|
Let's now use the sample analyzer - an example that interprets very carefully
|
||||||
the underscore-separated parts of the filename.
|
the underscore-separated parts of the filename.
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Classifier(AdapterBase):
|
||||||
|
|
||||||
_contextAttributes = list(IClassifier) + list(IConcept)
|
_contextAttributes = list(IClassifier) + list(IConcept)
|
||||||
|
|
||||||
logLevel = 5
|
logLevel = 99 # 99 don't log; 5 minimal logging; 0 full logging
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def conceptManager(self):
|
def conceptManager(self):
|
||||||
|
|
|
@ -80,4 +80,8 @@
|
||||||
<zope:adapter factory="loops.knowledge.setup.SetupManager"
|
<zope:adapter factory="loops.knowledge.setup.SetupManager"
|
||||||
name="knowledge" />
|
name="knowledge" />
|
||||||
|
|
||||||
|
<!-- sub-packages -->
|
||||||
|
|
||||||
|
<include package=".glossary" />
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
4
knowledge/glossary/__init__.py
Executable file
4
knowledge/glossary/__init__.py
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
37
knowledge/glossary/browser.py
Executable file
37
knowledge/glossary/browser.py
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
"""
|
||||||
|
Demonstration view.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
|
|
||||||
|
from loops.browser import common
|
||||||
|
from loops.browser.concept import ConceptRelationView
|
||||||
|
from loops.common import adapted
|
||||||
|
from loops import util
|
||||||
|
|
||||||
|
|
||||||
|
template = ViewPageTemplateFile('view_macros.pt')
|
||||||
|
conceptMacrosTemplate = common.conceptMacrosTemplate
|
||||||
|
|
||||||
|
|
||||||
|
class GlossaryItemView(common.BaseView):
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def macro(self):
|
||||||
|
return template.macros['glossaryitem']
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def conceptMacros(self):
|
||||||
|
return conceptMacrosTemplate.macros
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def children(self):
|
||||||
|
rels = sorted(self.context.getChildRelations(),
|
||||||
|
key=(lambda x: x.second.title.lower()))
|
||||||
|
for r in rels:
|
||||||
|
yield ConceptRelationView(r, self.request, contextIsSecond=True)
|
||||||
|
|
14
knowledge/glossary/configure.zcml
Executable file
14
knowledge/glossary/configure.zcml
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<configure
|
||||||
|
xmlns:zope="http://namespaces.zope.org/zope"
|
||||||
|
xmlns="http://namespaces.zope.org/browser"
|
||||||
|
i18n_domain="zope"
|
||||||
|
>
|
||||||
|
|
||||||
|
<page for="*"
|
||||||
|
name="glossaryitem.html"
|
||||||
|
class=".browser.GlossaryItemView"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
|
</configure>
|
17
knowledge/glossary/view_macros.pt
Executable file
17
knowledge/glossary/view_macros.pt
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
<!-- ZPT macros for demo view -->
|
||||||
|
|
||||||
|
<metal:block define-macro="glossaryitem">
|
||||||
|
|
||||||
|
<metal:title use-macro="item/conceptMacros/concepttitle" />
|
||||||
|
|
||||||
|
<div>siehe:
|
||||||
|
<span tal:repeat="related item/children">
|
||||||
|
<a href="#"
|
||||||
|
tal:content="related/title"
|
||||||
|
tal:attributes="href string:${view/url}/.target${related/uniqueId}">
|
||||||
|
Topic
|
||||||
|
</a><tal:comma condition="not:repeat/related/end">,</tal:comma>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</metal:block>
|
Loading…
Add table
Reference in a new issue