Plone 4 is rewriting my HTML, can this be disabled? - plone

We have a Plone 4.1 site. When I edit the HTML source of a document to use a path from the root directory (/codes in our case) and save it, Plone will translate the HTML (in our case it becomes ../codes). Is there a way to disable this, at least for this page? We cannot point to it using the file system because this is a virtual directory used to retrieve and display data from MySQL tables.
Here is some code:
<div class="agency_cd">The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available. <strong>[ <a class="internal-link" href="../codes/agency_cd_query?fmt=rdb">Tab-separated -- saved to file</a> || <a class="internal-link" href="../codes/agency_cd_query?fmt=html">HTML</a> ] </strong></div>
I change it to:
<div class="agency_cd">The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available. <strong>[ <a class="internal-link" href="/codes/agency_cd_query?fmt=rdb">Tab-separated -- saved to file</a> || <a class="internal-link" href="/codes/agency_cd_query?fmt=html">HTML</a> ] </strong></div>
I then save it, but Plone reverts it to the way it was before.

Do file a bug report on this. The component at fault is an output filter that is automatically translating absolute links to the same host to relative ones. That filter probably poses problems for various "inside-out" rewriting schemes.
Meanwhile, I'll bet you can fix this with some custom rewrite rules. Put in a rewrite rule that looks for /codes-and-parameters/codes/(.+) URLs and rewrites them to /codes/$1. That way you won't need to break anything in Plone to work around the problem.

Disable TinyMCE URL Conversions was useful although I could not say it definitely solved my problem. I found that selecting the option on the Plone edit screen to not use the visual editor and edit the HTML seemed to offer a workaround. The link though is not obvious.

Related

Load resources in gadgets in Jira

I've made an Add-on which is a custom field.
The style of the text in the field changes depending on the properties of an issue.
I check which style should the text have in the .java file and I pass the html class in a variable called $indicator to the velocity template:
#if( ${value} )
<span class="$indicator">${value}</span>
#end
It works perfect everywhere but in gadgets. When I add this field to a table showing issues in a dashboard, the html code is correct, but it doesn't find the css resource. This is because gadgets are inside an iframe.
How can I make the iframe have a reference to the stylesheet?
You did not say exactly which gadget you were using, but try adding the following context within your <web-resource> module:
<context>jira.webresources:issue-table</context>
The above should work for at least Assigned to Me, Filter Results, In Progress, Voted, and Watched in JIRA 6.1+.
If that does not work, you might also try:
<context>com.atlassian.jira.gadgets:common-lite</context>
If that general context doesn't work, you can look for which exact contexts are #requireContext'ed by the specific gadget you are trying to use, and then make sure that your web-resource is listed in that context. You can figure this out by looking at the gadget's XML and then searching for the #requireContext. (You can find the gadget XMLs inside $JIRA_DATA/plugins/.osgi-plugins/transformed-plugins/jira-gadgets-plugin-*.jar)
Starting with JIRA 7 the Answer of Scott Dudley is no longer working. #requireContext was replaced with a #requireResource within the Atlassian sources of this gadget.
As it affects our plugin, I created a Improvement Request to make that possible again

Plone 4 Zope Display Contents of specific folder TALES

