summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-08-21 16:59:49 +0200
committerJulius Härtl <jus@bitgrid.net>2019-08-21 16:59:49 +0200
commitf5352b9c6738e22f94115ffe6afdd0a792cc6834 (patch)
tree98d08ec8b9b010b32c545365d67f1b57384942e1 /core/src
parent9ac15bc4e9d78c77d982bb017034c8ac1d8e4b54 (diff)
downloadnextcloud-server-f5352b9c6738e22f94115ffe6afdd0a792cc6834.tar.gz
nextcloud-server-f5352b9c6738e22f94115ffe6afdd0a792cc6834.zip
filepicker: Add option to also choose folders without a mimetype limit
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/OC/dialogs.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js
index 6308927093b..04bac6d63da 100644
--- a/core/src/OC/dialogs.js
+++ b/core/src/OC/dialogs.js
@@ -195,8 +195,9 @@ const Dialogs = {
* @param modal make the dialog modal
* @param type Type of file picker : Choose, copy, move, copy and move
* @param path path to the folder that the the file can be picket from
+ * @param options additonal options that need to be set
*/
- filepicker: function (title, callback, multiselect, mimetypeFilter, modal, type, path) {
+ filepicker: function (title, callback, multiselect, mimetypeFilter, modal, type, path, options) {
var self = this;
this.filepicker.sortField = 'name';
@@ -221,6 +222,9 @@ const Dialogs = {
this.filelist = null;
path = path || '';
+ options = Object.assign({
+ allowDirectoryChooser: false
+ }, options)
$.when(this._getFilePickerTemplate()).then(function ($tmpl) {
self.filepicker.loading = false;
@@ -244,7 +248,7 @@ const Dialogs = {
nameCol: t('core', 'Name'),
sizeCol: t('core', 'Size'),
modifiedCol: t('core', 'Modified')
- }).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter);
+ }).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter).data('allowDirectoryChooser', options.allowDirectoryChooser)
if (modal === undefined) {
modal = false;
@@ -457,7 +461,7 @@ const Dialogs = {
// Hence this is one of the approach to get the choose button.
var getOcDialog = self.$filePicker.closest('.oc-dialog');
var buttonEnableDisable = getOcDialog.find('.primary');
- if (self.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1) {
+ if (self.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1 && !self.$filePicker.data('.allowDirectoryChooser')) {
buttonEnableDisable.prop("disabled", false);
} else {
buttonEnableDisable.prop("disabled", true);
@@ -1178,7 +1182,7 @@ const Dialogs = {
} else if ($element.data('type') === 'dir') {
this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'));
this._changeButtonsText(type, $element.data('entryname'));
- if (this.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1) {
+ if (this.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1 || this.$filePicker.data('allowDirectoryChooser')) {
buttonEnableDisable.prop("disabled", false);
} else {
buttonEnableDisable.prop("disabled", true);