|
@@ -289,7 +289,7 @@
|
|
'title="{removeTitle}"{dataUrl}{dataKey}>{removeIcon}</button>\n',
|
|
'title="{removeTitle}"{dataUrl}{dataKey}>{removeIcon}</button>\n',
|
|
tActionUpload = '<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">' +
|
|
tActionUpload = '<button type="button" class="kv-file-upload {uploadClass}" title="{uploadTitle}">' +
|
|
' {uploadIcon}\n</button>\n',
|
|
' {uploadIcon}\n</button>\n',
|
|
- tZoom = '<button type="button" class="btn btn-default btn-xs btn-block" title="{zoomTitle}: {caption}" onclick="{dialog}">\n' +
|
|
|
|
|
|
+ tZoom = '<button type="button" class="btn btn-default btn-xs btn-block" title="{zoomTitle}: {caption}" onclick="{dialog}">\n' +
|
|
' {zoomInd}\n' +
|
|
' {zoomInd}\n' +
|
|
'</button>\n',
|
|
'</button>\n',
|
|
tGeneric = '<div class="file-preview-frame{frameClass}" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
|
tGeneric = '<div class="file-preview-frame{frameClass}" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
|
@@ -344,7 +344,7 @@
|
|
'</div>',
|
|
'</div>',
|
|
tOther = '<div class="file-preview-frame{frameClass}" id="{previewId}" data-fileindex="{fileindex}"' +
|
|
tOther = '<div class="file-preview-frame{frameClass}" id="{previewId}" data-fileindex="{fileindex}"' +
|
|
' title="{caption}" ' + STYLE_SETTING + '>\n' +
|
|
' title="{caption}" ' + STYLE_SETTING + '>\n' +
|
|
- ' <div class="file-preview-other-frame">\n'+
|
|
|
|
|
|
+ ' <div class="file-preview-other-frame">\n' +
|
|
' ' + DEFAULT_PREVIEW + '\n' +
|
|
' ' + DEFAULT_PREVIEW + '\n' +
|
|
' </div>\n' +
|
|
' </div>\n' +
|
|
' <div class="file-preview-other-footer">{footer}</div>\n' +
|
|
' <div class="file-preview-other-footer">{footer}</div>\n' +
|
|
@@ -430,7 +430,7 @@
|
|
return Math.round(new Date().getTime() + (Math.random() * 100));
|
|
return Math.round(new Date().getTime() + (Math.random() * 100));
|
|
},
|
|
},
|
|
htmlEncode = function (str) {
|
|
htmlEncode = function (str) {
|
|
- var $el = $(document.createElement('div')).html(str),
|
|
|
|
|
|
+ var $el = $(document.createElement('div')).html(str),
|
|
out = $el.text();
|
|
out = $el.text();
|
|
$el.remove();
|
|
$el.remove();
|
|
return out;
|
|
return out;
|
|
@@ -620,7 +620,7 @@
|
|
icn = self.previewFileIconSettings[ext];
|
|
icn = self.previewFileIconSettings[ext];
|
|
}
|
|
}
|
|
if (self.previewFileExtSettings) {
|
|
if (self.previewFileExtSettings) {
|
|
- $.each(self.previewFileExtSettings, function(key, func) {
|
|
|
|
|
|
+ $.each(self.previewFileExtSettings, function (key, func) {
|
|
if (self.previewFileIconSettings[key] && func(ext)) {
|
|
if (self.previewFileIconSettings[key] && func(ext)) {
|
|
icn = self.previewFileIconSettings[key];
|
|
icn = self.previewFileIconSettings[key];
|
|
}
|
|
}
|
|
@@ -1551,8 +1551,8 @@
|
|
self.setProgress(100);
|
|
self.setProgress(100);
|
|
self.unlock();
|
|
self.unlock();
|
|
self.initSuccessThumbs();
|
|
self.initSuccessThumbs();
|
|
- self.raise('filebatchuploadcomplete', [self.filestack, self.getExtraData()]);
|
|
|
|
self.clearFileInput();
|
|
self.clearFileInput();
|
|
|
|
+ self.raise('filebatchuploadcomplete', [self.filestack, self.getExtraData()]);
|
|
};
|
|
};
|
|
fnError = function (jqXHR, textStatus, errorThrown) {
|
|
fnError = function (jqXHR, textStatus, errorThrown) {
|
|
var outData = self.getOutData(jqXHR), errMsg = self.parseError(jqXHR, errorThrown);
|
|
var outData = self.getOutData(jqXHR), errMsg = self.parseError(jqXHR, errorThrown);
|
|
@@ -1610,8 +1610,8 @@
|
|
fnComplete = function () {
|
|
fnComplete = function () {
|
|
self.setProgress(100);
|
|
self.setProgress(100);
|
|
self.unlock();
|
|
self.unlock();
|
|
- self.raise('filebatchuploadcomplete', [self.filestack, self.getExtraData()]);
|
|
|
|
self.clearFileInput();
|
|
self.clearFileInput();
|
|
|
|
+ self.raise('filebatchuploadcomplete', [self.filestack, self.getExtraData()]);
|
|
};
|
|
};
|
|
fnError = function (jqXHR, textStatus, errorThrown) {
|
|
fnError = function (jqXHR, textStatus, errorThrown) {
|
|
var outData = self.getOutData(jqXHR), errMsg = self.parseError(jqXHR, errorThrown);
|
|
var outData = self.getOutData(jqXHR), errMsg = self.parseError(jqXHR, errorThrown);
|
|
@@ -1719,7 +1719,10 @@
|
|
previewOtherTemplate = self.parseFilePreviewIcon(self.getPreviewTemplate('other'), fname);
|
|
previewOtherTemplate = self.parseFilePreviewIcon(self.getPreviewTemplate('other'), fname);
|
|
if (isDisabled === true) {
|
|
if (isDisabled === true) {
|
|
frameClass = ' btn disabled';
|
|
frameClass = ' btn disabled';
|
|
- footer += '<div class="file-other-error text-danger"><i class="glyphicon glyphicon-exclamation-sign"></i></div>';
|
|
|
|
|
|
+ if (!self.isUploadable) {
|
|
|
|
+ footer += '<div class="file-other-error" title="' + self.fileActionSettings.indicatorErrorTitle +
|
|
|
|
+ '">' + self.fileActionSettings.indicatorError + '</div>';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
self.$preview.append("\n" + previewOtherTemplate
|
|
self.$preview.append("\n" + previewOtherTemplate
|
|
.replace(/\{previewId\}/g, previewId)
|
|
.replace(/\{previewId\}/g, previewId)
|
|
@@ -1731,6 +1734,9 @@
|
|
.replace(/\{type\}/g, file.type)
|
|
.replace(/\{type\}/g, file.type)
|
|
.replace(/\{data\}/g, data)
|
|
.replace(/\{data\}/g, data)
|
|
.replace(/\{footer\}/g, footer));
|
|
.replace(/\{footer\}/g, footer));
|
|
|
|
+ if (isDisabled === true && self.isUploadable) {
|
|
|
|
+ self.setThumbStatus($('#' + previewId), 'Error');
|
|
|
|
+ }
|
|
},
|
|
},
|
|
previewFile: function (i, file, theFile, previewId, data) {
|
|
previewFile: function (i, file, theFile, previewId, data) {
|
|
if (!this.showPreview) {
|
|
if (!this.showPreview) {
|
|
@@ -1738,7 +1744,7 @@
|
|
}
|
|
}
|
|
var self = this, cat = self.parseFileType(file), fname = file ? file.name : '', caption = self.slug(fname),
|
|
var self = this, cat = self.parseFileType(file), fname = file ? file.name : '', caption = self.slug(fname),
|
|
content, strText, types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes,
|
|
content, strText, types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes,
|
|
- tmplt = self.getPreviewTemplate(cat), chkTypes = types && types.indexOf(cat) >= 0, id, height,
|
|
|
|
|
|
+ tmplt = self.getPreviewTemplate(cat), chkTypes = types && types.indexOf(cat) >= 0, id,
|
|
config = isSet(cat, self.previewSettings) ? self.previewSettings[cat] : defaultPreviewSettings[cat],
|
|
config = isSet(cat, self.previewSettings) ? self.previewSettings[cat] : defaultPreviewSettings[cat],
|
|
chkMimes = mimes && mimes.indexOf(file.type) !== -1,
|
|
chkMimes = mimes && mimes.indexOf(file.type) !== -1,
|
|
footer = self.renderFileFooter(caption, config.width), modal = '',
|
|
footer = self.renderFileFooter(caption, config.width), modal = '',
|
|
@@ -1748,8 +1754,7 @@
|
|
if (cat === 'text') {
|
|
if (cat === 'text') {
|
|
strText = htmlEncode(theFile.target.result);
|
|
strText = htmlEncode(theFile.target.result);
|
|
id = 'text-' + uniqId();
|
|
id = 'text-' + uniqId();
|
|
- height = window.innerHeight * 0.75;
|
|
|
|
- content = tmplt.replace(/\{zoom\}/g, self.getLayoutTemplate('zoom'));
|
|
|
|
|
|
+ content = tmplt.replace(/\{zoom\}/g, self.getLayoutTemplate('zoom'));
|
|
modal = self.getLayoutTemplate('modal').replace('{id}', id)
|
|
modal = self.getLayoutTemplate('modal').replace('{id}', id)
|
|
.replace(/\{title\}/g, caption)
|
|
.replace(/\{title\}/g, caption)
|
|
.replace(/\{body\}/g, strText).replace(/\{heading\}/g, self.msgZoomModalHeading);
|
|
.replace(/\{body\}/g, strText).replace(/\{heading\}/g, self.msgZoomModalHeading);
|
|
@@ -2030,7 +2035,7 @@
|
|
self.showFolderError(folders);
|
|
self.showFolderError(folders);
|
|
},
|
|
},
|
|
validateImage: function (i, previewId) {
|
|
validateImage: function (i, previewId) {
|
|
- var self = this, $preview = self.$preview, params, w1, w2,
|
|
|
|
|
|
+ var self = this, $preview = self.$preview, params, w1, w2,
|
|
$thumb = $preview.find("#" + previewId), fname = 'Untitled',
|
|
$thumb = $preview.find("#" + previewId), fname = 'Untitled',
|
|
$img = $thumb.find('img');
|
|
$img = $thumb.find('img');
|
|
if (!$img.length) {
|
|
if (!$img.length) {
|
|
@@ -2129,10 +2134,10 @@
|
|
.replace(/\{cancel\}/g, self.renderButton('cancel'))
|
|
.replace(/\{cancel\}/g, self.renderButton('cancel'))
|
|
.replace(/\{browse\}/g, self.renderButton('browse'));
|
|
.replace(/\{browse\}/g, self.renderButton('browse'));
|
|
},
|
|
},
|
|
- renderButton: function(type) {
|
|
|
|
|
|
+ renderButton: function (type) {
|
|
var self = this, tmplt = self.getLayoutTemplate('btnDefault'), css = self[type + 'Class'],
|
|
var self = this, tmplt = self.getLayoutTemplate('btnDefault'), css = self[type + 'Class'],
|
|
- status = self.isDisabled ? ' disabled' : '', title = self[type + 'Title'],
|
|
|
|
- icon = self[type + 'Icon'], label = self[type + 'Label'], btnType = 'button';
|
|
|
|
|
|
+ title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'],
|
|
|
|
+ status = self.isDisabled ? ' disabled' : '', btnType = 'button';
|
|
switch (type) {
|
|
switch (type) {
|
|
case 'remove':
|
|
case 'remove':
|
|
if (!self.showRemove) {
|
|
if (!self.showRemove) {
|
|
@@ -2158,6 +2163,8 @@
|
|
case 'browse':
|
|
case 'browse':
|
|
tmplt = self.getLayoutTemplate('btnBrowse');
|
|
tmplt = self.getLayoutTemplate('btnBrowse');
|
|
break;
|
|
break;
|
|
|
|
+ default:
|
|
|
|
+ return '';
|
|
}
|
|
}
|
|
css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button';
|
|
css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button';
|
|
return tmplt.replace('{type}', btnType)
|
|
return tmplt.replace('{type}', btnType)
|
|
@@ -2166,7 +2173,7 @@
|
|
.replace('{status}', status)
|
|
.replace('{status}', status)
|
|
.replace('{icon}', icon)
|
|
.replace('{icon}', icon)
|
|
.replace('{label}', label);
|
|
.replace('{label}', label);
|
|
- },
|
|
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
//FileInput plugin definition
|
|
//FileInput plugin definition
|