- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2015 01:53 PM
<module> <id>Create Site Extension</id> <version>1.0</version> <customizations> <customization> <targetPackageRoot>org.alfresco.modules</targetPackageRoot> <sourcePackageRoot>create-site</sourcePackageRoot> </customization> </customizations></module>
I've added the create-site.post.json.js to the directory /config/alfresco/site-webscripts/create-site inside my module's JAR file. The javascript in my create-site.post.json.js file doesn't seem to be running at all and yes, I've added it to the deployed modules list inside Alfresco.
I'm using Alfresco 5.0d. Does anyone know what I'm doing wrong? Is it even possible to add functionality to a post controller like you can a get controller?
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 09:01 AM
I got asked to look into this thread and have done some debugging into it and it would seem that there is a bug in the way in which extension controller paths are looked up. Essentially what is happening is that Surf is looking for extension scripts with the name create-site.post.js and not create-site.post.json.js (note the missing .json).
The workaround to this problem is just to create your extension as create-site.post.js and that should then get processed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2015 12:29 PM
Maybe the problem is in the code of your
create-site.post.json.js
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 12:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 03:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 12:35 PM
The code inside the post is very minimal and I've tested it elsewhere so I know it's not failing there, it's just not getting called.
I've also wrapped it in a function, turned on server side debugging and enabled "break on function enter" but it never hit the break point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 03:50 PM
create-site.post.json.js
. It will help to find out this problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 04:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 05:38 PM
WORKING MODULE
/config/alfresco/site-data/extensions/extension-modules.xml
<extension> <modules> <module> <id>Test Module</id> <version>1.0</version> <customizations> <customization> <targetPackageRoot>org.alfresco.modules</targetPackageRoot> <sourcePackageRoot>create-site</sourcePackageRoot> </customization> </customizations> </module> </modules></extension>
/config/alfresco/site-webscripts/create-site/create-site.get.js
model.sitePresets.push({ id: "site-test", name: "TEST"});
The above module (when activated) works perfectly. I click on create site and there is a new site type of "TEST" listed in the drop down on the form.
BROKEN NOT WORKING MODULE
/config/alfresco/site-data/extensions/extension-modules.xml
<extension> <modules> <module> <id>Test Module</id> <version>1.0</version> <customizations> <customization> <targetPackageRoot>org.alfresco.modules</targetPackageRoot> <sourcePackageRoot>create-site</sourcePackageRoot> </customization> </customizations> </module> </modules></extension>
/config/alfresco/site-webscripts/create-site/create-site.post.json.js
function deleteDashboard(type, id){ var connector = remote.connect("alfresco"); for (var col = 1; col < 5; col++) { for (var row = 1; row < 6; row++) connector.del("/remoteadm/delete/s/sitestore/alfresco/site-data/components/page.component-" + col + "-" + row + "." + type + "~" + id + "~dashboard.xml"); } connector.del("/remoteadm/delete/s/sitestore/alfresco/site-data/pages/" + type + "/" + id + "/dashboard.xml"); return status.STATUS_OK;}function test(){ deleteDashboard("site", "good-site");}test();
I know the function deleteDashboard works because I tested it in a different module that I created. I'm testing the post with this function so that I can verify that the dashboard page has been deleted from the existing "good-site" I've created.
This link is to the entire source code of the module I've created. Unless Alfresco doesn't allow extending POST controllers then this should work and I'm at a loss as to why it's not working.
<a href="https://drive.google.com/file/d/0By5d2e2jSbmJX0pRQmJXN1hfNnM/view?usp=sharing" target="_blank">Module Source</a> If you build this source into a JAR file and place inside tomcat/webapps/share/WEB-INF/lib and be sure to enable everything via http://ALFRESCOHOST/share/page/modules/deploy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2015 01:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2016 09:01 AM
I got asked to look into this thread and have done some debugging into it and it would seem that there is a bug in the way in which extension controller paths are looked up. Essentially what is happening is that Surf is looking for extension scripts with the name create-site.post.js and not create-site.post.json.js (note the missing .json).
The workaround to this problem is just to create your extension as create-site.post.js and that should then get processed.
