05-16-2007 03:59 PM
05-18-2007 07:14 AM
06-13-2007 11:28 AM
06-13-2007 12:00 PM
07-04-2007 01:19 PM
07-05-2007 07:03 AM
08-01-2007 09:28 PM
08-02-2007 05:28 AM
08-02-2007 03:37 PM
<alfresco-config>
<config>
<actions>
<!– Copy to My Sandbox –>
<action id="copy_to_my_sandbox">
<label>Copy to My Sandbox</label>
<image>/images/icons/user_sandbox.gif</image>
<script>/GIR/Data Dictionary/Scripts/CopyToMySandbox.js</script>
<params>
<!– IMPORTANT : allows the script to fetch its context with default objects (document, person, etc.) –>
<param name="nodeRef">#{actionContext.nodeRef}</param>
</params>
</action>
<!– Add action to more actions menu –>
<action-group id="document_browse_menu">
<action idref="copy_to_my_sandbox" />
</action-group>
</actions>
</config>
</alfresco-config>
var output = null;
if(logger.isLoggingEnabled()) logger.log("Starting CopyToMySandbox.js script.");
// Fetch document from action context
var document = search.findNode(args["nodeRef"])
if(document != null) {
if(logger.isLoggingEnabled()) logger.log("Document found.");
// Fetch document path
var documentPath = document.displayPath;
// Fetch document name
var documentName = document.name;
// Fetch current user's name
var currentUserName = new String(person.properties['cm:userName']);
// Fetch current user's AVM store
var targetUserAVMStore = null;
for(var i in avm.stores) {
var currentStore = avm.stores[i];
// Check that the store's owner is the current user and that
// it's its personnal sandbox and not the preview
// repository or the staging sandbox.
var storeName = new String(currentStore.name);
if(logger.isLoggingEnabled()) logger.log("Iterating over store : " + storeName);
var storeOwnerUserName = new String(currentStore.lookupRoot().owner);
var storeSuffix = '–' + currentUserName;
if(logger.isLoggingEnabled()) logger.log("Store suffix : " + storeSuffix);
var storeSuffixPosition = storeName.length - storeSuffix.length;
if(logger.isLoggingEnabled()) logger.log("Store suffix position : " + storeSuffixPosition);
var storeSuffixLastIndex = storeName.lastIndexOf(storeSuffix);
if(logger.isLoggingEnabled()) logger.log("Store suffix last index : " + storeSuffixLastIndex);
if(logger.isLoggingEnabled()) logger.log("Current user name : " + currentUserName);
if(logger.isLoggingEnabled()) logger.log("Current user name length : " + currentUserName.length);
if(logger.isLoggingEnabled()) logger.log("Store owner : " + storeOwnerUserName);
if(logger.isLoggingEnabled()) logger.log("Store owner length : " + storeOwnerUserName.length);
if(logger.isLoggingEnabled()) logger.log("storeOwnerUserName == currentUserName : " + new String(storeOwnerUserName == currentUserName));
if(logger.isLoggingEnabled()) logger.log("storeSuffixLastIndex == storeSuffixPosition : " + new String(storeSuffixLastIndex == storeSuffixPosition));
// TODO : why "storeOwnerUserName == currentUserName" doesn't work?
if(storeSuffixLastIndex == storeSuffixPosition) {
// Set the sandbox
targetUserAVMStore = currentStore;
if(logger.isLoggingEnabled()) logger.log("Setting personal sandbox : " + storeName);
break;
}
}
// If personal sandbox found, copy document to sandbox.
if(targetUserAVMStore) {
document.copy(currentStore.lookupRoot());
if(logger.isLoggingEnabled()) logger.log("Moved source document to personal sandbox.");
}
output = "<script>history.back();</script>";
}
output;
08-03-2007 07:04 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.