Merged V3.2E to HEAD

17460: Refactored calendar views into separate objects
   17466: Remote API part of fix for ETHREEOH-3268.
          - Added simple webscript to return details of the authentication system, such as account creation allowed.
   17473: ETHREEOH-3268 - UI part of fix.
          - Add External Users is now disabled in Share if Alfresco instance does not support creating new users i.e. if LDAP or similar is used.
   17479: ETHREEOH-2409 - Doc Library Details page displays incomplete action list; usability issue
   17480: My Tasks dashlet - prevent display of fake date used for sorting
   17484: Fixed ETHREEOH-2305 "It's impossible to implement a Search request with empty search field in Site Members area."
          - Default settings can be applied in web-framework-config-application.xml:
             <min-search-term-length>1</min-search-term-length>
             <max-search-results>100</max-search-results>
             and later be overriden in the properties section for each searchable components binding file.
          - The components that override the min-search-term-length default value and set it to "0" are:
             site-finder, site-members & site-groups
   17485: Merged DEV_TEMPORARY TO V3.2
      17468: Problem rendering field description (MultilingualTextAreaGenerator) for app:folderlink
   17486: Merged DEV_TEMPORARY to V3.2 (record-only)
   17487: Partial fix for ETHREEOH-3308 (xf:switch cannot be used in repeating field type), fixes 'extra' set of fields seen when using a maxOccurs of more than 1
   17489: MERGED DEV/TEMPORARY to V3.2
      ETHREEOH-3068 - WCM Create Web Content Wizard
   17492: Fix for ETHREEOH-2598 documents uploaded via Share interface are not incremented as versions with CIFS/SMB interface.
          - Auto versioning of documents now correctly handled via CIFS edit if an appropriate rule is applied to a doclib

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18123 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2010-01-19 11:33:37 +00:00
parent d5841706d2
commit 26ab723052
19 changed files with 400 additions and 205 deletions

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>Authentication</shortname>
<description>Authentication stack information</description>
<url>/api/authentication</url>
<format default="json"/>
<authentication>none</authentication>
<transaction>none</transaction>
</webscript>

View File

@@ -0,0 +1,6 @@
{
"data":
{
"creationAllowed": ${creationAllowed?string}
}
}

View File

@@ -11,6 +11,7 @@ function main()
} }
model.item = getCommentData(node); model.item = getCommentData(node);
model.node = node;
} }
main(); main();

View File

@@ -1,4 +1,4 @@
<#import "comment.lib.ftl" as commentLib/> <#import "comment.lib.ftl" as commentLib/>
{ {
"item" : <@commentLib.commentJSON item=item /> "item": <@commentLib.commentJSON item=item parent=node />
} }

View File

