OpenCMS Content Type - when editing, it doesn't show the names of the fields - content-type

I created a custom content type FaqEntry in OpenCMS (three fields - title, question, answer) and registered it. When I create a new file of that type and want to edit it, it shows the three fields there, but it doesn't show their label, i.e. "Title", "Question", "Answer". Do you have any idea as to why?

So, what does it show then if not the labels you set/expect?
There are three possible reasons why the labels are not showing correctly:
you're referencing the wrong
properties file in your xsd
you
haven't set the properties/labels
correctly in your properties file
you haven't published and restarted
the tomcat yet
The labels should be in the file workplace.properties under 'classes' in the the folder structure of your module, i.e. /system/modules/com.mydomain.www/classes/com/mydomain/www/workplace.properties
In your faqentry.xsd the reference should then be like this:
<xsd:annotation>
<xsd:appinfo>
<resourcebundle name="com.mydomain.www.workplace"/>
...
In the properties file, the labels need to have the proper mapping:
label.FaqEntry.Title = Title Label The Way You Want It
Last, the Tomcat needs to be restarted for the properties to take effect.

Related

Remove custom type in Alfresco

In Alfresco, if a type name is removed/changed all nodes of that type will disappears but still exists.
Using alfresco 5.0.c I've added some custom types:
eg:
<type name="my:test">
<title>Test folder</title>
<parent>cm:folder</parent>
</type>
now i deploy it and create a folder of this type (a simple folder, then change type)
Now i edit the type like this:
<type name="my:test2"> <!-- from my:test to my:test2 -->
<title>Test folder</title>
<parent>cm:folder</parent>
</type>
Deploying this: any "my:test" folder will disappear, but, if I try to create another folder with the same name I get an error becouse the node still exists.
These nodes will not be not even listed within the folder child:
print(document.getChildren());
How can I recover (if possible using the the javascript console) all the "broken" nodes and be able to change the type?
A little preface: as widely stated by Alfresco, if you want to change your custom content model you should change it only incrementally.
This means that you can't remove any properties, types or aspect at definition level of the model, you only can add new definitions in the content model of Alfresco.
So it is a very bad practice to change types "on the fly".
A good practice is to always start with a model as small as you can and then add features as long as you need them.
In your case you should have deleted all nodes referencing my:test type BEFORE changing the model and then safely remove it and finally you should have performed a full reindex. This could be the reason why the repository tells you that the folder exists even if you cannot see it anymore.
As far as I know it is not possible to delete this inconsistent nodes through the console, so my advice is to perform a full reindex. If the issues come up again then you should consider to start again from scratch.
Another approach next time is to add the new type and programmatically hide the older one.

How to make a dexterity reference field?

