是否可以将文档选择器默认设置为露天共享中的文档库? [英] Is it possible to make document picker default to document library in alfresco share?
问题描述
我有一个association.ftl副本,用于共享添加到高级搜索表单中的控件。不幸的是,当打开时,默认显示为companyhome,我希望它默认为相关站点的文档库。
我阅读了此Wiki ,并且还尝试了更改 javascript中的 parentNodeRef 值,至少将网站添加到没有成功的路径。
I have a copy of association.ftl which I use for a control added to the advanced search form in share. Unfortunately when opened the default display is companyhome where as I'd rather have it default to the related site's document library. I read this wiki and also tried the changing the parentNodeRef value in the javascript to at least add sites to the path to no success.
共享表单配置控件:
<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控制文件:
The freemarker control file :
<#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>
推荐答案
Wiki非常清楚如何做到这一点:
The wiki is pretty clear on how to do this:
在forms-config中提供一个startLocation作为选择器的参数,因为您希望与用户从中搜索的站点的documentLibrary一起使用,建议您实施Wiki中所述的NodeLocator:
Supply a startLocation as parameter to the picker in the forms-config, since you want to go with the documentLibrary of the site the user searches from I would recommend you to implement a NodeLocator as described in the wiki:
https: //wiki.alfresco.com/wiki/NodeLocatorService
实际上,这似乎已经为您实现,并且似乎位于露天资源中:
In fact that seems to already have been implemented for you and seems to reside in the alfresco source:
但是我找不到bean声明,因此您可能必须将其添加到spring-bean定义中(或将源复制到自己的实现中)才能正确使用它。
However I cant find the bean declaration so you might have to add it to your spring-bean definitions (or copy the source to an own implementation) to be able to use it properly.
这篇关于是否可以将文档选择器默认设置为露天共享中的文档库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!