@@ -3,9 +3,9 @@
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
"${fieldName}": "${fieldName}":
{ {
<#if person.assocs["cm:avatar"]??> <#if person.assocs["cm:avatar"]??>
"avatarRef": "${person.assocs["cm:avatar"][0].nodeRef?string}", "avatarRef": "${person.assocs["cm:avatar"][0].nodeRef?string}",
</#if> </#if>
"username": "${person.properties["cm:userName"]}", "username": "${person.properties["cm:userName"]}",
"firstName": "${person.properties["cm:firstName"]}", "firstName": "${person.properties["cm:firstName"]}",
"lastName": "${person.properties["cm:lastName"]}" "lastName": "${person.properties["cm:lastName"]}"
@@ -16,13 +16,13 @@
<#-- <#--
This template renders a comment. This template renders a comment.
--> -->
<#macro commentJSON item> <#macro commentJSON item parent>
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
{ {
"url": "api/comment/node/${item.node.nodeRef?replace('://','/')}", "url": "api/comment/node/${item.node.nodeRef?replace('://','/')}",
"nodeRef": "${item.node.nodeRef}", "nodeRef": "${item.node.nodeRef}",
"name": "${item.node.properties.name!''}", "name": "${item.node.properties.name!''}",
"title": "${item.node.properties.title!''}", "title": "${item.node.properties.title!''}",
"content": "${stringUtils.stripUnsafeHTML(item.node.content)}", "content": "${stringUtils.stripUnsafeHTML(item.node.content)}",
<#if item.author??> <#if item.author??>
<@renderPerson person=item.author fieldName="author" /> <@renderPerson person=item.author fieldName="author" />
@@ -37,8 +37,13 @@
"isUpdated": ${item.isUpdated?string}, "isUpdated": ${item.isUpdated?string},
"permissions": "permissions":
{ {
<#if parent?? && (parent.isLocked || parent.hasAspect("cm:workingcopy"))>
"edit": false,
"delete": false
<#else>
"edit": ${item.node.hasPermission("Write")?string}, "edit": ${item.node.hasPermission("Write")?string},
"delete": ${item.node.hasPermission("Delete")?string} "delete": ${item.node.hasPermission("Delete")?string}
</#if>
} }
} }
</#escape> </#escape>

View File

@@ -1,4 +1,4 @@
<#import "comment.lib.ftl" as commentLib/> <#import "comment.lib.ftl" as commentLib/>
{ {
"item" : <@commentLib.commentJSON item=item /> "item": <@commentLib.commentJSON item=item parent=node />
} }

View File

@@ -32,6 +32,7 @@ function main()
// update comment // update comment
updateComment(node); updateComment(node);
model.item = getCommentData(node); model.item = getCommentData(node);
model.node = node;
// post an activity item, but only if we got a site // post an activity item, but only if we got a site
if (json.has("site") && json.has("itemTitle") && json.has("page")) if (json.has("site") && json.has("itemTitle") && json.has("page"))

View File

@@ -1,9 +1,9 @@
<#import "comment.lib.ftl" as commentLib/> <#import "comment.lib.ftl" as commentLib>
<#import "../generic-paged-results.lib.ftl" as gen/> <#import "../generic-paged-results.lib.ftl" as gen>
{ {
"nodePermissions": "nodePermissions":
{ {
<#if node.isLocked> <#if node.isLocked || node.hasAspect("cm:workingcopy")>
"create": false, "create": false,
"edit": false, "edit": false,
"delete": false "delete": false
@@ -14,6 +14,6 @@
</#if> </#if>
}, },
<@gen.pagedResults data=data ; item> <@gen.pagedResults data=data ; item>
<@commentLib.commentJSON item=item /> <@commentLib.commentJSON item=item parent=node />
</@gen.pagedResults> </@gen.pagedResults>
} }

View File

@@ -1,4 +1,4 @@
<#import "comment.lib.ftl" as commentLib/> <#import "comment.lib.ftl" as commentLib/>
{ {
"item" : <@commentLib.commentJSON item=item /> "item": <@commentLib.commentJSON item=item parent=node />
} }

View File

@@ -42,6 +42,7 @@ function main()
var comment = addComment(node); var comment = addComment(node);
model.item = getCommentData(comment); model.item = getCommentData(comment);
model.node = node;
// post an activitiy item, but only if we got a site // post an activitiy item, but only if we got a site
if (json.has("site") && json.has("itemTitle") && json.has("page")) if (json.has("site") && json.has("itemTitle") && json.has("page"))

View File

@@ -142,10 +142,9 @@ function main()
// Ensure the original file is versionable - may have been uploaded via different route // Ensure the original file is versionable - may have been uploaded via different route
if (!workingCopy.hasAspect("cm:versionable")) if (!workingCopy.hasAspect("cm:versionable"))
{ {
// Ensure the file is versionable - but do not autoversion or create initial version yet // Ensure the file is versionable
var props = new Array(2); var props = new Array(1);
props["cm:autoVersion"] = false; props["cm:autoVersionOnUpdateProps"] = false;
props["cm:initialVersion"] = false;
workingCopy.addAspect("cm:versionable", props); workingCopy.addAspect("cm:versionable", props);
} }
@@ -241,12 +240,6 @@ function main()
newFile.properties.content.encoding = "UTF-8"; newFile.properties.content.encoding = "UTF-8";
newFile.save(); newFile.save();
// Ensure the file is versionable - but do not autoversion or create initial version
var props = new Array(2);
props["cm:autoVersion"] = false;
props["cm:initialVersion"] = false;
newFile.addAspect("cm:versionable", props);
// Additional aspects? // Additional aspects?
if (aspects.length > 0) if (aspects.length > 0)
{ {

View File

@@ -1,31 +0,0 @@
function getActionSet(asset, obj)
{
var actionSet = "empty",
assetType = obj.assetType,
isLink = obj.isLink,
itemStatus = obj.itemStatus,
isItemOwner = (obj.itemOwner && obj.itemOwner.properties.userName == person.properties.userName);
if (isLink)
{
actionSet = "link";
}
else if (asset.isContainer)
{
actionSet = "folder";
}
else if (itemStatus.indexOf("workingCopy") != -1)
{
actionSet = isItemOwner ? "workingCopyOwner" : "locked";
}
else if (itemStatus.indexOf("locked") != -1)
{
actionSet = isItemOwner ? "lockOwner" : "locked";
}
else
{
actionSet = "document";
}
return actionSet;
}

View File

@@ -29,13 +29,11 @@ function runAction(p_params)
return; return;
} }
// Ensure the file is versionable - but do not autoversion or create initial version // Ensure the file is versionable
if (!assetNode.hasAspect("cm:versionable")) if (!assetNode.hasAspect("cm:versionable"))
{ {
// Do not autoversion (we perform explicit checkout) var props = new Array(1);
var props = new Array(2); props["cm:autoVersionOnUpdateProps"] = false;
props["cm:autoVersion"] = false;
props["cm:initialVersion"] = false;
assetNode.addAspect("cm:versionable", props); assetNode.addAspect("cm:versionable", props);
} }

View File

@@ -1,4 +1,4 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action-sets.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/evaluator.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js">
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js"> <import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js">
@@ -22,6 +22,22 @@ function getPerson(username)
return PeopleCache[username]; return PeopleCache[username];
} }
/**
* Gets a person's full name
* @method getPersonName
* @param username {string} User name
*/
function getPersonName(username)
{
var user = getPerson(username);
if (user)
{
// Return trimmed full name
return (user.properties.firstName + " " + user.properties.lastName).replace(/^\s+|\s+$/g, "");
}
return username;
}
/** /**
* Gets / caches a site object * Gets / caches a site object
* @method getSite * @method getSite
@@ -97,17 +113,32 @@ function main()
}), }),
query = filterParams.query; query = filterParams.query;
// Query and sort the list before trimming to page chunks below // Query the assets - passing in sort and result limit parameters
allAssets = search.luceneSearch(query, filterParams.sortBy, filterParams.sortByAscending, filterParams.limitResults ? filterParams.limitResults : 0); if (query !== "")
{
allAssets = search.query(
{
query: query,
language: filterParams.language,
page:
{
maxItems: (filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : 0)
},
sort: filterParams.sort,
templates: filterParams.templates,
namespace: (filterParams.namespace ? filterParams.namespace : null)
});
}
// Ensure folders and folderlinks appear at the top of the list // Ensure folders and folderlinks appear at the top of the list
folderAssets = []; var folderAssets = [],
documentAssets = []; documentAssets = [];
for each (asset in allAssets) for each (asset in allAssets)
{ {
try try
{ {
if (asset.isContainer || asset.type == "{http://www.alfresco.org/model/application/1.0}folderlink") if (asset.isContainer || asset.typeShort == "app:folderlink")
{ {
folderAssets.push(asset); folderAssets.push(asset);
} }
@@ -143,12 +174,11 @@ function main()
startIndex = (pagePos - 1) * pageSize; startIndex = (pagePos - 1) * pageSize;
assets = assets.slice(startIndex, pagePos * pageSize); assets = assets.slice(startIndex, pagePos * pageSize);
var itemStatus, itemOwner, actionSet, thumbnail, createdBy, modifiedBy, activeWorkflows, assetType, linkAsset, isLink, var thumbnail, assetEvaluator, defaultLocation, location, qnamePaths, displayPaths, site, item;
location, qnamePaths, displayPaths, locationAsset;
// Location if we're in a site // Location if we're in a site
var defaultLocation = defaultLocation =
{ {
site: parsedArgs.location.site, site: parsedArgs.location.site,
siteTitle: parsedArgs.location.siteTitle, siteTitle: parsedArgs.location.siteTitle,
@@ -156,88 +186,33 @@ function main()
path: parsedArgs.location.path, path: parsedArgs.location.path,
file: null file: null
}; };
// Evaluate parent container
var parent = Evaluator.run(parsedArgs.parentNode);
// User permissions and role // User permissions and role
var user = var user =
{ {
permissions: permissions: parent.actionPermissions
{
create: parsedArgs.parentNode.hasPermission("CreateChildren"),
edit: parsedArgs.parentNode.hasPermission("Write"),
"delete": parsedArgs.parentNode.hasPermission("Delete")
}
}; };
if (defaultLocation.site !== null) if (defaultLocation.site !== null)
{ {
user.role = parsedArgs.location.siteNode.getMembersRole(person.properties.userName); user.role = parsedArgs.location.siteNode.getMembersRole(person.properties.userName);
} }
// Locked/working copy status defines action set // Loop through and evaluate each asset in this result set
for each (asset in assets) for each (asset in assets)
{ {
itemStatus = []; // Get evaluated properties.
itemOwner = null; item = Evaluator.run(asset);
createdBy = null; // Note: Only access item.asset after this point, as a link may have been resolved.
modifiedBy = null;
activeWorkflows = []; item.isFavourite = (favourites[item.asset.nodeRef] === true);
linkAsset = null;
isLink = false;
// Asset status
if (asset.isLocked)
{
itemStatus.push("locked");
itemOwner = getPerson(asset.properties["cm:lockOwner"]);
}
if (asset.hasAspect("cm:workingcopy"))
{
itemStatus.push("workingCopy");
itemOwner = getPerson(asset.properties["cm:workingCopyOwner"]);
}
// Is this user the item owner?
if (itemOwner && (itemOwner.properties.userName == person.properties.userName))
{
itemStatus.push("lockedBySelf");
}
// Get users
createdBy = getPerson(asset.properties["cm:creator"]);
modifiedBy = getPerson(asset.properties["cm:modifier"]);
// Asset type
if (asset.isContainer)
{
assetType = "folder";
}
else if (asset.type == "{http://www.alfresco.org/model/application/1.0}folderlink")
{
assetType = "folder";
isLink = true;
}
else if (asset.type == "{http://www.alfresco.org/model/application/1.0}filelink")
{
assetType = "document";
isLink = true;
}
else
{
assetType = "document";
}
if (isLink)
{
/**
* NOTE: After this point, the "asset" object will be changed to a link's destination node
* if the original node was a filelink type
*/
linkAsset = asset;
asset = linkAsset.properties.destination;
}
// Does this collection of assets have potentially differering paths? // Does this collection of assets have potentially differering paths?
if (filterParams.variablePath || isLink) if (filterParams.variablePath || item.isLink)
{ {
locationAsset = (isLink && assetType == "document") ? linkAsset : asset; locationAsset = (item.isLink && item.type == "document") ? item.linkAsset : item.asset;
qnamePaths = locationAsset.qnamePath.split("/"); qnamePaths = locationAsset.qnamePath.split("/");
displayPaths = locationAsset.displayPath.split("/"); displayPaths = locationAsset.displayPath.split("/");
@@ -252,7 +227,8 @@ function main()
path: "/" + displayPaths.slice(5, displayPaths.length).join("/"), path: "/" + displayPaths.slice(5, displayPaths.length).join("/"),
file: locationAsset.name file: locationAsset.name
}; };
var site = getSite(location.site);
site = getSite(location.site);
if (site != null) if (site != null)
{ {
location.siteTitle = site.title; location.siteTitle = site.title;
@@ -281,51 +257,30 @@ function main()
file: asset.name file: asset.name
}; };
} }
// Make sure we have a thumbnail // Resolved location
item.location = location;
// Make sure we have a thumbnail.
if (haveThumbnails) if (haveThumbnails)
{ {
thumbnail = asset.getThumbnail(THUMBNAIL_NAME); thumbnail = item.asset.getThumbnail(THUMBNAIL_NAME);
if (thumbnail === null) if (thumbnail === null)
{ {
// No thumbnail, so queue creation // No thumbnail, so queue creation
asset.createThumbnail(THUMBNAIL_NAME, true); item.asset.createThumbnail(THUMBNAIL_NAME, true);
} }
} }
// Get relevant actions set items.push(item);
actionSet = getActionSet(asset,
{
assetType: assetType,
isLink: isLink,
itemStatus: itemStatus,
itemOwner: itemOwner
});
// Part of an active workflow?
for each (activeWorkflow in asset.activeWorkflows)
{
activeWorkflows.push(activeWorkflow.id);
}
items.push(
{
asset: asset,
linkAsset: linkAsset,
type: assetType,
isLink: isLink,
status: itemStatus,
owner: itemOwner,
createdBy: createdBy,
modifiedBy: modifiedBy,
actionSet: actionSet,
tags: asset.tags,
activeWorkflows: activeWorkflows,
location: location,
isFavourite: (favourites[asset.nodeRef] === true)
});
} }
var parentMeta = filterParams.variablePath ? null :
{
nodeRef: String(parsedArgs.parentNode.nodeRef),
type: parent.typeShort
};
return ( return (
{ {
luceneQuery: query, luceneQuery: query,
@@ -342,7 +297,7 @@ function main()
}, },
user: user, user: user,
items: items, items: items,
parent: filterParams.variablePath ? null : parsedArgs.parentNode parent: parentMeta
}); });
} }

