cancel
Showing results for 
Search instead for 
Did you mean: 

New site preset with Alfresco SDK - Where to put create-site.get.js mod?

mxc
Confirmed Champ
Confirmed Champ
Hi there,

I am attempting to use the Alfresco SDK for some modifications to share. Basically adding a new site preset. I know that the *-preset.xml will be picked up and add the preset to the defaults listed in presets.xml.

What I don't know how to handle is how to add the site preset name to the list of available site templates in the create site dialog. I previously modified the create-site.get.js file directly. I would like this change to be made automatically as part of the deployment of the amp.

Is this possible? Is so what do I need to do to accomplish this?

thanks

Mark
1 REPLY 1

uvukasinovic
Champ on-the-rise
Champ on-the-rise
It is possible. I tested it with Maven SDK and Alfresco 4.2.f.

Here is the solution that worked for me:

1. Create empty file create-site.get.js and put it in the:
…/web-extension/site-webscripts/com/mycompany/my-project/extensions/modules
Add this snippet of code:

model.sitePresets.push({
   id : msg.get("my-project.site.presets"),
   name : msg.get("my-project.site.name")
});

2. Create create-site.get.properties and put it in next to the create-site.get.js:
…/web-extension/site-webscripts/com/mycompany/my-project/extensions/modules
Add this key/value:

my-project.site.name=My site name
my-project.site.presets=my-site

3. Create custom my-presets.xml and put it in the:
…/web-extension/site-data/presets

4. Create my-extension.xml and put it in the:
…/web-extension/site-data/extensions
Add this:

<extension>
   <modules>
      <module>
         <id>ChooseMySite</id>
         <customizations>
            <customization>
               <targetPackageRoot>org.alfresco.modules</targetPackageRoot>
               <sourcePackageRoot>com.mycompany.my-project.extensions.modules</sourcePackageRoot>
            </customization>
         </customizations>
         <auto-deploy>true</auto-deploy>
      </module>
   </modules>
</extension>


I hope this will help you.