summaryrefslogtreecommitdiffstats
path: root/core/js/oc-dialogs.js
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-09-04 13:55:49 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-09-04 14:11:40 +0200
commit4af5a8c483278eae2e8e38f5ea0a238072848b87 (patch)
treebeca3f5250e1a50eca58fa63eea056b69ab82e44 /core/js/oc-dialogs.js
parent7c9d9992432839f2265b8f6b0f43ed15bfca9ff1 (diff)
parent09187f3b3b30e6f810c6afff7332615ed472154e (diff)
downloadnextcloud-server-4af5a8c483278eae2e8e38f5ea0a238072848b87.tar.gz
nextcloud-server-4af5a8c483278eae2e8e38f5ea0a238072848b87.zip
Merge branch 'master' into fix_3728_with_file_exists_dialog
Conflicts: apps/files/ajax/upload.php apps/files/js/file-upload.js apps/files/js/filelist.js apps/files/js/files.js apps/files/templates/part.list.php
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r--core/js/oc-dialogs.js52
1 files changed, 33 insertions, 19 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index a101cce9d1f..b949fc74d14 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -77,11 +77,17 @@ var OCdialogs = {
self.$filePicker = $tmpl.octemplate({
dialog_name: dialog_name,
title: title
- }).data('path', '');
+ }).data('path', '').data('multiselect', multiselect).data('mimetype', mimetype_filter);
- if (modal === undefined) { modal = false };
- if (multiselect === undefined) { multiselect = false };
- if (mimetype_filter === undefined) { mimetype_filter = '' };
+ if (modal === undefined) {
+ modal = false;
+ }
+ if (multiselect === undefined) {
+ multiselect = false;
+ }
+ if (mimetype_filter === undefined) {
+ mimetype_filter = '';
+ }
$('body').append(self.$filePicker);
@@ -94,7 +100,7 @@ var OCdialogs = {
self._handlePickerClick(event, $(this));
});
self._fillFilePicker('');
- }).data('multiselect', multiselect).data('mimetype',mimetype_filter);
+ });
// build buttons
var functionToCall = function() {
@@ -106,7 +112,7 @@ var OCdialogs = {
datapath.push(self.$filePicker.data('path') + '/' + $(element).text());
});
} else {
- var datapath = self.$filePicker.data('path');
+ datapath = self.$filePicker.data('path');
datapath += '/' + self.$filelist.find('.filepicker_element_selected .filename').text();
}
callback(datapath);
@@ -117,10 +123,6 @@ var OCdialogs = {
text: t('core', 'Choose'),
click: functionToCall,
defaultButton: true
- },
- {
- text: t('core', 'Cancel'),
- click: function(){self.$filePicker.ocdialog('close'); }
}];
self.$filePicker.ocdialog({
@@ -155,7 +157,9 @@ var OCdialogs = {
message: content,
type: dialog_type
});
- if (modal === undefined) { modal = false };
+ if (modal === undefined) {
+ modal = false;
+ }
$('body').append($dlg);
var buttonlist = [];
switch (buttons) {
@@ -163,7 +167,9 @@ var OCdialogs = {
buttonlist = [{
text: t('core', 'Yes'),
click: function(){
- if (callback !== undefined) { callback(true) };
+ if (callback !== undefined) {
+ callback(true);
+ }
$(dialog_id).ocdialog('close');
},
defaultButton: true
@@ -171,7 +177,9 @@ var OCdialogs = {
{
text: t('core', 'No'),
click: function(){
- if (callback !== undefined) { callback(false) };
+ if (callback !== undefined) {
+ callback(false);
+ }
$(dialog_id).ocdialog('close');
}
}];
@@ -179,7 +187,9 @@ var OCdialogs = {
case OCdialogs.OK_BUTTON:
var functionToCall = function() {
$(dialog_id).ocdialog('close');
- if(callback !== undefined) { callback() };
+ if(callback !== undefined) {
+ callback();
+ }
};
buttonlist[0] = {
text: t('core', 'Ok'),
@@ -187,7 +197,7 @@ var OCdialogs = {
defaultButton: true
};
break;
- };
+ }
$(dialog_id).ocdialog({
closeOnEscape: true,
@@ -502,13 +512,17 @@ var OCdialogs = {
var sorted = dirs.concat(others);
$.each(sorted, function(idx, entry) {
- $li = self.$listTmpl.octemplate({
+ var $li = self.$listTmpl.octemplate({
type: entry.type,
dir: dir,
filename: entry.name,
date: OC.mtime2date(entry.mtime)
});
- $li.find('img').attr('src', entry.mimetype_icon);
+ if (entry.mimetype === "httpd/unix-directory") {
+ $li.find('img').attr('src', OC.imagePath('core', 'filetypes/folder.png'));
+ } else {
+ $li.find('img').attr('src', OC.Router.generate('core_ajax_preview', {x:32, y:32, file:escapeHTML(dir+'/'+entry.name)}) );
+ }
self.$filelist.append($li);
});
@@ -526,7 +540,7 @@ var OCdialogs = {
if(path) {
var paths = path.split('/');
$.each(paths, function(index, dir) {
- var dir = paths.pop();
+ dir = paths.pop();
if(dir === '') {
return false;
}
@@ -560,7 +574,7 @@ var OCdialogs = {
$element.toggleClass('filepicker_element_selected');
return;
} else if ( $element.data('type') === 'dir' ) {
- this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'))
+ this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'));
}
}
};