3

In Alfresco 4.0, I'd like to extend Share Doclib Filter webscript to add my own customized filter.

  1. Is there a simple way to add my own filter in the share-config-custom.xml?
  2. How do I define my own filter on the repository side?

enter image description here

plus-
  • 45,453
  • 15
  • 60
  • 73

1 Answers1

6

There are 2 steps involved:

  • Adding the link by customizing the document library with your own module(see alfresco Help):

    <customization>
      <targetPackageRoot>org.alfresco.components.documentlibrary</targetPackageRoot>
      <sourcePackageRoot>com.company.components.documentlibrary</sourcePackageRoot>
    </customization>
    

extend the webscripts filter.get.js and repo-filter.get.js (add them in web-extension / site-webscripts / com / company/ components / documentlibrary / )

var filters = model.filters;
filters.push(
      {
         id: 'myExtension',
         data: '',
         label: 'link.myExtension'
      });

model.filters = filters;

extend the property file with your own labels

  • Override the repository webscript to add your own filter interpretation:

in alfresco / templates / webscripts / org / alfresco / slingshot / documentlibrary-v2 /

Copy paste the filters.lib.js and add your logic:

case "myExtension":
                filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
                filterQuery += "+@blabla\\:isLikeThat:\"FALSE\"";
                filterParams.query = filterQuery + filterQueryDefaults;
                break;
plus-
  • 45,453
  • 15
  • 60
  • 73