web/views/treeview.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1133 8a409ea0c9ec
child 1826 afc563537d8f
equal deleted inserted replaced
1801:672acc730ce5 1802:d628defebc17
    43         self.w(u'<ul id="tree-%s" class="%s">' % (treeid, self.css_classes))
    43         self.w(u'<ul id="tree-%s" class="%s">' % (treeid, self.css_classes))
    44         for rowidx in xrange(len(self.rset)):
    44         for rowidx in xrange(len(self.rset)):
    45             self.wview(self.itemvid, self.rset, row=rowidx, col=0,
    45             self.wview(self.itemvid, self.rset, row=rowidx, col=0,
    46                        vid=subvid, parentvid=self.id)
    46                        vid=subvid, parentvid=self.id)
    47         self.w(u'</ul>')
    47         self.w(u'</ul>')
    48         
    48 
    49 
    49 
    50 class FileTreeView(TreeView):
    50 class FileTreeView(TreeView):
    51     """specific version of the treeview to display file trees
    51     """specific version of the treeview to display file trees
    52     """
    52     """
    53     id = 'filetree'
    53     id = 'filetree'
    77 
    77 
    78 
    78 
    79 class DefaultTreeViewItemView(EntityView):
    79 class DefaultTreeViewItemView(EntityView):
    80     """default treeitem view for entities which don't implement ITree"""
    80     """default treeitem view for entities which don't implement ITree"""
    81     id = 'treeitemview'
    81     id = 'treeitemview'
    82     
    82 
    83     def cell_call(self, row, col, vid='oneline', parentvid='treeview'):
    83     def cell_call(self, row, col, vid='oneline', parentvid='treeview'):
    84         entity = self.entity(row, col)
    84         entity = self.entity(row, col)
    85         itemview = self.view(vid, self.rset, row=row, col=col)
    85         itemview = self.view(vid, self.rset, row=row, col=col)
    86         if row == len(self.rset) - 1:
    86         if row == len(self.rset) - 1:
    87             self.w(u'<li class="last">%s</li>' % itemview)
    87             self.w(u'<li class="last">%s</li>' % itemview)
    94 
    94 
    95     (each item should be expandable if it's not a tree leaf)
    95     (each item should be expandable if it's not a tree leaf)
    96     """
    96     """
    97     id = 'treeitemview'
    97     id = 'treeitemview'
    98     __select__ = implements(ITree)
    98     __select__ = implements(ITree)
    99     
    99 
   100     def cell_call(self, row, col, vid='oneline', parentvid='treeview'):
   100     def cell_call(self, row, col, vid='oneline', parentvid='treeview'):
   101         entity = self.entity(row, col)
   101         entity = self.entity(row, col)
   102         cssclasses = []
   102         cssclasses = []
   103         is_leaf = False
   103         is_leaf = False
   104         if row == len(self.rset) - 1:
   104         if row == len(self.rset) - 1:
   122             # add empty <ul> because jquery's treeview plugin checks for
   122             # add empty <ul> because jquery's treeview plugin checks for
   123             # sublists presence
   123             # sublists presence
   124             self.w(u'<ul class="placeholder"><li>place holder</li></ul>')
   124             self.w(u'<ul class="placeholder"><li>place holder</li></ul>')
   125         self.wview(vid, self.rset, row=row, col=col)
   125         self.wview(vid, self.rset, row=row, col=col)
   126         self.w(u'</li>')
   126         self.w(u'</li>')
   127