View File

@@ -11,15 +11,19 @@
{ {
"parent": "parent":
{ {
<#if doclist.parent??>"nodeRef": "${doclist.parent.nodeRef}",</#if> <#if doclist.parent??>
"nodeRef": "${doclist.parent.nodeRef}",
</#if>
"permissions": "permissions":
{ {
"userRole": "${user.role!""}", "userRole": "${user.role!""}",
"userAccess": "userAccess":
{ {
"create" : ${user.permissions.create?string}, <#list user.permissions?keys as perm>
"edit" : ${user.permissions.edit?string}, <#if user.permissions[perm]?is_boolean>
"delete" : ${user.permissions.delete?string} "${perm?string}": ${user.permissions[perm]?string}<#if perm_has_next>,</#if>
</#if>
</#list>
} }
} }
}, },
@@ -36,12 +40,6 @@
<#assign d = item.asset> <#assign d = item.asset>
<#assign version = "1.0"> <#assign version = "1.0">
<#if d.hasAspect("cm:versionable") && d.versionHistory?size != 0><#assign version = d.versionHistory[0].versionLabel></#if> <#if d.hasAspect("cm:versionable") && d.versionHistory?size != 0><#assign version = d.versionHistory[0].versionLabel></#if>
<#if item.owner??>
<#assign lockedBy = (item.owner.properties.firstName + " " + item.owner.properties.lastName)?trim>
<#assign lockedByUser = item.owner.properties.userName>
<#else>
<#assign lockedBy="" lockedByUser="">
</#if>
<#if item.createdBy??> <#if item.createdBy??>
<#assign createdBy = (item.createdBy.properties.firstName + " " + item.createdBy.properties.lastName)?trim> <#assign createdBy = (item.createdBy.properties.firstName + " " + item.createdBy.properties.lastName)?trim>
<#assign createdByUser = item.createdBy.properties.userName> <#assign createdByUser = item.createdBy.properties.userName>
@@ -54,6 +52,12 @@
<#else> <#else>
<#assign modifiedBy="" modifiedByUser=""> <#assign modifiedBy="" modifiedByUser="">
</#if> </#if>
<#if item.lockedBy??>
<#assign lockedBy = (item.lockedBy.properties.firstName + " " + item.lockedBy.properties.lastName)?trim>
<#assign lockedByUser = item.lockedBy.properties.userName>
<#else>
<#assign lockedBy="" lockedByUser="">
</#if>
<#assign tags><#list item.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list></#assign> <#assign tags><#list item.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list></#assign>
{ {
"index": ${item_index}, "index": ${item_index},
@@ -64,9 +68,7 @@
"mimetype": "${d.mimetype!""}", "mimetype": "${d.mimetype!""}",
"fileName": "<#if item.isLink>${item.linkAsset.name}<#else>${d.name}</#if>", "fileName": "<#if item.isLink>${item.linkAsset.name}<#else>${d.name}</#if>",
"displayName": "${d.name?replace(workingCopyLabel, "")}", "displayName": "${d.name?replace(workingCopyLabel, "")}",
"status": "<#list item.status as s>${s}<#if s_has_next>,</#if></#list>", "status": "<#list item.status?keys as s><#if item.status[s]?is_boolean && item.status[s] == true>${s}<#if s_has_next>,</#if></#if></#list>",
"lockedBy": "${lockedBy}",
"lockedByUser": "${lockedByUser}",
"title": "${d.properties.title!""}", "title": "${d.properties.title!""}",
"description": "${d.properties.description!""}", "description": "${d.properties.description!""}",
"author": "${d.properties.author!""}", "author": "${d.properties.author!""}",
@@ -76,6 +78,8 @@
"modifiedOn": "<@dateFormat d.properties.modified />", "modifiedOn": "<@dateFormat d.properties.modified />",
"modifiedBy": "${modifiedBy}", "modifiedBy": "${modifiedBy}",
"modifiedByUser": "${modifiedByUser}", "modifiedByUser": "${modifiedByUser}",
"lockedBy": "${lockedBy}",
"lockedByUser": "${lockedByUser}",
"size": "${d.size?c}", "size": "${d.size?c}",
"version": "${version}", "version": "${version}",
"contentUrl": "api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}", "contentUrl": "api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}",
@@ -102,12 +106,14 @@
], ],
"userAccess": "userAccess":
{ {
"create": ${d.hasPermission("CreateChildren")?string}, <#list item.actionPermissions?keys as actionPerm>
"edit": ${d.hasPermission("Write")?string}, <#if item.actionPermissions[actionPerm]?is_boolean>
"delete": ${d.hasPermission("Delete")?string}, "${actionPerm?string}": ${item.actionPermissions[actionPerm]?string}<#if actionPerm_has_next>,</#if>
"permissions": ${d.hasPermission("ChangePermissions")?string} </#if>
</#list>
} }
} },
"custom": <#noescape>${item.custom}</#noescape>
}<#if item_has_next>,</#if> }<#if item_has_next>,</#if>
</#list> </#list>
] ]

