294 card= rdef.role_cardinality(self.role) |
294 card= rdef.role_cardinality(self.role) |
295 # when one is adding an inline entity for a relation of a single card, |
295 # when one is adding an inline entity for a relation of a single card, |
296 # the 'add a new xxx' link disappears. If the user then cancel the addition, |
296 # the 'add a new xxx' link disappears. If the user then cancel the addition, |
297 # we have to make this link appears back. This is done by giving add new link |
297 # we have to make this link appears back. This is done by giving add new link |
298 # id to removeInlineForm. |
298 # id to removeInlineForm. |
299 if card not in '?1': |
299 if card == '?': |
|
300 divid = "addNew%s%s%s:%s" % (self.etype, self.rtype, self.role, self.peid) |
|
301 return "removeInlineForm('%%s', '%%s', '%s', '%%s', '%s')" % ( |
|
302 self.role, divid) |
|
303 elif card in '+*': |
300 return "removeInlineForm('%%s', '%%s', '%s', '%%s')" % self.role |
304 return "removeInlineForm('%%s', '%%s', '%s', '%%s')" % self.role |
301 divid = "addNew%s%s%s:%s" % ( |
305 # don't do anything for card == '1' |
302 self.etype, self.rtype, self.role, self.peid) |
|
303 return "removeInlineForm('%%s', '%%s', '%s', '%%s', '%s')" % ( |
|
304 self.role, divid) |
|
305 |
306 |
306 @cached |
307 @cached |
307 def _entity(self): |
308 def _entity(self): |
308 try: |
309 try: |
309 cls = self._cw.vreg['etypes'].etype_class(self.etype) |
310 cls = self._cw.vreg['etypes'].etype_class(self.etype) |