Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ck_ruid_to_url portal transform #89

Merged
merged 3 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ Changelog
5.0.0b4 (unreleased)
--------------------

- Nothing changed yet.
- Set "other" as default link protocol, to lessen the chances that
https://resolveuid/xxxxx are setup with plonefinder.
[gotcha]

- Unregister ck_ruid_to_url as plone.outputfilters come with the same feature.
[gotcha]

- Include CKeditor resources only when user is logged in.
[gotcha]


5.0.0b3 (2023-11-13)
Expand Down
2 changes: 1 addition & 1 deletion src/collective/ckeditor/browser/ckeditorsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class ICKEditorBrowserSchema(Interface):
title=_(u"Allow link objects by UID"),
description=_(u"Check if you want url with Unique ID "
"(no more 404 errors when moving objects). "
"Notice that portal_transforms in standard "
"Notice that plone.outputfilters in standard "
"configuration transforms uid links in absolute urls "
"in view displays."),
default=True,
Expand Down
1 change: 1 addition & 0 deletions src/collective/ckeditor/browser/ckeditorview.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def cke_params(self):
params['filebrowserFlashBrowseUrl'] = flash_url
# the basehref must be set in wysiwyg template
# params['baseHref'] = self.cke_basehref
params['linkDefaultProtocol'] = "''"
params.update(self.cke_toolbars())
return params