View File

@@ -0,0 +1,173 @@
var Evaluator =
{
/**
* Asset Type evaluator
*/
getAssetType: function Evaluator_getAssetType(asset)
{
var assetType = "";
if (asset.isContainer)
{
assetType = "folder";
}
else if (asset.typeShort == "app:folderlink")
{
assetType = "folderlink";
}
else if (asset.typeShort == "app:filelink")
{
assetType = "filelink";
}
else
{
assetType = "document";
}
return assetType;
},
/**
* Asset Evaluator - main entrypoint
*/
run: function Evaluator_run(asset)
{
var assetType = Evaluator.getAssetType(asset),
actions = {},
actionSet = "empty",
permissions = {},
status = {},
custom = {},
activeWorkflows = [],
createdBy = getPerson(asset.properties["cm:creator"]),
modifiedBy = getPerson(asset.properties["cm:modifier"]),
isLink = false,
linkAsset = null,
lockedBy = null,
lockOwnerUser = "";
/**
* COMMON TO ALL
*/
permissions =
{
"create": asset.hasPermission("CreateChildren"),
"edit": asset.hasPermission("Write"),
"delete": asset.hasPermission("Delete"),
"permissions": asset.hasPermission("ChangePermissions"),
"cancel-checkout": asset.hasPermission("CancelCheckOut")
};
// Get relevant actions set
switch (assetType)
{
/**
* SPECIFIC TO: LINK
*/
case "folderlink":
case "filelink":
actionSet = "link";
isLink = true;
/**
* NOTE: After this point, the "asset" object will be changed to a link's destination node
* if the original node was a filelink type.
*/
linkAsset = asset;
asset = linkAsset.properties.destination;
// Re-evaluate the assetType based on the link's destination node
assetType = Evaluator.getAssetType(asset);
break;
/**
* SPECIFIC TO: FOLDER
*/
case "folder":
actionSet = "folder";
break;
/**
* SPECIFIC TO: DOCUMENTS
*/
case "document":
actionSet = "document";
// Working Copy?
if (asset.hasAspect("cm:workingcopy"))
{
lockedBy = getPerson(asset.properties["cm:workingCopyOwner"]);
lockOwnerUser = lockedBy.properties.userName;
if (lockOwnerUser == person.properties.userName)
{
status["editing"] = true;
actionSet = "workingCopyOwner";
}
else
{
status["locked " + getPersonName(lockOwnerUser) + "|" + lockedBy.properties.userName] = true;
actionSet = "locked";
}
var wcNode = asset.properties["source"];
custom["isWorkingCopy"] = true;
custom["workingCopyOriginal"] = wcNode.nodeRef;
if (wcNode.hasAspect("cm:versionable") && wcNode.versionHistory.length > 0)
{
custom["workingCopyVersion"] = wcNode.versionHistory[0].label;
}
permissions["view-original"] = true;
}
// Locked?
else if (asset.isLocked)
{
lockedBy = getPerson(asset.properties["cm:lockOwner"]);
lockOwnerUser = lockedBy.properties.userName;
if (lockOwnerUser == person.properties.userName)
{
status["lock-owner"] = true;
actionSet = "lockOwner";
}
else
{
status["locked " + getPersonName(lockOwnerUser) + "|" + lockedBy.properties.userName] = true;
actionSet = "locked";
}
var srcNodes = search.query(
{
query: "+@cm\\:source:\"" + asset.nodeRef + "\" +ISNOTNULL:cm\\:workingCopyOwner",
language: "lucene",
page:
{
maxItems: 1
}
});
if (srcNodes.length == 1)
{
custom["hasWorkingCopy"] = true;
custom["workingCopyNode"] = srcNodes[0].nodeRef;
permissions["view-working-copy"] = true;
}
}
break;
}
// Part of an active workflow?
for each (activeWorkflow in asset.activeWorkflows)
{
activeWorkflows.push(activeWorkflow.id);
}
return(
{
asset: asset,
type: assetType,
linkAsset: linkAsset,
isLink: isLink,
status: status,
actionSet: actionSet,
actionPermissions: permissions,
createdBy: createdBy,
modifiedBy: modifiedBy,
lockedBy: lockedBy,
tags: asset.tags,
activeWorkflows: activeWorkflows,
custom: jsonUtils.toJSONString(custom),
});
}
};

