web/views/editforms.py
branchstable
changeset 3327 44efba78afac
parent 3078 186ccbe0ba3f
child 3331 8e63b72287b1
--- a/web/views/editforms.py	Fri Sep 18 19:47:07 2009 +0200
+++ b/web/views/editforms.py	Fri Sep 18 19:48:58 2009 +0200
@@ -454,7 +454,7 @@
         for i in xrange(len(rset)):
             self.wview(self.id, rset, row=i, **kwargs)
 
-    def cell_call(self, row, col, peid, rtype, role='subject', **kwargs):
+    def cell_call(self, row, col, peid, rtype, role, i18nctx, **kwargs):
         """
         :param peid: the parent entity's eid hosting the inline form
         :param rtype: the relation bridging `etype` and `peid`
@@ -463,23 +463,25 @@
         entity = self.entity(row, col)
         divonclick = "restoreInlinedEntity('%s', '%s', '%s')" % (peid, rtype,
                                                                  entity.eid)
-        self.render_form(entity, peid, rtype, role, divonclick=divonclick)
+        self.render_form(entity, peid, rtype, role, i18nctx,
+                         divonclick=divonclick)
 
-    def render_form(self, entity, peid, rtype, role, **kwargs):
+    def render_form(self, entity, peid, rtype, role, i18nctx, **kwargs):
         """fetch and render the form"""
         form = self.vreg['forms'].select('edition', self.req, entity=entity,
                                          form_renderer_id='inline',
                                          mainform=False, copy_nav_params=False)
         self.add_hiddens(form, entity, peid, rtype, role)
         divid = '%s-%s-%s' % (peid, rtype, entity.eid)
-        title = self.schema.rschema(rtype).display_name(self.req, role)
-        removejs = self.removejs % (peid, rtype,entity.eid)
+        title = self.req.pgettext(i18nctx, 'This %s' % entity.e_schema)
+        removejs = self.removejs % (peid, rtype, entity.eid)
         countkey = '%s_count' % rtype
         try:
             self.req.data[countkey] += 1
         except:
             self.req.data[countkey] = 1
         self.w(form.form_render(divid=divid, title=title, removejs=removejs,
+                                i18nctx=i18nctx,
                                 counter=self.req.data[countkey], **kwargs))
 
     def add_hiddens(self, form, entity, peid, rtype, role):
@@ -511,7 +513,7 @@
                   & specified_etype_implements('Any'))
     removejs = "removeInlineForm('%s', '%s', '%s')"
 
-    def call(self, etype, peid, rtype, role='subject', **kwargs):
+    def call(self, etype, peid, rtype, role, i18nctx, **kwargs):
         """
         :param etype: the entity type being created in the inline form
         :param peid: the parent entity's eid hosting the inline form
@@ -525,4 +527,4 @@
             return
         self.initialize_varmaker()
         entity.eid = self.varmaker.next()
-        self.render_form(entity, peid, rtype, role)
+        self.render_form(entity, peid, rtype, role, i18nctx)