Tool tip (instructions) in Component fields and conditional field values in SDL Tridion components - tridion

Is it possible to implement tool tip (instruction) for SDL Tridion component fields using GUI extension? If so, could you please provide the details on how it can be done. The tool tip should appear right next to the field whenever the cursor is placed on the field.
Based on the selected value in one field of SDL Tridion component, can the values in an other field be restricted to specific set of values? For example, country and city fields. When the country is selected, city field should only show the cities of the selected country.

A custom tool tip with instructions for a field
You may consider using custom URLs to accomplish the same functionality. You can provide a separate URL for every field, so you could easily have a "/Extensions/Instructions/Article_Body.html" for one field and ""/Extensions/Instructions/Article_NavTitle.html" for another. That way the user can click the field name to pop up your HTML files with instructions. Although the GUI is different from what you describe, it will require less custom coding.
If you're stuck on the GUI as described in the requirements, I suggest you start by writing your own GUI extension and show us how far you got.
A dependency between fields
As Jeremy said already this is not a default option in Tridion, but can be accomplished (like pretty much anything) in a GUI extension.
This type of requirement has been covered quite extensively already in these questions:
Dynamic drop downs in Tridion designing in schema in SDL Tridion 2011 SP1
how to pass embedded schemas as drop down for the content schema in SDL Tridion 2011 SP1

Check out Can we show a different tooltip when a Dashboard Button is disabled? for the answer to question 1. The default option for question 2 is that it is not possible to do this. A GUI extension could be the answer though.

Custom URL and Description
+1 to Frank on Custom URL. Organization-specific help pages definitely help authors. Though they may not use Custom URLs for this, see a great user guide example from Yale.
Don't forget the description field. This is the easiest way to give authors basic instruction for each field and it shows as a tool tip.
For the text within a field, you can also use default settings. If you're using the inline UI (formerly SiteEdit), consider Content (Component) Types to set default values and instructions.
Category & Keyword (as a tree) for Field Dependencies
Use Categories and Keywords displayed with the "tree" option by setting subcategories (such as country) to abstract keywords. Set selectable keywords (e.g. cities) to normal. Then select the tree option to make it easier to navigate between the options.
If the use case is actually countries and cities, consider offering a better interface than the tree selector or drop-downs.
The catch is only the normal keywords would be saved in the component. However, there are workarounds to getting the keyword path.
Update: Custom Urls are not deprecated, only the old script was deprecated in favor of a new approach in SDL Tridion 2011 SP1.

Related

Adding hyperlinks to the Description field

