def __call__(self, context):
     assert IPortletAdding.providedBy(context)
     name = context.__parent__.__manager__
     manager = getUtility(IPortletManager, name=name)
     request = context.request
     return SimpleVocabulary([
         SimpleTerm(ptype.addview, ptype.addview, ptype.title)
         for ptype in sorted(
             manager.getAddablePortletTypes(),
             key=lambda ptype: translate(ptype.title, context=request))
         if ptype.addview != "collective.portlet.geo.GeoPortlet"
         ])
    def cke_config_url(self, context=None):
        """"
        return the dynamic configuration file url
        """
        def findContentish(context):
            # find context by walking up acquisition chain
            while True:
                context = aq_parent(context)
                if IContentish.providedBy(context):
                    break
                elif IFolderish.providedBy(context):
                    break
            return context

        # when used by plone.app.form.widgets.wysiwygwidget
        # to add or edit a portlet
        if IPortletAssignment.providedBy(context):
            context = findContentish(context)
        elif IPortletAdding.providedBy(context):
            context = findContentish(context)
        else:
            context = aq_inner(self.context)
        return '%s/ckeditor_plone_config.js' % context.absolute_url()
Esempio n. 3
0
    def cke_config_url(self, context=None):
        """"
        return the dynamic configuration file url
        """

        def findContentish(context):
            # find context by walking up acquisition chain
            while True:
                context = aq_parent(context)
                if IContentish.providedBy(context):
                    break
                elif IFolderish.providedBy(context):
                    break
            return context

        # when used by plone.app.form.widgets.wysiwygwidget
        # to add or edit a portlet
        if IPortletAssignment.providedBy(context):
            context = findContentish(context)
        elif IPortletAdding.providedBy(context):
            context = findContentish(context)
        else:
            context = aq_inner(self.context)
        return '%s/ckeditor_plone_config.js' % context.absolute_url()