def uninstall(self): out = StringIO() # remove the configlet from the portal control panel configTool = getToolByName(self, 'portal_controlpanel', None) if configTool: configTool.unregisterConfiglet('kupu') out.write('Removed kupu configlet\n') # remove from list of available editors portal_props = getToolByName(self, 'portal_properties') site_props = getattr(portal_props,'site_properties', None) attrname = 'available_editors' if site_props is not None: editors = list(site_props.getProperty(attrname)) if 'Kupu' in editors: editors.remove('Kupu') site_props._updateProperty(attrname, editors) print >>out, "Removed 'Kupu' from available editors in Plone." uninstall_transform(self, out) uninstall_tool(self, out) uninstall_resources(self, out) unregister_layers(self, ['kupu_plone', 'kupu_references', 'kupu'], out) print >> out, "Successfully uninstalled %s." % PROJECTNAME return out.getvalue()
def uninstall(self): out = StringIO() # remove the configlet from the portal control panel configTool = getToolByName(self, 'portal_controlpanel', None) if configTool: configTool.unregisterConfiglet('kupu') out.write('Removed kupu configlet\n') uninstall_transform(self, out) uninstall_tool(self, out) uninstall_resources(self, out) unregister_layers(self, ['kupu_plone', 'kupu_references', 'kupu'], out) print >> out, "Successfully uninstalled %s." % PROJECTNAME return out.getvalue()
def configure_kupu(self, linkbyuid=None, table_classnames=None, html_exclusions=None, style_whitelist=None, class_blacklist=None, installBeforeUnload=None, parastyles=None, refbrowser=None, captioning=None, filterSourceEdit=None, allowOriginalImageSize=None, REQUEST=None): """Delete resource types through the ZMI""" if linkbyuid is not None: self.linkbyuid = bool(linkbyuid) if table_classnames is not None: self.table_classnames = [t for t in table_classnames if t] if installBeforeUnload is not None: self.install_beforeunload = bool(installBeforeUnload) if filterSourceEdit is not None: self.filtersourceedit = bool(filterSourceEdit) if allowOriginalImageSize is not None: self.allowOriginalImageSize = bool(allowOriginalImageSize) if parastyles is not None: self.paragraph_styles = [ line.strip() for line in parastyles if line.strip() ] if html_exclusions is not None: newex = html_exclusions[-1] html_exclusions = html_exclusions[:-1] html_exclusions = [ (tuple(h.get('tags', ())), tuple(h.get('attributes', ()))) for h in html_exclusions if h.get('keep')] tags = newex.get('tags', '').replace(',',' ').split() attr = newex.get('attributes', '').replace(',',' ').split() if tags or attr: html_exclusions.append((tuple(tags), tuple(attr))) self.set_html_exclusions(html_exclusions) if style_whitelist is not None: self.style_whitelist = list(style_whitelist) if class_blacklist is not None: self.class_blacklist = list(class_blacklist) if refbrowser is not None: out = StringIO() if refbrowser: self.ensureReferencesLayer(True); else: util.unregister_layers(self, ['kupu_references'], out) # Force compressed javascript to be recomputed. try: self.portal_javascripts.cookResources() except AttributeError: pass if captioning is not None: self.captioning = bool(captioning) if REQUEST: REQUEST.RESPONSE.redirect(self.absolute_url() + '/kupu_config')