cancel
Showing results for 
Search instead for 
Did you mean: 

Taggable aspect problem ... and labels definitions

piski
Champ on-the-rise
Champ on-the-rise
Hi All,

I've a problem to show standard aspect cm:taggable ( Categories are shown instead ?!? ).

I've created a custom type within a custom model in which I put my properties (Publication's date, Document's ref …).
I apply madatory aspects such as cm:taggable and cm:categories to automatically available tags and categories features.

I apply these settings by the rules on my root space, and everything is alright … except tags which are shown like categories (only on Share interface - Alfresco 3.3, Explorer interface works properly).

Here is my code : MyModel.xml
<types> 
  <type name="my:MyModel">
    <title>Mon Modele</title>
    <parent>cm:content</parent>
    <properties>
      <property name="my:refDoc">
         <title>Référence du document</title>
         <type>d:text</type>
         <mandatory>false</mandatory>
      </property>
      <property name="my:publicationDate">
         <title>Date de publication</title>
         <type>d:datetime</type>
         <mandatory>false</mandatory>
      </property>
    </properties>      
    <mandatory-aspects>
      <!– Permet de tagguer les documents –>
      <aspect>cm:taggable</aspect>
      <!– Permet de categoriser les documents –>
      <aspect>cm:generalclassifiable</aspect>
    </mandatory-aspects>
  </type>
</types>

