Search code examples
ploneimagemapkss

Plone imagemaps error with zopyx.tinymceplugins.imgmap


I'm using Plone 4.2. I had the need to manage imagemaps in my application so I installed the following product: http://pypi.python.org/pypi/zopyx.tinymceplugins.imgmap. This product uses TinyMCE to edit the images and add links to them.

After installing this product, I noticed that I am now unable to view my TinyMCE controls while editing a content type. Looking at my browser's error console, I notice that all my *.kss cannot be read. This is the error that is displayed for all *.kss files:

Error: The stylesheet http://localhost:8082/plone/portal_kss/My%20CMS%20theme/++resource++tinymce.kss/tinymce.kss was not loaded because its MIME type, "text/plain", is not "text/css".
Source File: http://localhost:8082/plone/folder-test/image-maps-test/page-with-imagemap/edit
Line: 0

I do not understand why there should be error regarding the MIME type. Anyone has a clue on how to fix this?

Additionally, I get the following:

GET http://localhost:8082/plone/portal_javascripts/My%20CMS%20theme/plugins/imgmap/editor_plugin.js 500 (Internal Server Error)

Solution

  • Just to answer my own question:

    I opened the product's skins.xml file

    (i.e. zopyx.tinymceplugins.imgmap-0.3.1/zopyx/tinymceplugins/imgmap/profiles/default/skins.xml)

    This is how it looks like:

    <?xml version="1.0"?>
    <object name="portal_skins" allow_any="False" cookie_persistence="False">
    
     <object name="zopyx_tinymceplugins_imgmap"
        meta_type="Filesystem Directory View"
        directory="zopyx.tinymceplugins.imgmap:skins/zopyx_tinymceplugins_imgmap"/>
    
     <skin-path name="Plone Default">
      <layer name="zopyx_tinymceplugins_imgmap"
         insert-after="custom"/>
     </skin-path>
    
     <skin-path name="Sunburst Theme">
      <layer name="zopyx_tinymceplugins_imgmap"
         insert-after="custom"/>
     </skin-path>
    
    </object>
    

    It appears that the product has been geared towards specific themes.

    Now, my application has a custom theme i.e. MyCustomTheme. When I inspect my portal_skins

    Site > Zope Management Interface > portal_skins > properties

    I notice that indeed the "Sunburst Theme" has included the zopyx_tinymceplugins_imgmap skin layer in the 'Plone Default' and 'Sunburst Theme', but NOT in my 'MyCustomTheme'. It has added it right after the custom layer.

    So I go ahead and manually add zopyx_tinymceplugins_imgmap in MyCustomTheme, just immediately after the custom layer.

    This manages to fix it, and I can now view my TinyMCE controls. I believe there must be a better way to have it work.

    Hope this helps someone in future.

    UPDATE: See this for a better solution.