Browse Source

Updates to release v4.5.2 fix #1313 fix #1319 fix #1320 fix #1322

Kartik Visweswaran 6 years ago
parent
commit
7aa9bf7ef6
4 changed files with 130 additions and 7 deletions
  1. 5 0
      CHANGE.md
  2. 24 7
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js
  4. 101 0
      js/locales/uz.js

+ 5 - 0
CHANGE.md

@@ -5,8 +5,13 @@ Change Log: `bootstrap-fileinput`
 
 
 **Date:** _under development_
 **Date:** _under development_
 
 
+- (enh #1322): Add Uzbek Translations.
+- (enh #1320): New events for files dragged and dropped.
+- (enh #1319): Enhance mimeType parsing via `mimeTypeAliases`.
+   - allows quicktime `.mov` files to be previewed in non Apple browsers like Chrome/Firefox/IE.
 - (enh #1318): Configure PDFjs viewer for IE11 pdf preview.
 - (enh #1318): Configure PDFjs viewer for IE11 pdf preview.
 - (enh #1314): Update Hebrew Translations.
 - (enh #1314): Update Hebrew Translations.
+- (enh #1313): Correct file type function validation.
 - (enh #1311): Correct preview zoom modal keydown next and prev keyboard behavior.
 - (enh #1311): Correct preview zoom modal keydown next and prev keyboard behavior.
 - (enh #1308): Enhance audio file preview thumbnail styling.
 - (enh #1308): Enhance audio file preview thumbnail styling.
 - (enh #1298): New `encodeUrl` boolean option that encodes all URL passed by default.
 - (enh #1298): New `encodeUrl` boolean option that encodes all URL passed by default.

+ 24 - 7
js/fileinput.js

@@ -661,7 +661,8 @@
                 '      {browse}\n' +
                 '      {browse}\n' +
                 '    </div>\n' +
                 '    </div>\n' +
                 '</div>';
                 '</div>';
-            tMain2 = '{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n{remove}\n{cancel}\n{upload}\n{browse}\n';
+            tMain2 = '{preview}\n<div class="kv-upload-progress kv-hidden"></div>\n<div class="clearfix"></div>\n' +
+                '{remove}\n{cancel}\n{upload}\n{browse}\n';
             tPreview = '<div class="file-preview {class}">\n' +
             tPreview = '<div class="file-preview {class}">\n' +
                 '    {close}' +
                 '    {close}' +
                 '    <div class="{dropClass}">\n' +
                 '    <div class="{dropClass}">\n' +
@@ -849,6 +850,9 @@
                     pdf: vDefaultDim,
                     pdf: vDefaultDim,
                     other: {width: "auto", height: "100%", 'min-height': "480px"}
                     other: {width: "auto", height: "100%", 'min-height': "480px"}
                 },
                 },
+                mimeTypeAliases: {
+                    'video/quicktime': 'video/mp4'
+                },
                 fileTypeSettings: {
                 fileTypeSettings: {
                     image: function (vType, vName) {
                     image: function (vType, vName) {
                         return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) ||
                         return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) ||
@@ -1492,14 +1496,17 @@
             e.preventDefault();
             e.preventDefault();
         },
         },
         _zoneDragEnter: function (e) {
         _zoneDragEnter: function (e) {
-            var self = this, hasFiles = $.inArray('Files', e.originalEvent.dataTransfer.types) > -1;
+            var self = this, dataTransfer = e.originalEvent.dataTransfer,
+                hasFiles = $.inArray('Files', dataTransfer.types) > -1;
             self._zoneDragDropInit(e);
             self._zoneDragDropInit(e);
             if (self.isDisabled || !hasFiles) {
             if (self.isDisabled || !hasFiles) {
                 e.originalEvent.dataTransfer.effectAllowed = 'none';
                 e.originalEvent.dataTransfer.effectAllowed = 'none';
                 e.originalEvent.dataTransfer.dropEffect = 'none';
                 e.originalEvent.dataTransfer.dropEffect = 'none';
                 return;
                 return;
             }
             }
-            $h.addCss(self.$dropZone, 'file-highlighted');
+            if (self._raise('fileDragEnter', {'sourceEvent': e, 'files': dataTransfer.types.Files})) {
+                $h.addCss(self.$dropZone, 'file-highlighted');
+            }
         },
         },
         _zoneDragLeave: function (e) {
         _zoneDragLeave: function (e) {
             var self = this;
             var self = this;
@@ -1507,7 +1514,10 @@
             if (self.isDisabled) {
             if (self.isDisabled) {
                 return;
                 return;
             }
             }
-            self.$dropZone.removeClass('file-highlighted');
+            if (self._raise('fileDragLeave', {'sourceEvent': e})) {
+                self.$dropZone.removeClass('file-highlighted');
+            }
+
         },
         },
         _zoneDrop: function (e) {
         _zoneDrop: function (e) {
             /** @namespace e.originalEvent.dataTransfer */
             /** @namespace e.originalEvent.dataTransfer */
@@ -1530,6 +1540,9 @@
             if (self.isDisabled || $h.isEmpty(files)) {
             if (self.isDisabled || $h.isEmpty(files)) {
                 return;
                 return;
             }
             }
+            if (!self._raise('fileDragDrop', {'sourceEvent': e, 'files': files})) {
+                return;
+            }
             if (folders > 0) {
             if (folders > 0) {
                 if (!self.isAjaxUpload) {
                 if (!self.isAjaxUpload) {
                     self._showFolderError(folders);
                     self._showFolderError(folders);
@@ -2844,6 +2857,10 @@
             }
             }
             return self._getLayoutTemplate('size').replace('{sizeText}', out);
             return self._getLayoutTemplate('size').replace('{sizeText}', out);
         },
         },
+        _getFileType: function (ftype) {
+            var self = this;
+            return self.mimeTypeAliases[ftype] || ftype;
+        },
         _generatePreviewTemplate: function (cat, data, fname, ftype, previewId, isError, size, frameClass, foot, ind, templ) {
         _generatePreviewTemplate: function (cat, data, fname, ftype, previewId, isError, size, frameClass, foot, ind, templ) {
             var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '',
             var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '',
                 screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
                 screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
@@ -2885,7 +2902,7 @@
                     'previewId': id,
                     'previewId': id,
                     'caption': caption,
                     'caption': caption,
                     'frameClass': css,
                     'frameClass': css,
-                    'type': ftype,
+                    'type': self._getFileType(ftype),
                     'fileindex': ind,
                     'fileindex': ind,
                     'typeCss': typeCss,
                     'typeCss': typeCss,
                     'footer': footer,
                     'footer': footer,
@@ -3924,8 +3941,8 @@
                             }
                             }
                         };
                         };
                         fileInfo = {'name': caption, 'type': file.type};
                         fileInfo = {'name': caption, 'type': file.type};
-                        $.each(settings, function (key, func) {
-                            if (key !== 'object' && key !== 'other' && func(file.type, caption)) {
+                        $.each(settings, function (k, f) {
+                            if (k !== 'object' && k !== 'other' && typeof f === 'function' && f(file.type, caption)) {
                                 knownTypes++;
                                 knownTypes++;
                             }
                             }
                         });
                         });

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


+ 101 - 0
js/locales/uz.js

@@ -0,0 +1,101 @@
+/*!
+ * FileInput Uzbek Translations
+ *
+ * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
+ * any HTML markup tags in the messages must not be converted or translated.
+ *
+ * @see http://github.com/kartik-v/bootstrap-fileinput
+ * @author CyanoFresh <[email protected]>
+ *
+ * NOTE: this file must be saved in UTF-8 encoding.
+ */
+(function ($) {
+    "use strict";
+
+    $.fn.fileinputLocales.uz = {
+        fileSingle: 'fayl',
+        filePlural: 'fayllar',
+        browseLabel: 'Tanlash &hellip;',
+        removeLabel: 'O\'chirish',
+        removeTitle: 'Tanlangan fayllarni tozalash',
+        cancelLabel: 'Bekor qilish',
+        cancelTitle: 'Joriy yuklab olishni bekor qilish',
+        uploadLabel: 'Yuklab olish',
+        uploadTitle: 'Tanlangan fayllarni yuklash',
+        msgNo: 'No',
+        msgNoFilesSelected: 'No files selected',
+        msgCancelled: 'Cancelled',
+        msgPlaceholder: 'Select {files}...',
+        msgZoomModalHeading: 'Detailed Preview',
+        msgFileRequired: 'You must select a file to upload.',
+        msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',
+        msgSizeTooLarge: '"{name}" fayl (<b>{size} KB</b>) ruxsat etilgan maksimal yuklash hajmidan <b>{maxSize} KB</b> ortiq. Yuklashni qayta urinib ko\'ring!',
+        msgFilesTooLess: 'Yuklash uchun kamida <b>{n}</b> {files} tanlashingiz kerak. Yuklashni qayta urinib ko\'ring!',
+        msgFilesTooMany: 'Tanlangan fayllar <b>({n})</b>  ruxsat etilgan maksimal yuklash hajmidan <b>{m}</b> ortiq. Yuklashni qayta urinib ko\'ring!',
+        msgFileNotFound: '"{name}" fayl topilmaydi!',
+        msgFileSecured: 'Security restrictions prevent reading the file "{name}".',
+        msgFileNotReadable: '"{name}" fayl o\'qilmaydi.',
+        msgFilePreviewAborted: '"{name}" Ffylni oldindan ko\'rish jarayoni to\'xtatildi.',
+        msgFilePreviewError: '"{name}" faylni o\'qish paytida xatolik yuz berdi.',
+        msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".',
+        msgInvalidFileType: '"{name}" fayl uchun yaroqsiz tur. Faqat "{types}" fayllari qo\'llab-quvvatlanadi.',
+        msgInvalidFileExtension: '"{name}" fayl uchun noto\'g\'ri kengaytma. Faqat "{extensions}" fayllari qo\'llab-quvvatlanadi.',
+        msgFileTypes: {
+            'image': 'image',
+            'html': 'HTML',
+            'text': 'text',
+            'video': 'video',
+            'audio': 'audio',
+            'flash': 'flash',
+            'pdf': 'PDF',
+            'object': 'object'
+        },
+        msgUploadAborted: 'The file upload was aborted',
+        msgUploadThreshold: 'Processing...',
+        msgUploadBegin: 'Initializing...',
+        msgUploadEnd: 'Done',
+        msgUploadEmpty: 'No valid data available for upload.',
+        msgUploadError: 'Error',
+        msgValidationError: 'Fayl yuklash xatosi',
+        msgLoading: '{Files} dan {index} faylini yuklash &hellip;',
+        msgProgress: '{Files} dan {index}{name} faylini yuklashi  - {percent}% tugallandi.',
+        msgSelected: '{n} {files} tanlangan',
+        msgFoldersNotAllowed: 'Faqat tortib qo\'yiladon fayllar! {n} o\'tirilgan tashlangan papka(lar).',
+        msgImageWidthSmall: 'Width of image file "{name}" must be at least {size} px.',
+        msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px.',
+        msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px.',
+        msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px.',
+        msgImageResizeError: 'Could not get the image dimensions to resize.',
+        msgImageResizeException: 'Error while resizing the image.<pre>{errors}</pre>',
+        msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!',
+        msgAjaxProgressError: '{operation} failed',
+        ajaxOperations: {
+            deleteThumb: 'file delete',
+            uploadThumb: 'file upload',
+            uploadBatch: 'batch file upload',
+            uploadExtra: 'form data upload'
+        },
+        dropZoneTitle: 'Fayllarni bu yerga tortib qo\'ying &hellip;',
+        dropZoneClickTitle: '<br>(or click to select {files})',
+        fileActionSettings: {
+            removeTitle: 'Remove file',
+            uploadTitle: 'Upload file',
+            uploadRetryTitle: 'Retry upload',
+            downloadTitle: 'Download file',
+            zoomTitle: 'View details',
+            dragTitle: 'Move / Rearrange',
+            indicatorNewTitle: 'Not uploaded yet',
+            indicatorSuccessTitle: 'Uploaded',
+            indicatorErrorTitle: 'Upload Error',
+            indicatorLoadingTitle: 'Uploading ...'
+        },
+        previewZoomButtonTitles: {
+            prev: 'View previous file',
+            next: 'View next file',
+            toggleheader: 'Toggle header',
+            fullscreen: 'Toggle full screen',
+            borderless: 'Toggle borderless mode',
+            close: 'Close detailed preview'
+        }
+    };
+})(window.jQuery);

Some files were not shown because too many files changed in this diff