Skip to content

Commit

Permalink
Merge pull request softwareloop#149 from douglascrp/develop
Browse files Browse the repository at this point in the history
Merging some of the open PRs
  • Loading branch information
douglascrp authored Jun 24, 2022
2 parents 0d10470 + 4f3f597 commit 2072776
Show file tree
Hide file tree
Showing 69 changed files with 108 additions and 73 deletions.
22 changes: 22 additions & 0 deletions repo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-remote-api</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.social</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.social</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
up_UploaderPlus.aspect.up_UploadFolder.title = R\u00e9pertoire de t\u00e9l\u00e9versement
up_UploaderPlus.property.up_allowedTypes.title = Types trouv\u00e9s
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<url>/uploader-plus/allowed-content-types?siteid={siteid}&amp;containerid={containerid}&amp;path={path}</url>
<url>/uploader-plus/allowed-content-types?destination={destination}</url>
<format default="json">extension</format>
<authentication>user</authentication>
<authentication runas="admin">user</authentication>
<transaction allow="readonly">required</transaction>
</webscript>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function uploaderPlusMain()
case "containerid":
case "destination":
case "uploaddirectory":
case "createdirectory":
case "updatenoderef":
case "description":
case "contenttype":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tool.uploader-plus-admin.label=Uploader Plus
tool.uploader-plus-admin.description=Uploader Plus
aspect.up_UploadFolder=R\u00e9pertoire de t\u00e9l\u00e9versement
content.type=Type de contenu
uploader.plus.next=Suivant
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>documentlibrary</source-id>
<region-id>flash-upload</region-id>
<sub-components>
<sub-component id="uploader-plus" index="60">
<url>/components/uploader-plus/flash-upload</url>
</sub-component>
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>documentlibrary</source-id>
Expand All @@ -64,17 +53,6 @@
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>repository</source-id>
<region-id>flash-upload</region-id>
<sub-components>
<sub-component id="uploader-plus" index="60">
<url>/components/uploader-plus/flash-upload</url>
</sub-component>
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>repository</source-id>
Expand All @@ -97,17 +75,6 @@
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>myfiles</source-id>
<region-id>flash-upload</region-id>
<sub-components>
<sub-component id="uploader-plus" index="60">
<url>/components/uploader-plus/flash-upload</url>
</sub-component>
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>myfiles</source-id>
Expand All @@ -130,16 +97,6 @@
</sub-components>
</component>

<component>
<scope>template</scope>
<source-id>sharedfiles</source-id>
<region-id>flash-upload</region-id>
<sub-components>
<sub-component id="uploader-plus" index="60">
<url>/components/uploader-plus/flash-upload</url>
</sub-component>
</sub-components>
</component>

<component>
<scope>template</scope>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title.path = Chemin
title.allowed.types = Types autoris\u00e9s
title.actions = Actions
loading.folders = R\u00e9pertoire de t\u00e9l\u00e9versement
no.folders.found = Aucun dossier trouv\u00e9
upload.folders = Upload folders
open.in.repository=Ouvrir dans l'entrep\u00f4t
operation.completed.successfully = Op\u00e9ration r\u00e9alis\u00e9e avec succ\u00e8s
operation.failed = Op\u00e9ration \u00e9chou\u00e9e
select.the.upload.folder=S\u00e9lectionner un r\u00e9pertoire
new.upload.folder=Nouveau r\u00e9pertoire de t\u00e9l\u00e9versement
_.is.already.an.upload.folder={path} est d\u00e9j\u00e0 un r\u00e9pertoire de t\u00e9l\u00e9versement
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<bean id="uploader-plus.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.uploader-plus</value>
<value>alfresco.web-extension.messages.uploader-plus</value>
</list>
</property>
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,21 @@
fileInfo.state = this.STATE_UPLOADING;

