cancel
Showing results for 
Search instead for 
Did you mean: 

How to select content type by space name?

roby71
Champ in-the-making
Champ in-the-making
Hello,

I created a space named "MyBooks"

then I created a costum content-typeadding it definition in file
customModel.xml
below the snippest of customModel.xml

<type name="custom:MyBook">
         <title>My Books</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:myBookTitle">
               <title>Title</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="custom:myBookNumPages">
               <title>Page number</title>
               <type>d:int</type>
               <mandatory>true</mandatory>
            </property>
             <property name="custom:myBookBuyDate">
               <title>Buy date</title>
               <type>d:date</type>
               <mandatory>true</mandatory>
            </property>
             …. and so on…
         </properties>
      
      </type>


then I customized web-client-config-custom.xml file…

all things works fine!

Now, I would like to add this feature: :idea:

When I upload a new document in space "MyBooks"
the Alfresco wizzard GUI select as default in the contet-type drop-down-list
the value "Content".

Indeed, I would like to show in the drop-down-list as default value the name of the space, that is "MyBooks" and not "Content"

Anyone could help me please?

Thanks,
regards,
2 REPLIES 2

roman
Champ in-the-making
Champ in-the-making
Hi,

I don't know if there is an official way of doin' it but i've done it my way:

You need to customize the upload dialog
i've created new Class XXX extends AddContentDialog

then copied the original add-content.jsp to, lets say: /jsp/dialogs/custom-upload/

and finally created an action (with params, but not needed, i have the same action for different content-types) which calls this dialog

you can override the function getObjectType(), there you can influence what the combobox with the content types delivers.
you can even remove all irrelevant types.

hope this helps

best regards

rivarola
Champ on-the-rise
Champ on-the-rise
Hello,

You can define a rule in your folder to specialize the content type. The document the user creates will be cm:content, but if the rule is not run in background it will get specialized to your specific type before the document property sheet appears, and the user can fill your custom properties.