Using Plone 4.3 (from https://raw.github.com/plock/pins/master/plone-4-3) and trying to make a reference field between two dexterity contents: from IConsumibleEntry to IConsumibleItem.
If I'm understand correctly, I have to add a RelationChoice into IConsumibleEntry with a ObjPathSourceBinder and then all related IConsumibleItem will appear in the add form. I'm following http://docs.plone.org/external/plone.app.dexterity/docs/advanced/references.html so I did:
from mypackage.consumibles.consumible_item import IConsumibleItem
class IConsumibleEntry(form.Schema, IImageScaleTraversable):
item = RelationChoice(
title=_(u"Item"),
source=ObjPathSourceBinder(object_provides=IConsumibleItem.__identifier__),
required=True,
)
I run plone and created several IConsumibleItem instances, but when I try to create an IConsumibleEntry, there's nothing to chose for the 'item' field.
I tried using other expressions for ObjPathSourceBinder, like chosing by content type, but I still can't get any reference to IConsumibleItem instances.
What else is needed to do to get reference fields populated? Is in needed to modify IConsumibleItem? What am I missing?
Thanks in advance.

Take data from a field from exsisting node and make that the default value of a field in different content type

I don't know if I'm on the right track but I'm trying to let users of my web site create there own versions of pages on my web site.
Basically I'd like to make our documentation used as a starting point where they just add details and make a new page for themselves in the process.
I have a 'book' content type that I have changed with CCK and a 'client edits' content type that uses a nodereferencefromURL widget to link itself to the book node.
So simple version of what I'm saying is I have a link on my book pages that creates a node using client edits content type. I would like to put some fields on the client edits content type that take the values of some of the fields from the book page it is linked from.
I'm sure I'm missing something as I would have thought someone would have tried this before but I can't even find a hint on how to go about this.
All I really need is a point in the right direction if my current thinking is wrong.
Current thinking is that I use a php script to get the default value for a field on the new node add screen that drags the value for a field from the book I'm linking from.
I'm thinking this is the case because there is an option for default values for the field in cck manage fields that lets you put in a php value to return a default value for your field.
Am I on the right track or is there already a module or process that does what I'm talking about and I'm just too dumb to find it.
This sounds a little strange, are your client edits going to be a diff from the original node or just coppied data?
I would prehaps do it a more simple way, just have book nodes, and have different fields disaply depending on who edits it (enable the content_permissions module). That way you can use the node clone module to create the users copy.
You will need to make a module to contain your custom php code.
I ended up using rules to save information from the user and the cloned node into hidden fields.
One that saved the original node ID into a field when ever you create content of that type unless the url ends with Clone. This means that when you create the clone the original node ID is kept in the field.
That made it easy to use a views argument that took the node ID to make the clone appear along side the original when a user visits the original page.
The second rule trick was to compute a field that saved the "store name" from the profile of the user only when saving clone content.
This meant that there was a hidden field on the clone that stored the info so I could then use another views argument to restrict the view to only people with the same store name in their profile.
I am no good with PHP but I managed to find a snippet (can't remember where) that returns the store name of the current logged in user as the argument.
global $user;
profile_load_profile($user);
return $user->profile_store_name;

Drupal Views (Page) Using Human-Friendly Path

I have CCK and Views module installed. For the sake of this question scope, I'll call the content type as Project. Projects have many Members.
Project nodes are accessible through /project/project-name. I want to be able to display list of members through path /project/project-name/members.
Is there any way to do this?
Currently I have a views setup for page display on path /project/%/members, and have the argument taken from the url. I realize I can't use "Node ID from URL" option directly since it's node name instead of node id. Therefore I tried to enable "PHP Code" argument. But the problem is, Drupal Views always assume that the parameter is "project-name" and therefore ignored my php code argument setting. Anyone knows how I might be able to do this?
Thanks
Yes, you can actually use the "Node ID from URL" option, and you should.
Use the path or pathauto module to generate human-readable URLs for your projects in the form project/project-name. This will create a human-readable alias for the node, but the underlying Drupal system path is still node/nid.
Views can still use the "Node ID from URL" as an argument (or Contextual filter, as they are known in Drupal 7) even with human-readable aliases for those ugly paths.
If the project's name is the node title you can get what you want pretty easily.
You can pass the node title as argument instead of the nid, but the result will be the same. You get some options to use lowercase, transform - to space ect, as what you can do in a url is limited compared to a node title.
The rest of the view would be the same, as the solution using node nids in the url.
You need to create path aliases for /project/project-NID/members to /project/project-Name/members
I asked this exact question a month ago. :)
drupal link to view dependent on argument

Saving Configuration Section Error - Elements are merged as attributes

I have created a configuration section designer project to represent nodes of a custom section necessary to read and save from my web application. I am able to successfully create instances of the configuration elements and collections, however when I save the configuration using the referenced System.Configuration.Configuration object and issuing save, the elements get merged into their parents as attributes. An example of the issue is outlined below:
After calling the referenced Configuration.save, the output is as follows:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets dataViewId="1" id="4203bb88-b0c4-4d57-8708-18e48f0a1d2d">
<selects keyId="1" sortOrder="1" />
</resultsSets>
</savedReports>
As defined in my configuration section designer project (confirmed by the resulting xsd as well) the output should match the following:
<savedReports xmlns="SavedReportSchema.xsd">
<resultsSets>
<savedReport id="1">
<selects>
<select keyId="1" sortOrder="1"/>
</selects>
</savedReport>
</resultsSets>
</savedReports>
Any ideas? The element collection types are set to BasicMapAlternate however when I set them to AddRemoveClearMapAlternate they are not merged but they are prefixed by "add" rather than "select" or "savedReport" causing the validation to be off.
Turns out AddRemoveClearMapAlternate was the option I needed to correct my problem referenced in the question.

Resources