cancel
Showing results for 
Search instead for 
Did you mean: 

Content categorization and Dependent XForm fields

mcmagi
Champ in-the-making
Champ in-the-making
Is there a way to have the selection of an enumerated field on an XForm alter the available list selections on a following field?  Basically, we are attempting to author a web form whereby users can categorize content, however there are three levels of categorization, where subcategories are dependent on the parent category, following a tree structure.  Further complicating the issue is that these categories and subcategories are dynamic - users can add and remove them at will.  I can see a way to have the first level of categories constructed dynamically by following the tutorial, but I cannot see a way to have the second level dependent on the first within an XForm.

If we cannot have the XForm work in this way, another way we were thinking of implementing this by subdirectories in the web project.  User would browse the site, navigating to the appropriate subdirectory which represents that category, then create the web content using the appropriate web form from that directory.  However, I was hoping we could mask the creation of files and navigation of directories from the user so that users need only be familiar with the web form.

Is there another - perhaps Alfresco-recommended - way we can categorize content within a web project in this manner?

Thanks again for your help,
- Michael C. Maggio
6 REPLIES 6

arielb
Champ in-the-making
Champ in-the-making
there isn't a great way to do this at the moment.  it's related to a feature i'm working on for the 2.1 release.  please file a feature request at issues.alfresco.com in the WCM category.

rdanner
Champ in-the-making
Champ in-the-making
there isn't a great way to do this at the moment.  it's related to a feature i'm working on for the 2.1 release.  please file a feature request at issues.alfresco.com in the WCM category.

ariel, is this an alfresco limitation?  what is missing?  I haven't played with the categories in the XFORMS impl enough to know. 

From a XFORMS 1.0 perspective it seems possible. XFORMS 1.0 relates fields together in a slightly awkward way but its do'able

rdanner
Champ in-the-making
Champ in-the-making
there isn't a great way to do this at the moment.  it's related to a feature i'm working on for the 2.1 release.  please file a feature request at issues.alfresco.com in the WCM category.

ariel, is this an alfresco limitation?  what is missing?  I haven't played with the categories in the XFORMS impl enough to know. 

From a XFORMS 1.0 perspective it seems possible. XFORMS 1.0 relates fields together in a slightly awkward way but its do'able

Let me see if i can find an example – this example uses bindings .. may not be relevant:



     BINDINGS
     ———————–
     <xforms:bind id="storyWebPresPagesImagesBinding"                                                                xforms:nodeset="images" >
       <xforms:bind id="storyWebPresPagesImagesImageBinding"                                                         xforms:nodeset="image[position() != last()]" >
         <xforms:bind id="storyWebPresImageNameBinding"                               xforms:type="string"           xforms:nodeset="@name" />
         <xforms:bind id="storyWebPresImageClassBinding"                              xforms:type="string"           xforms:nodeset="@class" />
         <xforms:bind id="storyWebPresImageParagraphBinding"                          xforms:type="string"           xforms:nodeset="@paragraph" />
       </xforms:bind>
     </xforms:bind>

     <xforms:bind id="presTemplatesBinding"                                                                                 xforms:nodeset="/story/templates/template">
       <xforms:bind id="presTemplateNameBinding"                           xforms:type="string"                             xforms:nodeset="@name" />
       <xforms:bind id="presTemplatePathBinding"                           xforms:type="string"                             xforms:nodeset="path" />
       <xforms:bind id="presTemplateMultiPageBinding"                      xforms:type="boolean"                            xforms:nodeset="multipage" />
      
       <xforms:bind id="presTemplatesResourceSlotsBinding"                                                                  xforms:nodeset="resourceSlots">
         <xforms:bind id="presTemplateResourceSlotsSlotBinding"                                                             xforms:nodeset="slot" >
           <xforms:bind id="presTemplateResourceSlotsSlotNameBinding"      xforms:type="string"                             xforms:nodeset="@name" />
         </xforms:bind>
       </xforms:bind>
     </xforms:bind>

     <xforms:bind id="presChoicesTemplateSlotsBinding"                                                                      xforms:nodeset="/story/templateSlotOptions/option">
       <xforms:bind id="presChoicesTemplateSlotsViewBinding"               xforms:type="string"                             xforms:nodeset="@view" />
       <xforms:bind id="presChoicesTemplateSlotsCodeBinding"               xforms:type="string"                             xforms:nodeset="@code" />
     </xforms:bind>
    

     XFORM MARKUP
     —————————-
    <!– render template –>
    <xforms:select1 id="TMPL-TEMPLATE" bind="storyWebPresPagesPageRenderTemplateBinding" ev:event="DOMActivate">
      <xforms:label>Render Template</xforms:label>
      <xforms:itemset bind="presTemplatesBinding">
   <xforms:label bind="presTemplateNameBinding"/>
   <xforms:value bind="presTemplateNameBinding"/>
      </xforms:itemset>
    </xforms:select1> 
   
    <!– template has pages –>
    <xforms:output ref="/story/templates/template[@name=/story/webPresentation/renderTemplate]/multipage">
      <xforms:label>Multiple Pages</xforms:label>
    </xforms:output>
   
    <!– image class –>
    <!– ! WHERE IMAGE CLASS (SLOT NAME) DEPENDS ON THE RENDER TEMPLATE! –>
    <xforms:select1 id="TWPRSS-PAGE-IMAGE-CLASS" xforms:bind="storyWebPresImageClassBinding">
      <xforms:label>Image Class</xforms:label>
      <xforms:itemset nodeset="/story/templates/template[@name=/story/webPresentation/renderTemplate]/resourceSlots/slot">
         <xforms:label ref="@name"/>
         <xforms:value ref="@name"/>
      </xforms:itemset>
    </xforms:select1>
   
   
    <!– XML SAMPLE –>
  <template name="Standard">
    <resourceSlots>
      <slot name="photoStoryTop"/>
      <slot name="photoStorySidebar"/>
      <slot name="photoStoryFlow"/>
      <slot name="photoStoryBottom"/>
      <slot name="photoCulturalSnapshots"/>
    </resourceSlots>
  </template>
 
  <template name="Standard Without Sidebar">
    <resourceSlots>
      <slot name="photoStoryTop"/>
      <slot name="photoStoryFlow"/>
      <slot name="photoStoryBottom"/>
      <slot name="photoCulturalSnapshots"/>
    </resourceSlots>
  </template>