var url;
if (this.showConfig.uploadURL === null) {
if (this.showConfig.uploadURL === null)
{
url = Alfresco.constants.PROXY_URI + "uploader-plus/upload";
}
else {
else
{
url = Alfresco.constants.PROXY_URI + this.showConfig.uploadURL;
}
if (Alfresco.util.CSRFPolicy.isFilterEnabled()) {
if (Alfresco.util.CSRFPolicy.isFilterEnabled())
{
url += "?" + Alfresco.util.CSRFPolicy.getParameter() + "=" + encodeURIComponent(Alfresco.util.CSRFPolicy.getToken());
}

if (this.uploadMethod === this.FORMDATA_UPLOAD) {
if (this.uploadMethod === this.FORMDATA_UPLOAD)
{
// For Browsers that support it (currently FireFox 4), the FormData object is the best
// object to use for file upload as it supports asynchronous multipart upload without
// the need to read the entire object into memory.
Expand All @@ -168,20 +172,26 @@
formData.append("filedata", fileInfo.uploadData.filedata);
formData.append("filename", fileInfo.uploadData.filename);
formData.append("destination", fileInfo.uploadData.destination);
formData.append("siteId", fileInfo.uploadData.siteId);
formData.append("containerId", fileInfo.uploadData.containerId);
formData.append("uploaddirectory", fileInfo.uploadData.uploaddirectory);
formData.append("createdirectory", fileInfo.uploadData.createdirectory ? "true" : "false");
formData.append("majorVersion", fileInfo.uploadData.majorVersion ? "true" : "false");
formData.append("username", fileInfo.uploadData.username);
formData.append("overwrite", fileInfo.uploadData.overwrite);
formData.append("thumbnails", fileInfo.uploadData.thumbnails);
formData.append("updatenameandmimetype", fileInfo.uploadData.updateNameAndMimetype);
formData.append("updatenameandmimetype", fileInfo.uploadData.updateNameAndMimetype)


if (fileInfo.uploadData.updateNodeRef) {
if (fileInfo.uploadData.updateNodeRef)
{
formData.append("updateNodeRef", fileInfo.uploadData.updateNodeRef);
}
if (fileInfo.uploadData.description) {
else
{
formData.append("siteId", fileInfo.uploadData.siteId);
formData.append("containerId", fileInfo.uploadData.containerId);
}

if (fileInfo.uploadData.description)
{
formData.append("description", fileInfo.uploadData.description);
}

Expand All @@ -206,10 +216,10 @@
for (var current in fileInfo.propertyData) {
Alfresco.logger.debug("Current:", current);
if (fileInfo.propertyData.hasOwnProperty(current) &&
(current != "prop_mimetype" ||
(current == "prop_mimetype" && YAHOO.lang.isString(fileInfo.propertyData[current]) && fileInfo.propertyData[current].length > 0)
)) {
(current != "prop_mimetype" ||
(current == "prop_mimetype" && YAHOO.lang.isString(fileInfo.propertyData[current]) && fileInfo.propertyData[current].length > 0)
)) {

Alfresco.logger.debug("Appending", current);
formData.append(current, fileInfo.propertyData[current]);
}
Expand All @@ -218,10 +228,27 @@
Alfresco.logger.debug("formData:", formData);
// END: uploader-plus customisations

fileInfo.request.open("POST", url, true);
fileInfo.request.open("POST", url, true);
fileInfo.request.send(formData);
fileInfo.request.onreadystatechange = function() {
if (this.status === 401)
{
var redirect = this.getResponseHeader["Location"];
if (redirect)
{
window.location.href = window.location.protocol + "//" + window.location.host + redirect;
return;
}
else
{
window.location.reload(true);
return;
}
}
};
}
else if (this.uploadMethod === this.INMEMORY_UPLOAD) {
else if (this.uploadMethod === this.INMEMORY_UPLOAD)
{
Alfresco.logger.debug("Using custom multipart upload");

// PLEASE NOTE: Be *VERY* careful modifying the following code, this carefully constructs a multipart formatted request...
Expand All @@ -238,10 +265,12 @@
customFormData += rn + "Content-Disposition: form-data; name=\"filename\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.filename)) + rn + "--" + multipartBoundary;
customFormData += rn + "Content-Disposition: form-data; name=\"destination\"";
if (fileInfo.uploadData.destination !== null) {
if (fileInfo.uploadData.destination !== null)
{
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.destination)) + rn + "--" + multipartBoundary;
}
else {
else
{
customFormData += rn + rn + rn + "--" + multipartBoundary;
}
customFormData += rn + "Content-Disposition: form-data; name=\"siteId\"";
Expand All @@ -252,23 +281,28 @@
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.uploaddirectory)) + rn + "--" + multipartBoundary + "--";
customFormData += rn + "Content-Disposition: form-data; name=\"majorVersion\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.majorVersion)) + rn + "--" + multipartBoundary + "--";
if (fileInfo.uploadData.updateNodeRef) {
if (fileInfo.uploadData.updateNodeRef)
{
customFormData += rn + "Content-Disposition: form-data; name=\"updateNodeRef\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.updateNodeRef)) + rn + "--" + multipartBoundary + "--";
}
if (fileInfo.uploadData.description) {
if (fileInfo.uploadData.description)
{
customFormData += rn + "Content-Disposition: form-data; name=\"description\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.description)) + rn + "--" + multipartBoundary + "--";
}
if (fileInfo.uploadData.username) {
if (fileInfo.uploadData.username)
{
customFormData += rn + "Content-Disposition: form-data; name=\"username\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.username)) + rn + "--" + multipartBoundary + "--";
}
if (fileInfo.uploadData.overwrite) {
if (fileInfo.uploadData.overwrite)
{
customFormData += rn + "Content-Disposition: form-data; name=\"overwrite\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.overwrite)) + rn + "--" + multipartBoundary + "--";
}
if (fileInfo.uploadData.thumbnails) {
if (fileInfo.uploadData.thumbnails)
{
customFormData += rn + "Content-Disposition: form-data; name=\"thumbnails\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.uploadData.thumbnails)) + rn + "--" + multipartBoundary + "--";
}
Expand All @@ -281,10 +315,10 @@
if (fileInfo.propertyData) {
for (var current in fileInfo.propertyData) {
if (fileInfo.propertyData.hasOwnProperty(current) &&
(current != "prop_mimetype" ||
(current == "prop_mimetype" && YAHOO.lang.isString(fileInfo.propertyData[current]) && fileInfo.propertyData[current].length > 0)
)) {
(current != "prop_mimetype" ||
(current == "prop_mimetype" && YAHOO.lang.isString(fileInfo.propertyData[current]) && fileInfo.propertyData[current].length > 0)
)) {

customFormData += rn + "Content-Disposition: form-data; name=\"" + current + "\"";
customFormData += rn + rn + unescape(encodeURIComponent(fileInfo.propertyData[current])) + rn + "--" + multipartBoundary + "--";
}
Expand All @@ -293,10 +327,11 @@
// END: uploader-plus customisations


fileInfo.request.open("POST", url, true);
fileInfo.request.open("POST", url, true);
fileInfo.request.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + multipartBoundary);
fileInfo.request.sendAsBinary(customFormData);
}
}

}));
})();

0 comments on commit 2072776

Please sign in to comment.