diff --git a/.gitignore b/.gitignore index 3e3f6ae..50b1c19 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ testrelease include/ lib/ +.DS_Store diff --git a/CHANGES.rst b/CHANGES.rst index a55d28f..3498fda 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,12 @@ JQueryUI Changelog: http://jqueryui.com/changelog/ Bug fixes: +- Added uninstall profile + [agitator] + +- Python 2/3 compatibility + [pbauer] + - Simplify resource registration for Plone 5 the way done in https://github.com/collective/example.p4p5#cssjs-declaration-in-plone-5 [rnix] diff --git a/collective/js/jqueryui/controlpanel.py b/collective/js/jqueryui/controlpanel.py index c813fa1..f41b622 100644 --- a/collective/js/jqueryui/controlpanel.py +++ b/collective/js/jqueryui/controlpanel.py @@ -198,7 +198,7 @@ def verify_jsregistry(record): site = getSite() jsregistry = site.portal_javascripts - keys = JQUERYUI_DEPENDENCIES.keys() + keys = list(JQUERYUI_DEPENDENCIES.keys()) for key in keys: rkey = key.replace('.', '_') resource_id = RESOURCE_ID % key diff --git a/collective/js/jqueryui/profiles.zcml b/collective/js/jqueryui/profiles.zcml index f213d8e..e33ba4f 100644 --- a/collective/js/jqueryui/profiles.zcml +++ b/collective/js/jqueryui/profiles.zcml @@ -30,6 +30,15 @@ description="Install jQuery UI." provides="Products.GenericSetup.interfaces.EXTENSION" /> + <genericsetup:registerProfile + name="uninstall" + title="jQuery UI (uninstall)" + directory="profiles/uninstall" + description="Uninstalls the jQuery UI add-on." + provides="Products.GenericSetup.interfaces.EXTENSION" + /> + + <!-- Hide profiles/products from Quick Installer --> <utility factory=".setuphandlers.HiddenProfiles" name="collective.js.jqueryui" /> <utility factory=".setuphandlers.HiddenProducts" name="collective.js.jqueryui" /> diff --git a/collective/js/jqueryui/profiles/default/metadata.xml b/collective/js/jqueryui/profiles/default/metadata.xml index 24b1137..58b9ffd 100644 --- a/collective/js/jqueryui/profiles/default/metadata.xml +++ b/collective/js/jqueryui/profiles/default/metadata.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <metadata> - <version>3203</version> + <version>3204</version> <dependencies> <dependency>profile-collective.js.jqueryui:install-base</dependency> </dependencies> diff --git a/collective/js/jqueryui/profiles/uninstall/actions.xml b/collective/js/jqueryui/profiles/uninstall/actions.xml new file mode 100644 index 0000000..f0b26a6 --- /dev/null +++ b/collective/js/jqueryui/profiles/uninstall/actions.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<object name="portal_actions" meta_type="Plone Actions Tool" + xmlns:i18n="http://xml.zope.org/namespaces/i18n"> + <object name="jqueryui_panels" meta_type="CMF Action Category" remove="true"/> + <object name="sunburst" meta_type="CMF Action" i18n:domain="collective.js.jqueryui" remove="true"/> +</object> diff --git a/collective/js/jqueryui/profiles/uninstall/browserlayer.xml b/collective/js/jqueryui/profiles/uninstall/browserlayer.xml new file mode 100644 index 0000000..9697923 --- /dev/null +++ b/collective/js/jqueryui/profiles/uninstall/browserlayer.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<layers> + <layer + name="collective.js.jqueryui" + remove="true" + /> +</layers> diff --git a/collective/js/jqueryui/profiles/uninstall/controlpanel.xml b/collective/js/jqueryui/profiles/uninstall/controlpanel.xml new file mode 100644 index 0000000..dcedde7 --- /dev/null +++ b/collective/js/jqueryui/profiles/uninstall/controlpanel.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<object + name="portal_controlpanel" + xmlns:i18n="http://xml.zope.org/namespaces/i18n" + i18n:domain="collective.jqueryuithememanager"> + + <configlet + title="JQueryUI" + action_id="collective.js.jqueryui" + appId="collective.js.jqueryui" + category="Products" + condition_expr="" + url_expr="string:${portal_url}/@@jqueryui-controlpanel" + icon_expr="string:${portal_url}/++resource++jqueryui_icon.jpg" + visible="True" + i18n:attributes="title" + remove="true"> + </configlet> + +</object> diff --git a/collective/js/jqueryui/profiles/uninstall/registry.xml b/collective/js/jqueryui/profiles/uninstall/registry.xml new file mode 100644 index 0000000..002aa7a --- /dev/null +++ b/collective/js/jqueryui/profiles/uninstall/registry.xml @@ -0,0 +1,7 @@ +<registry> + <records interface="collective.js.jqueryui.controlpanel.IJQueryUIPlugins" remove="true" /> + <records interface="collective.js.jqueryui.controlpanel.IJQueryUICSS" remove="true" /> + <records prefix="plone.bundles/jqueryui" + interface='Products.CMFPlone.interfaces.IBundleRegistry' remove="true" /> + +</registry> diff --git a/collective/js/jqueryui/resources.py b/collective/js/jqueryui/resources.py index 632dd0c..340daa1 100644 --- a/collective/js/jqueryui/resources.py +++ b/collective/js/jqueryui/resources.py @@ -1,22 +1,16 @@ import logging from copy import copy from zope import component -from StringIO import StringIO -try: - from zope.component.hooks import getSite -except ImportError: - #BBB - from zope.site.hooks import getSite +from six import StringIO from plone.registry.interfaces import IRegistry from Products.CMFCore.utils import getToolByName +from Products.CMFPlone.utils import safe_unicode from Products.Five import BrowserView from Products.ResourceRegistries.tools.packer import CSSPacker from Products.ResourceRegistries.tools.packer import JavascriptPacker from Products.ResourceRegistries.utils import applyPrefix - from collective.js.jqueryui import interfaces, config -from Acquisition import aq_parent logger = logging.getLogger('collective.js.jqueryui') @@ -85,7 +79,7 @@ def get_resources_content(self, resources): try: resource = self.context.restrictedTraverse( resourceid) - except KeyError, e: + except KeyError as e: logger.error(e) continue if not resource: @@ -102,13 +96,9 @@ def get_resources_content(self, resources): fic = open(resource.context.path, 'r') content = fic.read() fic.close() - try: - content = unicode(content) - - except Exception, e: - content = unicode(content.decode('utf-8')) + content = safe_unicode(content) - #css applyPrefix + # css applyPrefix if self._css: upath = upath.rstrip('/') prefix = '/'.join([upath, resourceid]) @@ -118,7 +108,7 @@ def get_resources_content(self, resources): prefix.split('/')[:-1]) content = applyPrefix(content, prefix) - #content is already minified + # content is already minified data.write(content) data.write(u"\n") @@ -141,7 +131,7 @@ def get_resources(self): portal_registry""" settings = self.settings() deps = config.JQUERYUI_DEPENDENCIES - alljs = deps.keys() + alljs = list(deps.keys()) resources = [] wanted = [] # not ordered list of wanted plugins tpl = "++resource++jquery-ui/jquery.%s.min.js" diff --git a/setup.py b/setup.py index 93b5438..507e36d 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,8 @@ "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", ], keywords='plone jqueryui', author='JeanMichel FRANCOIS aka toutpt',