merge default doc-dc
authorDamien Correia
Wed, 13 Jun 2018 10:02:53 +0200
branchdoc-dc
changeset 663 19d5d65babb4
parent 662 93f8b735357a (current diff)
parent 634 4e43b556a2a9 (diff)
child 664 aff026ee8508
merge default
--- a/buildout.cfg	Tue Jun 12 10:57:46 2018 +0200
+++ b/buildout.cfg	Wed Jun 13 10:02:53 2018 +0200
@@ -92,4 +92,4 @@
 eggs = pyams_content [test]
 
 [versions]
-pyams_content = 0.1.14
+pyams_content = 0.1.15
--- a/setup.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/setup.py	Wed Jun 13 10:02:53 2018 +0200
@@ -22,7 +22,7 @@
 README = os.path.join(DOCS, 'README.txt')
 HISTORY = os.path.join(DOCS, 'HISTORY.txt')
 
-version = '0.1.14'
+version = '0.1.15'
 long_description = open(README).read() + '\n\n' + open(HISTORY).read()
 
 tests_require = []
--- a/src/pyams_content/component/association/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/association/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationItem, IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationItem, IAssociationContainerTarget
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
 
@@ -52,14 +52,14 @@
 
     @property
     def edit_permission(self):
-        content = get_parent(self.context, IAssociationTarget)
+        content = get_parent(self.context, IAssociationContainerTarget)
         return IFormContextPermissionChecker(content).edit_permission
 
 
 @subscriber(IObjectAddedEvent, context_selector=IAssociationItem)
 def handle_added_association(event):
     """Handle added association item"""
-    content = get_parent(event.object, IAssociationTarget)
+    content = get_parent(event.object, IAssociationContainerTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))
 
@@ -67,7 +67,7 @@
 @subscriber(IObjectModifiedEvent, context_selector=IAssociationItem)
 def handle_modified_association(event):
     """Handle modified association item"""
-    content = get_parent(event.object, IAssociationTarget)
+    content = get_parent(event.object, IAssociationContainerTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))
 
@@ -75,6 +75,6 @@
 @subscriber(IObjectRemovedEvent, context_selector=IAssociationItem)
 def handle_removed_association(event):
     """Handle removed association item"""
-    content = get_parent(event.object, IAssociationTarget)
+    content = get_parent(event.object, IAssociationContainerTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))
--- a/src/pyams_content/component/association/container.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/association/container.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, \
+from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget, \
     ASSOCIATION_CONTAINER_KEY, IAssociationItem, IAssociationInfo
 from pyams_content.features.checker.interfaces import IContentChecker
 from zope.location.interfaces import ISublocations
@@ -58,13 +58,13 @@
         return filter(lambda x: IAssociationItem(x).visible, self.values())
 
 
-@adapter_config(context=IAssociationTarget, provides=IAssociationContainer)
+@adapter_config(context=IAssociationContainerTarget, provides=IAssociationContainer)
 def association_container_factory(target):
     """Associations container factory"""
     return get_annotation_adapter(target, ASSOCIATION_CONTAINER_KEY, AssociationContainer, name='++ass++')
 
 
-@adapter_config(name='ass', context=IAssociationTarget, provides=ITraversable)
+@adapter_config(name='ass', context=IAssociationContainerTarget, provides=ITraversable)
 class AssociationContainerNamespace(ContextAdapter):
     """Associations container ++ass++ namespace"""
 
@@ -73,7 +73,7 @@
         return registry.queryAdapter(self.context, IAssociationContainer, name=name or '')
 
 
-@adapter_config(name='associations', context=IAssociationTarget, provides=ISublocations)
+@adapter_config(name='associations', context=IAssociationContainerTarget, provides=ISublocations)
 class AssociationContainerSublocations(ContextAdapter):
     """Associations container sub-locations adapter"""
 
@@ -81,7 +81,7 @@
         return IAssociationContainer(self.context).values()
 
 
-@adapter_config(name='associations', context=IAssociationTarget, provides=IContentChecker)
+@adapter_config(name='associations', context=IAssociationContainerTarget, provides=IContentChecker)
 class AssociationsContentChecker(BaseContentChecker):
     """Associations content checker"""
 
@@ -110,7 +110,7 @@
 
     def __init__(self, context=None):
         terms = []
-        target = get_parent(context, IAssociationTarget)
+        target = get_parent(context, IAssociationContainerTarget)
         if target is not None:
             terms = [SimpleTerm(link.__name__, title=IAssociationInfo(link).inner_title)
                      for link in IAssociationContainer(target).values()]
--- a/src/pyams_content/component/association/interfaces/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/association/interfaces/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -74,7 +74,7 @@
         """Get list of visible items"""
 
 
-class IAssociationTarget(IAttributeAnnotatable):
+class IAssociationContainerTarget(IAttributeAnnotatable):
     """Associations container target interface"""
 
 
@@ -82,6 +82,10 @@
     """Association renderer adapter interface"""
 
 
+#
+# Associations paragraph
+#
+
 ASSOCIATION_PARAGRAPH_TYPE = 'Associations'
 ASSOCIATION_PARAGRAPH_NAME = _("Associations")
 ASSOCIATION_PARAGRAPH_RENDERERS = 'PyAMS.associations.renderers'
--- a/src/pyams_content/component/association/zmi/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/association/zmi/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -17,7 +17,8 @@
 import json
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationContainer, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationContainer, \
+    IAssociationInfo
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm, IAssociationsView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerSubForm
@@ -73,7 +74,7 @@
     """Association item properties edit form, JSON renderer"""
 
     def get_associations_table(self):