I am a user, not a programmer, whose forthcoming new website on Plone 4 requires adding hyperlinks inside the Description field of pages and folders. This is needed to point specific words to our website Dictionary as we had been doing on EZ Publish for the last 10 years.
Our developer says this can't be done in Plone. I'm looking to help them find how to do this (they don't seem to use English-language forums).
Is there an existing add-on or existing code for this? If not, is it possible to code this in? How? If not, will it become standard in Plone 5?
<a href="http://python.org>Python</a> will not work, as the description-field is ment and used as a meta-information of an item, holding plain-text only, and doesn't allow the usage of html-elements, nor embedded Javascript. That's probably why T. K. Nguyen recommends to provide an additional rich-text-field.
But you can use reStrucuredText instead. Tell your developer to exchange the description-snippet in concerned templates to:
<div tal:define="Std modules/Products.PythonScripts/standard;
restructured_text nocall: Std/restructured_text;"
tal:content="structure python: restructured_text(context.Description())">
</div>
It will transform any word starting with 'http:' or 'https:' to a link, furthermore will also recognize mail-addresses like 'someone#plone.org' and transform them to mail-links (on click opens the user's default mail-client, if available, with the address pre-populated in the 'To'-field).
If you want to have named links, use the reStrucutredText-syntax for the input, like this:
`Check out Python`_, you'll love it.
`Write a mail`_ to someone.
.. _Python: http://www.python.org
.. _Write a mail: someone#example.org
The tricky part is to figure out, which templates are affected, but it's doable of my experience (did it with preserving line-breaks in listing-views, not reStructuredText).
Alternatively use a JS-workaround, as proposed by T. K. Nguyen. Be aware though, that it may break accessibility to some users.
It is possible to customize the description fields to be rich text (HTML) instead of plain text, but it requires a developer.
You can also use JavaScript to look at a description field and replace (for example) any string that starts with "http" with a hyperlink pointing to that URL. Your developer would have to look for examples of such JavaScript code and then would have to know how to register it on your site and then invoke it.
This describes how to do something similar, for PloneFormGen field help text (which is also plain text):
https://designinterventionsystems.com/blog/how-to-make-urls-clickable-in-ploneformgen-field-help-text
It might be easier to have your developer create a new rich-text description field and have all your content types include that new field. That, however, would require that you update the view templates for those modified content types. This is much easier with Dexterity, which ships with Plone 5 and is available for use with Plone 4.x.
imho it's a really bad idea to convert the description field to any richttext (html, rst, md) field. You need to change a hole bunch of templates to avoid html code rendered everywhere.
Example:
search
collections
content
portlets
Addons
The description is also often used as title attribute on links, in those cases you need to convert it to plain/text. And there are several more issues, where you could ran into.
As #T. Kim Nguyen wrote: Consider add a new textfield and show it, where necessary, probably implemented as a Viewlet in the below title slot.
Looking at your current site, it seems like you want this to provide a teaser for each article, which may contain links. If that is the case, then you can find other ways to do this without making the description html.
For instance, if you used collective.cover for your portal/collection pages then a Rich Text Tile would allow you to cut down the the object text to an appropriate size, but still edit it with a Rich Text editor, and keep/insert hyperlinks.

Plone: Master Slave Widget

I'm looking for a way of displaying two select fields A and B, where B depends on the selection made in A. For example: Assuming A is a select widget for displaying countries in the world, then B should only list those cities that are found in the country selected in the A field.
I intend to use this in a custom content type and hopefully create a search filter in my view template as well.
Does Plone has such a feature? I've taken a look at Products.MasterSelectWidget but it is very old and it is not compatible with Plone 4.2.
I'm thinking I may have to do this manually using ajax.
Any ideas?
If you are using Archetypes framework, MasterSelectWidget is still the answer for you needs.
You say that it's not working with Plone 4.2 (I never tested) but probably it needs only few fix to back working. Don't be scared from the fact that the product is old... Archetypes framewrork didn't change much in last years!
Just in case, if someone is looking for such widget with Dexterity framework. There is plone.formwidget.masterselect : https://github.com/collective/plone.formwidget.masterselect

What are the possible solution to hide the field from the child publication

We have a main schema which are using for generic content at many places and across blueprint for many websites(markets).
Now one of the website(market) wants one extra field but all other do not wants to see this in their publications.
I suggested to rename the fields for all other markets like (Not in use) but they are not agreeing on this as well.
What are the possible solution to hide the field from the child publication?
My suggestion is to not hide the field. Simply add the new field as non-mandatory and in its description clearly call out that it's only applicable for Market B such that the other markets know not to use it. This is simple, requires no effort and is a maintenance free solution. Otherwise a GUI extension is your best bet.
Without knowing the full context it is hard to give an advise. But in general I would not recommend to hide fields (even though it's possible with a GUI extension in 2011 and with some hacking in 2009). I think Tridion offers plenty of options to solve the puzzle out of the box. For example:
Isolate the common fields into an embedded schema and set up separate content schemas for market A and market B which reuse the common fields
Isolate the different fields into content schemas for market A and market B and create a component link field in the original schema which links to those specific schemas.
With security on folders you can limit access to the market-specific schemas.

How to implement a node-VIEWNAME.tpl.php with Drupal Views module?

I am working with Drupal and Views module.
I am using the same theme with different Views.
I have created different pages which are listing nodes per viewname as this : views-view-fields--VIEWNAME--page.tpl.php but now when I click on an article title, I would like to personalize the node with the viewname, so I would like to use node-VIEWNAME.tpl.php, but it's not possible. The only thing I can do, is to create a node-TYPE.tpl.php but I do not want to follow this way.
So my question is how can I implement (may be with a hook function?) the node-VIEWNAME.tpl.php when I click on an article title (so when I have only one full article and which is defined by it's id in the url. This is for precision, I am not fluent in English.
Thank you very much !
Alexandre
The correct way to do what you're attempting - use the Display Suite module, set the view to point to a Display Suite object in the field settings, then click the gear next to that setting and pick the build mode you want to use. Then in your template.php file, do whatever special work you need to do to that build mode.

Drupal views: Allowing users to choose sort criteria on node display

I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.

Resources