如何覆盖Share层中的客户端JavaScript?

时间:2017-02-03 07:47:39

标签: alfresco alfresco-share alfresco-maven

我的问题是从这里开始的:Is there a way to control the sorting order in the user's search interface?

我发现我可以使用people-finder.js

来控制排序顺序

此脚本包含在FreeMarker模板people-finder.get.html.ftl中:

<@standalone>
   <@markup id="css" >
      <#-- CSS Dependencies -->
      <@link href="${url.context}/res/components/people-finder/people-finder.css" group="people-finder"/>
   </@>

   <@markup id="js">
      <#-- JavaScript Dependencies -->
      <@script src="${url.context}/res/components/people-finder/people-finder.js" group="people-finder"/>
   </@>

    <@markup id="new-js" action="replace" target="js">
      <#– JavaScript Dependencies –>
      <@script src="${url.context}/res/components/people-finder/people-finder-ext.js" group="people-finder"/>
    </@>

   <@markup id="widgets">
      <@createWidgets group="people-finder"/>
   </@>

   <@markup id="html">
      <@uniqueIdDiv>
         <#assign el=args.htmlid?html>
         <div id="${el}-body" class="people-finder list theme-color-1">
            <div class="title theme-color-2"><label for="${el}-search-text">${msg("title")}</label></div>
            <div class="finder-wrapper">
               <@markup id="searchBar">
               <div class="search-bar theme-bg-color-3">
                  <div class="search-text"><input type="text" id="${el}-search-text" name="-" value="" maxlength="256" tabindex="0" placeholder="${msg('help.title')}"/></div>
                  <div class="search-button alf-colored-button">
                     <span id="${el}-search-button" class="yui-button yui-push-button"><span class="first-child"><button>${msg("button.search")}</button></span></span>
                  </div>
               </div>
               </@markup>

                <@markup id="searchHelp">
               <div id="${el}-help" class="yui-g theme-bg-color-2 help hidden">
                  <span>${msg("help.content")}</span>
               </div>
               </@markup>               

               <@markup id="searchResults">
               <div class="alf-results-wrapper">
                  <div id="${el}-results-info" class="yui-dt-liner theme-bg-color-2 result-info hidden"></div>
                  <div id="${el}-results" class="results hidden"></div>
               </div>
               </@markup>
            </div>
         </div>
      </@>
   </@>
</@>

要确定所需的功能,我需要覆盖此脚本,并且“开发”了我自己的 - 让我们说,people-finder-ext.js

据我了解,使用此代码我可以实现此目的:

<@markup id="new-js" action="replace" target="js">
  <#– JavaScript Dependencies –>
  <@script src="${url.context}/res/components/people-finder/people-finder-ext.js" group="people-finder"/>
</@>

在我的AMP扩展程序中,我将people-finder-ext.js放在此处:

/some-customization-share/src/main/amp/web/components/people-finder/people-finder-ext.js

我修改过的FreeMarker模板people-finder.get.html.ftl

/some-customization-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/components/people-finder/people-finder.get.html.ftl

然后我在嵌入式Tomcat上运行我的项目:

mvn integration-test -Pamp-to-war

所以,我发现排序不是我需要的方式。

我观看了Share层与Alfresco / Repo层之间的网络流量,并注意到我的脚本people-finder-ext.js未加载。

构建后我注意到,我的脚本不在\target\amp-war\中,而只在\target\amp\中。

可能是什么原因?

我将非常感谢这些信息。谢谢大家。

1 个答案:

答案 0 :(得分:1)

使用带有maven sdk的Eclips进行自定义露天,这对开发和创建放大器非常有用。

使用maven设置Alfresco sdk:Setup Alfresco sdk using maven