-        target = get_parent(self.context, IAssociationTarget)
+        target = get_parent(self.context, IAssociationContainerTarget)
         return {
             'status': 'success',
             'message': self.request.localizer.translate(self.successMessage),
@@ -87,7 +88,7 @@
 # Content associations view
 #
 
-@viewlet_config(name='associations.menu', context=IAssociationTarget, layer=IPyAMSLayer,
+@viewlet_config(name='associations.menu', context=IAssociationContainerTarget, layer=IPyAMSLayer,
                 manager=IPropertiesMenu, permission=VIEW_SYSTEM_PERMISSION, weight=60)
 class AssociationsMenu(MenuItem):
     """Associations menu"""
@@ -117,7 +118,7 @@
     @property
     def data_attributes(self):
         registry = get_current_registry()
-        target = get_parent(self.context, IAssociationTarget)
+        target = get_parent(self.context, IAssociationContainerTarget)
         container = registry.getAdapter(target, IAssociationContainer, name=self.associations_name)
         attributes = super(AssociationsTable, self).data_attributes
         attributes['table'] = {
@@ -134,7 +135,7 @@
         return list(super(AssociationsTable, self).values)
 
 
-@adapter_config(context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IValues)
+@adapter_config(context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IValues)
 class AssociationsTableValuesAdapter(ContextRequestViewAdapter):
     """Associations table values adapter"""
 
@@ -144,7 +145,7 @@
         return registry.getAdapter(self.context, IAssociationContainer, name=self.view.associations_name).values()
 
 
-@adapter_config(name='sorter', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='sorter', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='sorter', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTableSorterColumn(ProtectedFormObjectMixin, SorterColumn):
     """Associations table sorter column"""
@@ -159,7 +160,7 @@
     return {'status': 'success'}
 
 
-@adapter_config(name='show-hide', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable),
+@adapter_config(name='show-hide', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable),
                 provides=IColumn)
 @adapter_config(name='show-hide', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable),
                 provides=IColumn)
@@ -174,7 +175,7 @@
     return switch_element_visibility(request, IAssociationContainer)
 
 
-@adapter_config(name='pictogram', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='pictogram', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='pictogram', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTablePictogramColumn(ImageColumn):
     """Associations table pictogram column"""
@@ -190,7 +191,7 @@
         return self.request.localizer.translate(item.icon_hint)
 
 
-@adapter_config(name='name', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='name', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='name', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTablePublicNameColumn(NameColumn):
     """Associations table name column"""
@@ -208,7 +209,7 @@
         return title
 
 
-@adapter_config(name='inner_name', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='inner_name', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='inner_name', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTableInnerNameColumn(I18nColumn, GetAttrColumn):
     """Associations table inner name column"""
@@ -224,7 +225,7 @@
             return '--'
 
 
-@adapter_config(name='size', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='size', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='size', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTableSizeColumn(I18nColumn, GetAttrColumn):
     """Associations table size column"""
@@ -240,7 +241,7 @@
             return '--'
 
 
-@adapter_config(name='trash', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
+@adapter_config(name='trash', context=(IAssociationContainerTarget, IPyAMSLayer, AssociationsTable), provides=IColumn)
 @adapter_config(name='trash', context=(IAssociationContainer, IPyAMSLayer, AssociationsTable), provides=IColumn)
 class AssociationsTableTrashColumn(ProtectedFormObjectMixin, TrashColumn):
     """Associations table trash column"""
@@ -253,7 +254,7 @@
     output = delete_container_element(request)
     if output.get('status') == 'success':
         from pyams_content.component.paragraph.zmi import get_json_paragraph_toolbar_refresh_event
-        parent = get_parent(request.context, IAssociationTarget)
+        parent = get_parent(request.context, IAssociationContainerTarget)
         output.update({
             'handle_json': True,
             'events': [
@@ -264,7 +265,7 @@
     return output
 
 
-@pagelet_config(name='associations.html', context=IAssociationTarget, layer=IPyAMSLayer,
+@pagelet_config(name='associations.html', context=IAssociationContainerTarget, layer=IPyAMSLayer,
                 permission=VIEW_SYSTEM_PERMISSION)
 @implementer(IAssociationsView)
 class AssociationsContainerView(ContainerAdminView, Pagelet):
@@ -274,7 +275,7 @@
     table_class = AssociationsTable
 
 
-@pagelet_config(name='associations-dialog.html', context=IAssociationTarget, layer=IPyAMSLayer,
+@pagelet_config(name='associations-dialog.html', context=IAssociationContainerTarget, layer=IPyAMSLayer,
                 permission=VIEW_SYSTEM_PERMISSION)
 @implementer(IAssociationsParentForm)
 class AssociationsContainerDialogView(AdminDialogDisplayForm):
@@ -287,7 +288,7 @@
     fields = field.Fields(Interface)
 
 
-@adapter_config(name='associations', context=(IAssociationTarget, IPyAMSLayer, IAssociationsParentForm),
+@adapter_config(name='associations', context=(IAssociationContainerTarget, IPyAMSLayer, IAssociationsParentForm),
                 provides=IInnerSubForm)
 @implementer(IAssociationsView)
 class AssociationsView(InnerTableView):
--- a/src/pyams_content/component/extfile/interfaces/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/extfile/interfaces/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationItem, IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationItem, IAssociationContainerTarget
 
 # import packages
 from pyams_i18n.schema import I18nTextLineField, I18nTextField, I18nFileField, I18nThumbnailImageField, \
@@ -91,5 +91,5 @@
                           required=True)
 
 
-class IExtFileContainerTarget(IAssociationTarget):
+class IExtFileContainerTarget(IAssociationContainerTarget):
     """External files container marker interface"""
--- a/src/pyams_content/component/extfile/zmi/container.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/extfile/zmi/container.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,8 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationContainer, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationContainer, \
+    IAssociationInfo
 from pyams_content.component.extfile.interfaces import IExtFile, IExtImage
 from pyams_i18n.interfaces import II18n
 from pyams_skin.layer import IPyAMSLayer
@@ -37,7 +38,7 @@
 def get_files_list(request):
     """Get container files in JSON format for TinyMCE editor"""
     result = []
-    target = get_parent(request.context, IAssociationTarget)
+    target = get_parent(request.context, IAssociationContainerTarget)
     if target is not None:
         container = IAssociationContainer(target)
         result.extend([{'title': IAssociationInfo(item).user_title,
@@ -52,7 +53,7 @@
 def get_images_list(request):
     """Get container images in JSON format for TinyMCE editor"""
     result = []
-    target = get_parent(request.context, IAssociationTarget)
+    target = get_parent(request.context, IAssociationContainerTarget)
     if target is not None:
         container = IAssociationContainer(target)
         result.extend([{'title': IAssociationInfo(item).user_title,
--- a/src/pyams_content/component/links/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/links/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationInfo, IAssociationTarget, IAssociationContainer
+from pyams_content.component.association.interfaces import IAssociationInfo, IAssociationContainerTarget, IAssociationContainer
 from pyams_content.component.links.interfaces import IBaseLink, IInternalLink, IExternalLink, IMailtoLink
 from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE
 from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION
@@ -55,7 +55,7 @@
 
     def __init__(self, context=None):
         terms = []
-        target = get_parent(context, IAssociationTarget)
+        target = get_parent(context, IAssociationContainerTarget)
         if target is not None:
             terms = [SimpleTerm(link.__name__, title=IAssociationInfo(link).inner_title)
                      for link in IAssociationContainer(target).values() if IBaseLink.providedBy(link)]
--- a/src/pyams_content/component/links/interfaces/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/links/interfaces/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget, IAssociationItem
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationItem
 from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY
 from pyams_sequence.interfaces import IInternalReference
 
@@ -83,5 +83,5 @@
                             required=True)
 
 
-class ILinkContainerTarget(IAssociationTarget):
+class ILinkContainerTarget(IAssociationContainerTarget):
     """Links container marker interface"""
--- a/src/pyams_content/component/links/zmi/container.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/links/zmi/container.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, IAssociationInfo
+from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget, IAssociationInfo
 from pyams_content.component.extfile.interfaces import IBaseExtFile
 from pyams_content.component.links.interfaces import IBaseLink
 from pyams_i18n.interfaces import II18n
@@ -40,7 +40,7 @@
     result = []
     key_field_name = request.params.get('keyFieldName', 'title')
     value_field_name = request.params.get('valueFieldName', 'value')
-    target = get_parent(request.context, IAssociationTarget)
+    target = get_parent(request.context, IAssociationContainerTarget)
     if target is not None:
         container = IAssociationContainer(target)
         result.extend([{key_field_name: item.__name__,
@@ -54,7 +54,7 @@
 def get_links_list(request):
     """Get links list in JSON format for TinyMCE editor"""
     result = []
-    target = get_parent(request.context, IAssociationTarget)
+    target = get_parent(request.context, IAssociationContainerTarget)
     if target is not None:
         container = IAssociationContainer(target)
         for item in container.values():
--- a/src/pyams_content/component/paragraph/zmi/frame.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/frame.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationContainerTarget
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
 from pyams_content.component.paragraph.interfaces.frame import IFrameParagraph, FRAME_PARAGRAPH_TYPE
@@ -150,7 +150,7 @@
         output = super(self.__class__, self).get_ajax_output(changes)
         if 'body' in changes.get(IFrameParagraph, ()):
             # refresh associations count markers
-            parent = get_parent(self.context, IAssociationTarget)
+            parent = get_parent(self.context, IAssociationContainerTarget)
             output.setdefault('events', []).append(
                 get_json_paragraph_toolbar_refresh_event(parent, self.request,
                                                          ParagraphContainerTable, ParagraphTitleToolbarViewletManager))
--- a/src/pyams_content/component/paragraph/zmi/html.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/html.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationTarget
+from pyams_content.component.association.interfaces import IAssociationContainerTarget
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphFactorySettings, \
     IParagraphContainer
@@ -223,7 +223,7 @@
         output = super(self.__class__, self).get_ajax_output(changes)
         if 'body' in changes.get(IHTMLParagraph, ()):
             # refresh associations count markers
-            parent = get_parent(self.context, IAssociationTarget)
+            parent = get_parent(self.context, IAssociationContainerTarget)
             output.setdefault('events', []).append(
                 get_json_paragraph_toolbar_refresh_event(parent, self.request))
             # refresh associations table
@@ -252,7 +252,7 @@
         output = super(self.__class__, self).get_ajax_output(changes)
         if 'body' in changes.get(IHTMLParagraph, ()):
             # refresh associations count markers
-            parent = get_parent(self.context, IAssociationTarget)
+            parent = get_parent(self.context, IAssociationContainerTarget)
             output.setdefault('events', []).append(
                 get_json_paragraph_toolbar_refresh_event(parent, self.request))
             # refresh associations table
--- a/src/pyams_content/component/paragraph/zmi/preview.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/preview.py	Wed Jun 13 10:02:53 2018 +0200
@@ -18,7 +18,7 @@
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
     IParagraphRenderer
-from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_content.features.renderer.interfaces import ISharedContentRenderer
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
@@ -27,7 +27,7 @@
 
 
 @adapter_config(name='paragraphs-render', context=(IParagraphContainerTarget, IPyAMSLayer),
-                provides=IContentRenderer)
+                provides=ISharedContentRenderer)
 class ParagraphsContainerRenderer(BaseContentRenderer):
     """Paragraphs container renderer"""
 
--- a/src/pyams_content/features/header/zmi/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/features/header/zmi/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -138,6 +138,8 @@
     fields = field.Fields(IHeaderSettings).select('renderer')
     weight = 1
 
+    _changes = None
+
     def __init__(self, context, request, group):
         context = IHeaderSettings(context)
         super(HeaderSettingsRendererEditSubform, self).__init__(context, request, group)
@@ -158,13 +160,24 @@
             alsoProvides(widget, IObjectData)
 
     def get_forms(self, include_self=True):
-        if include_self and self.request.method == 'POST':
+        if include_self and (self._changes is None) and (self.request.method == 'POST'):
             data, errors = self.extractData()
             if not errors:
-                self.applyChanges(data)
+                self._changes = self.applyChanges(data)
         for form in super(HeaderSettingsRendererEditSubform, self).get_forms(include_self):
             yield form
 
+    def get_ajax_output(self, changes):
+        if not changes:
+            changes = self._changes
+        if changes:
+            return {
+                'status': 'success',
+                'message': self.request.localizer.translate(self.successMessage)
+            }
+        else:
+            return super(HeaderSettingsRendererEditSubform, self).get_ajax_output(changes)
+
 
 @adapter_config(name='header-renderer-settings-form',
                 context=(IHeaderRendererSettings, IPyAMSLayer, HeaderSettingsRendererEditSubform),
--- a/src/pyams_content/features/renderer/interfaces/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/features/renderer/interfaces/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -43,5 +43,9 @@
     settings_interface = Attribute("Renderer target interface")
 
 
+class ISharedContentRenderer(IContentRenderer):
+    """Shared content renderer interface"""
+
+
 class IRendererSettings(Interface):
     """Base renderer settings interface"""
--- a/src/pyams_content/portlet/content/interfaces.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/portlet/content/interfaces.py	Wed Jun 13 10:02:53 2018 +0200
@@ -12,6 +12,7 @@
 
 __docformat__ = 'restructuredtext'
 
+
 # import standard library
 
 # import interfaces
--- a/src/pyams_content/portlet/content/skin/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/portlet/content/skin/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,11 +16,11 @@
 
 # import interfaces
 from pyams_content.portlet.content.interfaces import ISharedContentPortletSettings
+from pyams_content.features.renderer.interfaces import ISharedContentRenderer
 from pyams_portal.interfaces import IPortalContext, IPortletRenderer
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
-from pyams_content.features.renderer import IContentRenderer
 from pyams_portal.portlet import PortletRenderer
 from pyams_utils.adapter import adapter_config
 from zope.interface import Interface
@@ -39,7 +39,7 @@
         super(SharedContentPortletRenderer, self).__init__(context, request, view, settings)
         registry = self.request.registry
         self.renderers = [adapter for name, adapter in sorted(registry.getAdapters((self.context, self.request),
-                                                                                   IContentRenderer),
+                                                                                   ISharedContentRenderer),
                                                               key=lambda x: x[1].weight)]
 
     def update(self):
--- a/src/pyams_content/reference/pictograms/manager.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/reference/pictograms/manager.py	Wed Jun 13 10:02:53 2018 +0200
@@ -58,7 +58,7 @@
             target = get_parent(context, IPictogramManagerTarget)
             if target is not None:
                 manager = IPictogramManager(target)
-                pictograms = [table.get(name) for name in manager.selected_pictograms]
+                pictograms = [table.get(name) for name in manager.selected_pictograms or ()]
                 terms = [SimpleTerm(v.__name__,
                                     title=II18n(v).query_attribute('title', request=request))
                          for v in pictograms if v is not None]
--- a/src/pyams_content/shared/common/interfaces/__init__.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/shared/common/interfaces/__init__.py	Wed Jun 13 10:02:53 2018 +0200
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_portal.interfaces import IPortalContext
 
 __docformat__ = 'restructuredtext'
 
@@ -19,6 +18,7 @@
 # import interfaces
 from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION, OWNER_ROLE, MANAGER_ROLE, \
     READER_ROLE, GUEST_ROLE, WEBMASTER_ROLE, PILOT_ROLE, CONTRIBUTOR_ROLE
+from pyams_portal.interfaces import IPortalContext
 from pyams_workflow.interfaces import IWorkflowManagedContent
 from zope.container.interfaces import IContainer
 
--- a/src/pyams_content/shared/common/zmi/types.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/types.py	Wed Jun 13 10:02:53 2018 +0200
@@ -146,7 +146,9 @@
 
     def renderCell(self, item):
         return '<span data-ams-stop-propagation="true" ' \
-               '      data-ams-click-handler="PyAMS_content.types.switchSubtypes">' \
+               '      data-ams-click-handler="MyAMS.skin.switchCellContent" ' \
+               '      data-ams-switch-handler="get-subtypes-table.json" ' \
+               '      data-ams-switch-target=".subtypes">' \
                '    <span class="small hint" title="{hint}" data-ams-hint-gravity="e">' \
                '        <i class="fa fa-plus-square-o switch"></i>' \
                '    </span>' \
@@ -315,8 +317,6 @@
         attributes = super(DatatypeSubtypesTable, self).data_attributes
         attributes['table'] = {
             'id': self.id,
-            'data-ams-plugins': 'pyams_content',
-            'data-ams-plugin-pyams_content-src': get_resource_path(pyams_content),
             'data-ams-location': absolute_url(self.context, self.request),
             'data-ams-tablednd-drag-handle': 'td.sorter',
             'data-ams-tablednd-drop-target': 'set-subtypes-order.json'
--- a/src/pyams_content/shared/form/zmi/render.py	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/shared/form/zmi/render.py	Wed Jun 13 10:02:53 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_content.features.renderer.interfaces import ISharedContentRenderer
 from pyams_content.shared.form.interfaces import IFormFieldContainerTarget, IFormFieldContainer
 from pyams_form.interfaces.form import IFormHelp
 from pyams_i18n.interfaces import II18n
@@ -77,7 +77,7 @@
 
 
 @adapter_config(name='form-render', context=(IFormFieldContainerTarget, IPyAMSLayer),
-                provides=IContentRenderer)
+                provides=ISharedContentRenderer)
 class FormFieldContainerRenderer(BaseContentRenderer):
     """Form field container renderer"""
 
--- a/src/pyams_content/skin/resources/js/pyams_content.js	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.js	Wed Jun 13 10:02:53 2018 +0200
@@ -468,39 +468,6 @@
 		},
 
 		/**
-		 * Types management
-		 */
-		types: {
-
-			switchSubtypes: function(element) {
-				var source = $(this);
-				var switcher = $('i.switch', source);
-				var td = source.parents('td');
-				var subtypes = $('.subtypes', td);
-				var datatype = source.parents('tr');
-				if (switcher.hasClass('fa-plus-square-o')) {
-					var container = datatype.parents('table');
-					subtypes.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>');
-					MyAMS.ajax.post(container.data('ams-location') + '/get-subtypes-table.json',
-									{object_name: datatype.data('ams-element-name')},
-									function(result) {
-										subtypes.html(result);
-										if (result) {
-											MyAMS.initContent(subtypes);
-											switcher.removeClass('fa-plus-square-o')
-													.addClass('fa-minus-square-o');
-										}
-									});
-				} else {
-					MyAMS.skin.cleanContainer(subtypes);
-					subtypes.empty();
-					switcher.removeClass('fa-minus-square-o')
-							.addClass('fa-plus-square-o');
-				}
-			}
-		},
-
-		/**
 		 * Site management
 		 */
 		site: {
--- a/src/pyams_content/skin/resources/js/pyams_content.min.js	Tue Jun 12 10:57:46 2018 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.min.js	Wed Jun 13 10:02:53 2018 +0200
@@ -1,1 +1,1 @@
-!function(t,e){"use strict";var a=e.MyAMS,i={widget:{treeview:{selectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(a.id)},unselectFolder:function(e,a){t(e.target).siblings('input[type="hidden"]').val(null)}}},TinyMCE:{initEditor:function(t){return tinyMCE.addI18n("fr",{"Link list":"Liste de liens","Toggle h3 header":"En-tête H3","Toggle h4 header":"En-tête H4","Insert internal link":"Insérer un lien interne","Link title":"Texte à afficher","Internal number":"N° interne"}),tinymce.PluginManager.add("internal_links",function(t,e){t.addButton("internal_links",{icon:"cloud-check",tooltip:"Insert internal link",image:"/--static--/pyams_content/img/internal-link.png",onclick:function(){t.windowManager.open({title:"Insert internal link",body:[{type:"textbox",name:"oid",label:"Internal number"},{type:"textbox",name:"title",label:"Link title",value:t.selection.getContent()}],onsubmit:function(e){t.insertContent('<a href="oid://'+e.data.oid+'">'+e.data.title+"</a>")}})}})}),tinyMCE.PluginManager.add("headers",function(t,e){["h3","h4"].forEach(function(e){t.addButton("header-"+e,{tooltip:"Toggle "+e+" header",text:e.toUpperCase(),onClick:function(){t.execCommand("mceToggleFormat",!1,e)},onPostRender:function(){var a=this,i=function(){t.formatter.formatChanged(e,function(t){a.active(t)})};t.formatter?i():t.on("init",i)}})})}),t.image_list=i.TinyMCE.getImagesList,t.link_list=i.TinyMCE.getLinksList,t.style_formats=[{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],t.plugins+=" internal_links headers",t.toolbar1&&(t.toolbar1="undo redo | header-h3 header-h4 styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),t.toolbar2&&(t.toolbar2="forecolor backcolor | charmap internal_links link | fullscreen preview print | code"),t},getImagesList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-images-list.json",{},e)}},getLinksList:function(e){var i=t(document.activeElement).parents("form");if(i.exists()){var n=i.attr("data-ams-form-handler")||i.attr("action"),s=n.substr(0,n.lastIndexOf("/")+1);return a.ajax.post(s+"get-links-list.json",{},e)}}},galleries:{updateMediaTitle:function(e){t('img[id="'+e.media_id+'"]').attr("original-title",e.title)},switchMediaVisibility:function(e){return function(){var e=t(this),i=e.parents(".media"),n=i.parents(".gallery");a.ajax.post(n.data("ams-location")+"/set-media-visibility.json",{object_name:i.data("ams-element-name")},function(a,i){a.visible?(t("i",e).attr("class","fa fa-fw fa-eye"),e.parents(".btn-group").siblings("a.fancyimg").removeClass("not-visible")):(t("i",e).attr("class","fa fa-fw fa-eye-slash text-danger"),e.parents(".btn-group").siblings("a.fancyimg").addClass("not-visible"))})}},setOrder:function(e,i){if(!i||!i.item.hasClass("already-dropped")){var n=i.item.parents(".gallery"),s=t(".media",n).listattr("data-ams-element-name");a.ajax.post(n.data("ams-location")+"/set-medias-order.json",{medias:JSON.stringify(s)})}},removeMedia:function(e){return function(){var e=t(this);a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(t){if(t===a.i18n.BTN_OK){var i=e.parents(".gallery").data("ams-location"),n=e.parents(".media"),s=n.data("ams-element-name");a.ajax.post(i+"/delete-element.json",{object_name:s},function(t,e){n.remove()})}})}},afterFancyboxLoad:function(t,e){t.element.hasClass("not-visible")&&t.inner.prepend('<div class="hidden-mask"></div>')}},paragraphs:{preReload:function(){i.paragraphs.switched=t("i.switch.fa-minus-square-o","#paragraphs_list").parents("tr").listattr("id")},postReload:function(){t(i.paragraphs.switched).each(function(){t("i.switch.fa-plus-square-o",'[id="'+this+'"]').parents("div").first().click()}),delete i.paragraphs.switched},refreshParagraph:function(e){var a=t('tr[id="'+e.object_id+'"]');t("span.title",a).html(e.title||" - - - - - - - -")},switchEditor:function(e){var i=t(this),n=t("i.switch",i),s=i.parents("td"),r=t(".editor",s),o=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>'),a.ajax.post(l.data("ams-location")+"/get-paragraph-editor.json",{object_name:o.data("ams-element-name")},function(t){r.html(t),t&&(a.initContent(r),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),o.data("ams-disabled-handlers",!0),a.skin.scrollTo(r,{offset:r.height()-o.height()}))})}else a.skin.cleanContainer(r),r.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),o.removeData("ams-disabled-handlers")},switchLastEditor:function(e){var a=t('table[id="'+e+'"]'),i=t("tr:last",a);t('[data-ams-click-handler="PyAMS_content.paragraphs.switchEditor"]',i).click()},switchAllEditors:function(e){var i=t(this),n=t("i",i),s=i.parents("table");n.hasClass("fa-plus-square-o")?(n.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),a.ajax.post(s.data("ams-location")+"/get-paragraphs-editors.json",{},function(e){for(var i in e)if(e.hasOwnProperty(i)){var r=t('tr[data-ams-element-name="'+i+'"]',s),o=t(".editor",r);o.is(":empty")&&o.html(e[i]),t(".fa-plus-square-o",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),r.data("ams-disabled-handlers",!0)}t("i.fa-plus-square-o",t("tbody",s)).exists()||n.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o"),a.initContent(s)})):(t(".editor",s).each(function(){a.skin.cleanContainer(t(this)),t(this).empty()}),t(".fa-minus-square-o",s).removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),t("tr",s).removeData("ams-disabled-handlers"))},updateToolbar:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i);n.replaceWith(e.toolbar_tag),n=t(".title-toolbar",i),a.initContent(n)},updateMarkers:function(e){var i=t('tr[id="'+e.object_id+'"]'),n=t(".title-toolbar",i),s=t("DIV.action."+e.marker_type,n);s.exists()?s.replaceWith(e.marker_tag):t(e.marker_tag).appendTo(n),e.marker_tag&&(s=t("DIV.action."+e.marker_type,n),a.initContent(s)),a.helpers.sort(n,"weight")}},pictograms:{initManagerSelection:function(){var e=t(this),a=t('input[type="hidden"]',t(".selected-pictograms",e)).listattr("value");return{selected:JSON.stringify(a)}},switchPictogram:function(){var e=t(this),a=e.parents(".pictograms"),i=a.parents(".pictograms-manager");a.hasClass("available-pictograms")?t(".selected-pictograms",i).append(e):t(".available-pictograms",i).append(e)}},themes:{initExtracts:function(e){var i=t('select[name="form.widgets.thesaurus_name:list"]',e).val(),n=t('select[name="form.widgets.extract_name:list"]',e),s=n.val();i&&a.jsonrpc.post("getExtracts",{thesaurus_name:i},{url:"/api/thesaurus/json"},function(e){n.empty(),t(e.result).each(function(){t("<option></option>").attr("value",this.id).attr("selected",this.id===s).text(this.text).appendTo(n)})}),n.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(e){var i=t(e.currentTarget).parents("form"),n=t('select[name="form.widgets.thesaurus_name:list"]',i).val();n&&a.jsonrpc.post("getExtracts",{thesaurus_name:n},{url:"/api/thesaurus/json"},function(e){var a=t('select[name="form.widgets.extract_name:list"]',i).data("select2");a.results.empty(),a.opts.populateResults.call(a,a.results,e.result,{term:""})})}},fields:{refreshField:function(e){var a=t('table[id="form_fields_list"]'),i=t('tr[data-ams-element-name="'+e.object_name+'"]',a);t("td:nth-child(4)",i).html(e.title)}},imgmap:{init:function(){var e=t(this);a.ajax.check(t.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+a.devext+".js",function(){e.canvasAreaDraw({imageUrl:e.data("ams-image-url")})})},initPreview:function(){var e=t(this);a.ajax.check(t.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+a.devext+".js",function(){e.mapster({fillColor:"ff0000",fillOpacity:.35,selected:!0,highlight:!0,staticState:!0})})}},types:{switchSubtypes:function(e){var i=t(this),n=t("i.switch",i),s=i.parents("td"),r=t(".subtypes",s),o=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>'),a.ajax.post(l.data("ams-location")+"/get-subtypes-table.json",{object_name:o.data("ams-element-name")},function(t){r.html(t),t&&(a.initContent(r),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else a.skin.cleanContainer(r),r.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")}},site:{switchVisibility:function(){return function(){var e=t(this),i=e.parents("tr").first();a.ajax.post(i.data("ams-location")+"/switch-content-visibility.json",{object_name:i.data("ams-element-name")},function(a,i){var n="fa-eye";a.visible||(n+="-slash"),a.published||(n+=" text-danger"),t("i",e).attr("class","fa fa-fw "+n)})}}},review:{timer:null,timer_duration:{general:3e4,chat:5e3},initComments:function(e){var n=t(".chat-body",e);n.animate({scrollTop:n[0].scrollHeight},1e3),clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.chat),a.skin.registerCleanCallback(i.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(i.review.timer),i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)},updateComments:function(){var e,i=t(".badge",'nav a[href="#review-comments.html"]'),n=t(".chat-body",".widget-body");e=n.exists()?t(".message",n).length:parseInt(i.text()),a.ajax.post("get-last-review-comments.json",{count:e},function(a){n.exists()&&i.removeClass("bg-color-danger").addClass("bg-color-info"),e!==a.count&&(i.text(a.count).removeClass("hidden"),n.exists()&&(t(".messages",n).append(a.content),n.animate({scrollTop:n[0].scrollHeight},1e3)),n.exists()||i.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){t(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")}))})},initCommentData:function(e){var a=t(".chat-body",".widget-body");return{count:t(".message",a).length}},addCommentAction:function(){return function(){t('textarea[name="comment"]').focus()}},addCommentCallback:function(e){var a=t(this),i=a.parents(".widget-body");t(".messages",i).append(e.content),t('textarea[name="comment"]',a).val("");var n=t(".chat-body",i);n.animate({scrollTop:n[0].scrollHeight},1e3),t(".badge",'nav a[href="#review-comments.html"]').text(e.count).removeClass("hidden")}},profile:{switchFavorite:function(){var e=t(this),i=e.data("sequence-oid");a.ajax.post("switch-user-favorite.json",{oid:i},function(t,a){t.favorite?e.removeClass("fa-star-o").addClass("fa-star"):e.removeClass("fa-star").addClass("fa-star-o")})}}};t(".badge",'nav a[href="#review-comments.html"]').exists()&&(i.review.timer=setInterval(i.review.updateComments,i.review.timer_duration.general)),e.PyAMS_content=i}(jQuery,this);
+!function(o,t){"use strict";var l=t.MyAMS,a={widget:{treeview:{selectFolder:function(t,e){o(t.target).siblings('input[type="hidden"]').val(e.id)},unselectFolder:function(t,e){o(t.target).siblings('input[type="hidden"]').val(null)}}},TinyMCE:{initEditor:function(t){return tinyMCE.addI18n("fr",{"Link list":"Liste de liens","Toggle h3 header":"En-tête H3","Toggle h4 header":"En-tête H4","Insert internal link":"Insérer un lien interne","Link title":"Texte à afficher","Internal number":"N° interne"}),tinymce.PluginManager.add("internal_links",function(e,t){e.addButton("internal_links",{icon:"cloud-check",tooltip:"Insert internal link",image:"/--static--/pyams_content/img/internal-link.png",onclick:function(){e.windowManager.open({title:"Insert internal link",body:[{type:"textbox",name:"oid",label:"Internal number"},{type:"textbox",name:"title",label:"Link title",value:e.selection.getContent()}],onsubmit:function(t){e.insertContent('<a href="oid://'+t.data.oid+'">'+t.data.title+"</a>")}})}})}),tinyMCE.PluginManager.add("headers",function(i,t){["h3","h4"].forEach(function(a){i.addButton("header-"+a,{tooltip:"Toggle "+a+" header",text:a.toUpperCase(),onClick:function(){i.execCommand("mceToggleFormat",!1,a)},onPostRender:function(){var e=this,t=function(){i.formatter.formatChanged(a,function(t){e.active(t)})};i.formatter?t():i.on("init",t)}})})}),t.image_list=a.TinyMCE.getImagesList,t.link_list=a.TinyMCE.getLinksList,t.style_formats=[{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],t.plugins+=" internal_links headers",t.toolbar1&&(t.toolbar1="undo redo | header-h3 header-h4 styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),t.toolbar2&&(t.toolbar2="forecolor backcolor | charmap internal_links link | fullscreen preview print | code"),t},getImagesList:function(t){var e=o(document.activeElement).parents("form");if(e.exists()){var a=e.attr("data-ams-form-handler")||e.attr("action"),i=a.substr(0,a.lastIndexOf("/")+1);return l.ajax.post(i+"get-images-list.json",{},t)}},getLinksList:function(t){var e=o(document.activeElement).parents("form");if(e.exists()){var a=e.attr("data-ams-form-handler")||e.attr("action"),i=a.substr(0,a.lastIndexOf("/")+1);return l.ajax.post(i+"get-links-list.json",{},t)}}},galleries:{updateMediaTitle:function(t){o('img[id="'+t.media_id+'"]').attr("original-title",t.title)},switchMediaVisibility:function(t){return function(){var a=o(this),t=a.parents(".media"),e=t.parents(".gallery");l.ajax.post(e.data("ams-location")+"/set-media-visibility.json",{object_name:t.data("ams-element-name")},function(t,e){t.visible?(o("i",a).attr("class","fa fa-fw fa-eye"),a.parents(".btn-group").siblings("a.fancyimg").removeClass("not-visible")):(o("i",a).attr("class","fa fa-fw fa-eye-slash text-danger"),a.parents(".btn-group").siblings("a.fancyimg").addClass("not-visible"))})}},setOrder:function(t,e){if(!e||!e.item.hasClass("already-dropped")){var a=e.item.parents(".gallery"),i=o(".media",a).listattr("data-ams-element-name");l.ajax.post(a.data("ams-location")+"/set-medias-order.json",{medias:JSON.stringify(i)})}},removeMedia:function(t){return function(){var n=o(this);l.skin.bigBox({title:l.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+l.i18n.DELETE_WARNING,buttons:l.i18n.BTN_OK_CANCEL},function(t){if(t===l.i18n.BTN_OK){var e=n.parents(".gallery").data("ams-location"),a=n.parents(".media"),i=a.data("ams-element-name");l.ajax.post(e+"/delete-element.json",{object_name:i},function(t,e){a.remove()})}})}},afterFancyboxLoad:function(t,e){t.element.hasClass("not-visible")&&t.inner.prepend('<div class="hidden-mask"></div>')}},paragraphs:{preReload:function(){a.paragraphs.switched=o("i.switch.fa-minus-square-o","#paragraphs_list").parents("tr").listattr("id")},postReload:function(){o(a.paragraphs.switched).each(function(){o("i.switch.fa-plus-square-o",'[id="'+this+'"]').parents("div").first().click()}),delete a.paragraphs.switched},refreshParagraph:function(t){var e=o('tr[id="'+t.object_id+'"]');o("span.title",e).html(t.title||" - - - - - - - -")},switchEditor:function(t){var e=o(this),a=o("i.switch",e),i=e.parents("td"),n=o(".editor",i),s=e.parents("tr");if(a.hasClass("fa-plus-square-o")){var r=s.parents("table");n.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>'),l.ajax.post(r.data("ams-location")+"/get-paragraph-editor.json",{object_name:s.data("ams-element-name")},function(t){n.html(t),t&&(l.initContent(n),a.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),s.data("ams-disabled-handlers",!0),l.skin.scrollTo(n,{offset:n.height()-s.height()}))})}else l.skin.cleanContainer(n),n.empty(),a.removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),s.removeData("ams-disabled-handlers")},switchLastEditor:function(t){var e=o('table[id="'+t+'"]'),a=o("tr:last",e);o('[data-ams-click-handler="PyAMS_content.paragraphs.switchEditor"]',a).click()},switchAllEditors:function(t){var e=o(this),n=o("i",e),s=e.parents("table");n.hasClass("fa-plus-square-o")?(n.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),l.ajax.post(s.data("ams-location")+"/get-paragraphs-editors.json",{},function(t){for(var e in t)if(t.hasOwnProperty(e)){var a=o('tr[data-ams-element-name="'+e+'"]',s),i=o(".editor",a);i.is(":empty")&&i.html(t[e]),o(".fa-plus-square-o",a).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),a.data("ams-disabled-handlers",!0)}o("i.fa-plus-square-o",o("tbody",s)).exists()||n.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o"),l.initContent(s)})):(o(".editor",s).each(function(){l.skin.cleanContainer(o(this)),o(this).empty()}),o(".fa-minus-square-o",s).removeClass("fa-minus-square-o").addClass("fa-plus-square-o"),o("tr",s).removeData("ams-disabled-handlers"))},updateToolbar:function(t){var e=o('tr[id="'+t.object_id+'"]'),a=o(".title-toolbar",e);a.replaceWith(t.toolbar_tag),a=o(".title-toolbar",e),l.initContent(a)},updateMarkers:function(t){var e=o('tr[id="'+t.object_id+'"]'),a=o(".title-toolbar",e),i=o("DIV.action."+t.marker_type,a);i.exists()?i.replaceWith(t.marker_tag):o(t.marker_tag).appendTo(a),t.marker_tag&&(i=o("DIV.action."+t.marker_type,a),l.initContent(i)),l.helpers.sort(a,"weight")}},pictograms:{initManagerSelection:function(){var t=o(this),e=o('input[type="hidden"]',o(".selected-pictograms",t)).listattr("value");return{selected:JSON.stringify(e)}},switchPictogram:function(){var t=o(this),e=t.parents(".pictograms"),a=e.parents(".pictograms-manager");e.hasClass("available-pictograms")?o(".selected-pictograms",a).append(t):o(".available-pictograms",a).append(t)}},themes:{initExtracts:function(t){var e=o('select[name="form.widgets.thesaurus_name:list"]',t).val(),a=o('select[name="form.widgets.extract_name:list"]',t),i=a.val();e&&l.jsonrpc.post("getExtracts",{thesaurus_name:e},{url:"/api/thesaurus/json"},function(t){a.empty(),o(t.result).each(function(){o("<option></option>").attr("value",this.id).attr("selected",this.id===i).text(this.text).appendTo(a)})}),a.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(t){var a=o(t.currentTarget).parents("form"),e=o('select[name="form.widgets.thesaurus_name:list"]',a).val();e&&l.jsonrpc.post("getExtracts",{thesaurus_name:e},{url:"/api/thesaurus/json"},function(t){var e=o('select[name="form.widgets.extract_name:list"]',a).data("select2");e.results.empty(),e.opts.populateResults.call(e,e.results,t.result,{term:""})})}},fields:{refreshField:function(t){var e=o('table[id="form_fields_list"]'),a=o('tr[data-ams-element-name="'+t.object_name+'"]',e);o("td:nth-child(4)",a).html(t.title)}},imgmap:{init:function(){var t=o(this);l.ajax.check(o.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+l.devext+".js",function(){t.canvasAreaDraw({imageUrl:t.data("ams-image-url")})})},initPreview:function(){var t=o(this);l.ajax.check(o.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+l.devext+".js",function(){t.mapster({fillColor:"ff0000",fillOpacity:.35,selected:!0,highlight:!0,staticState:!0})})}},site:{switchVisibility:function(){return function(){var i=o(this),t=i.parents("tr").first();l.ajax.post(t.data("ams-location")+"/switch-content-visibility.json",{object_name:t.data("ams-element-name")},function(t,e){var a="fa-eye";t.visible||(a+="-slash"),t.published||(a+=" text-danger"),o("i",i).attr("class","fa fa-fw "+a)})}}},review:{timer:null,timer_duration:{general:3e4,chat:5e3},initComments:function(t){var e=o(".chat-body",t);e.animate({scrollTop:e[0].scrollHeight},1e3),clearInterval(a.review.timer),a.review.timer=setInterval(a.review.updateComments,a.review.timer_duration.chat),l.skin.registerCleanCallback(a.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(a.review.timer),a.review.timer=setInterval(a.review.updateComments,a.review.timer_duration.general)},updateComments:function(){var e,a=o(".badge",'nav a[href="#review-comments.html"]'),i=o(".chat-body",".widget-body");e=i.exists()?o(".message",i).length:parseInt(a.text()),l.ajax.post("get-last-review-comments.json",{count:e},function(t){i.exists()&&a.removeClass("bg-color-danger").addClass("bg-color-info"),e!==t.count&&(a.text(t.count).removeClass("hidden"),i.exists()&&(o(".messages",i).append(t.content),i.animate({scrollTop:i[0].scrollHeight},1e3)),i.exists()||a.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){o(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")}))})},initCommentData:function(t){var e=o(".chat-body",".widget-body");return{count:o(".message",e).length}},addCommentAction:function(){return function(){o('textarea[name="comment"]').focus()}},addCommentCallback:function(t){var e=o(this),a=e.parents(".widget-body");o(".messages",a).append(t.content),o('textarea[name="comment"]',e).val("");var i=o(".chat-body",a);i.animate({scrollTop:i[0].scrollHeight},1e3),o(".badge",'nav a[href="#review-comments.html"]').text(t.count).removeClass("hidden")}},profile:{switchFavorite:function(){var a=o(this),t=a.data("sequence-oid");l.ajax.post("switch-user-favorite.json",{oid:t},function(t,e){t.favorite?a.removeClass("fa-star-o").addClass("fa-star"):a.removeClass("fa-star").addClass("fa-star-o")})}}};o(".badge",'nav a[href="#review-comments.html"]').exists()&&(a.review.timer=setInterval(a.review.updateComments,a.review.timer_duration.general)),t.PyAMS_content=a}(jQuery,this);