Plone imagemaps error with zopyx.tinymceplugins.imgmap - plone

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)

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.

Related

Edit is missing and Add Item not working in 2sxc 9.32.1 on DNN EVOQ BASIC v. 09.01.01

Just upgraded to DNN EVOQ BASIC v. 09.01.01 (113) and 2sxc 9.32.1
After placing the Content module on a page, some of our templates do not have Edit options and some of them that have an Add Item option doesn't do anything after clicked.
When I click on Add Item, I get this error:
Uncaught SyntaxError: Unexpected token T in JSON at position 0
at JSON.parse (<anonymous>)
at Object.t.showDetailedHttpError (ToSic.Sxc.Instance.ts:73)
at fire (jquery.js?cdv=209:1037)
at Object.fireWith [as rejectWith] (jquery.js?cdv=209:1148)
at done (jquery.js?cdv=209:8076)
at XMLHttpRequest.callback (jquery.js?cdv=209:8598)
This sounds like a skin / container compatibility issue, the "content module" you mention, is this the core text / html module or something else?
As a test, change the page skin and or module container to one that comes with the core 9.1.1 install and retest
DC
I don't know for sure what's happening, but let me give you a bit of background. When an editor is on the page, 2sxc adds some configuration information as json in the html-attributes, which the UI the needs to know what you were clicking on etc.
To me it sound like something is breaking this - either because a server-side filter is changing the HTML (not likely, but possible), or another javascript is running which changes the DOM, resulting in removed or broken attributes.
To get this resolved, pls verify that you can find these jsons in the html-tags (they are very obvious) by looking at the html-source. If they are there and look ok, it's not the server that's breaking it.
Then check if they are still there in Chrome-Debugger (F12) which doesn't show you the source as the server sent it, but the source as the browser currently has it. I'm pretty sure it will be off somehow, because maybe a neat jQuery mangles the HTML.
Love from Switzerland,
iJungleboy

Modifying dspace discover page in xmlui mirage theme

I'm trying to modify the Mirage theme in DSpace 4.2 to cater to the specific needs of my organization. We want to add our own search box with custom search fields, and modify the search results page.
This is how the default dspace search results page looks like:
After tinkering around with the css and xsl I came up with this layout:
The top search panel was added by me by modifying the page-structure.xsl file. Now, I want to remove the default search box which appears in the results page. I've looked into all the css, xsl and sitemap files.
By inspecting the sitemap files I found that the search is carried out by calling the [dspace-source]/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/discovery/SimpleSearch.java file.
I commented the code sections where the search box was being added, and re-built and re-deployed dspace, but still no success.
Maybe, I'm not looking at the right files, due to lack of understanding.
It would be nice if someone points me in the right direction.
Thanks in advance
You can override the template that generates the search box. In [dspace]/webapps/xmlui/themes/Mirage/Mirage.xsl put this after the <xsl:output indent="yes"/> line:
<xsl:template match="dri:div[#id='aspect.discovery.SimpleSearch.div.discovery-search-box']">
<!-- You can also add content here
to replace the default search box
-->
</xsl:template>
You seem to be on the right path. If you indeed commented out lines after 131, you should see the effect that the box is removed.
So if you are not seeing the change, it's possible that there is something wrong with how you deploy these updates. Can you confirm that you have performed a mvn clean package and ant update before restarting your tomcat?

How can we save multimedia components using external resource types if the URL doesn’t end in with a file extension?

