Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
up_UploaderPlus.aspect.up_UploadFolder.title = Upload folder
up_UploaderPlus.property.up_allowedTypes.title = Allowed types
up_UploaderPlus.property.up_allowedTypes.title = Allowed types
up_UploaderPlus.association.up_excludedSubFolders.title = Excluded subfolders
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
up_UploaderPlus.aspect.up_UploadFolder.title = R\u00e9pertoire de t\u00e9l\u00e9chargement
up_UploaderPlus.property.up_allowedTypes.title = Types autoris\u00e9s
up_UploaderPlus.property.up_allowedTypes.title = Types autoris\u00e9s
up_UploaderPlus.association.up_excludedSubFolders.title = Sous-r\u00e9pertoires \u00e0 exclure
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>

<namespaces>
Expand All @@ -31,6 +32,19 @@
</index>
</property>
</properties>
<associations>
<association name="up:excludedSubFolders">
<title>Excluded sub-folders</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:folder</class>
<many>true</many>
</target>
</association>
</associations>
</aspect>
</aspects>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ if (logger.isLoggingEnabled()) {
}

var destNode = null;

var initialDestNode = null;
if (destination !== null) {
destNode = search.findNode(destination);
initialDestNode = destNode;
} else if (siteId !== null) {
var site = siteService.getSite(siteId);
destNode = site.getContainer(containerId);

destNode = destNode.childByNamePath(path);
initialDestNode = destNode;
}


