Updated management interface
authorThierry Florac <thierry.florac@onf.fr>
Thu, 21 Apr 2016 18:12:30 +0200
changeset 24 b5882159dea4
parent 23 1c0bac23c875
child 25 4f51a7d6e18d
Updated management interface
src/pyams_content/shared/common/zmi/__init__.py
src/pyams_content/shared/common/zmi/dashboard.py
src/pyams_content/shared/common/zmi/properties.py
src/pyams_content/shared/common/zmi/workflow.py
--- a/src/pyams_content/shared/common/zmi/__init__.py	Thu Apr 21 18:11:50 2016 +0200
+++ b/src/pyams_content/shared/common/zmi/__init__.py	Thu Apr 21 18:12:30 2016 +0200
@@ -68,7 +68,7 @@
         return II18n(self.context).query_attribute('title', request=self.request)
 
     icon_css_class = 'fa fa-fw fa-plus'
-    fields = field.Fields(IWfSharedContent).select('title', 'description')
+    fields = field.Fields(IWfSharedContent).select('title', 'notepad')
 
     ajax_handler = 'add-shared-content.json'
     edit_permission = CREATE_CONTENT_PERMISSION
@@ -76,7 +76,7 @@
     def updateWidgets(self, prefix=None):
         super(SharedContentAddForm, self).updateWidgets(prefix)
         self.widgets['title'].description = _("This title can be modified afterwards")
-        self.widgets['description'].label_css_class = 'textarea'
+        self.widgets['notepad'].label_css_class = 'textarea'
 
     def create(self, data):
         return self.context.shared_content_factory.content_class()
--- a/src/pyams_content/shared/common/zmi/dashboard.py	Thu Apr 21 18:11:50 2016 +0200
+++ b/src/pyams_content/shared/common/zmi/dashboard.py	Thu Apr 21 18:12:30 2016 +0200
@@ -86,7 +86,7 @@
     @property
     def data_attributes(self):
         attributes = super(BaseDashboardTable, self).data_attributes
-        attributes['table'] = {'data-ams-datatable-sorting': "{0},{1}".format(len(self.columns)-1,
+        attributes['table'] = {'data-ams-datatable-sorting': "{0},{1}".format(len(self.columns) - 1,
                                                                               self.dt_sort_order),
                                'data-ams-datatable-display-length':
                                    IAdminProfile(self.request.principal).table_page_length}
--- a/src/pyams_content/shared/common/zmi/properties.py	Thu Apr 21 18:11:50 2016 +0200
+++ b/src/pyams_content/shared/common/zmi/properties.py	Thu Apr 21 18:12:30 2016 +0200
@@ -18,7 +18,7 @@
 # import interfaces
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_form.interfaces.form import IWidgetForm, IInnerTabForm, IInnerSubForm
+from pyams_form.interfaces.form import IWidgetForm
 from pyams_skin.interfaces import IInnerPage, IPageHeader
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.interfaces.menu import IContentManagementMenu, IPropertiesMenu
@@ -26,17 +26,16 @@
 
 # import packages
 from pyams_content.shared.common.zmi import WfSharedContentHeaderAdapter
-from pyams_content.shared.common.zmi.summary import SharedContentSummaryForm
 from pyams_form.form import AJAXEditForm
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.menu import MenuItem
 from pyams_utils.adapter import adapter_config
 from pyams_viewlet.manager import viewletmanager_config
 from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminEditForm, InnerAdminDisplayForm
+from pyams_zmi.form import AdminEditForm
 from pyramid.view import view_config
 from z3c.form import field
-from zope.interface import implementer, Interface
+from zope.interface import implementer
 
 from pyams_content import _
 
@@ -97,42 +96,3 @@
     """Shared content properties header adapter"""
 
     icon_class = 'fa fa-fw fa-edit'
-
-
-#
-# Properties summary
-#
-
-@adapter_config(name='properties-summary',
-                context=(IWfSharedContent, IPyAMSLayer, SharedContentSummaryForm),
-                provides=IInnerTabForm)
-class SharedContentPropertiesSummary(InnerAdminDisplayForm):
-    """Shared content properties summary tab"""
-
-    tab_label = _("Properties")
-    tab_target = 'properties-summary.html'
-
-    fields = field.Fields(Interface)
-
-    weight = 10
-
-
-@pagelet_config(name='properties-summary.html', context=IWfSharedContent, layer=IPyAMSLayer)
-@implementer(IInnerPage, IInnerTabForm)
-class SharedContentPropertiesSummaryDisplayForm(InnerAdminDisplayForm):
-    """Shared content properties summary display form"""
-
-    fields = field.Fields(Interface)
-
-
-@adapter_config(name='properties-main-summary.html',
-                context=(IWfSharedContent, IPyAMSLayer, SharedContentPropertiesSummaryDisplayForm),
-                provides=IInnerSubForm)
-class SharedContentMainPropertiesSummaryDisplayForm(InnerAdminDisplayForm):
-    """Shared content main properties summary display form"""
-
-    legend = _("Content properties")
-
-    fields = field.Fields(IWfSharedContent).select('title', 'short_name', 'description', 'keywords', 'notepad')
-
-    weight = 1
--- a/src/pyams_content/shared/common/zmi/workflow.py	Thu Apr 21 18:11:50 2016 +0200
+++ b/src/pyams_content/shared/common/zmi/workflow.py	Thu Apr 21 18:12:30 2016 +0200
@@ -81,9 +81,12 @@
     @property
     def fields(self):
         fields = field.Fields(IWorkflowState).omit('history') + \
-                 field.Fields(IWorkflowPublicationInfo)
+                 field.Fields(IWorkflowPublicationInfo).omit('publication_date', 'publisher')
         workflow = IWorkflow(self.context)
-        if IWorkflowState(self.context).state not in workflow.waiting_states:
+        state = IWorkflowState(self.context).state
+        if state not in workflow.published_states:
+            fields = fields.omit('publication')
+        if state not in workflow.waiting_states:
             fields = fields.omit('state_urgency')
         return fields
 
@@ -95,8 +98,6 @@
         self.widgets['state'].value = self.request.localizer.translate(workflow.get_state_label(state.state))
         self.widgets['state_date'].value = format_datetime(tztime(state.state_date))
         info = IWorkflowPublicationInfo(self.context)
-        if info.publication_date:
-            self.widgets['publication_date'].value = format_datetime(tztime(info.publication_date))
         if info.first_publication_date:
             self.widgets['first_publication_date'].value = format_datetime(tztime(info.first_publication_date))
         if info.publication_effective_date: