def __call__(self, context):
     items = [
         SimpleTerm("Basic", "Basic", _(u"Minimal toolbar")),
         SimpleTerm("Plone", "Plone", _(u"Standard Plone toolbar (recommanded)")),
         SimpleTerm("Custom", "Custom", _(u"Custom Toolbar fill next field")),
     ]
     return SimpleVocabulary(items)
class CKEditorControlPanel(ControlPanelForm):

    form_fields = FormFieldsets(basicset, skinset, browserset, advancedset)

    label = _("CKEditor settings")
    description = _("Control CKEditor settings for Plone.")
    form_name = _("CKEditor settings")
 def __call__(self, context):
     items = [
         SimpleTerm("kama", "kama", _(u"Default ( Kama )")),
         SimpleTerm("v2", "v2", _(u"v2")),
         SimpleTerm("office2003", "office2003", _(u"Office 2003")),
     ]
     return SimpleVocabulary(items)
Пример #4
0
 def __call__(self, context):
     items = [SimpleTerm('Basic', 'Basic',
                         _(u'Minimal toolbar')),
              SimpleTerm('Plone', 'Plone',
                         _(u'Standard Plone toolbar (recommanded)')),
              SimpleTerm('Custom', 'Custom',
                         _(u'Custom Toolbar fill next field'))]
     return SimpleVocabulary(items)
 def __call__(self, context):
     items = [SimpleTerm('default', 'Based on UI',
                         _(u'Automatic')),
              SimpleTerm('disabled', 'Disabled',
                         _(u'Disabled: any content is allowed.')),
              SimpleTerm('custom', 'Custom filtering',
                         _(u'Custom: filter is setup according to '
                           u'Custom Allowed Content option.'))]
     return SimpleVocabulary(items)
 def __call__(self, context):
     context = getattr(context, "context", context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IImageContent)
     msg1 = _(u"Content Type Registry default configuration (recommanded)")
     msg2 = _(u"Custom configuration, fill next field")
     items = [SimpleTerm("auto", "auto", msg1), SimpleTerm("custom", "custom", msg2)]
     items.extend([SimpleTerm(t["portal_type"], t["portal_type"], t["type_ui_info"]) for t in flt])
     return SimpleVocabulary(items)
Пример #7
0
 def __call__(self, context):
     items = [
         SimpleTerm('Basic', 'Basic', _(u'Minimal toolbar')),
         SimpleTerm('Plone', 'Plone',
                    _(u'Standard Plone toolbar (recommanded)')),
         SimpleTerm('Custom', 'Custom',
                    _(u'Custom Toolbar fill next field'))
     ]
     return SimpleVocabulary(items)
Пример #8
0
 def __call__(self, context):
     items = [SimpleTerm('default', 'Based on UI',
                         _(u'Automatic')),
              SimpleTerm('disabled', 'Disabled',
                         _(u'Disabled: any content is allowed.')),
              SimpleTerm('custom', 'Custom filtering',
                         _(u'Custom: filter is setup according to '
                           u'Custom Allowed Content option.'))]
     return SimpleVocabulary(items)
 def __call__(self, context):
     context = getattr(context, 'context', context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IImageContent)
     msg1 = _(u'Content Type Registry default configuration (recommanded)')
     msg2 = _(u'Custom configuration, fill next field')
     items = [SimpleTerm('auto', 'auto', msg1),
              SimpleTerm('custom', 'custom', msg2)]
     items.extend([SimpleTerm(t['portal_type'], t['portal_type'],
                              t['type_ui_info'])
                   for t in flt])
     return SimpleVocabulary(items)
Пример #10
0
 def __call__(self, context):
     items = [SimpleTerm('Basic', 'Basic',
                         _(u'Minimal toolbar')),
              SimpleTerm('Full', 'Full',
                         _(u'Full CKeditor toolbar providing every available '
                           u'functionnalities (some functionnalities could '
                           u'not work correctly depending on your Plone settings)')),
              SimpleTerm('Plone', 'Plone',
                         _(u'Standard Plone toolbar (recommanded)')),
              SimpleTerm('Custom', 'Custom',
                         _(u'Custom Toolbar fill next field'))]
     return SimpleVocabulary(items)
Пример #11
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IImageContent)
     msg1 = _(u'Content Type Registry default configuration (recommanded)')
     msg2 = _(u'Custom configuration, fill next field')
     items = [SimpleTerm('auto', 'auto', msg1),
              SimpleTerm('custom', 'custom', msg2)]
     items.extend([SimpleTerm(t['portal_type'], t['portal_type'],
                              t['type_ui_info'])
                   for t in flt])
     return SimpleVocabulary(items)
class ICKEditorSkinSchema(Interface):
    """
    CKEditor Skin fieldset schema
    """
    width = TextLine(
        title=_(u"Editor width"),
        description=_(u"Enter the width of the editor in px % or em"),
        required=False)

    height = TextLine(
        title=_(u"Editor height"),
        description=_(u"Enter the height of the editor in px % or em"),
        required=False)
Пример #13
0
 def __call__(self, context):
     items = [SimpleTerm('Basic', 'Basic',
                         _(u'Minimal toolbar')),
              SimpleTerm('Full', 'Full',
                         _(u'Full CKeditor toolbar providing every '
                           u'available functionnalities (some '
                           u'functionnalities could not work correctly '
                           u'depending on your Plone settings)')),
              SimpleTerm('Plone', 'Plone',
                         _(u'Standard Plone toolbar (recommanded)')),
              SimpleTerm('Custom', 'Custom',
                         _(u'Custom Toolbar fill next field'))]
     return SimpleVocabulary(items)
 def __call__(self, context):
     context = getattr(context, "context", context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IBaseFolder)
     items = [SimpleTerm("custom", "custom", _(u"Custom configuration, fill next field"))]
     items.extend([SimpleTerm(t["portal_type"], t["portal_type"], t["type_ui_info"]) for t in flt])
     return SimpleVocabulary(items)
Пример #15
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IBaseFolder)
     items = [SimpleTerm('custom', 'custom',
                         _(u'Custom configuration, fill next field'))]
     items.extend([SimpleTerm(t['portal_type'], t['portal_type'],
                              t['type_ui_info'])
                   for t in flt])
     return SimpleVocabulary(items)
Пример #16
0
 def __call__(self, context):
     context = getattr(context, 'context', context)
     portal = getSite()
     flt = _listTypesForInterface(portal, IBaseFolder)
     items = [SimpleTerm('custom', 'custom',
                         _(u'Custom configuration, fill next field'))]
     items.extend([SimpleTerm(t['portal_type'], t['portal_type'],
                              t['type_ui_info'])
                   for t in flt])
     return SimpleVocabulary(items)
class ICKEditorAdvancedSchema(Interface):
    """
    CKEditor Advanced schema
    """
    properties_overloaded = List(
        title=_(u"Widget overload"),
        description=_(u"If you want some cke control panel properties "
                      "overload local field widget properties, enter the "
                      "properties names list here. "
                      "Example, enter 'width' and 'height' to get always "
                      "the same values. Look at "
                      "ZMI > portal_properties > ckeditor_properties "
                      "for all properties names."),
        required=False,
        value_type=TextLine(),
        default=[
            'width',
        ],
    )

    entities = Bool(
        title=_(u"Html Entities"),
        description=_(u"Whether to use Html entities in the editor."),
        default=False,
        required=False)

    entities_greek = Bool(title=_(u"Greek Html Entities"),
                          description=_(
                              u"Whether to convert some symbols, mathematical "
                              "symbols, and Greek letters to Html entities."),
                          default=False,
                          required=False)

    entities_latin = Bool(
        title=_(u"Latin Html Entities"),
        description=_(u"Whether to convert some Latin characters "
                      "Latin alphabet No. 1, ISO 8859-1) to Html entities."),
        default=False,
        required=False)
Пример #18
0
    def getCK_plone_menu_styles(self):
        """
        return javascript for ckeditor
        plone menu styles
        """
        request = self.request
        response = request.RESPONSE
        cke_properties = self.cke_properties
        styles = demjson.loads(cke_properties.getProperty('menuStyles', '[]'))
        for style in styles:
            if 'name' in style:
                style['name'] = self.context.translate(_(style['name']))
        menu_styles_js_string = """
styles = jQuery.parseJSON('%s');
CKEDITOR.stylesSet.add('plone', styles);""" % demjson.dumps(styles)
        response.setHeader(
            'Cache-control', 'pre-check=0,post-check=0,must-revalidate,'
            's-maxage=0,max-age=0,no-cache')
        response.setHeader('Content-Type', 'application/x-javascript')

        return JavascriptPacker('safe').pack(menu_styles_js_string)
Пример #19
0
    def getCK_plone_menu_styles(self):
        """
        return javascript for ckeditor
        plone menu styles
        """
        request = self.request
        response = request.RESPONSE
        cke_properties = self.cke_properties
        styles = demjson.loads(cke_properties.getProperty("menuStyles", "[]"))
        for style in styles:
            if "name" in style:
                style["name"] = self.context.translate(_(style["name"]))
        menu_styles_js_string = """
styles = jQuery.parseJSON('%s');
CKEDITOR.stylesSet.add('plone', styles);""" % demjson.dumps(
            styles
        )
        response.setHeader("Cache-control", "pre-check=0,post-check=0,must-revalidate," "s-maxage=0,max-age=0,no-cache")
        response.setHeader("Content-Type", "application/x-javascript")

        return JavascriptPacker("safe").pack(menu_styles_js_string)
class ICKEditorBaseSchema(Interface):
    """
    CKEditor Base fieldset schema
    """

    skin = Choice(title=_(u"Skin"),
                  description=_(u"Choose the editor skin."),
                  required=True,
                  default='moonocolor',
                  vocabulary="collective.ckeditor.vocabularies.skin")

    forcePasteAsPlainText = Bool(
        title=_(u"Force paste as plain text"),
        description=_(u"Choose if you want to remove format on copy/paste, "
                      "and paste only text and CR/LF"),
        default=False,
        required=False)

    toolbar = Choice(
        title=_(u"Toolbar"),
        description=_(u"Choose the editor toolbar, "
                      "edit the next field if you choose a Custom toolbar'."),
        required=True,
        default='Plone',
        vocabulary="collective.ckeditor.vocabularies.toolbar")

    toolbar_Custom = Text(title=_(u"Customized Toolbar"),
                          description=_(
                              u"Build your own CKEditor Toolbar. "
                              "Take care with the javascript syntax. "
                              "If you want to add new plugins, "
                              "add new buttons here if needed."),
                          required=False)

    filtering = Choice(
        title=_(u"Filtering"),
        description=_(
            u"Setup of Advanced Content Filter. "
            u"Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter"),
        required=True,
        default='default',
        vocabulary="collective.ckeditor.vocabularies.filtering")

    customAllowedContent = Text(
        title=_(u"Custom Allowed Content"),
        description=_(
            u"Configuration of custom filtering. "
            u"Taken in account only if Filtering option is 'Custom'. "
            u"Use Javascript syntax. Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules"),
        required=False)

    extraAllowedContent = Text(
        title=_(u"Extra Allowed Content"),
        description=_(
            u"Extra rules on top of automatic filtering. "
            u"Taken in account only if Filtering option is 'Automatic'. "
            u"Use Javascript syntax. Read documentation at "
            u"http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules"),
        required=False)

    menuStyles = Text(title=_(u"Menu styles"),
                      description=_(
                          u"Build your own CKEditor menu styles Combo box. "
                          u"Take care with the javascript syntax. "
                          u"If you want to use css classes or ids, "
                          u"the attributes must exist in your css."),
                      required=True)

    bodyId = TextLine(title=_(u"Area Body Id"),
                      description=_(u"Enter the css id applied to the "
                                    "body tag of the editor area"),
                      default=u'content',
                      required=False)

    plugins = List(title=_(u"Plugins"),
                   description=_(u"Plugin format is 'id;relative path'."),
                   value_type=TextLine(),
                   required=False)

    removePlugins = List(title=_(u"Plugins to remove"),
                         description=_(u"Plugin format is 'id'."),
                         value_type=TextLine(),
                         required=False)

    bodyClass = TextLine(title=_(u"Area Body Class"),
                         description=_(
                             u"Enter the css class name applied to the "
                             "body tag of the editor area"),
                         required=False)

    customTemplates = List(title=_(u"Custom templates"),
                           description=_(
                               u"URLs of Javascript "
                               "files that register custom templates"),
                           value_type=TextLine(),
                           required=False)

    templatesReplaceContent = Bool(
        title=_(u"Templates will replace the current contents "
                "of the visual editor window"),
        description=_(u"Choose if you want templates to replace "
                      "the contents when inserted"),
        default=False,
        required=False)

    enableScaytOnStartup = Bool(
        title=_(u"Enable SCAYT on startup"),
        description=_(u"Choose if you want SCAYT to be automatically "
                      "enabled while the editor is loaded.  This will only "
                      "be the case if a relevant language can be used "
                      "in SCAYT availble ones."),
        default=False,
        required=False)

    defaultTableWidth = TextLine(
        title=_(u"Default Table Width"),
        description=_(u"Enter the default table width"),
        default=u"500px",
        required=False)
