Plone: Master Slave Widget - plone

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

Related

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

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.

How can I filter node references to 'strictly own nodes' ? (Drupal 7)

On my drupal 7 site, I have a content type (artwork) that presents my users with a CCK field where they can specify what project (another content type) the node is referenced to (node reference module). The problem is that I can't seem to find a way to filter the options to 'own nodes only', so all the projects of all the users show up it in the list, and any user can just push his nodes on the nodes of another. I can still filter these nodes out with views on the output of the project node, but it's not very clean on the add/node form.
I found a module that is called 'CCK reference filter' that sounds like it should handle this situation, but it's not ported to Drupal 7.
So far I've gone pretty far without having to touch template.php and using hooks, and I would be very relieved if I wouldn't have to, since I'm hardly a php wizard... But if someone has any suggestions! Everything is welcome
Have a good day!
Bruno
(this is my first post here by the way, please tell me if I'm in the wrong place or anything)
The way to achieve that in Drupal 6 was to use a Views to filter the node that you can reference.
The goal for References module in Drupal 7 is to strictly have the same functionality as the D6 module. But References is still in developpment and it seems that this has not been implemented for now.
This issue seems to be very similar to what to want : http://drupal.org/node/1034042

Drupal : how to create a view that displays all the content-types

It may sound 'weird' but I need to have a view that lists all the content types I have.
For example i have two content types : contenttypeA, contenttypeB
I want to create a view that just displays the two content types (and show number of items of that type, but that can be done later).
For now what I did is add one content of each content type and list them but only show the 'node type'; it works well if there's at least one content but I want to display even without any content of that content type.
Any idea ?
Introducing the node_type table to Views requires a custom module and some Views API knowledge however http://drupal.org/node/1001222 will give you a head start.
Use a Customfield: PHP code field and custom code the whole thing with PHP. This is provided by the Views Custom Field module.
Use the Table Wizard module to make the node_type table available to views. You may need to use the Data module as well since they say that all future development is going there.
Expose the node_type table yourself by writing a custom module using the Views API as suggested by chx.
Number one is the quick and dirty way, but number 2 might be a little more manageable, but I am not completely sure it will do everything you want. If you do number 3 make sure you contribute back to the community by putting your module on drupal.org.
There is no native functionality in Views to do that. You can write a static page or (overkill) a module that provide a "system"-like type similar to Views Watchdog.

Is it possible to change the content type on nodes in Drupal 6?

I have inherited a Drupal site on which (for some reason) there are two different content types for news: one for press releases and one for everything else. I would like to combine the two and use a taxonomy to categorize the press releases and other news types.
Is it even possible to do this? The site is using a number of modules, including Views and CCK, and I don't know how much a change like this would affect module data.
http://drupal.org/project/node_convert
The module linked above works extremely well for migrating nodes from one content type to another.
When you are done, you can then use VBO (http://drupal.org/project/views_bulk_operations) to mass manipulate the taxonomy changes you need.
Is it possible? Yes.
Is it easy? No.
To quote a well used phrase:
If it ain't broke, don't fix it.
You can get your site to work like you describe, and if you started with a clean site that you were going to build, it would be no problem. It's just a matter of choice. Now when you do have a database with views, content and other stuff, it wont be easy. You would have to:
Go through all the views, and set them up to use taxonomy and the 1 content type.
Migrate all the data into 1 content type. This might evolve setting up CCK for this content type to fit both, and take this into consideration when migrating the data.
It's possible the content types are used elsewhere, in custom modules, settings etc, these need to be tracked down and fixed as well.
So it's a lot of work with little/no gain.
Of course it's possible. The change won't necessarily be difficult if you've got a good understanding of how each content type is being used. You'll just need to be careful as it's a fundamental change.
If you think that the two different content types are not warranted and it is, in fact duplication of information then you could justify merging the two. Good house keeping!
You could phase out the unwanted content type over time and then when you're confident you've got it just right, build your self a merge module to move the old nodes into the new format. You could also build yourself test views and content types that you can dispose of later.
It may also help to install the devel module to get a programmatic overview of what your nodes look like. You shouldn't leave this module running on live sites as it effects performance.
Sometimes, there's a fair amount of crossover between content taxonomy and content types. It helps to ask yourself: What is a classification of an object and what's an attribute?
It is possible to change the content type of nodes.
The problem is if the content types use different CCK fields, which are present in a content type but not in the other. In such case, if you change the content type, those fields would not appear in the converted node; you should convert all those fields manually, or create a custom module to do that.

How can I categorize the content types on the Drupal "Create content" page (/node/add)

How can I categorize/organize the content types on my "Create content" page? I'm running Drupal 6.x with CCK. I have a lot of custom content types, and my "Create content" page has become a bit unwieldy, as it lists them all alphabetically. I'd like to organize them by category, so users would see something like:
Create Content
Reports
Report Type A
Report Type B
Events
Event Type A
Event Type B
I don't want to mess with Core, but anything else (custom module, theming, existing module functionality) is fair game. I'm hoping I'm missing something easy, because this seems like an obvious requirement, but all I could find on the Drupal site were these unanswered questions:
Organize Create Content Page
(node/add)
Core: Split create
content page into categories?
You should be able to accomplish this in a custom module, without hacking core.
You'll want to implement hook_menu_alter() to take over the callback function for node/add.
Something like
function mymodule_menu_alter(&$items) {
$items['node/add']['page callback'] = 'mymodule_node_add_page';
}
should get you started. You would then create the function mymodule_node_add_page, and you could use the original callback function as a starting point.
You can also do this at the theme level by overriding theme_node_add_list().
There are some different ways to attack this problem. You can overwrite the old form page or just create a new one with a custom module. Doing that you can in your module do whatever your want.
Another possibility is to do the same thing using views instead. Doing that gives you access to a lot of powerfull features, as you can do anything the views module lets you do. You can create different ways of sorting the content types.
I've heard of many who have used views to make a page like this for the create content page. Which method you choose is up to you, depending on how exactly you want to do this and the data you have associated with your content types, one will be more easy than the other. But without knowing the exact details, I can't say which. I would advise you to start out with views, since you quickly should be able to find out, if you can use it to get what you want.
there's a module that does what you are looking for, Content type groups
I created a sandbox module some time ago which was supposed to do this:
https://drupal.org/sandbox/YaronTal/1260038
The only problem is that I wasn't able to create the admin backend with draggable interface at the time.
I know the issue is old, but just in case someone else has the same problem...

Resources