cancel
Showing results for 
Search instead for 
Did you mean: 

Surf Extension Module vs. share-config-custom.xml

akreienbring
Confirmed Champ
Confirmed Champ

I'm working with ACS 6.2 and have two questions:

1.

I can manage aspects and types of the document library by adding them to the share-config-custom.xml. But indicators for example can be defined in the extension module XML.

The XML Element in both cases is:

<config evaluator="string-compare" condition="DocumentLibrary">

It seems that I can't put aspects and types in the extension module XML as well to have a single point of configuration. Why? Is it simply not possible or is it a question of tag sequence? Can someone point me to the XMS of the extension module?

2.

The same question for form definitions of types. How can I add tags like

<config evaluator="node-type" condition="xyz:myCustomType">

to the extension module XML?

From my perspective all module related stuff should be configured in the module and not in the global share-config-custom. I just can't figure out the concept of "What goes where..."

1 ACCEPTED ANSWER

You are not limited to put any configuration in either of the approaches. I gave an example of module extension configuration containing some configurations for reference. There is no fight between the two approaches. It depends on your requirement. You can define aspects, types, indicators etc. in share-config-custom.xml as well as in an extension module as well. Again its up to your requirement how you want to handle and what use cases you have. 

Surf extensions can be deployed/un-deployed dynamically giving benefit that if you want to disable an extension, you can do it dynamically from share module extension console "http://<host>:<port>/share/page/modules/deploy"

Surf extension also gives you flexibity to enable/disable a module based on evaluators as well. 

Suppose i am using multiple site-presets (in general- its type of sites, one of which is which is Collaboration site with site preset named as "site-dashboard"), and all sites (based on specific presets) have some specific functionalities pertating to either aspect, indicator etc. It would make sense for me to create an extension per site-preset and put site specific configs in the extensions and keep all general configurations in share-config-custom.xml. 

Remote, debug, csrf filerting, any global config are most common for share-config-custom.xml, however you are not limited to just use it for these configs only. 

I would suggest to read this documentation in detail in case you want to understand more: https://docs.alfresco.com/6.2/concepts/dev-extensions-share-surf-extension-modules.html 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

View answer in original post

5 REPLIES 5

abhinavmishra14
World-Class Innovator
World-Class Innovator

If i understand correctly, you have trouble configuring indicators in extension module.

You can denitely add each and every config in extension module which you can do in share-config-custom.xml. 

Here is a sample: 