Wow the forums really do a number on these: here is the un-indented code


     BINDINGS
     ———————–
     <xforms:bind id="storyWebPresPagesImagesBinding"                                                                xforms:nodeset="images" >
       <xforms:bind id="storyWebPresPagesImagesImageBinding"                                                         xforms:nodeset="image[position() != last()]" >
         <xforms:bind id="storyWebPresImageNameBinding"                               xforms:type="string"           xforms:nodeset="@name" />
         <xforms:bind id="storyWebPresImageClassBinding"                              xforms:type="string"           xforms:nodeset="@class" />
         <xforms:bind id="storyWebPresImageParagraphBinding"                          xforms:type="string"           xforms:nodeset="@paragraph" />
       </xforms:bind>
     </xforms:bind>

     <xforms:bind id="presTemplatesBinding"                                                                                 xforms:nodeset="/story/templates/template">
       <xforms:bind id="presTemplateNameBinding"                           xforms:type="string"                             xforms:nodeset="@name" />
       <xforms:bind id="presTemplatePathBinding"                           xforms:type="string"                             xforms:nodeset="path" />
       <xforms:bind id="presTemplateMultiPageBinding"                      xforms:type="boolean"                            xforms:nodeset="multipage" />
      
       <xforms:bind id="presTemplatesResourceSlotsBinding"                                                                  xforms:nodeset="resourceSlots">
         <xforms:bind id="presTemplateResourceSlotsSlotBinding"                                                             xforms:nodeset="slot" >
           <xforms:bind id="presTemplateResourceSlotsSlotNameBinding"      xforms:type="string"                             xforms:nodeset="@name" />
         </xforms:bind>
       </xforms:bind>
     </xforms:bind>

     <xforms:bind id="presChoicesTemplateSlotsBinding"                                                                      xforms:nodeset="/story/templateSlotOptions/option">
       <xforms:bind id="presChoicesTemplateSlotsViewBinding"               xforms:type="string"                             xforms:nodeset="@view" />
       <xforms:bind id="presChoicesTemplateSlotsCodeBinding"               xforms:type="string"                             xforms:nodeset="@code" />
     </xforms:bind>
    
     XFORM MARKUP
     —————————-
    <!– render template –>
    <xforms:select1 id="TMPL-TEMPLATE" bind="storyWebPresPagesPageRenderTemplateBinding" ev:event="DOMActivate">
      <xforms:label>Render Template</xforms:label>
      <xforms:itemset bind="presTemplatesBinding">
   <xforms:label bind="presTemplateNameBinding"/>
   <xforms:value bind="presTemplateNameBinding"/>
      </xforms:itemset>
    </xforms:select1> 
   
    <!– template has pages –>
    <xformsSmiley Surprisedutput ref="/story/templates/template[@name=/story/webPresentation/renderTemplate]/multipage">
      <xforms:label>Multiple Pages</xforms:label>
    </xformsSmiley Surprisedutput>
   
    <!– image class –>
    <!– ! WHERE IMAGE CLASS (SLOT NAME) DEPENDS ON THE RENDER TEMPLATE! –>
    <xforms:select1 id="TWPRSS-PAGE-IMAGE-CLASS" xforms:bind="storyWebPresImageClassBinding">
      <xforms:label>Image Class</xforms:label>
      <xforms:itemset nodeset="/story/templates/template[@name=/story/webPresentation/renderTemplate]/resourceSlots/slot">
         <xforms:label ref="@name"/>
         <xforms:value ref="@name"/>
      </xforms:itemset>
    </xforms:select1>
   
   
    <!– XML SAMPLE –>
  <template name="Standard">
    <resourceSlots>
      <slot name="photoStoryTop"/>
      <slot name="photoStorySidebar"/>
      <slot name="photoStoryFlow"/>
      <slot name="photoStoryBottom"/>
      <slot name="photoCulturalSnapshots"/>
    </resourceSlots>
  </template>
 
  <template name="Standard Without Sidebar">
    <resourceSlots>
      <slot name="photoStoryTop"/>
      <slot name="photoStoryFlow"/>
      <slot name="photoStoryBottom"/>
      <slot name="photoCulturalSnapshots"/>
    </resourceSlots>
  </template>

arielb
Champ in-the-making
Champ in-the-making
there are definitely multiple ways to do this in the xforms layer - however, the xforms layer is not exposed which means that either it needs to be exposed, or there needs to be a way to describe this using xml schema which gets converted internally to xforms.  i'll be exploring these options post 2.0.

mcmagi
Champ in-the-making
Champ in-the-making
Thanks for the reply Ariel.  I inputted the feature request.

thaiyal
Champ in-the-making
Champ in-the-making
Is this feature available in the 2.1.0 release?