Acosix / alfresco-site-hierarchy

Addon that allows creating hierarchies of sites as secondary structures and provides some common automatisms for site hierarchies
Apache License 2.0
3 stars 5 forks source link

Disable some options from "Membership Link Mode" list #7

Open mhshinde opened 6 years ago

mhshinde commented 6 years ago

Under "Membership Mode" there are a total of four options, I want to disable following options

I did changes in "siteHierarchyModel.xml", I have commented both the options but no change in the list, `

aco6sh:hierarchySite
        <properties>
            <property name="aco6sh:autoMembershipMode">
                <type>d:text</type>
                <protected>true</protected>
                <mandatory>true</mandatory>
                <default>systemDefault</default>
                <index enabled="false" />
                <constraints>
                    <constraint name="aco6sh:autoMembershipModes" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <!-- <value>none</value> -->
                                <value>systemDefault</value>
                                <!-- <value>parentMembersAsChildConsumers</value> -->
                                <value>childMembersAsParentConsumers</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>

`

So, what am I missing here? Is there an additional step I am not including? Do I need to edit some other properties? I'd be grateful if you could point me in the right direction.

AFaust commented 6 years ago

Unfortunately - due to how the create / edit site dialogs are build by default Alfresco - the constraint in the model is not used to restrict the options. You would have to customise the FreeMarker template for the dialogs themself to remove the options you do not want to provide. Check https://github.com/Acosix/alfresco-site-hierarchy/blob/master/share/src/main/site-webscripts/de/acosix/acosix-site-hierarchy/site-management-customisations/modules/create-site.get.html.ftl#L57 for the create site dialog.

mhshinde commented 6 years ago
  1. I have removed both of the options from following files,

    -  siteHierarchyModel.xml 
      Removed line 75 and 78

    <list> <value>systemDefault</value> <value>parentMembersAsChildConsumers</value> </list>

    - create-site.get.html.ftl   
       Edited line 57, removed  "none", "childMembersAsParentConsumers" options.

    <#list ["systemDefault", "parentMembersAsChildConsumers"] as mode>

    - edit-site.get.html.ftl   
      Edited line 41, removed  "none", "childMembersAsParentConsumers" options.

    <#list ["systemDefault", "parentMembersAsChildConsumers"] as mode>

  2. And mvn install it.

  3. Copied relevant .amp and .jar files to alfresco-community.

By removing entries from above three files, I am able to achieve following,

  1. Both the options are not allowing to create site, it is giving an ERROR Could Not Create Site 08110003 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/modules/create-site.post.json.js': 08110002 SyntaxError: Expected end of stream at char 638 (file:/home/mayuri/finalize/alfresco-community/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/modules/create-site.post.json.js#28)

But it has not removed the options from the menu dropdown. I want to disable them in the menu.