View File

@@ -13,8 +13,13 @@ var Filters =
{ {
query: "+PATH:\"" + parsedArgs.parentNode.qnamePath + "/*\"", query: "+PATH:\"" + parsedArgs.parentNode.qnamePath + "/*\"",
limitResults: null, limitResults: null,
sortBy: "@{http://www.alfresco.org/model/content/1.0}name", sort: [
sortByAscending: true, {
column: "@{http://www.alfresco.org/model/content/1.0}name",
ascending: true
}],
language: "lucene",
templates: null,
variablePath: false variablePath: false
}; };
@@ -34,20 +39,20 @@ var Filters =
} }
// Create query based on passed-in arguments // Create query based on passed-in arguments
var filterId = String(filter), var filterData = String(args.filterData),
filterData = String(args.filterData),
filterQuery = ""; filterQuery = "";
// Common types and aspects to filter from the UI // Common types and aspects to filter from the UI
filterQueryDefaults = " -ASPECT:\"{http://www.alfresco.org/model/content/1.0}workingcopy\""; filterQueryDefaults =
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}thumbnail\""; " -TYPE:\"{http://www.alfresco.org/model/content/1.0}thumbnail\"" +
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}systemfolder\""; " -TYPE:\"{http://www.alfresco.org/model/content/1.0}systemfolder\"" +
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}forums\""; " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}forums\"" +
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}forum\""; " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}forum\"" +
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}topic\""; " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}topic\"" +
filterQueryDefaults += " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}post\""; " -TYPE:\"{http://www.alfresco.org/model/forum/1.0}post\"" +
" -@cm\\:lockType:READ_ONLY_LOCK";
switch (filterId) switch (String(filter))
{ {
case "all": case "all":
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
@@ -96,8 +101,11 @@ var Filters =
} }
filterQuery += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\""; filterQuery += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\"";
filterParams.sortBy = "@{http://www.alfresco.org/model/content/1.0}" + dateField; filterParams.sort = [
filterParams.sortByAscending = false; {
column: "@{http://www.alfresco.org/model/content/1.0}" + dateField,
ascending: false
}];
filterParams.variablePath = true; filterParams.variablePath = true;
filterParams.query = filterQuery + filterQueryDefaults; filterParams.query = filterQuery + filterQueryDefaults;
break; break;
@@ -152,7 +160,10 @@ var Filters =
} }
// Specialise by passed-in type // Specialise by passed-in type
filterParams.query += " " + (Filters.TYPE_MAP[parsedArgs.type] || ""); if (filterParams.query !== "")
{
filterParams.query += " " + (Filters.TYPE_MAP[parsedArgs.type] || "");
}
return filterParams; return filterParams;
} }