in my share-config-custom.xml
<!– <config evaluator="node-type" condition="cm:content"> –>
<config evaluator="node-type" condition="my:MyModel">
   <forms>
      <!– Default form configuration used on the document details and edit metadata pages –>
      <form> 
         <field-visibility>
            <show id="cm:name" />
            <show id="cm:title" force="true" />
            <show id="cm:description" force="true" />
            <show id="cm:author" force="true" />
            
            <show id="cm:creator" for-mode="view" />
            <show id="cm:created" for-mode="view" />
            <show id="cm:modifier" for-mode="view" />
            <show id="cm:modified" for-mode="view" />
            <show id="mimetype" for-mode="view" />
            <show id="size" for-mode="view" />
            
            <show id="my:refDoc" />
            <show id="my:publicationDate" />
            
            <!– tags and categories –>
            <show id="cm:taggable" force="true"/>
            <show id="cm:categories" force="true"/>
         </field-visibility>
         <appearance>
            <!– Pattern - id, parent, appearance, label, label-id –>
            <set id="title" appearance="title" label="Document" label-id="grouptitre" />
            <set id="details" appearance="bordered-panel" label="Details" label-id="groupdetails" />
            <set id="attributes" appearance="bordered-panel" label="Attributs" label-id="groupattributes" />
            <set id="categories" appearance="bordered-panel" label="Categories" label-id="groupcategories" />
            <set id="tags" appearance="bordered-panel" label="Tags" label-id="grouptags" />
            
            <!– Pattern - id, set, mandatory, read-only, help –>
            <field id="cm:name" set="title" />
            <field id="cm:title" set="title" />
            <field id="cm:description" set="title" />
            <field id="cm:author" set="title" />
            
            <field id="cm:creator" set="details" />
            <field id="cm:created" set="details" />
            <field id="cm:modifier" set="details" />
            <field id="cm:modified" set="details" />
            <field id="mimetype" set="details" />
            <field id="size" set="details" />
            
            <field id="my:refDoc" set="attributes" />
            <field id="my:publicationDate" set="attributes" />
            
            <!– tags and categories –>
            <field id="cm:taggable" set="tags"/>
            <field id="cm:categories" set="categories"/>
         </appearance>
      </form>
      <!– Document Library pop-up Edit Metadata form –>
      <form id="doclib-simple-metadata">
         <edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
         <field-visibility> 
            <show id="cm:name" />
            <show id="cm:title" force="true" />
            <show id="cm:description" force="true" />
            <show id="cm:author" force="true" />
            
            <show id="cm:creator" for-mode="view" />
            <show id="cm:created" for-mode="view" />
            <show id="cm:modifier" for-mode="view" />
            <show id="cm:modified" for-mode="view" />
            <show id="mimetype" for-mode="view" />
            <show id="size" for-mode="view" />
            
            <show id="my:refDoc" />
            <show id="my:publicationDate" />
            
            <!– tags and categories –>
            <show id="cm:taggable" force="true"/>
            <show id="cm:categories" force="true"/>
         </field-visibility>
         <appearance>
            <set id="title" appearance="title" label="Document" label-id="grouptitre" />
            <set id="details" appearance="bordered-panel" label="Details" label-id="groupdetails" />
            <set id="attributes" appearance="bordered-panel" label="Attributs" label-id="groupattributes" />
            <set id="categories" appearance="bordered-panel" label="Categories" label-id="groupcategories" />
            <set id="tags" appearance="bordered-panel" label="Tags" label-id="grouptags" />
            
            <field id="cm:name" set="title" />
            <field id="cm:title" set="title" />
            <field id="cm:description" set="title" />
            <field id="cm:author" set="title" />
            
            <field id="cm:creator" set="details" />
            <field id="cm:created" set="details" />
            <field id="cm:modifier" set="details" />
            <field id="cm:modified" set="details" />
            <field id="mimetype" set="details" />
            <field id="size" set="details" />
            
            <field id="my:refDoc" set="attributes" />
            <field id="my:publicationDate" set="attributes" />
            
            <!– tags and categories –>
            <field id="cm:taggable" set="tags"/>
            <field id="cm:categories" set="categories"/>
         </appearance>
      </form>
      <!– Document Library Inline Edit form –>
      <form id="doclib-inline-edit">
         <field-visibility> 
            <show id="cm:name" />
            <show id="cm:title" force="true" />
            <show id="cm:description" force="true" />
            <show id="cm:author" force="true" />
            
            <show id="cm:creator" for-mode="view" />
            <show id="cm:created" for-mode="view" />
            <show id="cm:modifier" for-mode="view" />
            <show id="cm:modified" for-mode="view" />
            <show id="mimetype" for-mode="view" />
            <show id="size" for-mode="view" />
            
            <show id="my:refDoc" />
            <show id="my:publicationDate" />
            
            <!– tags and categories –>
            <show id="cm:taggable" force="true"/>
            <show id="cm:categories" force="true"/>
         </field-visibility>
         <appearance>
            <set id="title" appearance="title" label="Document" label-id="grouptitre" />
            <set id="details" appearance="bordered-panel" label="Details" label-id="groupdetails" />
            <set id="attributes" appearance="bordered-panel" label="Attributs" label-id="groupattributes" />
            <set id="categories" appearance="bordered-panel" label="Categories" label-id="groupcategories" />
            <set id="tags" appearance="bordered-panel" label="Tags" label-id="grouptags" />
            
            <field id="cm:name" set="title" />
            <field id="cm:title" set="title" />
            <field id="cm:description" set="title" />
            <field id="cm:author" set="title" />
            
            <field id="cm:creator" set="details" />
            <field id="cm:created" set="details" />
            <field id="cm:modifier" set="details" />
            <field id="cm:modified" set="details" />
            <field id="mimetype" set="details" />
            <field id="size" set="details" />
            
            <field id="my:refDoc" set="attributes" />
            <field id="my:publicationDate" set="attributes" />
            
            <!– tags and categories –>
            <field id="cm:taggable" set="tags"/>
            <field id="cm:categories" set="categories"/>
         </appearance>
      </form>

   </forms>
</config>

… and the result : http://img9.imageshack.us/img9/3334/errtaggable.jpg

Moreover, group's titles ("set=…" attributes, "bordered-panel" style ) don't display their label-id property. Documentation isn't very clear on that point. I've declared "label-id" on the same file where are stored my custom's model properties labels … without result !

I've also try to add links into custom-slingshot-application-context.xml like I saw on Will Abson & Loftux posts :
   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.messages.MyModel</value>
         </list>
      </property>
   </bean>

… and to put my files MyModel.properties et lMyModel_fr_FR.properties into directories tomcat\shared\classes\alfresco\extension (used by my custom model) and also into tomcat\shared\classes\alfresco\messages

Thanks for your help !
10 REPLIES 10