<extension>
	<modules>
		<module>
			<id>MyShareExtension</id>
			<version>1.0</version>
			<auto-deploy>true</auto-deploy>
			
			<customizations>		     
				<!-- About share component customization to load custom message in about share. -->
		        <customization>
		          <targetPackageRoot>org.alfresco.components.footer</targetPackageRoot>
		          <sourcePackageRoot>com.demo.components.footer</sourcePackageRoot>
		        </customization>
			</customizations>
			
			<configurations>
				<config evaluator="string-compare" condition="DocumentLibrary">
				    <!-- Create custom type contents -->
					<create-content>
                        <content id="support-doc" label="create.supportdoc.menu.item.label" icon="supporting-doc" type="javascript">
                            <param name="function">onNewObject</param>
							<param name="type">demo:supportingDoc</param>
                        </content>
                    </create-content>
					
					<indicators>
						<indicator id="mycontent" index="10" icon="mycontent-16.png" label="type.demo_mycontent">
							<evaluator>evaluator.doclib.action.isMycontent</evaluator>
						</indicator>
						<indicator id="supporting-doc" index="11" icon="supporting-doc-16.png" label="type.demo_supportingDoc">
							<evaluator>evaluator.doclib.action.isSupportingDoc</evaluator>
						</indicator>
						
					</indicators>
					
					<aspects>
						
						<visible>
							<aspect name="demo:webReferencesAspect" />
							<aspect name="smf:customConfigSmartFolder" />
							<aspect name="smf:systemConfigSmartFolder" />
							<aspect name="cm:indexControl" />
							<aspect name="dp:restrictable" />
							<aspect name="cm:generalclassifiable" />
							<aspect name="cm:complianceable" />
							<aspect name="cm:dublincore" />
							<aspect name="cm:effectivity" />
							<aspect name="cm:summarizable" />
							<aspect name="cm:versionable" />
							<aspect name="cm:templatable" />
							<aspect name="cm:emailed" />
							<aspect name="app:inlineeditable"/>
						</visible>
						
						<addable>
							<aspect name="demo:webReferencesAspect" />
							<aspect name="smf:customConfigSmartFolder" />
							<aspect name="smf:systemConfigSmartFolder" />
							<aspect name="cm:indexControl" />
							<aspect name="dp:restrictable" />
							<aspect name="cm:generalclassifiable" />
							<aspect name="cm:complianceable" />
							<aspect name="cm:dublincore" />
							<aspect name="cm:effectivity" />
							<aspect name="cm:summarizable" />
							<aspect name="cm:versionable" />
							<aspect name="cm:templatable" />
							<aspect name="cm:emailed" />
							<aspect name="app:inlineeditable"/>
						</addable>
						
						<removable>
							<aspect name="demo:webReferencesAspect" />
							<aspect name="smf:customConfigSmartFolder" />
							<aspect name="smf:systemConfigSmartFolder" />
							<aspect name="cm:indexControl" />
							<aspect name="dp:restrictable" />
							<aspect name="cm:generalclassifiable" />
							<aspect name="cm:complianceable" />
							<aspect name="cm:dublincore" />
							<aspect name="cm:effectivity" />
							<aspect name="cm:summarizable" />
							<aspect name="cm:versionable" />
							<aspect name="cm:templatable" />
							<aspect name="cm:emailed" />
							<aspect name="app:inlineeditable"/>
						</removable>
					</aspects>
					<types>
						<type name="cm:content">
							<subtype name="demo:myContent"/>
							<subtype name="demo:supportingDoc"/>
						</type>
						<type name="demo:myContent">
							<subtype name="demo:supportingDoc"/>
						</type>
						<type name="demo:supportingDoc">
							<subtype name="demo:myContent"/>
						</type>
					</types>
				</config>
				
				<config evaluator="string-compare" condition="DocLibActions">
					<!-- Actions are defined in the <actions> subsection under 
					     '<config evaluator="string-compare"  condition="DocLibActions">' 
					     There are 3 types of Doc Lib Actions: 
					     1- link – URL to a page on the Internet
						 2- pagelink – URL to a Share page 
						 3- javascript – Executes client side JS -->
					<actions>
						<!-- Link type action -->
						<action id="launch-abhinav-javaworld" type="link"
							label="abhinav.javaworld.link.action.label" icon="javaworld-action">
							<param name="href">https://javaworld-abhinav.blogspot.com</param>
							<param name="target">_blank</param>
							<evaluator>evaluator.doclib.action.isMyContentOrSupportingDoc</evaluator>	
						</action>
						
						<!-- Pagelink type actions -->
						<action id="launch-demo-surf-page" type="pagelink" 
							label="demo.surf.pagelink.action.label" icon="demo-surf-page">
							<param name="page">surf-pages/demo-surf-page</param>
							<evaluator>evaluator.doclib.action.isMyContentOrSupportingDoc</evaluator>	
						</action>
						<action id="launch-demo-aikau-page" type="pagelink" 
							label="demo.aikau.pagelink.action.label" icon="demo-aikau-page">
							<param name="page">/hdp/ws/demo-aikau-page</param>
							<evaluator>evaluator.doclib.action.isMyContentOrSupportingDoc</evaluator>	
						</action>
						
						<!-- Configure action with custom JavaScript function:  
						     See config evaluator="string-compare" condition="DocLibCustom" which is  used to inject the js file where 'showCustomMessage' javascript function is defined -->
						<action id="show-custom-message-javascript-action" type="javascript"
							label="show.custom.message.action.label" icon="show-custom-message">
							<param name="function">showCustomMessage</param>
							<evaluator>evaluator.doclib.action.isMyContentOrSupportingDoc</evaluator>
						</action>
						
						<action id="update-comments" type="javascript" label="updateComments.action.label" icon="update-comments">
							<param name="function">onActionFormDialog</param>
							<permissions>
						       <!-- Permission to write to the node -->
						       <!-- allow: If the permission specifies, the action is allowed
								    deny: If the permission specifies, the action is hidden
								    Only one of the "allow" or "deny" permissions can be specified for Read/Write-->
						       <permission allow="true">Write</permission>
						    </permissions>
						    <!-- Additional params for form dialog on action -->
						    <!-- The kind of item the form is for (node, action, task, type) -->
						    <param name="itemKind">action</param>
						    <!-- Item identifier, for action it is the Spring Bean ID.  
						    Check the string-compare config evaluator with condition as 'update-comments' which will be used to launch the popup form -->
						    <param name="itemId">update-comments</param>
						    <!-- Form mode (create, edit , view)-->
						    <param name="mode">create</param>
						    <!-- Node on which operation will be performed -->
						    <param name="destination">{node.nodeRef}</param>
						    <param name="successMessage">update-comments.success.message</param>
						    <param name="failureMessage">update-comments.failure.message</param>
						    <evaluator>evaluator.doclib.action.isMyContentOrSupportingDoc</evaluator>				
						</action>
			
					</actions>
					<actionGroups>
						<actionGroup id="document-browse">
							<action id="launch-abhinav-javaworld" index="100"/>
							<action id="launch-demo-surf-page" index="101"/>
							<action id="launch-demo-aikau-page" index="102"/>
							<action id="update-comments" index="103"/>
						</actionGroup>
						<actionGroup id="document-details">
							<action id="launch-abhinav-javaworld" index="100"/>
							<action id="launch-demo-surf-page" index="101"/>
							<action id="launch-demo-aikau-page" index="102"/>
							<action id="show-custom-message-javascript-action" index="103"/>
							<action id="update-comments" index="104"/>
						</actionGroup>
					</actionGroups>
				</config>
				
				<config evaluator="string-compare" condition="DocLibCustom">
				  <dependencies>
				     <!-- CSS and JS dependencies can be injected using this config -->
				     <!-- <css src="share-module/components/documentlibrary/custom-actions/show-custom-message.css/>-->
				     <js src="share-module/components/documentlibrary/custom-actions/show-custom-message.js"/>
				   </dependencies>
				</config>
								
				<!-- Form definition for update-comments action -->
				<config evaluator="string-compare" condition="update-comments">
					<forms>
						<form>
							<field-visibility>
								<show id="comment"/>
							</field-visibility>
							<appearence>
								<field id="comment">
									<control template="/org/alfresco/components/form/controls/textfield.ftl" />
								</field>
							</appearence>
						</form>
					</forms>
				</config>
				
			
			 </configurations>
		</module>
	</modules>
