为什么我的Share标头自定义不适用于搜索页面

Dav*_*per 4 alfresco alfresco-share aikau

这个问题在Alfresco JIRA,论坛和Alfresco IRC中被反复询问,所以我想我会在这里问及回答,因为这是人们最有可能找到解决方案的地方,问题是这个......

我已按照此博客文章中描述的步骤创建了对Alfresco Share标头的自定义,以删除菜单项.

但是,当我登录Alfresco时,自定义工作除了搜索页面之外的所有内容 - 我做错了什么?

Dav*_*per 6

Alfresco Share中的搜索页面是应用程序中为数不多的完整Aikau页面之一.Share中的大多数页面都是在创建Aikau之前编写的,并且由多个Surf Components组成 - 其中标题是自版本4.2以来由Aikau呈现的.

搜索页面在5.0中更新为完整的Aikau页面,并且不使用相同的Surf Component来呈现标题.

这意味着标准标题自定义仅针对Surf Component WebScript而不是整页WebScript.

要使其工作,您需要利用alwaysApply模块配置中的元素.

因此,例如,针对标头的典型扩展模块可能如下所示:

<extension>
  <modules>
    <module>
      <id>Extension Module</id>
      <auto-deploy>true</auto-deploy>
      <evaluator type="default.extensibility.evaluator"/>
        <customizations>   
          <customization>
            <targetPackageRoot>org.alfresco</targetPackageRoot>
            <sourcePackageRoot>org.alfresco.share.pages.customizations</sourcePackageRoot>
          </customization>
        </customizations>
      </evaluator>
    </module>
  </modules>
</extension>
Run Code Online (Sandbox Code Playgroud)

这将针对org.alfresco包中的所有WebScripts,并在包中查找匹配的文件org.alfresco.share.pages.customizations.

因此,Share标头由share-header.get.js WebScript定义,如果您的扩展文件应该在org.alfresco.share.pages.customizations.share-header.get.js.

但是,org.alfresco.share-header.get.js搜索页面上未使用WebScript,这就是自定义无法生效的原因.

相反,您应该包含一个额外的customization块以确保应用扩展,它应该类似于:

<customization>    
  <targetPackageRoot>org.alfresco.share.pages</targetPackageRoot>
  <sourcePackageRoot>org.alfresco.share.pages.customizations.share.header</sourcePackageRoot>
  <alwaysApply>
    <webscript>share-header</webscript>
  </alwaysApply>
</customization>
Run Code Online (Sandbox Code Playgroud)

这表示对于org.alfresco.share.pages包中的所有WebScripts (定义了所有完整的Aikau页面).您应该始终应用名为"share-header"的扩展文件(因此.get.js,.get.html.ftl和.get.properties文件也将匹配).

请注意,sourcePackageRootis是准确定义扩展文件的位置.