Executing a script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2007 04:24 PM
Run Action > Select "Execute a Script" from a dropdown > Set Values and Add > Select the script from a dropdown.
I would prefer to simplify this process somehow. Clicking on an icon or a link from the space Details page would be good. How would I proceed to do this?
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2007 12:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 12:47 PM
You can add a hypothetical copyFiles.js script as a custom menu action to the space browse menu by placing code similar to this in your web-client-config-custom.xml file:
<config> <actions> <!– Launch Add Aspect Dialog –> <action id="copy_files"> <label>Copy Files</label> <script>/Company Home/Data Dictionary/Scripts/copyFiles.js</script> </action> <!– Add action to Actions Menu for a space in the SpaceBrowse screen–> <action-group id="space_browse_menu"> <action idref="copy_files" /> </action-group> </actions> </config>
Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 01:40 PM
This could be really helpful. But where is the reference to the space? Should the action-group id have a path - like "/Company Home/Submissions/space_browse_menu"?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 03:58 PM
You can hard code the destination space as a path in your .js:
var put_here = companyhome.childByNamePath("Content Updating Project/Backup Folder");
Or am I misunderstanding you?
Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 07:11 PM
I see now that you were responding to my first post and not my second.
Sorry for the misunderstanding.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2007 11:05 AM
http://wiki.alfresco.com/wiki/URL_Addressability#Script_Command_Processor
So you could construct the appropriate URLs to the scripts and add them as links to a custom version of the space details page JSP.
Thanks,
Kevin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2007 06:41 PM
The xml code you recommended works for adding the action to the space dropdown but the dropdown is only available from outside the space. If I want to move content from the User Homes/User/Submissions space I have to be in the User Homes/User space to select the file from the dropdown. When I do that both "parent" and "space" are undefined for some reason.
This is not the end of the world, though. I can assume that the user will only want to submit content from his or her Submissions folder and hard code it in, i.e.
var sourceFolder = userhome.childByNamePath("Submissions");
When I do this everything executes as it should. The contents are moved but the web client goes to an error page containg only something like this,
"org.mozilla.javascript.Undefined@e55d75."
Nothing is sent to the log. When executing from inside the space details page via the
"Run Action > Select "Execute a Script" from a dropdown > Set Values and Add > Select the script from a dropdown"
sequence described above. It works fine but this is much less convenient than I would like.
Kevin,
I've looked at the space-detail.jsp file. That is one gnarly beast. I'm not sure I'm ready to dig in to it just yet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 09:48 AM
var goBack = "<script>history.back();</script>";goBack;
Kevin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2007 08:26 AM
<config>
<actions>
<!– Launch Add Aspect Dialog –>
<action id="test">
<label>Test</label>
<script>/Company Home/Data Dictionary/Scripts/testscript.js</script>
</action>
<!– Add action to Actions Menu for a space in the SpaceBrowse screen–>
<action-group id="document_browse">
<action idref="test" />
</action-group>
</actions>
</config>
What do i do to tell the script what it should use for its context? Something like?
<config>
<actions>
<!– Launch Add Aspect Dialog –>
<action id="test">
<label>Test</label>
<script>/Company Home/Data Dictionary/Scripts/testscript.js</script>
<params>
<param name="contextPath">#{actionContext.nodeRef}</param>
</params>
</action>
<!– Add action to Actions Menu for a space in the SpaceBrowse screen–>
<action-group id="document_browse">
<action idref="test" />
</action-group>
</actions>
</config>
But i want the link to be the same type as:
http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/S...
Ideas? Am i on the right track?