mikeh
Star Contributor
Star Contributor
Have a look at the "out of the box" form config in share-form-config.xml to see you're missing a couple of settings:
<field id="cm:taggable">
   <control>
      <control-param name="compactMode">true</control-param>
      <control-param name="params">aspect=cm:taggable</control-param>
      <control-param name="createNewItemUri">/api/tag/workspace/SpacesStore</control-param>
      <control-param name="createNewItemIcon">tag</control-param>
   </control>
</field>

compactMode is optional, as are the createNewItemUri and createNewItemIcon parameters (the last two present the user with the ability to add new tags within the picker).

However, because tags are represented in the Data Dictionary as the same type as categories, the Forms code needs to be told to treat them differently. Therefore, we need to tell the control to query using the cm:taggable aspect.

Thanks,
Mike

piski
Champ on-the-rise
Champ on-the-rise
Thank Mike, it works perfectly … I've missed this part !

… but I still have problems with groups labels traductions into Share. Could you please give some support or hints ?

Here is my files :
tomcat\shared\classes\alfresco\extension\MyModel-model-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!– Registration of new models –>   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/MyModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/extension/MyModel</value>
            </list>
        </property>
    </bean>
</beans>

MyModel.properties and MyModel_fr_FR.properties (both are similar except the language) :
my_MyModel.type.my_MyType.title=Document Type
my_MyModel.type.my_MyType.description=Document Type

my_MyModel.property.my_refDoc.title=Référence du document
my_MyModel.property.my_refDoc.description=Permet de numéroter, codifier un document
my_MyModel.property.my_publicationDate.title=Date de publication
my_MyModel.property.my_publicationDate.description=Date de création originelle du document

grouptitre=Document
groupdetails=Détails
groupattributes=Attributs
groupcategories=Categories
grouptags=Mot-Clés

Parts within the custom content model are well displayed, but not the groups customisations (by using label-id) defined into share-config-custom.xml.

As I've said before, documentation isn't clear (for me ! for all ?) and I've tried many ways to get it works … without success !

Thanks Mike, your help is very appreciated !

mikeh
Star Contributor
Star Contributor
You were correct adding the message bundle to the custom-slingshot-application-context.xml. Make sure the properties file is in the Share webapp's classpath, not the Alfresco one.

Thanks,
Mike

piski
Champ on-the-rise
Champ on-the-rise
Thanks for your advices !

I think the mistake was to put my files (label-id for custom model & label-id for set groups défined into shared-config-custom.xml) into tomcat\shared\classes\alfresco\extension and also to modify tomcat\shared\classes\alfresco\web-extension\custom-slingshot-application-context.xml instead of tomcat\webapps\share\WEB-INF\classes\alfresco\web-extension\custom-slingshot-application-context.xml.

So this is the result (it works) :

I've created a file in tomcat\shared\classes\alfresco\extension\MyModel_fr_FR.properties (because I've declared it into my MyModel-model-context.xml) :
# Only elements defined within my custom model
my_MyModel.type.my_MyType.title=Document Type
my_MyModel.type.my_MyType.description=Document Type

my_MyModel.property.my_refDoc.title=Référence du document
my_MyModel.property.my_refDoc.description=Permet de numéroter, codifier un document
my_MyModel.property.my_publicationDate.title=Date de publication
my_MyModel.property.my_publicationDate.description=Date de création originelle du document

and these files : tomcat\webapps\share\WEB-INF\classes\alfresco\web-extension\custom-slingshot-application-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
  
   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.messages.dod5015</value>
            <value>alfresco.messages.MyModel</value>
         </list>
      </property>
   </bean>
  
   <bean id="dod5015.custom.config" class="org.springframework.extensions.config.ConfigBootstrap" init-method="register">
      <property name="configService" ref="web.config" />
      <property name="configs">
         <list>
            <value>classpath:alfresco/dod-5015-form-config.xml</value>
         </list>
      </property>
   </bean>
  
</beans>

… and tomcat\webapps\share\WEB-INF\classes\alfresco\messages\MyModel_fr_FR.properties
grouptitre=Document
groupdetails=Détails
groupattributes=Attributs
groupcategories=Catégories
grouptags=Mot-Clés

Is this the best practice to define resource bundles keys, like that ?

Thanks, I'll mark the subject as solved !

