484 # important because `vocabfunc` might return a list with |
484 # important because `vocabfunc` might return a list with |
485 # couples (label, None) which act as separators. In these |
485 # couples (label, None) which act as separators. In these |
486 # cases, it doesn't make sense to sort results afterwards. |
486 # cases, it doesn't make sense to sort results afterwards. |
487 return vocabfunc(rtype, limit) |
487 return vocabfunc(rtype, limit) |
488 |
488 |
|
489 # XXX should be on the field, no? |
489 def subject_relation_vocabulary(self, rtype, limit=None): |
490 def subject_relation_vocabulary(self, rtype, limit=None): |
490 """defaut vocabulary method for the given relation, looking for |
491 """defaut vocabulary method for the given relation, looking for |
491 relation's object entities (i.e. self is the subject) |
492 relation's object entities (i.e. self is the subject) |
492 """ |
493 """ |
493 entity = self.edited_entity |
494 entity = self.edited_entity |
527 rsetsize, done) |
528 rsetsize, done) |
528 if limit is not None and len(result) >= limit: |
529 if limit is not None and len(result) >= limit: |
529 break |
530 break |
530 return result |
531 return result |
531 |
532 |
532 # def subject_in_state_vocabulary(self, rtype, limit=None): |
|
533 # """vocabulary method for the in_state relation, looking for relation's |
|
534 # object entities (i.e. self is the subject) according to initial_state, |
|
535 # state_of and next_state relation |
|
536 # """ |
|
537 # entity = self.edited_entity |
|
538 # if not entity.has_eid() or not entity.in_state: |
|
539 # # get the initial state |
|
540 # rql = 'Any S where S state_of ET, ET name %(etype)s, ET initial_state S' |
|
541 # rset = self.req.execute(rql, {'etype': str(entity.e_schema)}) |
|
542 # if rset: |
|
543 # return [(rset.get_entity(0, 0).view('combobox'), rset[0][0])] |
|
544 # return [] |
|
545 # results = [] |
|
546 # for tr in entity.in_state[0].transitions(entity): |
|
547 # state = tr.destination_state[0] |
|
548 # results.append((state.view('combobox'), state.eid)) |
|
549 # return sorted(results) |
|
550 |
|
551 def srelations_by_category(self, categories=None, permission=None): |
533 def srelations_by_category(self, categories=None, permission=None): |
552 return () |
534 return () |
553 |
535 |
554 def should_display_add_new_relation_link(self, rschema, existant, card): |
536 def should_display_add_new_relation_link(self, rschema, existant, card): |
555 return False |
537 return False |