src/pyams_content/shared/common/zmi/dashboard.py
changeset 1209 fcc1cf94976c
parent 1070 ea0c7ac589c4
child 1330 cad3e22cc2bd
equal deleted inserted replaced
1208:0ec8963e088e 1209:fcc1cf94976c
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
       
    12 from pyams_content.shared.common.interfaces.types import IWfTypedSharedContent
       
    13 
    12 
    14 
    13 __docformat__ = 'restructuredtext'
    15 __docformat__ = 'restructuredtext'
    14 
    16 
    15 from hypatia.catalog import CatalogQuery
    17 from hypatia.catalog import CatalogQuery
    16 from hypatia.interfaces import ICatalog
    18 from hypatia.interfaces import ICatalog
    95     @cached_property
    97     @cached_property
    96     def values(self):
    98     def values(self):
    97         return tuple(super(BaseDashboardTable, self).values)
    99         return tuple(super(BaseDashboardTable, self).values)
    98 
   100 
    99 
   101 
       
   102 @adapter_config(name='type', context=(Interface, IPyAMSLayer, IDashboardTable), provides=IColumn)
       
   103 class SharedToolDashboardTypeColumn(I18nColumn, GetAttrColumn):
       
   104     """Shared tool dashboard type column"""
       
   105 
       
   106     _header = _("Type")
       
   107     weight = 9
       
   108 
       
   109     def getValue(self, obj):
       
   110         content = IWfTypedSharedContent(obj, None)
       
   111         if content is not None:
       
   112             data_type = content.get_data_type()
       
   113             if data_type is not None:
       
   114                 return II18n(data_type).query_attribute('navigation_label', request=self.request) or \
       
   115                        II18n(data_type).query_attribute('label', request=self.request)
       
   116         return '--'
       
   117 
       
   118 
   100 @adapter_config(name='name', context=(Interface, IPyAMSLayer, IDashboardTable), provides=IColumn)
   119 @adapter_config(name='name', context=(Interface, IPyAMSLayer, IDashboardTable), provides=IColumn)
   101 class SharedToolDashboardNameColumn(NameColumn):
   120 class SharedToolDashboardNameColumn(NameColumn):
   102     """Shared tool dashboard name column"""
   121     """Shared tool dashboard name column"""
   103 
   122 
   104     _header = _("Title")
   123     _header = _("Title")