cancel
Showing results for 
Search instead for 
Did you mean: 

Reg category drop down while uploading content

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

I am using Alfresco 3.2r with Tomcat 6.0 & JDK 1.6. I want to show a drop down for all the categories which are available in Alfresco at the time of uploading the content.For this, i am following this Alfresco blog

http://blogs.alfresco.com/wp/jbarmash/2008/08/08/dynamic-data-driven-drop-downs-for-list-properties/

It is working without any error but still user is not able to see any drop down for categories.I have placed some logs inside encodeBegin() method of RefreshableUIPropertySheet.java.I can see following logs :

15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Inside encodeBegin()
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] size 8
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@159a5a7
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@8aa1b1
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@17d7d2e
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@1a57585
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@1c68525
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@4f7f9f
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@143b35f
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] Item list in encodeBegin() org.alfresco.web.ui.repo.component.property.UIProperty@1b53930
15:27:50,788 User:km DEBUG [km.web.RefreshableUIPropertySheet] super.isRendered() true

But still i am not able to see a drop down.Instead once document is uploaded, on Modify Content Properties page, i can see radio buttons for categories but not drop down.I am getting no idea where it is going wrong.

Can anybody help? :roll:
3 REPLIES 3

billerby
Champ on-the-rise
Champ on-the-rise
Ok, so you have made a custom type with a property that has this constraint set in your custom-model.xml? Do you as well have a property sheet configured in your web-client-custom.xml where you have made this property visible using the <show-property> tag?

Please post your configuration files, otherwise it will be impossible for us to provide help.

/Erik

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi Erik,

Thanks for your reply.

Below is my web-client-config-custom.xml entry:

<config evaluator="aspect-name" condition="cm:generalclassifiable">
   
   <property-sheet>
      <show-property name="cm:categories"></show-property>      
   </property-sheet>
</config>

  <config evaluator="node-type" condition="km:knowledgedoc">
      <property-sheet>
          <show-property name="km:coauthor" display-label="Co-Author"/>
          </property-sheet>
   
   
   </config>

Also below is entry for faces-config-repo.xml

<component>
      <component-type>org.alfresco.faces.PropertySheet</component-type>
      <component-class>com.xxxxxx.alfresco.km.web.RefreshableUIPropertySheet</component-class>
   </component>

Below is entries for custom beans in faces-config-beans.xml:

<managed-bean>
   <description>
      Bean that generates a custom generator component
   </description>
   <managed-bean-name>CustomListComponentGeneratorWithRefresh</managed-bean-name>
   <managed-bean-class>com.xxxxxx.alfresco.km.web.CustomListComponentGenerator</managed-bean-class>
   <managed-bean-scope>request</managed-bean-scope>
   <managed-property>
      <property-name>autoRefresh</property-name>
      <value>true</value>
   </managed-property>
     <managed-property>
         <property-name>communityConstraintsMap</property-name>
         <value>#{CommunitySearchConstraintMap}</value>
      </managed-property>
</managed-bean>

<managed-bean>
   <description>
      Bean that generates a custom generator component
   </description>
   <managed-bean-name>CustomDependentListComponentGenerator</managed-bean-name>
   <managed-bean-class>com.xxxxx.alfresco.km.web.CustomListComponentGenerator</managed-bean-class>
   <managed-bean-scope>request</managed-bean-scope>
   <managed-property>
      <property-name>autoRefresh</property-name>
      <value>false</value>
   </managed-property>
     <managed-property>
         <property-name>communityConstraintsMap</property-name>
         <value>#{CommunitySearchConstraintMap}</value>
      </managed-property>
</managed-bean>


Finally,here is my custom model:

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="km:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

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

   <!– 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" />
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.xxxxx.com/model/km/content/1.0" prefix="km" />
   </namespaces>

       <constraints>
      <constraint name="km:communityList" type="com.xxxxxxx.alfresco.km.constraints.CommunitySearchConstraint">
          <parameter name="allowedValues">
              <list>
               </list>
             </parameter>
             <parameter name="caseSensitive"><value>true</value></parameter>
        </constraint>
       
        <constraint name="km:subcommunityList" type="com.xxxxxxx.alfresco.km.constraints.CommunitySearchConstraint">
            <parameter name="allowedValues">
              <list>
               </list>
             </parameter>
             <parameter name="caseSensitive"><value>true</value></parameter>
        </constraint>
         <constraint name="km:subjectList" type="com.xxxxxxx.alfresco.km.constraints.CommunitySearchConstraint">
            <parameter name="allowedValues">
              <list>
               </list>
             </parameter>
             <parameter name="caseSensitive"><value>true</value></parameter>
        </constraint>
   </constraints>
   
   <types>
      <!– Enterprise-wide generic document type –>
      <type name="km:knowledgedoc">
         <title>xxxxxxx Knowledge Document</title>
         <parent>cm:content</parent>
         <properties>
            <property name="km:community">
               <type>d:text</type>
                <mandatory>true</mandatory>
                <multiple>false</multiple>
                <constraints>
                        <constraint ref="km:communityList" />
                    </constraints>
            </property>
            <property name="km:subcommunity">
                    <type>d:text</type>
                     <mandatory>true</mandatory>
                    <multiple>false</multiple>
                     <constraints>
                        <constraint ref="km:subcommunityList" />
                    </constraints>
                 </property>
                 <property name="km:subject">
                    <type>d:text</type>
                     <mandatory>true</mandatory>
                     <multiple>false</multiple>
                     <constraints>
                        <constraint ref="km:subjectList" />
                    </constraints>
                 </property>
                 <property name="km:coauthor">
                    <type>d:text</type>
                     <mandatory>false</mandatory>
                     <multiple>false</multiple>
                     <index enabled="true">
              <atomic>true</atomic>
              <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
                  </property>
                   <property name="km:status">
                    <type>d:text</type>
                    <default>false</default>
                  </property>
         </properties>
         <mandatory-aspects>
              <aspect>cm:generalclassifiable</aspect>
              <aspect>cm:versionable</aspect>
         </mandatory-aspects>
      </type>

      </types>
      
</model>

These are my configurations.Happy to see if i am missing something. Smiley Happy

billerby
Champ on-the-rise
Champ on-the-rise
Hi again,

Have you hardcoded your query in your search constraint classes? In the examples from the blog you specify the query with a parameter and value, and in your code there are no query parameter at all.

Example from the blog post:

<constraint name=”my:customConstraint” type=”org.alfresco.sample.constraints.LuceneSearchBasedListConstraint” >
<parameter name=”query”>
<value> TYPE:”{http://www.alfresco.org/model/content/1.0}content”
</value>
</parameter>
</constraint>

You have to do <show-property> for the types using your constraints to have the listbox to show up. For example the property km:subcommunity have the constraint km:subcommunityList which uses your dynamic constraint, without having a show-property directive in your web-client-config-custom.xml.