AnsweredAssumed Answered

Custom search in folder?

Question asked by theoryoflinkin on Feb 21, 2014
Latest reply on Jun 29, 2017 by tushar.khanka
Hi everyone,

I'm trying to extend the default search in Alfresco Share for the "cm:content" type.

What I need is, for example, when I select the "Test folder" folder, it returns me all the files inside the "Test folder".

I was wondering how could I implemente this.

Here is the code of my custom search:


         <!– Search form –>
         <form id="search">
      
            <field-visibility>
               <show id="cm:name" />
               <show id="cm:title" force="true" />
               <show id="cm:description" force="true" />
               <show id="mimetype" />
               <show id="cm:modified" />
               <show id="cm:modifier" />                           
         
               <!– new search parameters –>
               <show id="cm:created" />
          <show id="cm:creator" />
          <show id="cm:categories" force="true" />

          <!– Should insert here the parameters for the location search –>   
           
            </field-visibility>

            <appearance>
               <field id="mimetype">
                  <control template="/org/alfresco/components/form/controls/mimetype.ftl" />
               </field>
               <field id="cm:modifier">
                  <control>
                     <control-param name="forceEditable">true</control-param>
                  </control>
               </field>
               <field id="cm:modified">
                  <control template="/org/alfresco/components/form/controls/daterange.ftl" />
               </field>        
          <field id="cm:created">
                  <control template="/org/alfresco/components/form/controls/daterange.ftl" />
               </field>
          <field id="cm:creator">
                  <control>
                     <control-param name="forceEditable">true</control-param>
                  </control>
               </field>
           
          <field id="cm:categories">
        <control>
           <control-param name="compactMode">true</control-param>
           <control-param name="showSubCategoriesOption">true</control-param>
        </control>
          </field>
            </appearance>
         </form>



Please, could you tell me which parameter should I insert in order to search by file location?

Hope this is clear

Thanks in advance


PS: I already define a ftl template that allows me to select a folder. Here is the code of this if you want:


<#include "common/picker.inc.ftl" />

<#assign controlId = fieldHtmlId + "-cntrl">

<script type="text/javascript">//<![CDATA[
(function()
{
   <@renderPickerJS field "picker" />
   picker.setOptions(
   {
   <#if field.control.params.showTargetLink??>
      showLinkToTarget: ${field.control.params.showTargetLink},
      <#if page?? && page.url.templateArgs.site??>
         targetLinkTemplate: "${url.context}/page/site/${page.url.templateArgs.site!""}/document-details?nodeRef={nodeRef}",
      <#else>
         targetLinkTemplate: "${url.context}/page/document-details?nodeRef={nodeRef}",
      </#if>
   </#if>
   <#if field.control.params.allowNavigationToContentChildren??>
      allowNavigationToContentChildren: ${field.control.params.allowNavigationToContentChildren},
   </#if>
      itemType: "cm:folder",
      multipleSelectMode: true,
      parentNodeRef: "alfresco://company/home",
   <#if field.control.params.rootNode??>
      rootNode: "${field.control.params.rootNode}",
   </#if>
      itemFamily: "node",
      displayMode: "${field.control.params.displayMode!"items"}"
   });
})();
//]]></script>

<div class="form-field">
   <#if form.mode == "view">
      <div id="${controlId}" class="viewmode-field">
         <#if (field.endpointMandatory!false || field.mandatory!false) && field.value == "">
            <span class="incomplete-warning"><img src="${url.context}/res/components/form/images/warning-16.png" title="${msg("form.field.incomplete")}" /><span>
         </#if>
         <span class="viewmode-label">${field.label?html}:</span>
         <span id="${controlId}-currentValueDisplay" class="viewmode-value current-values"></span>
      </div>
   <#else>
      <label for="${controlId}">${field.label?html}:<#if field.endpointMandatory!false || field.mandatory!false><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label>
     
      <div id="${controlId}" class="object-finder">
        
         <div id="${controlId}-currentValueDisplay" class="current-values"></div>
        
         <#if field.disabled == false>
            <input type="hidden" id="${fieldHtmlId}" name="-" value="${field.value?html}" />
            <input type="hidden" id="${controlId}-added" name="${field.name}_added" />
            <input type="hidden" id="${controlId}-removed" name="${field.name}_removed" />
            <div id="${controlId}-itemGroupActions" class="show-picker"></div>
        
            <@renderPickerHTML controlId />
         </#if>
      </div>
   </#if>
</div>

Outcomes