Expand All @@ -42,5 +43,23 @@ while (destNode !== null && !destNode.hasAspect("up:UploadFolder")) {
if (destNode === null) {
model.types = null;
} else {
model.types = destNode.properties["up:allowedTypes"];
var excludedSubFolders = destNode.associations["up:excludedSubFolders"] || [];
for (var i = 0, ii = excludedSubFolders.length; i < ii; i++) {
var excludedSubFolder = excludedSubFolders[i];
if (excludedSubFolder.nodeRef.equals(destNode.nodeRef)) {
break;
}
}
model.types = isExcludedFolder(destNode, initialDestNode) ? null : destNode.properties["up:allowedTypes"];
}

function isExcludedFolder(destNode, initialDestNode) {
var excludedSubFolders = destNode.associations["up:excludedSubFolders"] || [];
for (var i = 0, ii = excludedSubFolders.length; i < ii; i++) {
var excludedSubFolder = excludedSubFolders[i];
if (excludedSubFolder.nodeRef.equals(initialDestNode.nodeRef)) {
return true;
}
}
return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
"${allowedType}"<#if allowedType_has_next>,</#if>
</#list>
</#if>
],
"excludedSubFolders": [
<#if node.associations["up:excludedSubFolders"]?has_content>
<#list node.associations["up:excludedSubFolders"] as excludedSubFolder>
{
"name": "${excludedSubFolder.properties.name}",
"nodeRef": "${excludedSubFolder.nodeRef}",
"path": "${excludedSubFolder.displayPath}\/${excludedSubFolder.properties.name}"
}
<#if excludedSubFolder_has_next>,</#if>
</#list>
</#if>
]
}<#if node_has_next>,</#if>
</#list>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
title.path = Path
title.allowed.types = Allowed types
title.excluded.subFolders = Excluded subfolders
title.actions = Actions
title.name = Name
loading.folders = Loading folders
no.folders.found = No folders found
upload.folders = Upload folders
Expand All @@ -9,4 +11,6 @@ operation.completed.successfully = Operation completed successfully
operation.failed = Operation failed
select.the.upload.folder=Select the upload folder
new.upload.folder=New upload folder
_.is.already.an.upload.folder={path} is already an upload folder
_.is.already.an.upload.folder={path} is already an upload folder
excluded.subFolders.no.folders.found=Not set
excluded.subFolders.details=See details
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
title.path = Chemin
title.allowed.types = Types g\u00e9r\u00e9s
title.excluded.subFolders = Sous-r\u00e9pertoires \u00e0 exclure
title.actions = Actions
title.name = Nom
loading.folders = Chargement des r\u00e9pertoires
no.folders.found = Pas de r\u00e9pertoires trouv\u00e9s
upload.folders = R\u00e9pertoires de t\u00e9l\u00e9chargement
Expand All @@ -9,4 +11,6 @@ operation.completed.successfully = Op\u00e9ration termin\u00e9e avec succ\u00e8
operation.failed = Op\u00e9ration \u00e9cho\u00e9e
select.the.upload.folder=S\u00e9lectionner le r\u00e9pertoire de t\u00e9l\u00e9chargement
new.upload.folder=Nouveau r\u00e9pertoire de t\u00e9l\u00e9chargement
_.is.already.an.upload.folder={path} est d\u00e9j\u00e0 un r\u00e9pertoire de t\u00e9l\u00e9chargement
_.is.already.an.upload.folder={path} est d\u00e9j\u00e0 un r\u00e9pertoire de t\u00e9l\u00e9chargement
excluded.subFolders.no.folders.found=Non configur\u00e9
excluded.subFolders.details=Voir les d\u00e9tails
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,30 @@ div.yui-u.edit-metadata.flat-button {
.form-container select.supported-types-select {
width: 100%;
height: 20em;
}

.excluded-sub-folders .yui-dt table {
border: none;
padding: 5px 5px 0 5px;
}

.excluded-sub-folders .yui-dt table tr td {
padding: 10px 10px;
border-bottom: 1px solid #ccc;
}

.excluded-sub-folders .yui-dt table tr th {
border-top: 1px solid #ccc;
padding: 0.5em;
text-align: center;
}

.excluded-sub-folders .yui-dt table tr th,
.excluded-sub-folders .yui-dt table tr td {
border-right: 1px solid #ccc;
}

.excluded-sub-folders .yui-dt table tr th:first-child,
.excluded-sub-folders .yui-dt table tr td:first-child {
border-left: 1px solid #ccc;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Alfresco.logger.debug("uploader-plus-admin.js");
var $hasEventInterest = Alfresco.util.hasEventInterest;

SoftwareLoop.UploaderPlusAdmin = function (htmlId) {
Alfresco.logger.debug("UploaderPlusAdmin constructor");
Expand All @@ -8,6 +9,54 @@ SoftwareLoop.UploaderPlusAdmin = function (htmlId) {
["button", "container", "datasource", "datatable", "paginator", "history", "animation"]
);

YAHOO.Bubbling.on("objectFinderReady", function(layer, args) {
if ($hasEventInterest(this.id + "-edit-form_assoc_up_excludedSubFolders-cntrl", args)) {
var subFolderPicker = args[1].eventGroup;
if (subFolderPicker) {
this.subFolderPicker = subFolderPicker;
this.pickerRootNodeRef = this.subFolderPicker.options.currentItem;
}
}
}, this);

YAHOO.Bubbling.on("parentDetails", function (layer, args) {
if ($hasEventInterest(this.subFolderPicker, args)) {
var obj = args[1];
if (obj && obj.parent) {
var item = obj.parent;
while (item) {
if (item.nodeRef == this.pickerRootNodeRef) {
delete item.parent;
break;
}
item = item.parent;
}
}
}
}, this);

YAHOO.Bubbling.on("renderCurrentValue", function(layer, args) {
if ($hasEventInterest(this.subFolderPicker, args)) {
var picker = args[1].eventGroup;
if (picker) {
var excludedSubFolders = [];
var selectedItems = picker.selectedItems;
if (selectedItems) {
for (var key in selectedItems) {
if (key.indexOf("workspace") != -1) {
excludedSubFolders.push({
"name" : selectedItems[key].name,
"nodeRef" : selectedItems[key].nodeRef,
"path" : selectedItems[key].displayPath + "/" + selectedItems[key].name,
});
}
}
}
this.currentEditedData.excludedSubFolders = excludedSubFolders;
}
}
}, this);

return this;
};

Expand Down Expand Up @@ -75,6 +124,19 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
Alfresco.logger.debug("END allowedTypesFormatter");
},

excludedSubFoldersFormatter: function (elCell, oRecord, oColumn, oData) {
Alfresco.logger.debug("excludedSubFoldersFormatter", arguments);
var folders = oData || [];
var html = "<span>" + this.msg("excluded.subFolders.no.folders.found") + "</span>";
if (folders.length > 0) {
html = "<div class='action'>" +
"<a class='show-excluded-subfolder'>" + this.msg("excluded.subFolders.details") + "</a>"
+ "</div>";
}
elCell.innerHTML = html;
Alfresco.logger.debug("END excludedSubFoldersFormatter");
},

actionFormatter: function (elCell, oRecord, oColumn, oData) {
Alfresco.logger.debug("actionFormatter", arguments);
var nodeRef = oRecord.getData().nodeRef;
Expand All @@ -100,6 +162,12 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
sortable: false,
formatter: SoftwareLoop.hitch(this, this.allowedTypesFormatter)
},
{
key: "excludedSubFolders",
label: this.msg("title.excluded.subFolders"),
sortable: false,
formatter: SoftwareLoop.hitch(this, this.excludedSubFoldersFormatter)
},
{
key: "actions",
label: this.msg("title.actions"),
Expand All @@ -116,7 +184,7 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
connXhrMode: "queueRequests",
responseSchema: {
resultsList: "results",
fields: ["path", "nodeRef", "allowedTypes"]
fields: ["path", "nodeRef", "allowedTypes", "excludedSubFolders"]
}
});

