diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/logo/__init__.py
--- a/src/pyams_content/shared/logo/__init__.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/logo/__init__.py Thu Sep 06 11:27:55 2018 +0200
@@ -15,20 +15,19 @@
# import standard library
-# import interfaces
-from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE
-from pyams_content.shared.logo.interfaces import IWfLogo, LOGO_CONTENT_TYPE, LOGO_CONTENT_NAME, ILogo, IWfLogoFactory
-from pyams_content.features.review import IReviewTarget
-
-# import packages
-from pyams_content.shared.common import WfSharedContent, register_content_type, SharedContent, WfSharedContentChecker, \
- IWfSharedContentFactory
-from pyams_file.property import FileProperty
-from pyams_utils.adapter import adapter_config
from zope.interface import implementer, provider
from zope.schema.fieldproperty import FieldProperty
from pyams_content import _
+# import interfaces
+from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE
+from pyams_content.features.review import IReviewTarget
+# import packages
+from pyams_content.shared.common import WfSharedContent, register_content_type, SharedContent, WfSharedContentChecker, \
+ IWfSharedContentFactory
+from pyams_content.shared.logo.interfaces import IWfLogo, LOGO_CONTENT_TYPE, LOGO_CONTENT_NAME, ILogo, IWfLogoFactory
+from pyams_file.property import FileProperty
+from pyams_utils.adapter import adapter_config
@implementer(IWfLogo, IReviewTarget)
@@ -38,6 +37,8 @@
content_type = LOGO_CONTENT_TYPE
content_name = LOGO_CONTENT_NAME
+ handle_header = False
+
image = FileProperty(IWfLogo['image'])
monochrome_image = FileProperty(IWfLogo['monochrome_image'])
url = FieldProperty(IWfLogo['url'])
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/logo/paragraph.py
--- a/src/pyams_content/shared/logo/paragraph.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/logo/paragraph.py Thu Sep 06 11:27:55 2018 +0200
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_utils.zodb import volatile_property
__docformat__ = 'restructuredtext'
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/folder.py
--- a/src/pyams_content/shared/site/folder.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/folder.py Thu Sep 06 11:27:55 2018 +0200
@@ -53,8 +53,11 @@
roles_interface = ISiteFolderRoles
heading = FieldProperty(ISiteFolder['heading'])
+ notepad = FieldProperty(ISiteFolder['notepad'])
+
+ visible_in_list = FieldProperty(ISiteFolder['visible_in_list'])
navigation_title = FieldProperty(ISiteFolder['navigation_title'])
- notepad = FieldProperty(ISiteFolder['notepad'])
+ navigation_mode = FieldProperty(ISiteFolder['navigation_mode'])
content_name = _("Site folder")
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/interfaces/__init__.py
--- a/src/pyams_content/shared/site/interfaces/__init__.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/interfaces/__init__.py Thu Sep 06 11:27:55 2018 +0200
@@ -14,6 +14,7 @@
# import standard library
+from collections import OrderedDict
# import interfaces
from pyams_content.interfaces import IBaseContent
@@ -28,11 +29,23 @@
from pyams_i18n.schema import I18nTextLineField, I18nTextField
from zope.container.constraints import containers, contains
from zope.interface import Interface, Attribute
-from zope.schema import Text, Bool
+from zope.schema import Text, Bool, Choice
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from pyams_content import _
+FOLDER_REDIRECT_DISPLAY_MODE = 'redirect'
+FOLDER_TEMPLATE_DISPLAY_MODE = 'template'
+
+FOLDER_DISPLAY_MODES = OrderedDict((
+ (FOLDER_REDIRECT_DISPLAY_MODE, _("Redirect to first visible sub-folder or content")),
+ (FOLDER_TEMPLATE_DISPLAY_MODE, _("Use presentation template"))
+))
+
+FOLDER_DISPLAY_MODE_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) for v, t in FOLDER_DISPLAY_MODES.items()])
+
+
class ISiteElement(IContained, IDeletableElement):
"""Base site element interface"""
@@ -60,14 +73,26 @@
description=_("Heading displayed according to presentation template"),
required=False)
- navigation_title = I18nTextLineField(title=_("Navigation title"),
- description=_("Title displayed in navigation items"),
- required=False)
-
notepad = Text(title=_("Notepad"),
description=_("Internal information to be known about this content"),
required=False)
+ visible_in_list = Bool(title=_("Visible in folders list"),
+ description=_("If 'no', folder will not be displayed into folders list"),
+ required=True,
+ default=True)
+
+ navigation_title = I18nTextLineField(title=_("Navigation title"),
+ description=_("Folder's title displayed in navigation pages; "
+ "original title will be used if none is specified"),
+ required=False)
+
+ navigation_mode = Choice(title=_("Navigation mode"),
+ description=_("Folder behaviour when navigating to folder URL"),
+ required=True,
+ vocabulary=FOLDER_DISPLAY_MODE_VOCABULARY,
+ default=FOLDER_REDIRECT_DISPLAY_MODE)
+
class ISiteFolderFactory(Interface):
"""Site folder factory interface"""
@@ -111,9 +136,10 @@
class IContentLink(ISiteElement, IInternalReference, IAttributeAnnotatable):
"""Rented content interface"""
- alt_title = I18nTextLineField(title=_("Alternate title"),
- description=_("Content title, as shown in front-office"),
- required=False)
+ navigation_title = I18nTextLineField(title=_("Navigation title"),
+ description=_("Alternate content's title displayed in navigation pages; "
+ "original title will be used if none is specified"),
+ required=False)
visible = Bool(title=_("Visible?"),
description=_("If 'no', link is not visible"),
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/link.py
--- a/src/pyams_content/shared/site/link.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/link.py Thu Sep 06 11:27:55 2018 +0200
@@ -43,7 +43,7 @@
"""
reference = FieldProperty(IContentLink['reference'])
- alt_title = FieldProperty(IContentLink['alt_title'])
+ navigation_title = FieldProperty(IContentLink['navigation_title'])
visible = FieldProperty(IContentLink['visible'])
content_name = _("Content link")
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/zmi/__init__.py
--- a/src/pyams_content/shared/site/zmi/__init__.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/__init__.py Thu Sep 06 11:27:55 2018 +0200
@@ -20,7 +20,7 @@
from pyams_content.interfaces import CREATE_CONTENT_PERMISSION
from pyams_content.shared.common.interfaces import IWfSharedContent
from pyams_content.shared.site.interfaces import ISiteContainer, ISiteManager, IWfTopic
-from pyams_i18n.interfaces import II18nManager
+from pyams_i18n.interfaces import II18nManager, INegotiator
from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IMenuHeader
from pyams_skin.layer import IPyAMSLayer
from pyams_workflow.interfaces import IWorkflowInfo, IWorkflowVersions
@@ -37,7 +37,7 @@
from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import get_utility
from pyams_utils.traversing import get_parent
-from pyams_utils.url import absolute_url
+from pyams_utils.url import absolute_url, generate_url
from pyams_viewlet.viewlet import viewlet_config
from pyramid.decorator import reify
from pyramid.path import DottedNameResolver
@@ -114,11 +114,13 @@
def update_content(self, content, data):
data = data.get(self, data)
# initialize content fields
+ lang = get_utility(INegotiator).server_language
+ content.creator = self.request.principal.id
+ content.owner = self.request.principal.id
content.title = data['title']
content.short_name = content.title.copy()
+ content.content_url = generate_url(content.title.get(lang, ''))
content.notepad = data.get('notepad')
- content.creator = self.request.principal.id
- content.owner = self.request.principal.id
# get parent
intids = get_utility(IIntIds)
parent = intids.queryObject(data.get('parent'))
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/zmi/container.py
--- a/src/pyams_content/shared/site/zmi/container.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py Thu Sep 06 11:27:55 2018 +0200
@@ -80,7 +80,7 @@
@property
def label(self):
- return II18n(self.context).query_attribute('short_name', request=self.request)
+ return II18n(self.context).query_attribute('title', request=self.request)
@adapter_config(context=(ISiteContainer, IAdminLayer), provides=IUserAddingsMenuLabel)
@@ -334,7 +334,7 @@
icon_class = 'fa-eye-slash text-danger opaque'
return '
'.format(
icon_class=icon_class,
- title=self.request.localizer.translate(self.icon_hint))
+ title=self.request.localizer.translate(self.get_icon_hint(item)))
def get_icon_hint(self, item):
translate = self.request.localizer.translate
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/zmi/folder.py
--- a/src/pyams_content/shared/site/zmi/folder.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/folder.py Thu Sep 06 11:27:55 2018 +0200
@@ -9,6 +9,8 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_form.group import NamedWidgetsGroup
+from pyams_form.interfaces.form import IInnerSubForm
__docformat__ = 'restructuredtext'
@@ -31,7 +33,7 @@
# import packages
from pyams_content.shared.common.zmi.manager import SharedToolPropertiesEditForm
from pyams_content.shared.site.zmi.widget import SiteManagerFoldersSelectorFieldWidget
-from pyams_form.form import AJAXAddForm, AJAXEditForm, ajax_config
+from pyams_form.form import AJAXAddForm, ajax_config
from pyams_i18n.schema import I18nTextLineField
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.table import DefaultElementEditorAdapter
@@ -42,10 +44,9 @@
from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogAddForm
+from pyams_zmi.form import AdminDialogAddForm, InnerAdminEditForm
from pyramid.events import subscriber
from pyramid.path import DottedNameResolver
-from pyramid.view import view_config
from z3c.form import field
from zope.interface import Interface, Invalid
from zope.schema import Text, Int
@@ -182,16 +183,45 @@
@pagelet_config(name='properties.html', context=ISiteFolder, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
+@ajax_config(name='properties.json', context=ISiteFolder, layer=IPyAMSLayer)
class SiteFolderPropertiesEditForm(SharedToolPropertiesEditForm):
"""Site folder properties edit form"""
legend = _("Site folder properties")
- fields = field.Fields(ISiteFolder).select('title', 'short_name', 'heading', 'navigation_title', 'notepad') + \
+ fields = field.Fields(ISiteFolder).select('title', 'short_name', 'heading', 'notepad') + \
field.Fields(IBaseSharedTool).select('shared_content_workflow')
-@view_config(name='properties.json', context=ISiteFolder, request_type=IPyAMSLayer,
- permission=MANAGE_TOOL_PERMISSION, renderer='json', xhr=True)
-class SiteFolderPropertiesAJAXEditForm(AJAXEditForm, SiteFolderPropertiesEditForm):
- """Site folder properties edit form, JSON renderer"""
+@adapter_config(name='navigation', context=(ISiteFolder, IPyAMSLayer, SiteFolderPropertiesEditForm),
+ provides=IInnerSubForm)
+class SiteFolderNavigationPropertiesEditForm(InnerAdminEditForm):
+ """Site folder navigation properties edit form"""
+
+ prefix = 'navigation_form.'
+
+ css_class = 'form-group'
+ padding_class = ''
+ fieldset_class = 'bordered margin-top-10 padding-y-5'
+
+ legend = None
+ main_group_legend = _("Navigation properties")
+ main_group_class = 'inner switcher no-y-padding'
+
+ fields = field.Fields(ISiteFolder).select('visible_in_list', 'navigation_title', 'navigation_mode')
+
+ weight = 5
+
+ def check_mode(self):
+ if self.parent_form is not None:
+ self.mode = self.parent_form.mode
+
+ def updateGroups(self):
+ self.add_group(NamedWidgetsGroup(self, 'navigation', self.widgets,
+ ('visible_in_list', 'navigation_title', 'navigation_mode'),
+ fieldset_class=self.fieldset_class,
+ legend=self.main_group_legend,
+ css_class=self.main_group_class,
+ switch=True,
+ display_mode='auto'))
+ super(SiteFolderNavigationPropertiesEditForm, self).updateGroups()
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/zmi/link.py
--- a/src/pyams_content/shared/site/zmi/link.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/link.py Thu Sep 06 11:27:55 2018 +0200
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_skin.event import get_json_table_row_refresh_event
__docformat__ = 'restructuredtext'
@@ -76,7 +75,7 @@
legend = _("Rent existing content")
- fields = field.Fields(IContentLinkAddFormFields).select('reference', 'alt_title', 'parent')
+ fields = field.Fields(IContentLinkAddFormFields).select('reference', 'navigation_title', 'parent')
fields['parent'].widgetFactory = SiteManagerFoldersSelectorFieldWidget
edit_permission = CREATE_CONTENT_PERMISSION
@@ -94,7 +93,7 @@
def update_content(self, content, data):
data = data.get(self, data)
content.reference = data.get('reference')
- content.alt_title = data['alt_title']
+ content.navigation_title = data['navigation_title']
intids = get_utility(IIntIds)
parent = intids.queryObject(data.get('parent'))
if parent is not None:
@@ -115,7 +114,7 @@
@property
def name(self):
- title = II18n(self.context).query_attribute('alt_title', request=self.request)
+ title = II18n(self.context).query_attribute('navigation_title', request=self.request)
if not title:
target = self.context.get_target()
if target is not None:
@@ -134,7 +133,7 @@
legend = _("Edit content link properties")
- fields = field.Fields(IContentLink).omit('__parent__', '__name__')
+ fields = field.Fields(IContentLink).omit('__parent__', '__name__', 'visible')
edit_permission = MANAGE_CONTENT_PERMISSION
def get_ajax_output(self, changes):
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/site/zmi/manager.py
--- a/src/pyams_content/shared/site/zmi/manager.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/manager.py Thu Sep 06 11:27:55 2018 +0200
@@ -63,7 +63,7 @@
@property
def label(self):
- return II18n(self.context).query_attribute('short_name', request=self.request)
+ return II18n(self.context).query_attribute('title', request=self.request)
css_class = 'strong'
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/view/__init__.py
--- a/src/pyams_content/shared/view/__init__.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/view/__init__.py Thu Sep 06 11:27:55 2018 +0200
@@ -24,6 +24,7 @@
from hypatia.interfaces import ICatalog
from pyams_content.features.preview.interfaces import IPreviewTarget
from pyams_content.features.review.interfaces import IReviewTarget
+from pyams_content.shared.common.interfaces.types import IWfTypedSharedContent
from pyams_content.shared.view.interfaces import IView, IWfView, IWfViewFactory, IViewQuery, \
IViewQueryParamsExtension, IViewQueryFilterExtension, VIEW_CONTENT_TYPE, VIEW_CONTENT_NAME, IViewSettings
from pyams_utils.interfaces import ICacheKeyValue
@@ -63,8 +64,12 @@
content_type = VIEW_CONTENT_TYPE
content_name = VIEW_CONTENT_NAME
+ handle_header = False
+
select_context_type = FieldProperty(IWfView['select_context_type'])
selected_content_types = FieldProperty(IWfView['selected_content_types'])
+ select_context_datatype = FieldProperty(IWfView['select_context_datatype'])
+ selected_datatypes = FieldProperty(IWfView['selected_datatypes'])
order_by = FieldProperty(IWfView['order_by'])
reversed_order = FieldProperty(IWfView['reversed_order'])
limit = FieldProperty(IWfView['limit'])
@@ -89,6 +94,16 @@
content_types |= set(self.selected_content_types)
return list(content_types)
+ def get_data_types(self, context):
+ data_types = set()
+ if self.select_context_datatype:
+ content = IWfTypedSharedContent(context, None)
+ if content is not None:
+ data_types.add(content.data_type)
+ if self.selected_datatypes:
+ data_types |= set(self.selected_datatypes)
+ return list(data_types)
+
def get_results(self, context, sort_index=None, reverse=None, limit=None, ignore_cache=False):
results = _MARKER
if not ignore_cache:
@@ -153,6 +168,10 @@
content_types = view.get_content_types(context)
if content_types:
params &= Any(catalog['content_type'], content_types)
+ # check data types
+ data_types = view.get_data_types(context)
+ if data_types:
+ params &= Any(catalog['data_type'], data_types)
# check workflow states
wf_params = None
for workflow in registry.getAllUtilitiesRegisteredFor(IWorkflow):
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/view/interfaces/__init__.py
--- a/src/pyams_content/shared/view/interfaces/__init__.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/view/interfaces/__init__.py Thu Sep 06 11:27:55 2018 +0200
@@ -16,13 +16,15 @@
# import standard library
# import interfaces
-from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool
+from pyams_content.shared.common.interfaces import ISharedContent, IWfSharedContent, ISharedTool, \
+ CONTENT_TYPES_VOCABULARY
+from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
from pyams_sequence.interfaces import IInternalReferencesList
# import packages
from pyams_thesaurus.schema import ThesaurusTermsListField
from zope.interface import Interface, Attribute
-from zope.schema import List, Choice, Bool, Int
+from zope.schema import List, Set, Choice, Bool, Int
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from pyams_content import _
@@ -64,14 +66,28 @@
required=True,
default=False)
- selected_content_types = List(title=_("Other content types"),
- description=_("Selected content types; leave empty for all"),
- value_type=Choice(vocabulary='PyAMS content types'),
- required=False)
+ selected_content_types = Set(title=_("Other content types"),
+ description=_("Selected content types; leave empty for all"),
+ value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY),
+ required=False)
def get_content_types(self, context):
"""Get content types for given context"""
+ select_context_datatype = Bool(title=_("Select context data type?"),
+ description=_("If 'yes', content data type (if available) will be extracted from "
+ "context"),
+ required=True,
+ default=False)
+
+ selected_datatypes = Set(title=_("Other data types"),
+ description=_("Selected data types; leave empty for all"),
+ value_type=Choice(vocabulary=ALL_DATA_TYPES_VOCABULARY),
+ required=False)
+
+ def get_data_types(self, context):
+ """Get data types for given context"""
+
order_by = Choice(title=_("Order by"),
description=_("Property to use to sort results"),
vocabulary=VIEW_ORDER_VOCABULARY,
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/shared/view/zmi/properties.py
--- a/src/pyams_content/shared/view/zmi/properties.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/shared/view/zmi/properties.py Thu Sep 06 11:27:55 2018 +0200
@@ -14,17 +14,22 @@
# import standard library
+import json
# import interfaces
from pyams_content.shared.view.interfaces import IWfView
from pyams_form.interfaces.form import IInnerSubForm
from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces.data import IObjectData
# import packages
+from pyams_content.shared.common.types import get_all_data_types
from pyams_content.shared.common.zmi.properties import SharedContentPropertiesEditForm
+from pyams_form.widget import HiddenSelect2FieldWidget
from pyams_utils.adapter import adapter_config
from pyams_zmi.form import InnerAdminEditForm
from z3c.form import field
+from zope.interface import alsoProvides
from pyams_content import _
@@ -41,5 +46,19 @@
fieldset_class = 'bordered no-x-margin margin-y-10'
fields = field.Fields(IWfView).select('select_context_type', 'selected_content_types',
+ 'select_context_datatype', 'selected_datatypes',
'order_by', 'reversed_order', 'limit')
+ fields['selected_datatypes'].widgetFactory = HiddenSelect2FieldWidget
+
weight = 1
+
+ def updateWidgets(self, prefix=None):
+ super(ViewPropertiesEditForm, self).updateWidgets(prefix)
+ if 'selected_datatypes' in self.widgets:
+ widget = self.widgets['selected_datatypes']
+ # widget.multiple = True
+ widget.object_data = {
+ 'ams-select2-multiple': True,
+ 'ams-select2-data': json.dumps(get_all_data_types(self.request))
+ }
+ alsoProvides(widget, IObjectData)
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/site.py
--- a/src/pyams_content/site.py Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/site.py Thu Sep 06 11:27:55 2018 +0200
@@ -18,14 +18,13 @@
# import interfaces
from hypatia.interfaces import ICatalog
-from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_content.shared.site.interfaces import IContentLink
from zope.intid.interfaces import IIntIds
# import packages
from pyams_utils.container import find_objects_providing
from pyams_utils.registry import set_local_registry, get_utility
from pyams_utils.site import site_factory
+from zope.interface import Interface
def site_index(request):
@@ -35,13 +34,14 @@
try:
set_local_registry(application.getSiteManager())
catalog = get_utility(ICatalog)
+ catalog.reset()
+ transaction.savepoint()
intids = get_utility(IIntIds)
- for document in find_objects_providing(application, IWfSharedContent):
+ for index, document in enumerate(find_objects_providing(application, Interface)):
print("Indexing: {0!r}".format(document))
catalog.reindex_doc(intids.register(document), document)
- for document in find_objects_providing(application, IContentLink):
- print("Indexing: {0!r}".format(document))
- catalog.reindex_doc(intids.register(document), document)
+ if not index % 100:
+ transaction.savepoint()
finally:
set_local_registry(None)
transaction.commit()
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/skin/resources/css/pyams_content.css
--- a/src/pyams_content/skin/resources/css/pyams_content.css Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/skin/resources/css/pyams_content.css Thu Sep 06 11:27:55 2018 +0200
@@ -46,3 +46,6 @@
.pictograms-manager .pictogram:last-child {
border-bottom: none;
}
+.sortable.gallery {
+ max-height: 550px;
+}
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/skin/resources/css/pyams_content.min.css
--- a/src/pyams_content/skin/resources/css/pyams_content.min.css Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/skin/resources/css/pyams_content.min.css Thu Sep 06 11:27:55 2018 +0200
@@ -1,1 +1,1 @@
-.ams-widget.comments .widget-body{position:fixed;height:calc(100% - 337px)}.ams-widget.comments .widget-body .chat-body{position:relative;height:100%}.ams-widget.comments .widget-body .chat-footer{position:fixed;bottom:10px}.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 240px)}@media (max-width:767px){.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 10px)}}@media (min-width:768px) and (max-width:979px){.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 20px)}}.minified .ams-widget.comments .widget-body,.minified .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 65px)}@media (max-width:767px){.minified .ams-widget.comments .widget-body,.minified .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 55px)}}.hidden-menu .ams-widget.comments .widget-body,.hidden-menu .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 30px)}.pictograms-manager .pictogram{border-bottom:1px solid silver}.pictograms-manager .pictogram:last-child{border-bottom:none}
+.ams-widget.comments .widget-body{position:fixed;height:calc(100% - 337px)}.ams-widget.comments .widget-body .chat-body{position:relative;height:100%}.ams-widget.comments .widget-body .chat-footer{position:fixed;bottom:10px}.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 240px)}@media (max-width:767px){.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 10px)}}@media (min-width:768px) and (max-width:979px){.ams-widget.comments .widget-body,.ams-widget.comments .widget-body .chat-footer{width:calc(100% - 20px)}}.minified .ams-widget.comments .widget-body,.minified .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 65px)}@media (max-width:767px){.minified .ams-widget.comments .widget-body,.minified .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 55px)}}.hidden-menu .ams-widget.comments .widget-body,.hidden-menu .ams-widget.comments .widget-body .chat-footer{width:calc(100% - 30px)}.pictograms-manager .pictogram{border-bottom:1px solid silver}.pictograms-manager .pictogram:last-child{border-bottom:none}.sortable.gallery{max-height:550px}
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/skin/resources/js/pyams_content.js
--- a/src/pyams_content/skin/resources/js/pyams_content.js Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.js Thu Sep 06 11:27:55 2018 +0200
@@ -173,6 +173,7 @@
var source = $(this);
var media = source.parents('.media');
var gallery = media.parents('.gallery');
+ $('i', source).attr('class', 'fa fa-fw fa-spinner fa-pulse');
MyAMS.ajax.post(gallery.data('ams-location') + '/set-media-visibility.json',
{object_name: media.data('ams-element-name')},
function(result, status) {
@@ -350,24 +351,6 @@
MyAMS.initContent(marker);
}
MyAMS.helpers.sort(toolbar, 'weight');
- },
-
- switchAnchor: function() {
- return function () {
- var source = $(this);
- var element = source.parents('tr').first();
- var container = element.parents('table');
- MyAMS.ajax.post(container.data('ams-location') + '/' +
- container.data('ams-anchor-switcher'),
- {object_name: element.data('ams-element-name')},
- function (result, status) {
- if (result.anchor) {
- $('i', source).attr('class', 'fa fa-fw fa-anchor');
- } else {
- $('i', source).attr('class', 'fa fa-fw fa-anchor txt-color-silver opacity-50');
- }
- });
- }
}
},
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/skin/resources/js/pyams_content.min.js
--- a/src/pyams_content/skin/resources/js/pyams_content.min.js Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.min.js Thu Sep 06 11:27:55 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('
'+e.data.title+"")}})}})}),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:'
'+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('
')}},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('
'),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")},switchAnchor:function(){return function(){var e=t(this),i=e.parents("tr").first(),n=i.parents("table");a.ajax.post(n.data("ams-location")+"/"+n.data("ams-anchor-switcher"),{object_name:i.data("ams-element-name")},function(a,i){a.anchor?t("i",e).attr("class","fa fa-fw fa-anchor"):t("i",e).attr("class","fa fa-fw fa-anchor txt-color-silver opacity-50")})}}},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="manager_themes.widgets.thesaurus_name:list"]',e).val(),n=t('select[name="manager_themes.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("
").attr("value",this.id).attr("selected",this.id===s).text(this.text).appendTo(n)})})},getExtracts:function(e){var i=t(e.currentTarget).parents("form"),n=t('select[name="manager_themes.widgets.thesaurus_name:list"]',i).val(),s=t('select[name="manager_themes.widgets.extract_name:list"]',i),r=s.data("select2");n&&"--NOVALUE--"!==n?a.jsonrpc.post("getExtracts",{thesaurus_name:n},{url:"/api/thesaurus/json"},function(t){r.results.empty(),r.opts.populateResults.call(r,r.results,t.result,{term:""})}):(s.select2("data",null),r.results.empty(),r.opts.populateResults.call(r,r.results,[],{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})})}},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")}},header:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},footer:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},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(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('
'+e.data.title+"")}})}})}),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");t("i",e).attr("class","fa fa-fw fa-spinner fa-pulse"),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:'
'+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('
')}},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('
'),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="manager_themes.widgets.thesaurus_name:list"]',e).val(),n=t('select[name="manager_themes.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("
").attr("value",this.id).attr("selected",this.id===s).text(this.text).appendTo(n)})})},getExtracts:function(e){var i=t(e.currentTarget).parents("form"),n=t('select[name="manager_themes.widgets.thesaurus_name:list"]',i).val(),s=t('select[name="manager_themes.widgets.extract_name:list"]',i),r=s.data("select2");n&&"--NOVALUE--"!==n?a.jsonrpc.post("getExtracts",{thesaurus_name:n},{url:"/api/thesaurus/json"},function(t){r.results.empty(),r.opts.populateResults.call(r,r.results,t.result,{term:""})}):(s.select2("data",null),r.results.empty(),r.opts.populateResults.call(r,r.results,[],{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})})}},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")}},header:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},footer:{submitEditForm:function(){var e=t(this).parents("form").first();a.form.submit(e,{form_data:{autosubmit:!0}})}},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);
diff -r 1afd36ed6947 -r a2f3b82f93c3 src/pyams_content/skin/resources/less/pyams_content.less
--- a/src/pyams_content/skin/resources/less/pyams_content.less Tue Jul 17 15:12:43 2018 +0200
+++ b/src/pyams_content/skin/resources/less/pyams_content.less Thu Sep 06 11:27:55 2018 +0200
@@ -50,3 +50,10 @@
border-bottom: none;
}
}
+
+
+.sortable {
+ &.gallery {
+ max-height: 550px;
+ }
+}
\ No newline at end of file