web/views/cwsources.py
changeset 7994 af3fb709c061
parent 7992 4ff9f25cb06e
child 7995 9a9f35ef418c
--- a/web/views/cwsources.py	Fri Oct 21 14:32:37 2011 +0200
+++ b/web/views/cwsources.py	Fri Oct 21 14:32:37 2011 +0200
@@ -29,7 +29,7 @@
 from cubicweb.view import EntityView, StartupView
 from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES, display_name
 from cubicweb.web import uicfg, formwidgets as wdgs
-from cubicweb.web.views import tabs, actions, ibreadcrumbs, add_etype_button
+from cubicweb.web.views import tabs, actions, ibreadcrumbs, tableview, add_etype_button
 
 
 _abaa = uicfg.actionbox_appearsin_addmenu
@@ -255,9 +255,10 @@
     title = _('data sources')
     category = 'manage'
 
-class CWSourceManagementView(StartupView):
-    __regid__ = 'cw.source-management'
-    rql = ('Any S, ST, SP, SD, SN ORDERBY SN WHERE S is CWSource, S name SN, S type ST, '
+
+class CWSourcesManagementView(StartupView):
+    __regid__ = 'cw.sources-management'
+    rql = ('Any S,ST,SP,SD,SN ORDERBY SN WHERE S is CWSource, S name SN, S type ST, '
            'S latest_retrieval SD, S parser SP')
     title = _('data sources management')
 
@@ -265,7 +266,18 @@
         self.w('<h1>%s</h1>' % self._cw._(self.title))
         self.w(add_etype_button(self._cw, 'CWSource'))
         self.w(u'<div class="clear"></div>')
-        self.wview('table', self._cw.execute(self.rql), displaycols=range(4))
+        self.wview('cw.sources-table', self._cw.execute(self.rql))
+
+
+class CWSourcesTable(tableview.EntityTableView):
+    __regid__ = 'cw.sources-table'
+    __select__ = is_instance('CWSource')
+    columns = ['source', 'type', 'parser', 'latest_retrieval']
+
+    # @tableview.etable_header_title('CWSource_plural', addcount=True)
+    # @tableview.etable_entity_sortvalue()
+    # def source_cell(self, w, entity):
+    #     w(entity.view('incontext'))
 
 
 # breadcrumbs configuration ####################################################