cancel
Showing results for 
Search instead for 
Did you mean: 

Custom type of space

tyve
Champ in-the-making
Champ in-the-making
How can I create a custom type of space? We want to add some custom properties to a space.

Best regards,
Johannes
14 REPLIES 14

jey
Champ in-the-making
Champ in-the-making
You can have a look here :
http://wiki.alfresco.com/wiki/Data_Dictionary_Guide

To resume:  you create a file mymodel.xml and a file mymodel-context.xml in your folder extension.

Your file mymodel.xml will contain the type definition…
Here is an example of a type project that extends the type folder (a space), it have a property (listbox due to constraint) and an association with a person.

<?xml version="1.0" encoding="UTF-8"?>

<!– Definition of new Model –>
<model name="custom:customModel"
   xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Imports are required to allow references to definitions in other models –>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0"
         prefix="d" />
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0"
         prefix="cm" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="extension.custom" prefix="custom" />
   </namespaces>

   <types>

      <!– Definition of new Content Type: Standard Operating Procedure –>
      <type name="customSmiley TonguerojectSpace">
         <title>ProjectSpace</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="customSmiley Frustratedolution">
               <type>d:text</type>
               <constraints>
                  <constraint type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           <value>Alfresco</value>
                           <value>Documentum</value>
                        </list>
                     </parameter>
                     <parameter name="caseSensitive">
                        <value>true</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>
         <associations>
            <association name="customSmiley TongueM">
               <target>
                  <class>cmSmiley Tongueerson</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
         </associations>
      </type>
   </types>

</model>

In the file mymodel-context.xml you define a bean to load your model.
Example:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <bean id="custom.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
            <value>alfresco/extension/mymodel-custom.xml</value>
         </list>
      </property>
   </bean>

</beans>

Then if you want (I guess you will) display custom properties in the web interface, you must add the following lines to the file web-client-config-custom.xml :

<config evaluator="node-type" condition="customSmiley TonguerojectSpace">
      <property-sheet>
         <show-property name="customSmiley Frustratedolution" />
         <show-association name="customSmiley TongueM" show-in-edit-mode="true"
            show-in-view-mode="true" />
      </property-sheet>
   </config>

Hope this help !

jey
Champ in-the-making
Champ in-the-making
Sorry for the indentation, I don't know why it doesn't work … when I edit my message it is indented, but when I see it it is not … 😞

tyve
Champ in-the-making
Champ in-the-making
Sorry for the indentation, I don't know why it doesn't work … when I edit my message it is indented, but when I see it it is not … 😞

np, thank you very much!

stk137
Champ in-the-making
Champ in-the-making
Sorry for the indentation, I don't know why it doesn't work … when I edit my message it is indented, but when I see it it is not … 😞

thanks for the post on this, it helped me, too.

As far as the indentation, try using "Code" instead of "Quote".

tyve
Champ in-the-making
Champ in-the-making
Is a custom space example added to the wiki?

stk137
Champ in-the-making
Champ in-the-making
Is a custom space example added to the wiki?

I didn't find one, but to add to what was already discussed, I found this
http://wiki.alfresco.com/wiki/Displaying_Custom_Metadata#Creating_Custom_Space_Types_in_the_Web_Clie...
which you need to know to get your custom space type to show up in the wizard

archana_bonkanp
Champ in-the-making
Champ in-the-making
How can I create a custom type of content?
We want to add some custom properties to a document through drop down, whenever it is uploaded into a space.

We accomplished of adding custom properties by entering ,but we want it by selecting.

gioele
Champ in-the-making
Champ in-the-making
Thank you for this example, it helped me a lot.  Like stk137 suggested I added in web-client-config-custom.xml:

  <config evaluator="string-compare" condition="Space Wizards">
    <folder-types>
      <type name="custom:projectSpace" description="Inline description of a Project Space"
            display-label="Project Space" />
    </folder-types>
  </config>

And the new ProjectSpace now shows in Create -> Advanced Space Wizard.  But I have a few questions:

1. In the Advanced Space Wizard, at step "3. Space Details", I don't see my custom properties.  I only see them after the space is created and click view details under Properties.  Why isn't it possible to edit them at the creation of the space at step 3 ?

2. Is it possible for this custom folder to be shown in Create -> Create Space?  Similar to when you ad content and are offered a drop menu with the custom type of your model.

Thanks!

Gioele

mcook
Champ in-the-making
Champ in-the-making
At this time, properties cannot be set for custom spaces in the Advanced Create Wizard.  This is a known feature request/bug.  View the following JIRA for more details:
https://issues.alfresco.com/jira/browse/ALFCOM-686

As far as I know, you can't add a custom space to the Create Space wizard because that is just for alfresco defined types.  Anything custom should be under the advanced wizard.

Matt