cancel
Showing results for 
Search instead for 
Did you mean: 

ComboBox Property

german
Champ on-the-rise
Champ on-the-rise
Hi all.
What is the syntax for defining a comboBox property type in a Content Model?
Thanks.

Germano.
5 REPLIES 5

sdavis
Champ in-the-making
Champ in-the-making
While possibly not a true ComboBox depending on your definition, a drop-down list can be achieved using http://wiki.alfresco.com/wiki/Constraints as part of your http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Step_by_Step_Model_Definition

For example, I have a CT model that includes

    <constraints>
        <constraint name="fp:allowedPositions" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Department Head</value>
                    <value>Tenured Professor</value>
                    <value>Teaching Assistant</value>
                    <value>Associate Professor</value>
                    <value>President</value>
                </list>
            </parameter>
        </constraint>
    </constraints>
    …
      <type name="fp:profile">
         <title>Faculty Profile</title>
         <parent>cm:content</parent>
         <properties>
          …
            <property name="fp:position">
               <title>Position</title>
               <type>d:text</type>
               <constraints>
                   <constraint ref="fp:allowedPositions" />
               </constraints>
            </property>
         </properties>
      </type>

which displays quite nicely with a drop down using a standard entry in web-client-config-custom.xml

   <config evaluator="node-type" condition="fp:profile">
      <property-sheet>
                  <show-property name="fp:position"/>
      </property-sheet>
   </config>

german
Champ on-the-rise
Champ on-the-rise
Perfect, thank you very much.

Bye.

Germano.

sharifu
Confirmed Champ
Confirmed Champ
I have done this but it does not work for me. i am using version 3.4d

in classes/alfresco/extension/web-client-config-custom.xml


<config evaluator="node-type" condition="sp:contract">
      <property-sheet>
                  <show-property name="sp:location"/>
      </property-sheet>
   </config>


in classes/alfresco/extension/SpectrumModel.xml

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

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="sp:spectrummodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Spectrum Custom Model</description>
   <author></author>
   <version>1.0</version>

   <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>

   <namespaces>
      <!– Define a Namespace for my new definitions –>
      <namespace uri="sp.new.model" prefix="sp"/>
   </namespaces>

   <constraints>
        <constraint name="sp:allowedLocations" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>UK</value>
                    <value>USA</value>
                </list>
            </parameter>
        </constraint>
    </constraints>

   <!– Type and Aspect definitions go here –>
   <types>
      <type name="sp:contract">
         <title>Spectrum Contract Document</title>
         <parent>cm:content</parent>
         <!–
         <properties>
            <property name="sp:thirdParties">
               <title>Third Parties</title>
               <type>d:text</type>
            </property>
            <property name="sp:location">
               <title>Location</title>
               <type>d:text</type>

      <constraints>
                  <constraint ref="sp:allowedLocations" />
         <constraint type="LIST">
<value>UK</value>
<value>USA</value>
                   </constraint>

                  </constraints>

            </property>
            <property name="sp:responsibleEmp">
               <title>Resposible Employee</title>
               <type>d:text</type>
            </property>
            <property name="sp:effectiveDate">
               <title>Effective Date</title>
               <type>d:date</type>
            </property>
            <property name="sp:expiryDate">
               <title>Expiry Date</title>
               <type>d:date</type>
            </property>
         </properties>
         –>
      </type>
    </types>

   <aspects>
      <aspect name="sp:contractFields">
         <title>Contract Meta Data</title>
         <parent>cm:content</parent>
         <properties>
            <property name="sp:thirdParties">
               <title>Third Parties</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:location">
               <title>Location</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:responsibleEmp">
               <title>Responsible Spectrum Employee</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:contractRef">
               <title>Internal Reference</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:logNumber">
               <title>Log Number</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:effectiveDate">
               <title>Effective Date</title>
               <type>d:date</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:expiryDate">
               <title>Expiry Date</title>
               <type>d:date</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </aspect>
   </aspects>

</model>


sharifu
Confirmed Champ
Confirmed Champ
I have done this but it does not work for me. i am using version 3.4d

in classes/alfresco/extension/web-client-config-custom.xml


<config evaluator="node-type" condition="sp:contract">
      <property-sheet>
                  <show-property name="sp:location"/>
      </property-sheet>
   </config>


in classes/alfresco/extension/SpectrumModel.xml

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

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="sp:spectrummodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Spectrum Custom Model</description>
   <author></author>
   <version>1.0</version>

   <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>

   <namespaces>
      <!– Define a Namespace for my new definitions –>
      <namespace uri="sp.new.model" prefix="sp"/>
   </namespaces>

   <constraints>
        <constraint name="sp:allowedLocations" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>UK</value>
                    <value>USA</value>
                </list>
            </parameter>
        </constraint>
    </constraints>

   <!– Type and Aspect definitions go here –>
   <types>
      <type name="sp:contract">
         <title>Spectrum Contract Document</title>
         <parent>cm:content</parent>
         <!–
         <properties>
            <property name="sp:thirdParties">
               <title>Third Parties</title>
               <type>d:text</type>
            </property>
            <property name="sp:location">
               <title>Location</title>
               <type>d:text</type>

      <constraints>
                  <constraint ref="sp:allowedLocations" />
         <constraint type="LIST">
<value>UK</value>
<value>USA</value>
                   </constraint>

                  </constraints>

            </property>
            <property name="sp:responsibleEmp">
               <title>Resposible Employee</title>
               <type>d:text</type>
            </property>
            <property name="sp:effectiveDate">
               <title>Effective Date</title>
               <type>d:date</type>
            </property>
            <property name="sp:expiryDate">
               <title>Expiry Date</title>
               <type>d:date</type>
            </property>
         </properties>
         –>
      </type>
    </types>

   <aspects>
      <aspect name="sp:contractFields">
         <title>Contract Meta Data</title>
         <parent>cm:content</parent>
         <properties>
            <property name="sp:thirdParties">
               <title>Third Parties</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:location">
               <title>Location</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:responsibleEmp">
               <title>Responsible Spectrum Employee</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:contractRef">
               <title>Internal Reference</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:logNumber">
               <title>Log Number</title>
               <type>d:text</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:effectiveDate">
               <title>Effective Date</title>
               <type>d:date</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
            <property name="sp:expiryDate">
               <title>Expiry Date</title>
               <type>d:date</type>
               <index enabled="true">
                 <atomic>true</atomic>
                 <stored>true</stored>
                 <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </aspect>
   </aspects>

</model>


sharifu
Confirmed Champ
Confirmed Champ