32 |
32 |
33 title = _('search for association') |
33 title = _('search for association') |
34 |
34 |
35 def cell_call(self, row, col): |
35 def cell_call(self, row, col): |
36 rset, vid, divid, paginate = self.filter_box_context_info() |
36 rset, vid, divid, paginate = self.filter_box_context_info() |
|
37 self.rset = rset |
37 self.w(u'<div id="%s">' % divid) |
38 self.w(u'<div id="%s">' % divid) |
38 self.pagination(self.req, rset, w=self.w) |
39 self.paginate(self.req, rset, w=self.w) |
39 self.wview(vid, rset, 'noresult') |
40 self.wview(vid, rset, 'noresult') |
40 self.w(u'</div>') |
41 self.w(u'</div>') |
41 |
42 |
42 @cached |
43 @cached |
43 def filter_box_context_info(self): |
44 def filter_box_context_info(self): |
112 <div class="%s" id="%s"> |
113 <div class="%s" id="%s"> |
113 <select id="%s" onchange="javascript: addPendingInsert(this.options[this.selectedIndex], %s, %s, '%s');"> |
114 <select id="%s" onchange="javascript: addPendingInsert(this.options[this.selectedIndex], %s, %s, '%s');"> |
114 %s |
115 %s |
115 </select> |
116 </select> |
116 </div> |
117 </div> |
117 """ % (hidden and 'hidden' or '', divid, selectid, html_escape(dumps(entity.eid)), |
118 """ % (hidden and 'hidden' or '', divid, selectid, |
118 is_cell and 'true' or 'null', relname, '\n'.join(options)) |
119 html_escape(dumps(entity.eid)), is_cell and 'true' or 'null', relname, |
|
120 '\n'.join(options)) |
119 |
121 |
120 def _get_select_options(self, entity, rschema, target): |
122 def _get_select_options(self, entity, rschema, target): |
121 """add options to search among all entities of each possible type""" |
123 """add options to search among all entities of each possible type""" |
122 options = [] |
124 options = [] |
123 eid = entity.eid |
125 eid = entity.eid |
124 pending_inserts = self.req.get_pending_inserts(eid) |
126 pending_inserts = self.req.get_pending_inserts(eid) |
125 rtype = rschema.type |
127 rtype = rschema.type |
126 for eview, reid in entity.vocabulary(rschema, target, self.limit): |
128 for eview, reid in entity.vocabulary(rschema, target, self.limit): |
127 if reid is None: |
129 if reid is None: |
128 options.append('<option class="separator">-- %s --</option>' % html_escape(eview)) |
130 options.append('<option class="separator">-- %s --</option>' |
|
131 % html_escape(eview)) |
129 else: |
132 else: |
130 optionid = relation_id(eid, rtype, target, reid) |
133 optionid = relation_id(eid, rtype, target, reid) |
131 if optionid not in pending_inserts: |
134 if optionid not in pending_inserts: |
132 # prefix option's id with letters to make valid XHTML wise |
135 # prefix option's id with letters to make valid XHTML wise |
133 options.append('<option id="id%s" value="%s">%s</option>' % |
136 options.append('<option id="id%s" value="%s">%s</option>' % |