|
|
|
@ -174,7 +174,7 @@ var OCdialogs = { |
|
|
|
self.$filePicker.ready(function() { |
|
|
|
self.$filelist = self.$filePicker.find('.filelist'); |
|
|
|
self.$dirTree = self.$filePicker.find('.dirtree'); |
|
|
|
self.$dirTree.on('click', 'span:not(:last-child)', self, self._handleTreeListSelect); |
|
|
|
self.$dirTree.on('click', 'div:not(:last-child)', self, self._handleTreeListSelect.bind(self)); |
|
|
|
self.$filelist.on('click', 'li', function(event) { |
|
|
|
self._handlePickerClick(event, $(this)); |
|
|
|
}); |
|
|
|
@ -769,10 +769,17 @@ var OCdialogs = { |
|
|
|
}); |
|
|
|
if (entry.type === 'file') { |
|
|
|
var urlSpec = { |
|
|
|
file: dir + '/' + entry.name |
|
|
|
file: dir + '/' + entry.name, |
|
|
|
}; |
|
|
|
$li.find('img').attr('src', OC.MimeType.getIconUrl(entry.mimetype)); |
|
|
|
var img = new Image(); |
|
|
|
var previewUrl = OC.generateUrl('/core/preview.png?') + $.param(urlSpec); |
|
|
|
$li.find('img').attr('src', previewUrl); |
|
|
|
img.onload = function() { |
|
|
|
if (img.width > 5) { |
|
|
|
$li.find('img').attr('src', previewUrl); |
|
|
|
} |
|
|
|
}; |
|
|
|
img.src = previewUrl; |
|
|
|
} |
|
|
|
else { |
|
|
|
$li.find('img').attr('src', OC.Util.replaceSVGIcon(entry.icon)); |
|
|
|
@ -792,8 +799,9 @@ var OCdialogs = { |
|
|
|
_fillSlug: function() { |
|
|
|
this.$dirTree.empty(); |
|
|
|
var self = this; |
|
|
|
var dir; |
|
|
|
var path = this.$filePicker.data('path'); |
|
|
|
var $template = $('<span data-dir="{dir}">{name}</span>'); |
|
|
|
var $template = $('<div data-dir="{dir}"><a>{name}</a></div>').addClass('crumb'); |
|
|
|
if(path) { |
|
|
|
var paths = path.split('/'); |
|
|
|
$.each(paths, function(index, dir) { |
|
|
|
@ -809,17 +817,17 @@ var OCdialogs = { |
|
|
|
} |
|
|
|
$template.octemplate({ |
|
|
|
dir: '', |
|
|
|
name: ' ' // Ugly but works ;)
|
|
|
|
}, {escapeFunction: null}).addClass('home svg').prependTo(this.$dirTree); |
|
|
|
name: '' // Ugly but works ;)
|
|
|
|
}, {escapeFunction: null}).prependTo(this.$dirTree); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* handle selection made in the tree list |
|
|
|
*/ |
|
|
|
_handleTreeListSelect:function(event) { |
|
|
|
var self = event.data; |
|
|
|
var dir = $(event.target).data('dir'); |
|
|
|
var dir = $(event.target).parent().data('dir'); |
|
|
|
self._fillFilePicker(dir); |
|
|
|
var getOcDialog = this.closest('.oc-dialog'); |
|
|
|
var getOcDialog = (event.target).closest('.oc-dialog'); |
|
|
|
var buttonEnableDisable = $('.primary', getOcDialog); |
|
|
|
if (this.$filePicker.data('mimetype') === "http/unix-directory") { |
|
|
|
buttonEnableDisable.prop("disabled", false); |
|
|
|
|