web/views/treeview.py
changeset 6140 65a619eb31c4
parent 6006 54cdc0164193
child 6582 8eb7883b4223
equal deleted inserted replaced
6139:f76599a96238 6140:65a619eb31c4
   108     """ajax tree view, click to expand folder"""
   108     """ajax tree view, click to expand folder"""
   109 
   109 
   110     __regid__ = 'treeview'
   110     __regid__ = 'treeview'
   111     itemvid = 'treeitemview'
   111     itemvid = 'treeitemview'
   112     subvid = 'oneline'
   112     subvid = 'oneline'
   113     css_classes = 'treeview widget'
   113     cssclass = 'treeview widget'
   114     title = _('tree view')
   114     title = _('tree view')
   115 
   115 
   116     def _init_params(self, subvid, treeid, initial_load, initial_thru_ajax, morekwargs):
   116     def _init_params(self, subvid, treeid, initial_load, initial_thru_ajax, morekwargs):
   117         form = self._cw.form
   117         form = self._cw.form
   118         if subvid is None:
   118         if subvid is None:
   142             subvid, treeid, initial_load, initial_thru_ajax, morekwargs)
   142             subvid, treeid, initial_load, initial_thru_ajax, morekwargs)
   143         ulid = ' '
   143         ulid = ' '
   144         if toplevel:
   144         if toplevel:
   145             self._init_headers(treeid, toplevel_thru_ajax)
   145             self._init_headers(treeid, toplevel_thru_ajax)
   146             ulid = ' id="tree-%s"' % treeid
   146             ulid = ' id="tree-%s"' % treeid
   147         self.w(u'<ul%s class="%s">' % (ulid, self.css_classes))
   147         self.w(u'<ul%s class="%s">' % (ulid, self.cssclass))
   148         # XXX force sorting on x.sortvalue() (which return dc_title by default)
   148         # XXX force sorting on x.sortvalue() (which return dc_title by default)
   149         # we need proper ITree & co specification to avoid this.
   149         # we need proper ITree & co specification to avoid this.
   150         # (pb when type ambiguity at the other side of the tree relation,
   150         # (pb when type ambiguity at the other side of the tree relation,
   151         # unability to provide generic implementation on eg Folder...)
   151         # unability to provide generic implementation on eg Folder...)
   152         for i, entity in enumerate(sorted(self.cw_rset.entities(),
   152         for i, entity in enumerate(sorted(self.cw_rset.entities(),
   169 
   169 
   170 class FileTreeView(TreeView):
   170 class FileTreeView(TreeView):
   171     """specific version of the treeview to display file trees
   171     """specific version of the treeview to display file trees
   172     """
   172     """
   173     __regid__ = 'filetree'
   173     __regid__ = 'filetree'
   174     css_classes = 'treeview widget filetree'
   174     cssclass = 'treeview widget filetree'
   175     title = _('file tree view')
   175     title = _('file tree view')
   176 
   176 
   177     def call(self, subvid=None, treeid=None, initial_load=True, **kwargs):
   177     def call(self, subvid=None, treeid=None, initial_load=True, **kwargs):
   178         super(FileTreeView, self).call(treeid=treeid, subvid='filetree-oneline',
   178         super(FileTreeView, self).call(treeid=treeid, subvid='filetree-oneline',
   179                                        initial_load=initial_load, **kwargs)
   179                                        initial_load=initial_load, **kwargs)