06-01-2021 11:04 AM
Hello Everyone,
I am working on a project that requires new fields to be added in file properties in alfresco share(5.2). So I have managed to do this, by creating a model and creating custom type and aspect for it. My question is,how can I include this model and use it's aspect for a particular site only in my alfresco share?. I don't wish to include this model for rest of the sites. Also, how can new fields be added in file properties using "share-config-custom.xml" configurations? please provide step wise approach for it as well.
Thanks
06-01-2021 12:30 PM
That's possible via Share forms not via content model itself.
You can create aspects based on your site specific requirements and extend share actions.js to work based on site-presets which you would include in form id while configuring the share form. When you click "Edit Properties" action, the custom form id based form will then be loaded. Note that you have to use site-preset not site-id of the site in the form config and extend the share actions.js based on site-preset only otherwise if you create multiple types of sites using same site-preset and if share actions.js is based on site id then correct form will not be loaded. so make sure you handle this case.
For example:
<config evaluator="node-type" condition="demo:whitePaper"> <forms> <form id="doclib-xyz-type-site"> <field-visibility> <show id="cm:name"/> <show id="cm:title"/> <show id="cm:description/> </field-visibility> </form> </forms> .............. ............. </config> <config evaluator="node-type" condition="demo:whitePaper"> <forms> <form id="doclib-abc-type-site"> <field-visibility> <show id="cm:name"/> <show id="cm:title"/>
<show id="demo:ratings"/> </field-visibility> </form> </forms> .............. ............. </config>
Here, xyz-type-site and abc-type-site are two different site presets.
Checkout these posts/docs for adding site-presets:
https://docs.alfresco.com/content-services/5.2/develop/share-ext-points/site-presets/
http://thinkalfresco.blogspot.com/2012/06/alfresco-hack-5-how-to-add-custom-share.html
You would have to extend the toolbar component as well if you want to have site specific forms loaded for a type based on site from create menu.
https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#addmenuitem2createmenu
https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#customizesurfwidget
06-02-2021 02:13 AM
Hi,
Can you please provide more simple and detailed approach. By using share.config.custom.xml, how can I add new fields "file path" and "location status" to file properties and make these two fields visibile to only a particular site in my alfresco share. To be more ellaborate, I have created a site "DUMMY" and I want all the files uploaded to this site to have these two created fields to be included in file properties.
06-02-2021 09:28 AM
I don't think there is any simple way to do this if your requirement is to keep properties site specific and it can't just be done via share-config-custom.xml.
I have already given you directions. To extend the out of the box components in share, follow these documentations):
https://docs.alfresco.com/content-services/5.2/develop/share-ext-points/
https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#addmenuitem2createmenu
https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#customizesurfwidget
Explore our Alfresco products with the links below. Use labels to filter content by product module.