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.
The share form config control:
<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>
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>