05-04-2009 06:38 AM
<webscript>
<shortname>View</shortname>
<description>View file</description>
<url>/view/{path}</url>
<authentication runas="admin">none</authentication>
<transaction>required</transaction>
</webscript>
// locate folder by path
// NOTE: only supports path beneath company home, not from root
logger.log("Start View script. Requested resource : " + url.extension);
var alfrescoCompanyHomeFolder = "Company Home";
logger.log("Alfresco company folder name : " + alfrescoCompanyHomeFolder);
var baseFolderPath = "My_Folder";
logger.log("Base folder path : " + baseFolderPath);
var completePath = (alfrescoCompanyHomeFolder + "/" + baseFolderPath + "/" + url.extension).replace(new RegExp("_SPACE_","g"), " ")
;
logger.log("Real requested path : " + completePath);
var requestFile = roothome.childByNamePath(completePath);
if (requestFile == undefined) {
logger.log("Requested resource is not found");
status.code = 404;
status.message = "Requested resource is not found";
status.redirect = true;
} else if (requestFile.isContainer) {
logger.log("Browsing is not allowed");
status.code = 403;
status.message = "Browsing is not allowed";
status.redirect = true;
} else {
logger.log("Rendering selected file");
model.requestFile = requestFile;
}
${requestFile.content}
05-05-2009 01:44 PM
<webscript kind="org.alfresco.repository.content.stream">
<shortname>Webview rendering</shortname>
<description>Render selected file
</description>
<url>/view/{path}</url>
<format default="">argument</format>
<authentication runas="admin">none</authentication>
<transaction>required</transaction>
</webscript>
// locate folder by path
// NOTE: only supports path beneath company home, not from root
logger.log("Start webview script. Requested resource : " + url.extension);
var alfrescoCompanyHomeFolder = "Company Home";
logger.log("Alfresco company folder name : " + alfrescoCompanyHomeFolder);
var baseFolderPath = "My_Folder";
logger.log("Base folder path : " + baseFolderPath);
var completePath = (alfrescoCompanyHomeFolder + "/" + baseFolderPath + "/" + url.extension).replace(new RegExp("_SPACE_","g")
, " ");
logger.log("Real requested path : " + completePath);
var requestFile = roothome.childByNamePath(completePath);
if (requestFile == undefined) {
logger.log("Requested resource is not found");
status.code = 404;
status.message = "Requested resource is not found";
status.redirect = true;
} else if (requestFile.isContainer) {
logger.log("Browsing is not allowed");
status.code = 403;
status.message = "Browsing is not allowed";
status.redirect = true;
} else {
logger.log("Rendering selected file");
model.contentNode = requestFile;
}
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.