View File

@@ -395,6 +395,11 @@
<!-- Web-tier SSO authentication touch point --> <!-- Web-tier SSO authentication touch point -->
<bean id="webscript.org.alfresco.repository.touch.get" class="org.alfresco.repo.web.scripts.bean.Touch" parent="webscript" /> <bean id="webscript.org.alfresco.repository.touch.get" class="org.alfresco.repo.web.scripts.bean.Touch" parent="webscript" />
<!-- Authentication information service -->
<bean id="webscript.org.alfresco.repository.authentication.get" class="org.alfresco.repo.web.scripts.bean.Authentication" parent="webscript">
<property name="authenticationService" ref="authenticationService"/>
</bean>
<!-- --> <!-- -->
<!-- Activity Feed Web Scripts --> <!-- Activity Feed Web Scripts -->

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.web.scripts.bean;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.web.scripts.DeclarativeWebScript;
import org.alfresco.web.scripts.Status;
import org.alfresco.web.scripts.WebScriptRequest;
/**
* WebScript java backed bean implementation - to return information about the
* authentication system, such as account mutability.
*
* @author Kevin Roast
*/
public class Authentication extends DeclarativeWebScript
{
private MutableAuthenticationService authenticationService;
public void setAuthenticationService(AuthenticationService authenticationService)
{
this.authenticationService = (MutableAuthenticationService)authenticationService;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
Map<String, Object> model = new HashMap<String, Object>(2);
model.put("creationAllowed", this.authenticationService.isAuthenticationCreationAllowed());
return model;
}
}