mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
12251: Fix for wiki parsing regression 12253: More regression fixes in wiki parser 12255: Update Share web session timeout value to 60 minutes. 12289: Share wiki - ETHREEOH-1021, ETHREEOH-1022, ETHREEOH-880, ETHREEOH-1032 12290: Additional to r12289 12344: Fix for ETHREEOH-1066 - Wiki page editing no longer broken for page titles that don't exist yet. 12355: ETHREEOH-984: External users in Share cannot edit profile 12359: Fixed typo in Flash/HTML uploader type selection 12364: ETHREEOH-1032 - Impossibility to delete Wiki page git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12542 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,12 +24,15 @@ function getTemplateArgs(params)
|
|||||||
/* Format and return error object */
|
/* Format and return error object */
|
||||||
function jsonError(errorString)
|
function jsonError(errorString)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
var obj =
|
var obj =
|
||||||
{
|
{
|
||||||
"error": errorString
|
"error": errorString
|
||||||
};
|
};
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
*/
|
||||||
|
status.setCode(status.STATUS_BAD_REQUEST, errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: may need a custom content type for a wiki entry
|
// NOTE: may need a custom content type for a wiki entry
|
||||||
|
@@ -23,10 +23,11 @@ function getTemplateParams()
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return (
|
||||||
|
{
|
||||||
"siteId": siteId,
|
"siteId": siteId,
|
||||||
"pageTitle": pageTitle
|
"pageTitle": pageTitle
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function update()
|
function update()
|
||||||
@@ -63,6 +64,9 @@ function update()
|
|||||||
activityType = "org.alfresco.wiki.page-created";
|
activityType = "org.alfresco.wiki.page-created";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Check the version of the page being submitted against the version now in the repo, or a forced save
|
||||||
|
if (pageVersionMatchesSubmitted(page) || json.has("forceSave"))
|
||||||
{
|
{
|
||||||
// Create a new revision of the page
|
// Create a new revision of the page
|
||||||
var workingCopy = page.checkout();
|
var workingCopy = page.checkout();
|
||||||
@@ -71,6 +75,12 @@ function update()
|
|||||||
|
|
||||||
activityType = "org.alfresco.wiki.page-edited";
|
activityType = "org.alfresco.wiki.page-edited";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_CONFLICT, "Repository version is newer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var data =
|
var data =
|
||||||
{
|
{
|
||||||
@@ -90,7 +100,7 @@ function update()
|
|||||||
// string and call the (native) method split
|
// string and call the (native) method split
|
||||||
var tags = [];
|
var tags = [];
|
||||||
var tmp = json.get("tags");
|
var tmp = json.get("tags");
|
||||||
for (var x=0; x < tmp.length(); x++)
|
for (var x = 0, xx = tmp.length(); x < xx; x++)
|
||||||
{
|
{
|
||||||
tags.push(tmp.get(x));
|
tags.push(tmp.get(x));
|
||||||
}
|
}
|
||||||
@@ -106,10 +116,60 @@ function update()
|
|||||||
// NOTE: for now we return the raw page content and do the transformation
|
// NOTE: for now we return the raw page content and do the transformation
|
||||||
// of any wiki markup on the client. This is because the edit view needs to display
|
// of any wiki markup on the client. This is because the edit view needs to display
|
||||||
// the raw content (for editing) whereas the page view needs to display the rendered content.
|
// the raw content (for editing) whereas the page view needs to display the rendered content.
|
||||||
return {
|
return (
|
||||||
|
{
|
||||||
page: page,
|
page: page,
|
||||||
tags: page.tags
|
tags: page.tags
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current repository version is newer than a submitted version number.
|
||||||
|
* Returns:
|
||||||
|
* false if currentVersion is older than repoVersion
|
||||||
|
* true otherwise
|
||||||
|
*/
|
||||||
|
function pageVersionMatchesSubmitted(page)
|
||||||
|
{
|
||||||
|
var currentVersion = 0, repoVersion = 0;
|
||||||
|
|
||||||
|
if (json.has("currentVersion"))
|
||||||
|
{
|
||||||
|
currentVersion = json.get("currentVersion");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (page.hasAspect("cm:versionable"))
|
||||||
|
{
|
||||||
|
repoVersion = getLatestVersion(page.versionHistory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sortByLabel(
|
||||||
|
{ label: repoVersion},
|
||||||
|
{ label: currentVersion }
|
||||||
|
) != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortByLabel(version1, version2)
|
||||||
|
{
|
||||||
|
var major1 = new Number(version1.label.substring(0, version1.label.indexOf(".")));
|
||||||
|
var major2 = new Number(version2.label.substring(0, version2.label.indexOf(".")));
|
||||||
|
if (major1 - 0 == major2 - 0)
|
||||||
|
{
|
||||||
|
var minor1 = new Number(version1.label.substring(version1.label.indexOf(".")+1));
|
||||||
|
var minor2 = new Number(version2.label.substring(version2.label.indexOf(".")+1));
|
||||||
|
return (minor1 < minor2) ? 1 : (minor1 > minor2) ? -1 : 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (major1 < major2) ? 1 : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getLatestVersion(versionHistory)
|
||||||
|
{
|
||||||
|
versionHistory.sort(sortByLabel);
|
||||||
|
return versionHistory[0].label;
|
||||||
|
}
|
||||||
|
|
||||||
model.result = update();
|
model.result = update();
|
@@ -351,6 +351,7 @@
|
|||||||
parent="webscript">
|
parent="webscript">
|
||||||
<property name="workflowService" ref="WorkflowService"/>
|
<property name="workflowService" ref="WorkflowService"/>
|
||||||
<property name="personService" ref="PersonService"/>
|
<property name="personService" ref="PersonService"/>
|
||||||
|
<property name="permissionService" ref="PermissionService"/>
|
||||||
<property name="authenticationService" ref="AuthenticationService"/>
|
<property name="authenticationService" ref="AuthenticationService"/>
|
||||||
<property name="mutableAuthenticationDao" ref="authenticationDao"/>
|
<property name="mutableAuthenticationDao" ref="authenticationDao"/>
|
||||||
<property name="siteService" ref="SiteService"/>
|
<property name="siteService" ref="SiteService"/>
|
||||||
|
@@ -43,6 +43,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowException;
|
import org.alfresco.service.cmr.workflow.WorkflowException;
|
||||||
@@ -100,6 +101,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
private WorkflowService workflowService;
|
private WorkflowService workflowService;
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
private AuthenticationService authenticationService;
|
private AuthenticationService authenticationService;
|
||||||
|
private PermissionService permissionService;
|
||||||
private MutableAuthenticationDao mutableAuthenticationDao;
|
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||||
private SiteService siteService;
|
private SiteService siteService;
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
@@ -214,6 +216,16 @@ public class Invite extends DeclarativeWebScript
|
|||||||
this.namespaceService = namespaceService;
|
this.namespaceService = namespaceService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the permission service
|
||||||
|
*
|
||||||
|
* @param permissionService the permission service
|
||||||
|
*/
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
@@ -419,11 +431,13 @@ public class Invite extends DeclarativeWebScript
|
|||||||
properties.put(ContentModel.PROP_LASTNAME, inviteeLastName);
|
properties.put(ContentModel.PROP_LASTNAME, inviteeLastName);
|
||||||
properties.put(ContentModel.PROP_EMAIL, inviteeEmail);
|
properties.put(ContentModel.PROP_EMAIL, inviteeEmail);
|
||||||
|
|
||||||
|
final String finalUserName = inviteeUserName;
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||||
{
|
{
|
||||||
public Object doWork() throws Exception
|
public Object doWork() throws Exception
|
||||||
{
|
{
|
||||||
personService.createPerson(properties);
|
NodeRef person = personService.createPerson(properties);
|
||||||
|
permissionService.setPermission(person, finalUserName, PermissionService.ALL_PERMISSIONS, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user