修改 Alfresco 社区 5.0.d 中的实时搜索 [英] Modify live search in Alfresco Commmunity 5.0.d

查看:25
本文介绍了修改 Alfresco 社区 5.0.d 中的实时搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Alfresco Community 5.0.d 并尝试查找与实时搜索相关的文件.

我想删除或修改实时搜索中的人物查找器.请让我知道文件或实现它的方法.

Share-header.get.js 信息如下:

if (!user.isAdmin){widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_MY_FILES");widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_SHARED_FILES");widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_SITES_MENU");widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_PEOPLE");widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_REPOSITORY");widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_BECPG");}//禁用人物搜索var headerSearch = widgetUtils.findObject(model.jsonModel, "id", "HEADER_SEARCH");如果(标题搜索){headerSearch.config.showPeopleResults = false;headerSearch.config.placeholder="搜索文件、站点";}

下面是extensions.xml

<模块><模块><id>更新站点标题</id><version>1.0</version>

真org.alfresco.share.headercom.site-header共享标题

正如我在下面添加的内容,现在我可以看到我的文件、共享文件和其他菜单项被用户(非管理员)删除,但搜索框中没有任何变化.

来源:Muralidharan

以下是模块/部署的截图:

调试模式截图:

提前致谢

解决方案

我按照下面的链接操作,效果很好.

https://community.alfresco.com/message/806438-re-not-able-to-disable-suggestion-in-alfresco?commentID=806438&et=watches.email.thread#comment-806438

总结:覆盖 live-search-people.get.json.ftl 文件以不生成实时搜索结果.

步骤:

  1. 提取 alfresco-remote-api-5.0.d (/Applications/alfresco-5.0.d/tomcat/webapps/alfresco/WEB-INF/lib)
  2. 转到/Applications/alfresco-5.0.d/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-remote-api-5.0.d/alfresco/templates/webscripts/org/alfresco/slingshot/search and copylive-search-people.get.json.ftl
  3. 然后转到 Applications/alfresco-5.0.d/tomcat/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search(如果不存在则创建新目录)并粘贴之前复制的文件
  4. 在编辑器中像 sublime text 一样打开该文件并替换为以下代码.

    <#import "../../repository/person/person.lib.ftl" as personLib/>

    <#escape x as jsonUtils.encodeJSONString(x)>{总记录":0,开始索引":0,项目":[]}

  5. 重启 tomcat 并测试实时搜索.

感谢 Angel 和 Alex 的回答,随后进行了澄清.

有趣的发现,我使用的是 Aikau 1.0.8 因为 Muralidharan 推荐的更改不起作用(旧版本)所以现在当我转向新版本的 Aikau (1.0.101) 然后这些更改很好.

谢谢 Muralidharan!

/****注意****/

如果您使用旧版本的 Aikau(如 1.0.8),则必须覆盖扩展名或者如果您使用较新版本的 Aikau(如 1.0.101),则可以直接进行更改.

I am using Alfresco Community 5.0.d and trying to find the files related to live search.

I would like to remove or modify the people finder in live search. Please let me know the files or way to achieve it.

Share-header.get.js info is below:

if (!user.isAdmin)
{
  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_MY_FILES");
  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_SHARED_FILES");

  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_SITES_MENU");
  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_PEOPLE");

  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_REPOSITORY");
  widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_BECPG");
}

//Disable people search 
var headerSearch = widgetUtils.findObject(model.jsonModel, "id", "HEADER_SEARCH");
if (headerSearch)
{ 
  headerSearch.config.showPeopleResults = false;       
  headerSearch.config.placeholder="Search files, sites";      
}

Below is extensions.xml

<extension>
    <modules>
        <module>
            <id>Update Site Header</id>
            <version>1.0</version>

true org.alfresco.share.header com.site-header share-header

As I added below lines, now I could see that my file, shared file and other menu items being removed for user(non admin) but no changes in search box.

Credit : Muralidharan

<auto-deploy>true</auto-deploy>
<evaluator type="default.extensibility.evaluator"/>

Screenshot of html structure for search box.

Below is screenshot of modules/deploy:

Screenshot of debug mode :

Thanks in advance

解决方案

I followed below link and it worked like a charm.

https://community.alfresco.com/message/806438-re-not-able-to-disable-suggestion-in-alfresco?commentID=806438&et=watches.email.thread#comment-806438

Summary: Override the live-search-people.get.json.ftl file to produce no result for live search.

Steps:

  1. Extract alfresco-remote-api-5.0.d (/Applications/alfresco-5.0.d/tomcat/webapps/alfresco/WEB-INF/lib)
  2. Goto /Applications/alfresco-5.0.d/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-remote-api-5.0.d/alfresco/templates/webscripts/org/alfresco/slingshot/search and copy live-search-people.get.json.ftl
  3. Then goto Applications/alfresco-5.0.d/tomcat/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/search (create new directory if not exist) and paste the file copied earlier
  4. Open that file in editor like sublime text and replace with following code.

    <#import "../../repository/person/person.lib.ftl" as personLib/>

    <#escape x as jsonUtils.encodeJSONString(x)> { "totalRecords": 0, "startIndex": 0, "items": [ ] }

  5. Restart the tomcat and test live search.

Thanks to Angel and Alex for answer followed with clarification.

Interesting finding that I was using Aikau 1.0.8 Because of that the changes recommended by Muralidharan was not working (older version) so now as I move to newer version of Aikau (1.0.101) then those changes are good to go.

Thank you Muralidharan!

/****NOTE****/

If your using older version of Aikau (like 1.0.8) than you have to override the extension Or If your using newer version of Aikau (like 1.0.101) than you can directly make changes.

这篇关于修改 Alfresco 社区 5.0.d 中的实时搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