added missing view.py
This commit is contained in:
parent
e12a479aa6
commit
c89e9dcec5
|
@ -87,8 +87,6 @@ TODO
|
|||
|
||||
- terminer la vue pour les kws
|
||||
- equivalences sous forme de liste
|
||||
- virer les doublons dans les RT
|
||||
- afficher les enfants
|
||||
- affiner la feuille de style
|
||||
|
||||
- vocabulaire pour autocomplete
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
from zope.component import getUtility
|
||||
|
||||
from zope.app.intid.interfaces import IIntIds
|
||||
|
||||
from zc.relation.interfaces import ICatalog
|
||||
|
||||
from plone.dexterity.browser.view import DefaultView
|
||||
|
||||
#from plone.dexterity.interfaces import IDexterityFTI
|
||||
#from plone.dexterity.utils import getAdditionalSchemata
|
||||
|
||||
|
||||
class DmsKeywordView(DefaultView):
|
||||
"""The default view for DMSKeyword.
|
||||
"""
|
||||
|
||||
@property
|
||||
def children(self):
|
||||
intids = getUtility(IIntIds)
|
||||
catalog = getUtility(ICatalog)
|
||||
value = []
|
||||
try:
|
||||
doc_intid = intids.getId(self.context)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
for ref in catalog.findRelations(
|
||||
{'to_id': doc_intid, 'from_attribute': 'broader'}):
|
||||
tp = (ref.from_path, ref.from_object.Title())
|
||||
if tp not in value:
|
||||
value.append(tp)
|
||||
return value
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<include package=".browser" />
|
||||
|
||||
<adapter factory=".relatedkeywords.RelatedThesaurusKeywordsFieldWidget" />
|
||||
<adapter factory=".equivalences.ThesaurusKeywordEquivalencesFieldWidget" />
|
||||
|
||||
<genericsetup:registerProfile
|
||||
name="default"
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<ul id="" class=""
|
||||
tal:attributes="id view/id;
|
||||
class view/klass;
|
||||
style view/style;
|
||||
title view/title;
|
||||
lang view/lang;
|
||||
onclick view/onclick;
|
||||
ondblclick view/ondblclick;
|
||||
onmousedown view/onmousedown;
|
||||
onmouseup view/onmouseup;
|
||||
onmouseover view/onmouseover;
|
||||
onmousemove view/onmousemove;
|
||||
onmouseout view/onmouseout;
|
||||
onkeypress view/onkeypress;
|
||||
onkeydown view/onkeydown;
|
||||
onkeyup view/onkeyup"><tal:block
|
||||
tal:repeat="value view/terms"
|
||||
><li class=""
|
||||
tal:content="value"
|
||||
/><tal:block condition="not:repeat/value/end">, </tal:block
|
||||
></tal:block
|
||||
></ul>
|
Reference in New Issue