--- a/src/pyams_content/shared/common/zmi/types.py Wed Jul 11 15:11:45 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/types.py Wed Jul 11 15:22:16 2018 +0200
@@ -9,6 +9,10 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_content.reference.pictograms.zmi.widget import PictogramSelectFieldWidget
+from pyams_content.shared.common.zmi import SharedContentAddForm
+from pyams_content.shared.common.zmi.properties import SharedContentPropertiesEditForm
+from pyams_i18n.widget import I18nSEOTextLineFieldWidget
__docformat__ = 'restructuredtext'
@@ -17,9 +21,9 @@
import json
# import interfaces
-from pyams_content.interfaces import MANAGE_TOOL_PERMISSION
+from pyams_content.interfaces import MANAGE_TOOL_PERMISSION, MANAGE_CONTENT_PERMISSION
from pyams_content.shared.common.interfaces.types import ITypedSharedTool, ITypedDataManager, \
- IBaseDataType, IDataType, ISubType
+ IBaseDataType, IDataType, ISubType, IWfTypedSharedContent
from pyams_content.skin import pyams_content
from pyams_i18n.interfaces import II18n
from pyams_skin.interfaces.container import ITableElementName
@@ -266,7 +270,13 @@
label_css_class = 'control-label col-md-4'
input_css_class = 'col-md-8'
- fields = field.Fields(IDataType).omit('__parent__', '__name__')
+ @property
+ def fields(self):
+ fields = field.Fields(IDataType).omit('__parent__', '__name__')
+ fields['pictogram'].widgetFactory = PictogramSelectFieldWidget
+ if not self.context.shared_content_types_fields:
+ fields = fields.omit('field_names')
+ return fields
edit_permission = MANAGE_TOOL_PERMISSION
@@ -303,7 +313,14 @@
label_css_class = 'control-label col-md-4'
input_css_class = 'col-md-8'
- fields = field.Fields(IDataType).omit('__parent__', '__name__')
+ @property
+ def fields(self):
+ fields = field.Fields(IDataType).omit('__parent__', '__name__')
+ fields['pictogram'].widgetFactory = PictogramSelectFieldWidget
+ tool = get_parent(self.context, ITypedSharedTool)
+ if not tool.shared_content_types_fields:
+ fields = fields.omit('field_names')
+ return fields
edit_permission = MANAGE_TOOL_PERMISSION
@@ -471,6 +488,7 @@
input_css_class = 'col-md-8'
fields = field.Fields(ISubType).omit('__parent__', '__name__')
+ fields['pictogram'].widgetFactory = PictogramSelectFieldWidget
edit_permission = MANAGE_TOOL_PERMISSION
@@ -517,6 +535,7 @@
input_css_class = 'col-md-8'
fields = field.Fields(ISubType).omit('__parent__', '__name__')
+ fields['pictogram'].widgetFactory = PictogramSelectFieldWidget
edit_permission = MANAGE_TOOL_PERMISSION
@@ -537,3 +556,25 @@
}
else:
return super(self.__class__, self).get_ajax_output(changes)
+
+
+#
+# Typed shared content views
+#
+
+class TypedSharedContentAddForm(SharedContentAddForm):
+ """Typed shared content add form"""
+
+ fields = field.Fields(IWfTypedSharedContent).select('title', 'data_type', 'notepad')
+
+
+@pagelet_config(name='properties.html', context=IWfTypedSharedContent, layer=IPyAMSLayer,
+ permission=MANAGE_CONTENT_PERMISSION)
+@ajax_config(name='properties.json', context=IWfTypedSharedContent, layer=IPyAMSLayer,
+ permission=MANAGE_CONTENT_PERMISSION)
+class TypedSharedContentProperteisEditForm(SharedContentPropertiesEditForm):
+ """Typed shared content properties edit form"""
+
+ fields = field.Fields(IWfTypedSharedContent).select('title', 'short_name', 'content_url',
+ 'data_type', 'description', 'notepad')
+ fields['title'].widgetFactory = I18nSEOTextLineFieldWidget