1

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.

enter image description here

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. screenshot of html structure

Below is screenshot of modules/deploy:

modules/deploy

Screenshot of debug mode :

enter image description here

Thanks in advance

nikhil84
  • 3,235
  • 4
  • 22
  • 43

3 Answers3

2

We excluded people search using below script.

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

And we placed this file, in the following path. C:\Alfresco5\tomcat\webapps\share\WEB-INF\classes\alfresco\web-extension\site-webscripts\com\quanticate\header\share-header.get.js

Use the module extension to apply your customisation in Share and store this file into alfresco\web-extension\site-data\extensions\extensions.xml

<extension>
  <modules>
    <module>
      <id>Menu customisation</id>
      <auto-deploy>true</auto-deploy>
      <evaluator type="default.extensibility.evaluator"/>
       <!-- default.extensibility.evaluator is applied to determine if the module should be executed -->
      <customizations>        
         <customization>
            <targetPackageRoot>org.alfresco</targetPackageRoot>
            <sourcePackageRoot>com.quanticate.header</sourcePackageRoot> <!-- Your package path should go here -->
            <alwaysApply>
               <webscript>share-header</webscript>
            </alwaysApply>
         </customization>
      </customizations>
    </module>
  </modules>
</extension>
1

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.

nikhil84
  • 3,235
  • 4
  • 22
  • 43
0

You have to override the files containing the webscript response. Search for the Freemarker template files which have the rendered output and over-ride it .

  • finding right file is itself difficult and I am new to Alfresco.. if you could tell about which file needs to be changed? – nikhil84 Jan 18 '17 at 14:48
  • Live search in Alfresco is implemented in Aikau . The related webscripts are packaged in share.war .You have to create your own extensions to override the required files as per your requirement. – user6784900 Jan 18 '17 at 15:48
  • Click on "Toggle Developer View" in Debug Menu drop down. That enables you to see the Aikau widget information. The Widget type you are looking for is alfresco/header/SearchBox . – user6784900 Jan 18 '17 at 19:13
  • added a screenshot, please have a look at it. – nikhil84 Jan 19 '17 at 10:57
  • how can I find this file in alfresco community so I could edit it? – nikhil84 Jan 19 '17 at 12:03