Problem
I have a customer that wishes to display the entire contents of a certain folder (containing images) on their search page, should the search return 0 results. The folder is located at mysite.com/images
Setup:
As a test environment I have setup a seperate site with the following structure:
ROOT
|-Folder1 <-- current directory I am viewing
| |-images
|-Other folders
I modified the folder_summar_view template, to include the following code (I decided to modify a view to see if I could hack that to pieces to make it do what I want):
<div tal:define="image context/images/getFolderContents">
<div tal:content="i" tal:repeat="i image" />
</div>
What I see:
<Products.ZCatalog.Catalog.mybrains object at 0x9d2ddb8>
Things I've tried and further explanations
I was under the assumption that when the context/images/getFolderContents returns a brain for the 'objects' in my images folder, I could then iterate through each 'object' using my tal:repeat statement below it. Then display them on my page.
If I just use the following code:
<div tal:content="context/images/getFolderContents" />
My output is very similar to the above 'What I see' section:
<Products.ZCatalog.Catalog.mybrains object at [...]>
where [...] is another number
I've been doing some research and reading the Plone Theming book, but my code is similar to their tal:repeat examples on page 169, it seems the only difference is they are not using this on a brain (as far as I can tell).
I tried this, although it produced the same results (not sure why I tought it wouldn't):
<div tal:define="image python:context.images.getFolderContents()">
<div tal:content="i" tal:repeat="i image" />
</div>
I don't seem to be able to 'get inside' the returned brain. Everything I've looked for online doesn't quite help that much, I've also trawled through the atct_album_view and folder_listings templates to know avail. - I think I'm overlooking or missing something.
The first link I stumbled across was this, however I have moved on since that as although similar, it's not quite what I was trying to do.
The Plone guys on their chat room were kind enough to give me the context/images/getFolderContents statement, I tried to press on without asking for help again but it seems I've hit a wall.
More stuff I've tried
Using this link as inspiration I decided to try the following:
<div tal:define="image context/images/getFolderContents">
<div tal:content="image/getURL" />
</div>
But that throws an error when I try to view the template. The error reads along the lines of the 'getFolderContents brain does not have the attribute getURL' - Although image/Title displays the name of the folder, but that's not really what I need.
I also found this link however because I am making use of the default search, I don't really want to have to edit python scripts as I fear it may adversely effect the normal Plone site search. Also in this link they seem to be making use of more Python scripts. - To expand on this point, I'm not sure on how these scripts 'link' with page templates (how they know to 'talk' to one another).
Conclusion
In conclusion I need to display all of the images contained within a folder named "images" located at the root of my site, I am unable to access the contents of a returned brain using getFolderContents. And other than displaying the title of the "images" folder or the brain identifcation (<Products.ZCatalog.Catalog.mybrains object at 0x9d2ddb8>) , I have had no luck. Any help or ideas welcomed!
As getFoldercontents returns a list of brains i cant see how your code can work.
Just repeat over it with something like that :
<tal:block tal:repeat="image context/images/getFolderContents">
<a tal:attributes="href image/getURL" tal:content="image/Title"/>
</tal:block>

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 language switcher unaware of the aliases? switches to node/XX/ instead of LANG/text

I have a big problem with the language switcher,
I have a multi language site that has every article in english and spanish , spanish being the default
so if one article is named :
domain.com/mi-articulo then the english one will be domain.com/en/my-article (using autopath is creating these aliases)
now this works fine if I manualy change the url.. but if I use the language switcher ..the english corespondent it's switches without aliases and Lang prefix
so instead of domain.com/en/my-article it finds domain.com/node/47 so as I have the menu and other things translated it makes drupal unaware of the language switched..
here are the screenshots to better understand what's happening (wierd behaviour)
ver1. spanish
ver2. english
now if i click on english ..look what happends (see url and content like drupal is not aware that this content is nor spanish nor english...because the language switcher doesn't find the aliases)
I had the same problem until I set the default 'Language domain'
in admin/settings/language/edit/en. Now the module is working as expected.
I stumbled upon the same issue today.
All nodes had been imported from another site. All translations were imported, but not the relationship between them, so if you edit a node and check the translations, you may notice that your node doesn't have any given translation.
If this is your issue, you may use the functionality to add existing nodes as translations.
I have the same problem with the language switcher; just cannot get it to do what it's supposed to do. I ended up effectively writing a very simple version of it by adding a block and inserting the following html:
<ul>
<li class="first en">English</li>
<li class="last fr">Français</li>
</ul>
It is limited in that it always takes you back to the homepage after a switch but once that's done, links to other nodes continue correctly with /fr in the url.

Visibility of byline in folder view in collages for plone 3.3.1

I'm currently in the process of setting up my plone site to show expiration dates for content items in folders. This is part of a process to keep track of old files and documents on our intranet.
I have already altered my "folder listing" to show the expiration date if there is one (or say there isn't if there is no such date) which works as I expected. Unfortunately I cannot seem to replicate this with one of my addons.
I am currently using an addon called collage (version 1.2.3) which basically allows us to have a combination of different sorts of content as main-pages. I'm not quite sure what it is about collages that does this but when they show the contents of folders they only seem to show the title and description.
Previously this was fine but now I want to show the expiration date from the byline. I've been searching through all the python files and views and I can't seem to find where it decides to cut off the byline but it does sound like it calls on the folder_listing file.
When I open up a page which uses a collage to show a folder and view the source the byline is there, but it doesn't show up in the final version for some reason.
If anyone knows collages or plone moderately well and has a thought about this I would greatly appreciate any insight.
As a reference, I altered my folder_list by including this underneath the entry for tal:modified:
<tal:expire condition="python: item_type != 'Event'">
—
<tal:mod tal:condition="python:toLocalizedTime(item_expire,long_format=1)" i18n:translate="box_when_expires">
Expires on
</tal:mod>
<span tal:condition="not: python:toLocalizedTime(item_expire,long_format=1)">
This item has no expiration date listed.
</span>
<span tal:replace="python:toLocalizedTime(item_expire,long_format=1)">
August 16, 2001 at 23:35:59
</span>
</tal:expire>
You should look at Collage CSS Products/Collage/browser/templates/collage.css.dtml
There is the following instruction which hides documentByLine
#collage .collage-item .documentByLine {
display: none;
}
I have overrided this rule to set display: block; in my own css.

Resources