web/component.py
brancholdstable
changeset 5993 50e1a6ad3e98
parent 5624 865c1779cc84
child 5715 2c3e83817a8e
equal deleted inserted replaced
5487:3ab2682a4b37 5993:50e1a6ad3e98
   128 
   128 
   129     def page_url(self, path, params, start, stop):
   129     def page_url(self, path, params, start, stop):
   130         params = dict(params)
   130         params = dict(params)
   131         params.update({self.start_param : start,
   131         params.update({self.start_param : start,
   132                        self.stop_param : stop,})
   132                        self.stop_param : stop,})
   133         if path == 'json':
   133         view = self.cw_extra_kwargs.get('view')
       
   134         if view is not None and hasattr(view, 'page_navigation_url'):
       
   135             url = view.page_navigation_url(self, path, params)
       
   136         elif path == 'json':
   134             rql = params.pop('rql', self.cw_rset.printable_rql())
   137             rql = params.pop('rql', self.cw_rset.printable_rql())
   135             # latest 'true' used for 'swap' mode
   138             # latest 'true' used for 'swap' mode
   136             url = 'javascript: replacePageChunk(%s, %s, %s, %s, true)' % (
   139             url = 'javascript: replacePageChunk(%s, %s, %s, %s, true)' % (
   137                 json.dumps(params.get('divid', 'paginated-content')),
   140                 json.dumps(params.get('divid', 'pageContent')),
   138                 json.dumps(rql), json.dumps(params.pop('vid', None)), json.dumps(params))
   141                 json.dumps(rql), json.dumps(params.pop('vid', None)), json.dumps(params))
   139         else:
   142         else:
   140             url = self._cw.build_url(path, **params)
   143             url = self._cw.build_url(path, **params)
   141         return url
   144         return url
   142 
   145 
   179         if rql is None:
   182         if rql is None:
   180             entity = self.cw_rset.get_entity(row, col)
   183             entity = self.cw_rset.get_entity(row, col)
   181             rset = entity.related(self.rtype, role(self))
   184             rset = entity.related(self.rtype, role(self))
   182         else:
   185         else:
   183             eid = self.cw_rset[row][col]
   186             eid = self.cw_rset[row][col]
   184             rset = self._cw.execute(self.rql(), {'x': eid}, 'x')
   187             rset = self._cw.execute(self.rql(), {'x': eid})
   185         if not rset.rowcount:
   188         if not rset.rowcount:
   186             return
   189             return
   187         self.w(u'<div class="%s">' % self.div_class())
   190         self.w(u'<div class="%s">' % self.div_class())
   188         self.w(u'<h4>%s</h4>\n' % self._cw._(self.title).capitalize())
   191         self.w(u'<h4>%s</h4>\n' % self._cw._(self.title).capitalize())
   189         self.wview(self.vid, rset)
   192         self.wview(self.vid, rset)