web/views/editviews.py
changeset 3377 dd9d292b6a6d
parent 3293 69c0ba095536
child 3451 6b46d73823f5
equal deleted inserted replaced
3376:f5c69485381f 3377:dd9d292b6a6d
    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     """
    30     id = 'search-associate'
    30     __regid__ = 'search-associate'
    31     __select__ = (one_line_rset() & match_search_state('linksearch')
    31     __select__ = (one_line_rset() & match_search_state('linksearch')
    32                   & non_final_entity())
    32                   & non_final_entity())
    33 
    33 
    34     title = _('search for association')
    34     title = _('search for association')
    35 
    35 
    56         rset = self.req.execute(rql, args, tuple(args))
    56         rset = self.req.execute(rql, args, tuple(args))
    57         return rset, 'list', "search-associate-content", True
    57         return rset, 'list', "search-associate-content", True
    58 
    58 
    59 
    59 
    60 class OutOfContextSearch(EntityView):
    60 class OutOfContextSearch(EntityView):
    61     id = 'outofcontext-search'
    61     __regid__ = 'outofcontext-search'
    62     def cell_call(self, row, col):
    62     def cell_call(self, row, col):
    63         entity = self.rset.get_entity(row, col)
    63         entity = self.rset.get_entity(row, col)
    64         erset = entity.as_rset()
    64         erset = entity.as_rset()
    65         if self.req.match_search_state(erset):
    65         if self.req.match_search_state(erset):
    66             self.w(u'<a href="%s" title="%s">%s</a>&#160;<a href="%s" title="%s">[...]</a>' % (
    66             self.w(u'<a href="%s" title="%s">%s</a>&#160;<a href="%s" title="%s">[...]</a>' % (
    72         else:
    72         else:
    73             entity.view('outofcontext', w=self.w)
    73             entity.view('outofcontext', w=self.w)
    74 
    74 
    75 
    75 
    76 class UnrelatedDivs(EntityView):
    76 class UnrelatedDivs(EntityView):
    77     id = 'unrelateddivs'
    77     __regid__ = 'unrelateddivs'
    78     __select__ = match_form_params('relation')
    78     __select__ = match_form_params('relation')
    79 
    79 
    80     def cell_call(self, row, col):
    80     def cell_call(self, row, col):
    81         entity = self.rset.get_entity(row, col)
    81         entity = self.rset.get_entity(row, col)
    82         relname, target = self.req.form.get('relation').rsplit('_', 1)
    82         relname, target = self.req.form.get('relation').rsplit('_', 1)
   182 class ComboboxView(EntityView):
   182 class ComboboxView(EntityView):
   183     """the view used in combobox (unrelated entities)
   183     """the view used in combobox (unrelated entities)
   184 
   184 
   185     THIS IS A TEXT VIEW. DO NOT HTML_ESCAPE
   185     THIS IS A TEXT VIEW. DO NOT HTML_ESCAPE
   186     """
   186     """
   187     id = 'combobox'
   187     __regid__ = 'combobox'
   188     title = None
   188     title = None
   189 
   189 
   190     def cell_call(self, row, col):
   190     def cell_call(self, row, col):
   191         """the combo-box view for an entity: same as text out of context view
   191         """the combo-box view for an entity: same as text out of context view
   192         by default
   192         by default
   194         self.wview('textoutofcontext', self.rset, row=row, col=col)
   194         self.wview('textoutofcontext', self.rset, row=row, col=col)
   195 
   195 
   196 
   196 
   197 class EditableFinalView(FinalView):
   197 class EditableFinalView(FinalView):
   198     """same as FinalView but enables inplace-edition when possible"""
   198     """same as FinalView but enables inplace-edition when possible"""
   199     id = 'editable-final'
   199     __regid__ = 'editable-final'
   200 
   200 
   201     def cell_call(self, row, col, props=None):
   201     def cell_call(self, row, col, props=None):
   202         entity, rtype = self.rset.related_entity(row, col)
   202         entity, rtype = self.rset.related_entity(row, col)
   203         if entity is not None:
   203         if entity is not None:
   204             self.w(entity.view('reledit', rtype=rtype))
   204             self.w(entity.view('reledit', rtype=rtype))