view.py
branchstable
changeset 3809 1b9b51ee543e
parent 3782 c69fe7493b91
child 3839 84c9aab84d8c
equal deleted inserted replaced
3808:60e78e93a0e5 3809:1b9b51ee543e
   291                 self.w(u'+"%s"' % part)
   291                 self.w(u'+"%s"' % part)
   292         self.w('\n document.window.href=url;\n')
   292         self.w('\n document.window.href=url;\n')
   293         self.w('}\n-->\n</script>\n')
   293         self.w('}\n-->\n</script>\n')
   294 
   294 
   295     def create_url(self, etype, **kwargs):
   295     def create_url(self, etype, **kwargs):
   296         """ return the url of the entity creation form for a given entity type"""
   296         """return the url of the entity creation form for a given entity type"""
   297         return self.req.build_url('add/%s'%etype, **kwargs)
   297         return self.req.build_url('add/%s' % etype, **kwargs)
   298 
   298 
   299     def field(self, label, value, row=True, show_label=True, w=None, tr=True):
   299     def field(self, label, value, row=True, show_label=True, w=None, tr=True, table=False):
   300         """ read-only field """
   300         """read-only field"""
   301         if w is None:
   301         if w is None:
   302             w = self.w
   302             w = self.w
   303         if row:
   303         if table:
   304             w(u'<div class="row">')
   304             w(u'<tr class="entityfield">')
       
   305         else:
       
   306             w(u'<div class="entityfield">')
   305         if show_label and label:
   307         if show_label and label:
   306             if tr:
   308             if tr:
   307                 label = display_name(self.req, label)
   309                 label = display_name(self.req, label)
   308             w(u'<span class="label">%s</span>' % label)
   310             if table:
   309         w(u'<div class="field">%s</div>' % value)
   311                 w(u'<th>%s</th>' % label)
   310         if row:
   312             else:
   311             w(u'</div>')
   313                 w(u'<span>%s</span>' % label)
       
   314         if table:
       
   315             w(u'<td>%s</td></tr>' % value)
       
   316         else:
       
   317             w(u'<span>%s</span></div>' % value)
   312 
   318 
   313 
   319 
   314 
   320 
   315 # concrete views base classes #################################################
   321 # concrete views base classes #################################################
   316 
   322