</extension>

You can see some details here as well: https://docs.alfresco.com/6.0/concepts/dev-extensions-share-module-dynamic-configuration.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

Thank you! But it's exactly the opposite. I wonder how I can put everything (types, apects...) in the extension module XML.

share-config-custom.xml is the central configuration for the whole share app. Whereas the module xml is, thinking of modularization, the place where modulespecific customizations should go.

You are not limited to put any configuration in either of the approaches. I gave an example of module extension configuration containing some configurations for reference. There is no fight between the two approaches. It depends on your requirement. You can define aspects, types, indicators etc. in share-config-custom.xml as well as in an extension module as well. Again its up to your requirement how you want to handle and what use cases you have. 

Surf extensions can be deployed/un-deployed dynamically giving benefit that if you want to disable an extension, you can do it dynamically from share module extension console "http://<host>:<port>/share/page/modules/deploy"

Surf extension also gives you flexibity to enable/disable a module based on evaluators as well. 

Suppose i am using multiple site-presets (in general- its type of sites, one of which is which is Collaboration site with site preset named as "site-dashboard"), and all sites (based on specific presets) have some specific functionalities pertating to either aspect, indicator etc. It would make sense for me to create an extension per site-preset and put site specific configs in the extensions and keep all general configurations in share-config-custom.xml. 

Remote, debug, csrf filerting, any global config are most common for share-config-custom.xml, however you are not limited to just use it for these configs only. 

I would suggest to read this documentation in detail in case you want to understand more: https://docs.alfresco.com/6.2/concepts/dev-extensions-share-surf-extension-modules.html 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

OK! I see... thank you!

I will try to move the config sections to the module.xml again based on your example and come back to give feedback with my results.

I now managed to copy all configurations to the Module XML. I guess that it is a matter of the sequence of the tags.

For others, who may have problems, here is the sequence of tags that works for me in the extension module:

<config evaluator="string-compare" condition="DocumentLibrary"> 
<indicators> ... </indicators>
<aspects> ... </aspects>
<types> ... </types>
</config>

<config evaluator="string-compare" condition="DocLibActions">
<actions> ... </actions>
<actionGroups> ... </actionGroups>
</config>

<config evaluator="string-compare" condition="AdvancedSearch" replace="true">

<config evaluator="string-compare" condition="activiti$SomeWorkflowForm">

<config evaluator="node-type" condition="xy:SomeType">

<config evaluator="aspect" condition="xy:AnyAspect">

,