mikeh
Star Contributor
Star Contributor
You should be able to move the Share extension files out into: tomcat/shared/classes/alfresco/web-extension/ - i.e. outside the webapps folder structure. Are you saying this mechanism isn't working for you?

Thanks,
Mike

piski
Champ on-the-rise
Champ on-the-rise
I've made some tests :

In tomcat\shared\classes\alfresco\extension\MyModel-model-context.xml, I've declared the resource bundle to use :
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!– Registration of new models –>  
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/MyModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/messages/MyModel</value>
            </list>
        </property>
    </bean>
</beans>

If the file MyModel.properties (and MyModel_fr_FR.properties for FR locale) isn't created at location tomcat\shared\classes\alfresco\extension\MyModel.properties, the model bootstrap fails -> NORMAL

I access to Share and when I take a look on Document Details, properties translations are well applied … but groups ("set" tags defined with "bordered-panel" style in share-config-custom.xml) aren't translated. Moreover, types in combo box "Change Type" action and custom aspect in "Add aspect" aren't translated.

If I create a file tomcat\shared\classes\alfresco\web-extension\custom-slingshot-application-context.xml :
   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.messages.dod5015</value>
            <value>alfresco.messages.lavdocModel</value>
         </list>
      </property>
   </bean>
and I put my file MyModel.properties (and FR file) into tomcat\shared\classes\alfresco\messages OR tomcat\webapps\share\WEB-INF\classes\alfresco\messages, it does'nt work.

… until I define, in WEBINF at location tomcat\webapps\share\WEB-INF\classes\alfresco\web-extension\custom-slingshot-application-context.xml
   <!– Override WebScript Messages - add slingshot application messages –>
   <bean id="webscripts.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>webscripts.messages.webscripts</value>
            <value>alfresco.messages.common</value>
            <value>alfresco.messages.slingshot</value>
            <value>alfresco.messages.dod5015</value>
            <value>alfresco.messages.lavdocModel</value>
         </list>
      </property>
   </bean>

and I put my file MyModel.properties into tomcat\webapps\share\WEB-INF\classes\alfresco
type.my_MyType=Document Type
type.my_MyType2=Document Type 2
aspect.my_MyAspect=My Custom Aspect

grouptitre=Document
groupdetails=Détails
groupattributes=Attributs
groupcategories=Catégories
grouptags=Mot-Clés
groupcontrat=Contrat

It works fine except the translation for aspect.my_MyAspect … and I don't know why !

To summarize, I made it work this way :

1) MyModel-model-context.xml -> bean extension.dictionaryBootstrap -> property label -> give the relative path of your resource bundle file (located everywhere you want in tomcat\shared\classes\alfresco, in my case, in ../alfresco/messages)

2) Within file MyModel.xml, I don't define any <title> flags except for types and aspects.

3) In my resource bundle file, which is located into tomcat\shared\classes\alfresco\messages, I add properties respecting naming rules. I'm sure that my file is correct because I see descriptions properties when I edit metadata.

4) In share-config-custom.xml, I define my <set /> flags (and my fields to be grouped) with a label-id.

5) For type and groups translations, I must declared in tomcat\webapps\share\WEB-INF\classes\alfresco\web-extension\custom-slingshot-application-context.xml the relative path to resource bundle, in my case tomcat\webapps\share\WEB-INF\classes\alfresco\messages.

6) I have to put my resource bundle tomcat\webapps\share\WEB-INF\classes\alfresco\messages containing only types and groups translations (aspect translation isn't working because of my syntax, file location ?!?)

I think adding some definitions into WEBINF files is a bad practice, isn't it ? … but I only find this way to translate properly other things than fields properties.

gavinc
Champ in-the-making
Champ in-the-making
Hi,

In 3.3 we added a Forms Development Kit (http://wiki.alfresco.com/wiki/Forms_Development_Kit) which actually demonstrates pretty much everything it appears you are trying to do, you could therefore use that to validate what you have done i.e. best practices.

Hope that helps!

piski
Champ on-the-rise
Champ on-the-rise
Thanks ! I'll take a look on this tool !

d_garry
Champ in-the-making
Champ in-the-making
[someone has deleted my post here.. what have i done wrong supplying my step-by-step solution with examples?]