equal
deleted
inserted
replaced
54 accepts = ('Any',) |
54 accepts = ('Any',) |
55 context = 'navcontentbottom' # 'footer' | 'header' | 'incontext' |
55 context = 'navcontentbottom' # 'footer' | 'header' | 'incontext' |
56 condition = None |
56 condition = None |
57 |
57 |
58 def call(self, view): |
58 def call(self, view): |
59 raise RuntimeError() |
59 return self.cell_call(0, 0, view) |
|
60 |
|
61 def cell_call(self, row, col, view): |
|
62 raise NotImplementedError() |
60 |
63 |
61 |
64 |
62 class NavigationComponent(VComponent): |
65 class NavigationComponent(VComponent): |
63 """abstract base class for navigation components""" |
66 """abstract base class for navigation components""" |
64 __selectors__ = (paginated_rset,) |
67 __selectors__ = (paginated_rset,) |
143 def rql(self): |
146 def rql(self): |
144 """override this method if you want to use a custom rql query. |
147 """override this method if you want to use a custom rql query. |
145 """ |
148 """ |
146 return None |
149 return None |
147 |
150 |
148 def call(self, view=None): |
151 def cell_call(self, row, col, view=None): |
149 rql = self.rql() |
152 rql = self.rql() |
150 if rql is None: |
153 if rql is None: |
151 entity = self.rset.get_entity(0, 0) |
154 entity = self.rset.get_entity(row, col) |
152 if self.target == 'object': |
155 if self.target == 'object': |
153 role = 'subject' |
156 role = 'subject' |
154 else: |
157 else: |
155 role = 'object' |
158 role = 'object' |
156 rset = entity.related(self.rtype, role) |
159 rset = entity.related(self.rtype, role) |
157 else: |
160 else: |
158 eid = self.rset[0][0] |
161 eid = self.rset[row][col] |
159 rset = self.req.execute(self.rql(), {'x': eid}, 'x') |
162 rset = self.req.execute(self.rql(), {'x': eid}, 'x') |
160 if not rset.rowcount: |
163 if not rset.rowcount: |
161 return |
164 return |
162 self.w(u'<div class="%s">' % self.div_class()) |
165 self.w(u'<div class="%s">' % self.div_class()) |
163 self.wview(self.vid, rset, title=self.req._(self.title).capitalize()) |
166 self.wview(self.vid, rset, title=self.req._(self.title).capitalize()) |