|
@@ -349,8 +349,8 @@
|
|
_initTemplateDefaults: function () {
|
|
_initTemplateDefaults: function () {
|
|
var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse,
|
|
var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse,
|
|
tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionZoom,
|
|
tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionZoom,
|
|
- tActionDrag, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage, tText, tVideo, tAudio,
|
|
|
|
- tFlash, tObject, tPdf, tOther, tZoomCache, vDefaultDim;
|
|
|
|
|
|
+ tActionDrag, tActionInd, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage, tText, tVideo,
|
|
|
|
+ tAudio, tFlash, tObject, tPdf, tOther, tZoomCache, vDefaultDim;
|
|
tMain1 = '{preview}\n' +
|
|
tMain1 = '{preview}\n' +
|
|
'<div class="kv-upload-progress hide"></div>\n' +
|
|
'<div class="kv-upload-progress hide"></div>\n' +
|
|
'<div class="input-group {class}">\n' +
|
|
'<div class="input-group {class}">\n' +
|
|
@@ -410,8 +410,7 @@
|
|
' <div class="file-footer-caption" title="{caption}">{caption}<br>{size}</div>\n' +
|
|
' <div class="file-footer-caption" title="{caption}">{caption}<br>{size}</div>\n' +
|
|
' {progress} {actions}\n' +
|
|
' {progress} {actions}\n' +
|
|
'</div>';
|
|
'</div>';
|
|
- tActions = '<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>\n' +
|
|
|
|
- '{drag}\n' +
|
|
|
|
|
|
+ tActions = '{indicator}\n' + '{drag}\n' +
|
|
'<div class="file-actions">\n' +
|
|
'<div class="file-actions">\n' +
|
|
' <div class="file-footer-buttons">\n' +
|
|
' <div class="file-footer-buttons">\n' +
|
|
' {upload} {delete} {zoom} {other}' +
|
|
' {upload} {delete} {zoom} {other}' +
|
|
@@ -426,6 +425,7 @@
|
|
tActionZoom = '<button type="button" class="kv-file-zoom {zoomClass}" ' +
|
|
tActionZoom = '<button type="button" class="kv-file-zoom {zoomClass}" ' +
|
|
'title="{zoomTitle}">{zoomIcon}</button>';
|
|
'title="{zoomTitle}">{zoomIcon}</button>';
|
|
tActionDrag = '<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>';
|
|
tActionDrag = '<span class="file-drag-handle {dragClass}" title="{dragTitle}">{dragIcon}</span>';
|
|
|
|
+ tActionInd = '<div class="file-upload-indicator" title="{indicatorTitle}">{indicator}</div>';
|
|
tTagBef = '<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}"' +
|
|
tTagBef = '<div class="file-preview-frame {frameClass}" id="{previewId}" data-fileindex="{fileindex}"' +
|
|
' data-template="{template}"';
|
|
' data-template="{template}"';
|
|
tTagBef1 = tTagBef + '><div class="kv-file-content">\n';
|
|
tTagBef1 = tTagBef + '><div class="kv-file-content">\n';
|
|
@@ -472,6 +472,7 @@
|
|
actionUpload: tActionUpload,
|
|
actionUpload: tActionUpload,
|
|
actionZoom: tActionZoom,
|
|
actionZoom: tActionZoom,
|
|
actionDrag: tActionDrag,
|
|
actionDrag: tActionDrag,
|
|
|
|
+ actionIndicator: tActionInd,
|
|
btnDefault: tBtnDefault,
|
|
btnDefault: tBtnDefault,
|
|
btnLink: tBtnLink,
|
|
btnLink: tBtnLink,
|
|
btnBrowse: tBtnBrowse,
|
|
btnBrowse: tBtnBrowse,
|
|
@@ -759,18 +760,19 @@
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|
|
isDisabled = isDisabled === undefined ? true : isDisabled;
|
|
isDisabled = isDisabled === undefined ? true : isDisabled;
|
|
- var config = data.config[i], caption = $h.ifSet('caption', config), actions = '',
|
|
|
|
|
|
+ var config = data.config[i], caption = $h.ifSet('caption', config), actions,
|
|
width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false),
|
|
width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false),
|
|
key = $h.ifSet('key', config, null), fs = self.fileActionSettings,
|
|
key = $h.ifSet('key', config, null), fs = self.fileActionSettings,
|
|
- showDel = $h.ifSet('showDelete', config, true), showZoom = $h.ifSet('showZoom', config, fs.showZoom),
|
|
|
|
- showDrag = $h.ifSet('showDrag', config, fs.showDrag), disabled = (url === false) && isDisabled;
|
|
|
|
- if (self.initialPreviewShowDelete) {
|
|
|
|
- actions = self._renderFileActions(false, showDel, showZoom, showDrag, disabled, url, key, true);
|
|
|
|
- }
|
|
|
|
|
|
+ initPreviewShowDel = self.initialPreviewShowDelete || false,
|
|
|
|
+ showDel = $h.ifSet('showDelete', config, $h.ifSet('showDelete', fs, initPreviewShowDel)),
|
|
|
|
+ showZoom = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)),
|
|
|
|
+ showDrag = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)),
|
|
|
|
+ disabled = (url === false) && isDisabled;
|
|
|
|
+ actions = self._renderFileActions(false, showDel, showZoom, showDrag, disabled, url, key, true);
|
|
return self._getLayoutTemplate('footer').replace(/\{progress}/g, self._renderThumbProgress())
|
|
return self._getLayoutTemplate('footer').replace(/\{progress}/g, self._renderThumbProgress())
|
|
.replace(/\{actions}/g, actions).replace(/\{caption}/g, caption)
|
|
.replace(/\{actions}/g, actions).replace(/\{caption}/g, caption)
|
|
.replace(/\{size}/g, self._getSize(size)).replace(/\{width}/g, width)
|
|
.replace(/\{size}/g, self._getSize(size)).replace(/\{width}/g, width)
|
|
- .replace(/\{indicator}/g, '').replace(/\{indicatorTitle}/g, '');
|
|
|
|
|
|
+ .replace(/\{indicator}/g, '');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
self.previewCache.init();
|
|
self.previewCache.init();
|
|
@@ -936,8 +938,8 @@
|
|
var self = this, ext, out = null;
|
|
var self = this, ext, out = null;
|
|
if (fname && fname.indexOf('.') > -1) {
|
|
if (fname && fname.indexOf('.') > -1) {
|
|
ext = fname.split('.').pop();
|
|
ext = fname.split('.').pop();
|
|
- if (self.previewFileIconSettings && self.previewFileIconSettings[ext]) {
|
|
|
|
- out = self.previewFileIconSettings[ext];
|
|
|
|
|
|
+ if (self.previewFileIconSettings) {
|
|
|
|
+ out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null;
|
|
}
|
|
}
|
|
if (self.previewFileExtSettings) {
|
|
if (self.previewFileExtSettings) {
|
|
$.each(self.previewFileExtSettings, function (key, func) {
|
|
$.each(self.previewFileExtSettings, function (key, func) {
|
|
@@ -987,7 +989,9 @@
|
|
break;
|
|
break;
|
|
// receive data response via `filecustomerror` event`
|
|
// receive data response via `filecustomerror` event`
|
|
default:
|
|
default:
|
|
- self.ajaxAborted = e.result;
|
|
|
|
|
|
+ if (!self.ajaxAborted) {
|
|
|
|
+ self.ajaxAborted = e.result;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
@@ -1161,7 +1165,7 @@
|
|
if (self.initialPreviewConfig[i] !== null) {
|
|
if (self.initialPreviewConfig[i] !== null) {
|
|
key = self.initialPreviewConfig[i].key;
|
|
key = self.initialPreviewConfig[i].key;
|
|
$frame = $(".kv-file-remove[data-key='" + key + "']").closest($h.FRAMES);
|
|
$frame = $(".kv-file-remove[data-key='" + key + "']").closest($h.FRAMES);
|
|
- $frame.attr('data-fileindex', 'init_' + i).data('fileindex', 'init_' + i);
|
|
|
|
|
|
+ $frame.attr('data-fileindex', 'init_' + i).attr('data-fileindex', 'init_' + i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
self._raise('filesorted', {
|
|
self._raise('filesorted', {
|
|
@@ -1353,7 +1357,7 @@
|
|
$tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body);
|
|
$tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body);
|
|
$body.html(body).hide();
|
|
$body.html(body).hide();
|
|
$tmp.fadeOut('fast', function () {
|
|
$tmp.fadeOut('fast', function () {
|
|
- $body.fadeIn('fast', function() {
|
|
|
|
|
|
+ $body.fadeIn('fast', function () {
|
|
$body.removeClass('file-thumb-loading');
|
|
$body.removeClass('file-thumb-loading');
|
|
});
|
|
});
|
|
$tmp.remove();
|
|
$tmp.remove();
|
|
@@ -1736,7 +1740,7 @@
|
|
var $thumb = $(this), $preview = self.$preview, $remove = $thumb.find('.kv-file-remove');
|
|
var $thumb = $(this), $preview = self.$preview, $remove = $thumb.find('.kv-file-remove');
|
|
$remove.removeAttr('disabled');
|
|
$remove.removeAttr('disabled');
|
|
self._handler($remove, 'click', function () {
|
|
self._handler($remove, 'click', function () {
|
|
- var id = $thumb.attr('id'), out = self._raise('filesuccessremove', [id, $thumb.data('fileindex')]);
|
|
|
|
|
|
+ var id = $thumb.attr('id'), out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]);
|
|
$h.cleanMemory($thumb);
|
|
$h.cleanMemory($thumb);
|
|
if (out === false) {
|
|
if (out === false) {
|
|
return;
|
|
return;
|
|
@@ -2177,7 +2181,7 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data,
|
|
var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data,
|
|
- settings, params, index = $frame.data('fileindex'), config, extraData;
|
|
|
|
|
|
+ settings, params, index = $frame.attr('data-fileindex'), config, extraData;
|
|
index = parseInt(index.replace('init_', ''));
|
|
index = parseInt(index.replace('init_', ''));
|
|
config = $h.isEmpty(cache.config) && $h.isEmpty(cache.config[index]) ? null : cache.config[index];
|
|
config = $h.isEmpty(cache.config) && $h.isEmpty(cache.config[index]) ? null : cache.config[index];
|
|
extraData = $h.isEmpty(config) || $h.isEmpty(config.extra) ? deleteExtraData : config.extra;
|
|
extraData = $h.isEmpty(config) || $h.isEmpty(config.extra) ? deleteExtraData : config.extra;
|
|
@@ -2204,7 +2208,7 @@
|
|
var n, cap;
|
|
var n, cap;
|
|
if ($h.isEmpty(data) || $h.isEmpty(data.error)) {
|
|
if ($h.isEmpty(data) || $h.isEmpty(data.error)) {
|
|
self.previewCache.init();
|
|
self.previewCache.init();
|
|
- index = parseInt(($frame.data('fileindex')).replace('init_', ''));
|
|
|
|
|
|
+ index = parseInt(($frame.attr('data-fileindex')).replace('init_', ''));
|
|
self.previewCache.unset(index);
|
|
self.previewCache.unset(index);
|
|
n = self.previewCache.count();
|
|
n = self.previewCache.count();
|
|
cap = n > 0 ? self._getMsgSelected(n) : '';
|
|
cap = n > 0 ? self._getMsgSelected(n) : '';
|
|
@@ -2976,20 +2980,20 @@
|
|
_renderFileFooter: function (caption, size, width, isError) {
|
|
_renderFileFooter: function (caption, size, width, isError) {
|
|
var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag,
|
|
var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag,
|
|
upl = config.showUpload, zoom = config.showZoom, out, template = self._getLayoutTemplate('footer'),
|
|
upl = config.showUpload, zoom = config.showZoom, out, template = self._getLayoutTemplate('footer'),
|
|
- indicator = isError ? config.indicatorError : config.indicatorNew,
|
|
|
|
- title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle;
|
|
|
|
|
|
+ ind = isError ? config.indicatorError : config.indicatorNew,
|
|
|
|
+ tInd = self._getLayoutTemplate('actionIndicator'),
|
|
|
|
+ title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle,
|
|
|
|
+ indicator = tInd.replace(/\{indicator}/g, ind).replace(/\{indicatorTitle}/g, title);
|
|
size = self._getSize(size);
|
|
size = self._getSize(size);
|
|
if (self.isUploadable) {
|
|
if (self.isUploadable) {
|
|
out = template.replace(/\{actions}/g, self._renderFileActions(upl, rem, zoom, drg, false, false, false))
|
|
out = template.replace(/\{actions}/g, self._renderFileActions(upl, rem, zoom, drg, false, false, false))
|
|
.replace(/\{caption}/g, caption).replace(/\{size}/g, size).replace(/\{width}/g, width)
|
|
.replace(/\{caption}/g, caption).replace(/\{size}/g, size).replace(/\{width}/g, width)
|
|
- .replace(/\{progress}/g, self._renderThumbProgress()).replace(/\{indicator}/g, indicator)
|
|
|
|
- .replace(/\{indicatorTitle}/g, title);
|
|
|
|
|
|
+ .replace(/\{progress}/g, self._renderThumbProgress()).replace(/\{indicator}/g, indicator);
|
|
} else {
|
|
} else {
|
|
out = template.replace(/\{actions}/g,
|
|
out = template.replace(/\{actions}/g,
|
|
self._renderFileActions(false, false, zoom, drg, false, false, false))
|
|
self._renderFileActions(false, false, zoom, drg, false, false, false))
|
|
.replace(/\{caption}/g, caption).replace(/\{size}/g, size).replace(/\{width}/g, width)
|
|
.replace(/\{caption}/g, caption).replace(/\{size}/g, size).replace(/\{width}/g, width)
|
|
- .replace(/\{progress}/g, '').replace(/\{indicator}/g, indicator)
|
|
|
|
- .replace(/\{indicatorTitle}/g, title);
|
|
|
|
|
|
+ .replace(/\{progress}/g, '').replace(/\{indicator}/g, indicator);
|
|
}
|
|
}
|
|
out = $h.replaceTags(out, self.previewThumbTags);
|
|
out = $h.replaceTags(out, self.previewThumbTags);
|
|
return out;
|
|
return out;
|
|
@@ -2998,8 +3002,7 @@
|
|
if (!showUpload && !showDelete && !showZoom && !showDrag) {
|
|
if (!showUpload && !showDelete && !showZoom && !showDrag) {
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|
|
- var self = this,
|
|
|
|
- vUrl = url === false ? '' : ' data-url="' + url + '"',
|
|
|
|
|
|
+ var self = this, vUrl = url === false ? '' : ' data-url="' + url + '"',
|
|
vKey = key === false ? '' : ' data-key="' + key + '"',
|
|
vKey = key === false ? '' : ' data-key="' + key + '"',
|
|
btnDelete = '', btnUpload = '', btnZoom = '', btnDrag = '', css,
|
|
btnDelete = '', btnUpload = '', btnZoom = '', btnDrag = '', css,
|
|
template = self._getLayoutTemplate('actions'), config = self.fileActionSettings,
|
|
template = self._getLayoutTemplate('actions'), config = self.fileActionSettings,
|