In Alfresco 4.0, I'd like to extend Share Doclib Filter webscript to add my own customized filter.
- Is there a simple way to add my own filter in the
share-config-custom.xml
? - How do I define my own filter on the repository side?
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
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;