We have a Tridion use case related to curated content where we are creating multimedia components for images associated with our content which are pointing to External resource types instead of uploaded resource types.
One of the issues we have run into with this use case is that despite explicitly setting the Multimedia Type for the resource, if the URL of the image has either a query string in it: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default or uses a ‘friendly url’: http://www.somewhere.com/images/myimage/ when we save the component, Tridion barfs with error messages similar to : ‘Invalid value for property 'Filename'. Unexpected file extension: jpg?w=160&h=120&mode=crop&404=default. Expecting: jpg,jpeg,jpe.’
So far, the only way we’ve been able to figure out to potentially get around this issue is to do something hacky like appending an extra query string parameter to the very end of the urls which end with the expected file extension: http://cdn.hw.net/UploadService/1c8b7f28-bb12-4e02-b888-388fdff5836e.jpg?w=160&h=120&mode=crop&404=default&ext=.jpg Obviously, this is not the best solution and in fact may not work for some images if the site they are being served from strictly validates the requested URL.
Does anyone have any ideas on how we can work around this issue?
Unfortunately I can't really think of an easy solution to this, since Tridion "detects" the Mime type by checking the file extension.
You could perhaps add it while saving and remove it when reading (via Event System)? Definitely a worthwhile enhancement request, to my knowledge this behavior has not been changed for the soon-coming Tridion 2013... See comment below, it has been changed for 2013.
+1 for Nuno's answer. Recognizing that the title of your question is specific to multimedia components, you may want to consider another approach which is to use normal Components, not Multimedia Components. You can create a normal component schema called something like "External Image" that has an External Url field to store your extentionless url.
Content authors will then include these images via regular component linking mechanisms in the Tridion GUI.
You will then need a custom link resolver TBB that will parse the Output item (via Regex) looking for any Tridion anchor tags <a tridion:href="tcm:x-y-z"> and for each one replace them with an <img src=...> tag where the src path would come from this linked component.
For an example of a similar approach, but with videos, and sample code for a custom link resolver TBB have a look at the code in the following post: http://www.tridiondeveloper.com/integration-sdl-tridion-jw-media-player.

drupal 6 /user/permissions checkbox page core module

Does anyone know where i can find the code that makes the user/permissions checkbox page in drupal? I'd like to see how it's done to make something similar for a custom module i'm building.
The function you're looking for is theme_checkbox($element) and can be found in root/includes/form.inc. If you ever want to know what function/template is responsible for a certain HTML element then Theme developer is your friend.
Enable the module, set the permissions and you'll see a small checkbox Themer info. Then just point to the HTML part you're interested and see what theme function/template is doing the rendering.
i think on default module folder there is user folder on user.admin.inc file contain code for permission function is user_admin_perm(); see this code

Magento Top Menu suddenly stops writting "Active" Class

I have come accross a strange problem where magento seems to have stopped writting the Active and Active parent classes onto my menus.
I have been using the default Magento menu and it has been working for a month or so fine. I have cleared the cache and re-indexed the categories and products.
Any advice appreciated.. could this be a file permision problem ?
for me this xml change in my local.xml solves the issue:
<default>
<reference name="catalog.topnav">
<action method="unsetData"><key>cache_lifetime</key></action>
<action method="unsetData"><key>cache_tags</key></action>
</reference>
</default>
Followed Benmarks advice, Disabled the Block Html Caching and the active class was being written again.
Magento's HTML Block caching is a rather strange beast. They've only enabled a few blocks to work with it, one of which is the top menu (the template file is different depending on which version of Magento you're using).
If you want to keep block caching on and get rid of this bug, then you could create a module with a new block type which
extends Mage_Catalog_Block_Navigation
and set the following data in your block's _construct() method:
$this->addData(array(
'cache_lifetime' => null,
'cache_tags' => array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Core_Model_Store_Group::CACHE_TAG),
));
This sets the cache time to null, ie disables it.
Then, in your layout files you'll need to find (in page.xml) the Navigation Bar. It will have the following tag:
<block type="catalog/navigation"...
Which you'll need to replace with your own module's navigation block class:
<block type="mycompany/navigation"
Refresh your caches, and you should find your classes behave properly. For more information on Magento's layout I really reccommend Alan Storm's excellent book 'No Frills Magento Layout', and for a great addition to your Magento debugging tools check out this module which shows you which blocks are being cached (as well as a whole load of other useful block info).

Resources