equal
deleted
inserted
replaced
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
|
9 _ = unicode |
9 |
10 |
10 from simplejson import dumps |
11 from simplejson import dumps |
11 |
12 |
12 from logilab.common.decorators import cached |
13 from logilab.common.decorators import cached |
13 from logilab.mtconverter import html_escape |
14 from logilab.mtconverter import html_escape |
19 from cubicweb.common.uilib import cut |
20 from cubicweb.common.uilib import cut |
20 from cubicweb.web.views import linksearch_select_url |
21 from cubicweb.web.views import linksearch_select_url |
21 from cubicweb.web.views.editforms import relation_id |
22 from cubicweb.web.views.editforms import relation_id |
22 from cubicweb.web.views.baseviews import FinalView |
23 from cubicweb.web.views.baseviews import FinalView |
23 |
24 |
24 _ = unicode |
|
25 |
25 |
26 class SearchForAssociationView(EntityView): |
26 class SearchForAssociationView(EntityView): |
27 """view called by the edition view when the user asks to search for |
27 """view called by the edition view when the user asks to search for |
28 something to link to the edited eid |
28 something to link to the edited eid |
29 """ |
29 """ |
118 """add options to search among all entities of each possible type""" |
118 """add options to search among all entities of each possible type""" |
119 options = [] |
119 options = [] |
120 eid = entity.eid |
120 eid = entity.eid |
121 pending_inserts = self.req.get_pending_inserts(eid) |
121 pending_inserts = self.req.get_pending_inserts(eid) |
122 rtype = rschema.type |
122 rtype = rschema.type |
123 form = self.vreg.select_object('forms', 'edition', self.req, |
123 form = self.vreg.select('forms', 'edition', self.req, entity=entity) |
124 self.rset, entity=entity) |
|
125 field = form.field_by_name(rschema, target, entity.e_schema) |
124 field = form.field_by_name(rschema, target, entity.e_schema) |
126 limit = self.req.property_value('navigation.combobox-limit') |
125 limit = self.req.property_value('navigation.combobox-limit') |
127 for eview, reid in form.form_field_vocabulary(field, limit): |
126 for eview, reid in form.form_field_vocabulary(field, limit): |
128 if reid is None: |
127 if reid is None: |
129 options.append('<option class="separator">-- %s --</option>' |
128 options.append('<option class="separator">-- %s --</option>' |