How to setup content model for a particular site in alfresco share

cancel
Showing results for 
Search instead for 
Did you mean: 
sneha-lolge
Active Member

How to setup content model for a particular site in alfresco share

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.

Thanksac1.png

3 Replies
abhinavmishra14
Advanced

Re: How to setup content model for a particular site in alfresco share

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:

https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/acti...

 

<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/

https://hub.alfresco.com/t5/alfresco-content-services-blog/create-and-edit-site-dialog-customization...

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

https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/tool...

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)
sneha-lolge
Active Member

Re: How to setup content model for a particular site in alfresco share

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.

abhinavmishra14
Advanced

Re: How to setup content model for a particular site in alfresco share

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/develop/share-ext-points/surf-extension-modules/#surf...

https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#addmenuitem2createmenu

https://docs.alfresco.com/content-services/5.2/tutorial/share/doclib/#customizesurfwidget

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)