是否可以将文档选择器默认为露天共享中的文档库?

时间:2013-11-21 11:13:48

标签: alfresco alfresco-share

我有一份association.ftl副本,我将其用于添加到共享中高级搜索表单的控件。不幸的是,当打开时,默认显示是公司家,因为我宁愿将它默认为相关网站的文档库。 我看了this wiki并尝试更改javascript中的 parentNodeRef 值,至少将网站添加到路径中,但没有成功。

共享表单配置控件:

<config evaluator="model-type" condition="cm:content">
    <forms>
        <!-- Search form -->
        <form id="search">
            <field-visibility>
                <show id="cm:name" force="true" />
                <show id="space" force="true" />
            </field-visibility>
            <appearance>
                <field id="cm:name" label-id="prop.search.cm_name" />
                <field id="space" label-id="prop.search.cm_search_in_folder" >
                    <control template="/org/alfresco/components/form/controls/space.ftl">
                        <control-param name="startLocation">{doclib}</control-param>
                    </control>
                </field>
            </appearance>
        </form>
    </forms>
</config>

freemarker控制文件:

<#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: false,
      parentNodeRef: "alfresco://company/home/sites", //<== Not the default path
   <#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">
         <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}:</label>

      <div id="${controlId}" class="object-finder">

         <div id="${controlId}-currentValueDisplay" class="current-values"></div>

            <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 />
      </div>
   </#if>
</div>

1 个答案:

答案 0 :(得分:1)

维基非常清楚如何做到这一点:

将一个startLocation作为参数提供给forms-config中的选择器,因为你想要使用用户搜索的站点的documentLibrary,我建议你实现一个NodeLocator,如wiki所述:

https://wiki.alfresco.com/wiki/NodeLocatorService

事实上,似乎已经为您实施并且似乎存在于露天来源中:

http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2e/root/projects/repository/source/java/org/alfresco/repo/site/DocLibNodeLocator.java

但是我无法找到bean声明,因此您可能必须将它添加到spring-bean定义中(或将源复制到自己的实现中)才能正确使用它。