Expand Down Expand Up @@ -153,6 +221,14 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
"a.delete-upload-folder"
);
Alfresco.logger.debug("END setupDataTable");

// Attach event to delete links
YAHOO.util.Event.delegate(
this.id,
"click",
SoftwareLoop.hitch(this, this.showExcludedSubfolderHandler),
"a.show-excluded-subfolder"
);
},

setupNewUploadFolderButton: function () {
Expand Down Expand Up @@ -267,6 +343,7 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
editUploadFolderRecord: function (record) {
Alfresco.logger.debug("editUploadFolderRecord", arguments);
var data = record.getData();
this.currentEditedData = data;

var formHtmlId = this.id + "-edit-form";
var templateUrl = YAHOO.lang.substitute(
Expand All @@ -292,7 +369,7 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
actionUrl: actionUrl,
destroyOnHide: true,
doBeforeDialogShow: {
fn: function () {
fn: function (p_form, p_dialog) {
Alfresco.logger.debug("doBeforeDialogShow callback", arguments);
var titleNode = YAHOO.util.Dom.get(formHtmlId + "-dialogTitle");
if (titleNode) {
Expand Down Expand Up @@ -369,6 +446,47 @@ YAHOO.extend(SoftwareLoop.UploaderPlusAdmin, Alfresco.component.Base, {
Alfresco.logger.debug("END deleteUploadFolderHandler");
},

showExcludedSubfolderHandler: function (e, el, container) {
Alfresco.logger.debug("showExcludedSubfolderHandler", arguments);
var tr = el.parentNode.parentNode.parentNode;
var record = this.widgets.dataTable.getRecord(tr);

var handleClose = function() {
this.hide();
return true;
};

var showDialog = new YAHOO.widget.SimpleDialog('dtDialog', {
fixedcenter: true,
visible: false,
draggable: true,
close: false,
constraintoviewport: true,
modal: true,
buttons: [{text: this.msg('button.close'), handler: handleClose, isDefault:true }]
});

var html = "<div class='excluded-sub-folders'><div class='body scrollableList yui-dt'><table><tbody>";
html += "<thead><tr><th>" + this.msg("title.name") + "</th><th>" + this.msg("title.path") + "</th><tr></thead>";
var excludedSubFolders = record.getData("excludedSubFolders");
if (excludedSubFolders) {
for (var i = 0, ii = excludedSubFolders.length; i < ii; i++) {
var excludedSubFolder = excludedSubFolders[i];
html += "<tr>";
html += "<td>" + excludedSubFolder.name + "</td>";
html += "<td>" + excludedSubFolder.path + "</td>";
html += "</tr>";
}
}
html += "</tbody><table></div></div>";

showDialog.setHeader(this.msg("title.excluded.subFolders"));
showDialog.setBody(html);
showDialog.render(document.body);
showDialog.show();
Alfresco.logger.debug("END showExcludedSubfolderHandler");
},

populateAllowedTypesSelect: function (selectNode) {
Alfresco.logger.debug("populateAllowedTypesSelect", arguments);
var selectedValues = selectNode.getAttribute("data-selectedValues");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ SoftwareLoop.UploaderPlusMixin = {
"uploader-plus/allowed-content-types?destination={destination}",

allowedContentTypesSiteTemplate: Alfresco.constants.PROXY_URI +
"/uploader-plus/allowed-content-types?siteid={siteId}&containerid={containerId}&path={uploadDirectory}",
"uploader-plus/allowed-content-types?siteid={siteId}&containerid={containerId}&path={uploadDirectory}",

allowedContentTypesBlankUrl: Alfresco.constants.PROXY_URI +
"/uploader-plus/allowed-content-types",
"uploader-plus/allowed-content-types",

//**************************************************************************
// Types list management
Expand All @@ -18,6 +18,18 @@ SoftwareLoop.UploaderPlusMixin = {
loadTypes: function (callback) {
Alfresco.logger.debug("loadTypes", arguments);
var url;

// If we need to use alfresco upload component
// but don't want uploader-plus treatment
// add disableUploderPlus to the upload configuration
if (this.showConfig.disableUploderPlus) {
this.types = null;
if (callback) {
callback();
}
return;
}

if (this.showConfig.destination && Alfresco.util.NodeRef(this.showConfig.destination).id) {
Alfresco.logger.debug("Repository folder", this.showConfig.destination);
url = YAHOO.lang.substitute(
Expand Down
Loading