Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing Doclib Filter in Alfresco Share

Tags:

share

alfresco

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

like image 211
plus- Avatar asked Nov 25 '25 14:11

plus-


1 Answers

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;
like image 61
plus- Avatar answered Nov 27 '25 03:11

plus-



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!