class ICKEditorBrowserSchema(Interface):
    """
    CKEditor Browser fieldset schema
    """
    allow_link_byuid = Bool(
        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 "
                      "configuration transforms uid links in absolute urls "
                      "in view displays."),
        default=True,
        required=False)

    allow_relative_links = Bool(
        title=_(u"Allow relative urls transformation"),
        description=_(u"Check if you want relative urls after saving forms. "
                      "Useful when link by uid is not checked."),
        default=False,
        required=False)

    allow_server_browsing = Bool(title=_(u"Allow browsing for links"),
                                 description=_(
                                     u"Check to allow server browsing"
                                     "used for medias linking."),
                                 default=True,
                                 required=False)

    allow_file_upload = Bool(
        title=_(u"Allow file upload"),
        description=_(u"Check to allow files upload in link dialog boxes)."),
        default=False,
        required=False)

    allow_image_upload = Bool(
        title=_(u"Allow image upload"),
        description=_(u"Check to allow upload for images."),
        default=False,
        required=False)

    allow_flash_upload = Bool(
        title=_(u"Allow flash upload"),
        description=_(u"Check to allow upload for flash content."),
        default=False,
        required=False)

    allow_folder_creation = Bool(
        title=_(u"Allow folder creation"),
        description=_(u"Check to allow folder creation in browser."),
        default=False,
        required=False)

    file_portal_type = Choice(
        title=_(u"File portal type"),
        description=_(u"Choose the portal type used for file upload."),
        required=True,
        default='File',
        vocabulary="collective.ckeditor.vocabularies.FileTypeUpload")

    file_portal_type_custom = List(
        title=_(u"Custom File portal type for upload"),
        description=_(u"Add list of pairs CONTAINER_TYPE|FILE_TYPE. "
                      "The file portal type choosen for upload will depend "
                      "on contextual container portal type. "
                      "* means any portal type."
                      "Take care, no control is done over this field value."),
        required=False,
        value_type=TextLine(),
        default=[
            '*|File',
            'Folder|File',
        ])

    browse_images_portal_types = Tuple(
        title=_(u"Portal Types for images linking"),
        description=_(u"Choose the types used "
                      "for images selection in browser."),
        required=True,
        missing_value=tuple(),
        default=(
            'Image',
            'News Item',
        ),
        value_type=Choice(
            vocabulary="collective.ckeditor.vocabularies.ImageTypes"))

    image_portal_type = Choice(
        title=_(u"Image portal type"),
        description=_(u"Choose the portal type used for image upload."),
        required=True,
        default='auto',
        vocabulary="collective.ckeditor.vocabularies.ImageTypeUpload")

    image_portal_type_custom = List(
        title=_(u"Custom Image portal type for upload"),
        description=_(u"Add list of pairs CONTAINER_TYPE|IMAGE_TYPE. "
                      "The image portal type choosen for upload will depend "
                      "on contextual container portal type. "
                      "* means any portal type."
                      "Take care, no control is done over this field value."),
        required=False,
        value_type=TextLine(),
        default=[
            '*|Image',
            'Folder|Image',
        ])

    browse_flashs_portal_types = Tuple(
        title=_(u"Portal Types for flash contents linking"),
        description=_(u"Choose the types used "
                      "for flash contents selection in browser."),
        required=True,
        missing_value=tuple(),
        default=('File', ),
        value_type=Choice(
            vocabulary="collective.ckeditor.vocabularies.FileTypes"))

    flash_portal_type = Choice(
        title=_(u"Flash portal type"),
        description=_(u"Choose the portal type used for flash content upload"),
        required=True,
        default='File',
        vocabulary="collective.ckeditor.vocabularies.FileTypeUpload")

    flash_portal_type_custom = List(
        title=_(u"Custom Flash portal type for upload"),
        description=_(u"Add list of pairs CONTAINER_TYPE|FLASH_TYPE. "
                      "The flash portal type choosen for upload will depend "
                      "on contextual container portal type. "
                      "* means any portal type. "
                      "Take care, no control is done over this field value."),
        required=False,
        value_type=TextLine(),
        default=[
            '*|File',
            'Folder|File',
        ])

    folder_portal_type = Choice(
        title=_(u"Folder portal type"),
        description=_(u"Choose the portal type used for folder creation"),
        required=True,
        default='Folder',
        vocabulary="collective.ckeditor.vocabularies.FolderTypes")

    folder_portal_type_custom = List(
        title=_(u"Custom portal type for folder creation"),
        description=_(u"Add list of pairs CONTAINER_TYPE|FOLDER_TYPE. "
                      "The folder portal type choosen for folders creation "
                      "will depend on contextual container portal type. "
                      "* means any portal type. "
                      "Take care, no control is done over this field value."),
        required=False,
        value_type=TextLine(),
        default=[
            '*|Folder',
            'Large Plone Folder|Large Plone Folder',
        ])