Expand Down
5 changes: 0 additions & 5 deletions src/collective/ckeditor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
'Link', 'Unlink','-','About']
]"""

# quintagroup.com (from qPloneResolveUID product)
DOCUMENT_DEFAULT_OUTPUT_TYPE = "text/x-html-safe"
REQUIRED_TRANSFORM = "ck_ruid_to_url"

# taken from collective/ckeditor/_src/ckeditor/_source/plugins/scayt/plugin.js
# XXX warning order language correctly because if several values for the same
# main language, the first defined language will be used as fallback when
# trying to find SCAYT language to use when enableScaytOnStartup is True
Expand Down
2 changes: 1 addition & 1 deletion src/collective/ckeditor/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>5000</version>
<version>5010</version>
<dependencies>
<dependency>profile-collective.plonefinder:default</dependency>
<dependency>profile-collective.quickupload:default</dependency>
Expand Down
3 changes: 3 additions & 0 deletions src/collective/ckeditor/profiles/default/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,22 @@
<value key="compile">False</value>
<value key="jscompilation">ckeditor_vars.js</value>
<value key="last_compilation">2021-10-15 12:30:00</value>
<value key="expression">python: member is not None</value>
</records>
<records prefix="plone.bundles/collective.ckeditor.ckeditor_js" interface="Products.CMFPlone.interfaces.IBundleRegistry">
<value key="depends">collective.ckeditor.ckeditor_vars</value>
<value key="enabled">True</value>
<value key="compile">False</value>
<value key="jscompilation">++resource++ckeditor/ckeditor.js</value>
<value key="last_compilation">2021-10-15 12:30:00</value>
<value key="expression">python: member is not None</value>
</records>
<records prefix="plone.bundles/collective.ckeditor.ckeditor_plone" interface="Products.CMFPlone.interfaces.IBundleRegistry">
<value key="depends">collective.ckeditor.ckeditor_js</value>
<value key="enabled">True</value>
<value key="compile">False</value>
<value key="jscompilation">++resource++ckeditor_for_plone/ckeditor_plone.js</value>
<value key="last_compilation">2021-10-15 12:30:00</value>
<value key="expression">python: member is not None</value>
</records>
</registry>
12 changes: 12 additions & 0 deletions src/collective/ckeditor/profiles/to5010/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<registry>
<records prefix="plone.bundles/collective.ckeditor.ckeditor_vars" interface="Products.CMFPlone.interfaces.IBundleRegistry">
<value key="expression">python: member is not None</value>
</records>
<records prefix="plone.bundles/collective.ckeditor.ckeditor_js" interface="Products.CMFPlone.interfaces.IBundleRegistry">
<value key="expression">python: member is not None</value>
</records>
<records prefix="plone.bundles/collective.ckeditor.ckeditor_plone" interface="Products.CMFPlone.interfaces.IBundleRegistry">
<value key="expression">python: member is not None</value>
</records>
</registry>
38 changes: 1 addition & 37 deletions src/collective/ckeditor/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from collective.ckeditor import LOG
from collective.ckeditor.config import DOCUMENT_DEFAULT_OUTPUT_TYPE, \
REQUIRED_TRANSFORM
from Products.CMFPlone.utils import getToolByName
from Products.CMFPlone.interfaces import INonInstallable
from plone.registry.interfaces import IRegistry
Expand All @@ -15,10 +13,6 @@ def importFinalSteps(context):
if context.readDataFile('collective.ckeditor.txt') is None:
return
site = context.getSite()
registerTransform(site, 'ck_ruid_to_url',
'collective.ckeditor.transforms.ck_ruid_to_url')
registerTransformPolicy(site, DOCUMENT_DEFAULT_OUTPUT_TYPE,
REQUIRED_TRANSFORM)
LOG.info('CKEditor for Plone installed')


Expand All @@ -29,40 +23,9 @@ def uninstallSteps(context):
uninstallControlPanel(site)
uninstallFromRegistry(site)
uninstallMemberProperties(site)
unregisterTransform(site, 'ck_ruid_to_url')
unregisterTransformPolicy(site, DOCUMENT_DEFAULT_OUTPUT_TYPE,
REQUIRED_TRANSFORM)
LOG.info('CKEditor for Plone uninstalled')


def registerTransform(context, name, module):
transforms = getToolByName(context, 'portal_transforms')
if name not in transforms.objectIds():
transforms.manage_addTransform(name, module)
LOG.info("Registered transform '%s'" % name)
else:
LOG.info("Transform '%s' always registered" % name)


def registerTransformPolicy(context, output_mimetype, required_transform):
transforms = getToolByName(context, 'portal_transforms')
tpolicies = transforms.listPolicies()
mimetype_registered = False
for p in tpolicies:
out_type = p[0]
if out_type == output_mimetype:
policies = list(p[1])
if required_transform not in policies:
policies.append(required_transform)
transforms.manage_delPolicies([output_mimetype])
transforms.manage_addPolicy(output_mimetype, policies)
mimetype_registered = True
break
if not mimetype_registered:
transforms.manage_addPolicy(output_mimetype, [required_transform])
LOG.info("Registered policy for '%s' mimetype" % output_mimetype)


def uninstallControlPanel(context):
"""
Uninstall CKeditor control panel
Expand Down Expand Up @@ -164,4 +127,5 @@ def getNonInstallableProfiles(self):
"collective.ckeditor:uninstall",
"collective.ckeditor:to4350",
"collective.ckeditor:to4330",
"collective.ckeditor:to5010",
]
25 changes: 0 additions & 25 deletions src/collective/ckeditor/tests/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,3 @@ Control resource bundles in registry
>>> ckbundles = [name for name in bundles if name.startswith("collective.ckeditor")]
>>> len(ckbundles) == 3
True

Control portal_transforms installation
--------------------------------------

>>> transforms = getToolByName(portal, 'portal_transforms')
>>> output_mimetype = 'text/x-html-safe'
>>> cke_transform = 'ck_ruid_to_url'

Control if cke_transform is here

>>> cke_transform in transforms.objectIds()
True

Control if ckeditor policies are registered
>>> tpolicies = transforms.listPolicies()
>>> mimetype_registered = False
>>> for p in tpolicies :
... out_type = p[0]
... if out_type == output_mimetype :
... policies = p[1]
... if cke_transform in policies :
... mimetype_registered = True
... break
>>> mimetype_registered
True
1 change: 0 additions & 1 deletion src/collective/ckeditor/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'ckeditor_jsconfig.txt',
'uninstall.txt',
'widget.txt',
'transform_uids.txt',
]


Expand Down
207 changes: 0 additions & 207 deletions src/collective/ckeditor/tests/test_transform.py

This file was deleted.

Loading
Loading