equivs now have a dedicated widget that behaves the same way as the one for listing keywords
This commit is contained in:
parent
5211383de2
commit
d3ce8eb40b
|
@ -97,3 +97,10 @@ TODO
|
|||
cf vocab pour les contacts
|
||||
+ exploiter ce vocab dans une vue pour le thesaurus
|
||||
|
||||
questions pour demain
|
||||
----------------------
|
||||
|
||||
- tiens, le package mailcontent n'apparait plus dans le portal_setup
|
||||
- on vire le champ description d'un kw ?
|
||||
- comment je change le widget pour les equivs, c'est zarbi le truc
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
from zope.interface import implements, implementer
|
||||
from zope.component import adapter, getUtility
|
||||
from zope.app.intid.interfaces import IIntIds
|
||||
|
||||
from zc.relation.interfaces import ICatalog
|
||||
|
||||
from z3c.form.interfaces import IFormLayer, IFieldWidget
|
||||
from z3c.form.widget import FieldWidget
|
||||
from z3c.relationfield.interfaces import IRelationList
|
||||
from z3c.relationfield.schema import RelationChoice, RelationList
|
||||
|
||||
from plone.formwidget.contenttree.widget import MultiContentTreeWidget
|
||||
from plone.formwidget.contenttree.utils import closest_content
|
||||
|
||||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
|
||||
|
||||
from .relatedkeywords import RelatedThesaurusKeywords
|
||||
from .relatedkeywords import RelatedThesaurusKeywordsWidget
|
||||
from .relatedkeywords import ThesaurusPathSourceBinder
|
||||
|
||||
class IBroaderThesaurusKeywords(IRelationList):
|
||||
""""""
|
||||
|
||||
|
||||
@adapter(IBroaderThesaurusKeywords, IFormLayer)
|
||||
@implementer(IFieldWidget)
|
||||
def BroaderThesaurusKeywordsFieldWidget(field, request):
|
||||
return FieldWidget(field, RelatedThesaurusKeywordsWidget(
|
||||
request, from_attribute='broader'))
|
||||
|
||||
class BroaderThesaurusKeywords(RelatedThesaurusKeywords):
|
||||
implements(IBroaderThesaurusKeywords)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
RelationList.__init__(self,
|
||||
value_type=RelationChoice(
|
||||
title=u'',
|
||||
source=ThesaurusPathSourceBinder()),
|
||||
**kwargs)
|
||||
|
|
@ -52,6 +52,7 @@
|
|||
<div class="field" id="dmskeywords-navigation-narrower">
|
||||
<label tal:content="string:NT (Narrower Terms)" />
|
||||
<br />
|
||||
<tal:list condition="view/children">
|
||||
<ul id="" class=""
|
||||
tal:attributes="id string:form-widgets-children;
|
||||
class string:contenttree-widget narrowerthesauruskeywords-field;
|
||||
|
@ -61,7 +62,8 @@
|
|||
tal:content="value/label"
|
||||
tal:attributes="href value/url"
|
||||
/></li
|
||||
></ul>
|
||||
></ul></tal:list>
|
||||
<em tal:condition="not:view/children">(nothing)</em>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
<include package="." />
|
||||
<include package=".browser" />
|
||||
|
||||
<include file="widgets.zcml" />
|
||||
|
||||
<adapter factory=".relatedkeywords.RelatedThesaurusKeywordsFieldWidget" />
|
||||
<adapter factory=".broaderkeywords.BroaderThesaurusKeywordsFieldWidget" />
|
||||
<adapter factory=".equivalences.ThesaurusKeywordEquivalencesFieldWidget" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<ul id="" class=""
|
||||
tal:condition="view/dictvalues"
|
||||
tal:attributes="id view/id;
|
||||
class view/klass;
|
||||
style view/style;
|
||||
|
@ -21,3 +22,4 @@
|
|||
tal:attributes="href value/url"
|
||||
/></li
|
||||
></ul>
|
||||
<em tal:condition="not:view/dictvalues">(nothing)</em>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<span id="" class=""
|
||||
<ul id="" class=""
|
||||
tal:condition="view/terms"
|
||||
tal:attributes="id view/id;
|
||||
class view/klass;
|
||||
style view/style;
|
||||
|
@ -13,9 +14,10 @@
|
|||
onmouseout view/onmouseout;
|
||||
onkeypress view/onkeypress;
|
||||
onkeydown view/onkeydown;
|
||||
onkeyup view/onkeyup"><ul><tal:block
|
||||
onkeyup view/onkeyup"><li
|
||||
tal:repeat="value view/terms"
|
||||
><span class=""
|
||||
tal:content="value" /></tal:block
|
||||
></tal:block
|
||||
></ul></span>
|
||||
><span class=""
|
||||
tal:content="value" />
|
||||
</li
|
||||
></ul>
|
||||
<em tal:condition="not:view/terms">(nothing)</em>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<configure
|
||||
xmlns="http://namespaces.zope.org/zope"
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
xmlns:z3c="http://namespaces.zope.org/z3c">
|
||||
|
||||
<z3c:widgetTemplate
|
||||
mode="display"
|
||||
widget=".equivalences.ThesaurusKeywordEquivalencesWidget"
|
||||
layer="z3c.form.interfaces.IFormLayer"
|
||||
template="thesaurus-keyword-equivs-display.pt"
|
||||
/>
|
||||
|
||||
</configure>
|
Reference in New Issue