class ICKEditorBaseSchema(Interface):
    """
    CKEditor Base fieldset schema
    """

    forcePasteAsPlainText = Bool(
        title=_(u"Force paste as plain text"),
        description=_(u"Choose if you want to remove format on copy/paste, "
                      "and paste only text and CR/LF"),
        default=False,
        required=False)

    toolbar = Choice(
        title=_(u"Toolbar"),
        description=_(u"Choose the editor toolbar, "
                      "edit the next field if you choose a Custom toolbar'."),
        required=True,
        default='Plone',
        vocabulary="collective.ckeditor.vocabularies.toolbar")

    toolbar_Custom = Text(title=_(u"Customized Toolbar"),
                          description=_(
                              u"Build your own CKEditor Toolbar. "
                              "Take care with the javascript syntax. "
                              "If you want to add new plugins, "
                              "add new buttons here if needed."),
                          required=False)

    menuStyles = Text(title=_(u"Menu styles"),
                      description=_(
                          u"Build your own CKEditor menu styles Combo box. "
                          "Take care with the javascript syntax. "
                          "If you want to use css classes or ids, "
                          "the attributes must exist in your css."),
                      required=True)

    bodyId = TextLine(title=_(u"Area Body Id"),
                      description=_(u"Enter the css id applied to the "
                                    "body tag of the editor area"),
                      default=u'content',
                      required=False)

    plugins = List(title=_(u"Plugins"),
                   description=_(u"Plugin format is 'id;relative path'."),
                   value_type=TextLine(),
                   required=False)

    bodyClass = TextLine(title=_(u"Area Body Class"),
                         description=_(
                             u"Enter the css class name applied to the "
                             "body tag of the editor area"),
                         required=False)

    customTemplates = List(title=_(u"Custom templates"),
                           description=_(
                               u"URLs of Javascript "
                               "files that register custom templates"),
                           value_type=TextLine(),
                           required=False)

    templatesReplaceContent = Bool(
        title=_(u"Templates will replace the current contents "
                "of the visual editor window"),
        description=_(u"Choose if you want templates to replace "
                      "the contents when inserted"),
        default=False,
        required=False)
        self.context._updateProperty('entities_greek', value)

    entities_greek = property(get_entities_greek, set_entities_greek)

    def get_entities_latin(self):
        return self.context.entities_latin

    def set_entities_latin(self, value):
        self.context._updateProperty('entities_latin', value)

    entities_latin = property(get_entities_latin, set_entities_latin)


basicset = FormFieldsets(ICKEditorBaseSchema)
basicset.id = 'cke_base'
basicset.label = _(u'Basic settings')

skinset = FormFieldsets(ICKEditorSkinSchema)
skinset.id = 'cke_skin'
skinset.label = _(u'Editor Skin')

browserset = FormFieldsets(ICKEditorBrowserSchema)
browserset.id = 'cke_browser'
browserset.label = _(u'Resources Browser')

advancedset = FormFieldsets(ICKEditorAdvancedSchema)
advancedset.id = 'cke_advanced'
advancedset.label = _(u'Advanced Configuration')


class CKEditorControlPanel(ControlPanelForm):
Пример #24
0
 def __call__(self, context):
     items = [SimpleTerm('moonocolor', 'moonocolor',
                         _(u'Colored buttons')),
              SimpleTerm('moono-lisa', 'moono-lisa',
                         _(u'Flat buttons'))]
     return SimpleVocabulary(items)
Пример #25
0
 def __call__(self, context):
     items = [
         SimpleTerm('moonocolor', 'moonocolor', _(u'Colored buttons')),
         SimpleTerm('moono-lisa', 'moono-lisa', _(u'Flat buttons'))
     ]
     return SimpleVocabulary(items)
Пример #26
0
        self.context._updateProperty('entities_greek', value)

    entities_greek = property(get_entities_greek, set_entities_greek)

    def get_entities_latin(self):
        return self.context.entities_latin

    def set_entities_latin(self, value):
        self.context._updateProperty('entities_latin', value)

    entities_latin = property(get_entities_latin, set_entities_latin)


basicset = FormFieldsets(ICKEditorBaseSchema)
basicset.id = 'cke_base'
basicset.label = _(u'Basic settings')

skinset = FormFieldsets(ICKEditorSkinSchema)
skinset.id = 'cke_skin'
skinset.label = _(u'Editor Skin')

browserset = FormFieldsets(ICKEditorBrowserSchema)
browserset.id = 'cke_browser'
browserset.label = _(u'Resources Browser')

advancedset = FormFieldsets(ICKEditorAdvancedSchema)
advancedset.id = 'cke_advanced'
advancedset.label = _(u'Advanced Configuration')


class CKEditorControlPanel(ControlPanelForm):