view.py
changeset 6039 6e84db1b3e44
parent 5725 b5d595b66c35
child 6047 ee6deb534f57
equal deleted inserted replaced
6033:09db6f4619c9 6039:6e84db1b3e44
   317                     clabel = u'#[*] (%s)' % vtitle
   317                     clabel = u'#[*] (%s)' % vtitle
   318         else:
   318         else:
   319             clabel = vtitle
   319             clabel = vtitle
   320         return u'%s (%s)' % (clabel, self._cw.property_value('ui.site-title'))
   320         return u'%s (%s)' % (clabel, self._cw.property_value('ui.site-title'))
   321 
   321 
   322     def output_url_builder( self, name, url, args ):
   322     @deprecated('[3.10] use vreg["etypes"].etype_class(etype).cw_create_url(req)')
   323         self.w(u'<script language="JavaScript"><!--\n' \
       
   324                u'function %s( %s ) {\n' % (name, ','.join(args) ) )
       
   325         url_parts = url.split("%s")
       
   326         self.w(u' url="%s"' % url_parts[0] )
       
   327         for arg, part in zip(args, url_parts[1:]):
       
   328             self.w(u'+str(%s)' % arg )
       
   329             if part:
       
   330                 self.w(u'+"%s"' % part)
       
   331         self.w('\n document.window.href=url;\n')
       
   332         self.w('}\n-->\n</script>\n')
       
   333 
       
   334     def create_url(self, etype, **kwargs):
   323     def create_url(self, etype, **kwargs):
   335         """ return the url of the entity creation form for a given entity type"""
   324         """ return the url of the entity creation form for a given entity type"""
   336         return self._cw.build_url('add/%s' % etype, **kwargs)
   325         return self._cw.vreg["etypes"].etype_class(etype).cw_create_url(
       
   326             self._cw, **kwargs)
   337 
   327 
   338     def field(self, label, value, row=True, show_label=True, w=None, tr=True, table=False):
   328     def field(self, label, value, row=True, show_label=True, w=None, tr=True, table=False):
   339         """read-only field"""
   329         """read-only field"""
   340         if w is None:
   330         if w is None:
   341             w = self.w
   331             w = self.w