webdav portal create new ability added

This commit is contained in:
vfedosevich 2015-03-11 05:34:35 -07:00
parent 6b1c1660fe
commit 50e902b94d
26 changed files with 473 additions and 38 deletions

View file

@ -2,8 +2,15 @@
this.settings = {
deletionBlockSelector: ".file-actions-menu .file-deletion",
deletionUrl: "storage/files-group-action/delete",
fileExistUrl: "storage/fileExist",
textDateModified: "Date modified",
textSize: "Size"
textSize: "Size",
textItemExist: "File already exists",
textItemExistFunc: function() {
return textItemExist;
} ,
createNewItemDialogId: "#createNewItemDialog",
createNewItemButtonId: "#create-button"
};
this.itemsTable = null;
this.searchTable = null;
@ -272,6 +279,38 @@ WspFileBrowser.prototype = {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
},
showCreateNewItemDialog: function (extension, target) {
$(this.settings.createNewItemButtonId).data('extension', extension);
$(this.settings.createNewItemButtonId).data('target', target);
$(this.settings.createNewItemDialogId + " input").val("");
$(this.settings.createNewItemDialogId).modal();
},
hideCreateNewItemDialog: function () {
$(this.settings.createNewItemDialogId).modal('hide');
},
uniqueFileNameFieldRule: function(fieldId) {
return {
url: this.settings.fileExistUrl,
type: "post",
data: {
newItemName: function() {
return $(fieldId).val() + $(wsp.fileBrowser.settings.createNewItemButtonId).data('extension');
}
},
beforeSend: function(response) {
wsp.dialogs.showInlineProcessing(fieldId);
},
complete: function() {
wsp.dialogs.hideInlineProcessing(fieldId);
}
};
}
};