diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md old mode 100644 new mode 100755 index 50fe536..b42a921 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,7 +4,6 @@ - [ ] The issue still exists against the latest `master` branch of yii2-export. - [ ] This is not an usage question. I confirm having gone through and read the [documentation](https://demos.krajee.com/export) and [demos](https://demos.krajee.com/export-demo). - [ ] This is not a general programming / coding question. (Those should be directed to the [webtips Q & A forum](http://webtips.krajee.com/questions)). -- [ ] This is not a source plugin (select2) issue. (Those should be directed to the [plugin issues repo](https://github.com/select2/select2/search?q=&type=Issues)). - [ ] I have attempted to find the simplest possible steps to reproduce the issue. - [ ] I have included a failing test as a pull request (Optional). diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md old mode 100644 new mode 100755 diff --git a/CHANGE.md b/CHANGE.md old mode 100644 new mode 100755 index 93d3605..58c8a87 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,10 +1,14 @@ Change Log: `yii2-export` ========================= -## version 1.2.7 +## version 1.2.6 -**Date:** 03-Aug-2016 +**Date:** 05-Aug-2016 +- (enh #135): Add Indonesian translations. +- (enh #137): Add Estonian translations. +- (enh #138): Add dynagrid selection support. +- (enh #141): Add grouping option in export column. - (enh #149): Add Turkish translations. - (enh #150): Created beforeContent and afterContent settings. - (bug #151): Correct "undefined offset" when `batchSize` is set. @@ -12,15 +16,7 @@ Change Log: `yii2-export` - (enh #156): Add Lithuanian translations. - (enh #159): Fix export to exel columns with comma in headers. - Add contribution templates. - -## version 1.2.6 - -**Date:** 02-Jun-2016 - -- (enh #135): Add Indonesian translations. -- (enh #137): Add Estonian translations. -- (enh #138): Add dynagrid selection support. -- (enh #141): Add grouping option in export column. +- (enh #161): Implement Krajee Dialog to display confirmation alerts. ## version 1.2.5 diff --git a/ExportColumnAsset.php b/ExportColumnAsset.php old mode 100644 new mode 100755 index 38afc35..42667d1 --- a/ExportColumnAsset.php +++ b/ExportColumnAsset.php @@ -3,7 +3,7 @@ /** * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 * @package yii2-export - * @version 1.2.7 + * @version 1.2.6 */ namespace kartik\export; diff --git a/ExportMenu.php b/ExportMenu.php old mode 100644 new mode 100755 index 0ac1560..2cd0dc4 --- a/ExportMenu.php +++ b/ExportMenu.php @@ -4,7 +4,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 */ namespace kartik\export; @@ -38,6 +38,7 @@ use yii\helpers\Url; use yii\web\JsExpression; use yii\web\View; +use kartik\dialog\Dialog; /** * Export menu widget. Export tabular data to various formats using the PHPExcel library by reading data from a @@ -81,6 +82,13 @@ class ExportMenu extends GridView */ public $target = self::TARGET_POPUP; + /** + * @var array configuration settings for the Krajee dialog widget that will be used to render alerts and + * confirmation dialog prompts + * @see http://demos.krajee.com/dialog + */ + public $krajeeDialogSettings = []; + /** * @var bool whether to show a confirmation alert dialog before download. This confirmation dialog will notify user * about the type of exported file for download and to disable popup blockers. Defaults to `true`. @@ -1005,6 +1013,7 @@ protected function setDefaultExportConfig() protected function registerAssets() { $view = $this->getView(); + Dialog::widget($this->krajeeDialogSettings); ExportMenuAsset::register($view); $this->messages += [ 'allowPopups' => Yii::t( @@ -1022,6 +1031,7 @@ protected function registerAssets() $options = Json::encode([ 'formId' => $formId, 'messages' => $this->messages, + 'dialogLib' => new JsExpression(ArrayHelper::getValue($this->krajeeDialogSettings, 'libName', 'krajeeDialog')) ]); $menu = 'kvexpmenu_' . hash('crc32', $options); $view->registerJs("var {$menu} = {$options};\n", View::POS_HEAD); diff --git a/ExportMenuAsset.php b/ExportMenuAsset.php old mode 100644 new mode 100755 index 51bc360..ac543ad --- a/ExportMenuAsset.php +++ b/ExportMenuAsset.php @@ -3,7 +3,7 @@ /** * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 * @package yii2-export - * @version 1.2.7 + * @version 1.2.6 */ namespace kartik\export; diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 793df54..b58dad4 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The extension offers configurable user interfaces for advanced cases using view You can see detailed [documentation](http://demos.krajee.com/export) and [demonstration](http://demos.krajee.com/export-demo) on usage of the extension. ## Latest Release ->NOTE: The latest version of the extension is v1.2.7. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-export/blob/master/CHANGE.md) for details. +>NOTE: The latest version of the extension is v1.2.6. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-export/blob/master/CHANGE.md) for details. ## Installation diff --git a/assets/css/kv-export-columns.css b/assets/css/kv-export-columns.css old mode 100644 new mode 100755 index c724dc0..3ee532e --- a/assets/css/kv-export-columns.css +++ b/assets/css/kv-export-columns.css @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Columns Selector Style Sheet * diff --git a/assets/css/kv-export-columns.min.css b/assets/css/kv-export-columns.min.css old mode 100644 new mode 100755 index f93a728..576bbb9 --- a/assets/css/kv-export-columns.min.css +++ b/assets/css/kv-export-columns.min.css @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Columns Selector Style Sheet * diff --git a/assets/css/kv-export-data.css b/assets/css/kv-export-data.css old mode 100644 new mode 100755 index 2bf8fbd..221dbeb --- a/assets/css/kv-export-data.css +++ b/assets/css/kv-export-data.css @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Menu Style Sheet * diff --git a/assets/css/kv-export-data.min.css b/assets/css/kv-export-data.min.css old mode 100644 new mode 100755 index eab6ca5..2a29481 --- a/assets/css/kv-export-data.min.css +++ b/assets/css/kv-export-data.min.css @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Menu Style Sheet * diff --git a/assets/js/kv-export-columns.js b/assets/js/kv-export-columns.js old mode 100644 new mode 100755 index 5c3c82e..5c143fe --- a/assets/js/kv-export-columns.js +++ b/assets/js/kv-export-columns.js @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Columns Selector Validation Module. * diff --git a/assets/js/kv-export-columns.min.js b/assets/js/kv-export-columns.min.js old mode 100644 new mode 100755 index 32ea706..797f777 --- a/assets/js/kv-export-columns.min.js +++ b/assets/js/kv-export-columns.min.js @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Columns Selector Validation Module. * diff --git a/assets/js/kv-export-data.js b/assets/js/kv-export-data.js old mode 100644 new mode 100755 index 080dd6a..4434495 --- a/assets/js/kv-export-data.js +++ b/assets/js/kv-export-data.js @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Data Validation Module. * @@ -29,18 +29,7 @@ '' + '{msg}' + '' + - '', - kvConfirm = function (msg) { - if (isEmpty(msg)) { - return true; - } - try { - return window.confirm(msg); - } - catch (err) { - return true; - } - }; + ''; var ExportData = function (element, options) { var self = this; @@ -57,34 +46,6 @@ ExportData.prototype = { constructor: ExportData, - notify: function (e) { - var self = this, msgs, msg = '', msg1, msg2, msg3; - if (!self.showConfirmAlert) { - e.preventDefault(); - return true; - } - msgs = self.messages; - msg1 = isEmpty(self.alertMsg) ? '' : self.alertMsg; - msg2 = isEmpty(msgs.allowPopups) ? '' : msgs.allowPopups; - msg3 = isEmpty(msgs.confirmDownload) ? '' : msgs.confirmDownload; - if (msg1.length && msg2.length) { - msg = msg1 + '\n\n' + msg2; - } else { - if (!msg1.length && msg2.length) { - msg = msg2; - } else { - msg = (msg1.length && !msg2.length) ? msg1 : ''; - } - } - if (msg3.length) { - msg = msg + '\n\n' + msg3; - } - e.preventDefault(); - if (isEmpty(msg)) { - return true; - } - return kvConfirm(msg); - }, setPopupAlert: function (msg) { var self = this; if (!self.popup.document) { @@ -103,10 +64,49 @@ listen: function () { var self = this; self.$form.attr('action', window.location.href).appendTo('body'); - self.$element.off('click').on('click', function (e) { - var $selected, cols = []; - if (self.notify(e)) { - var fmt = $(this).data('format'); + self.listenClick(); + if (self.target === '_popup') { + self.$form.off('submit.exportmenu').on('submit.exportmenu', function () { + setTimeout(function () { + self.setPopupAlert(self.messages.downloadComplete, true); + }, 1000); + }); + } + }, + listenClick: function() { + var self = this; + self.$element.off('click.exportmenu').on('click.exportmenu', function (e) { + var fmt, msgs, msg = '', msg1, msg2, msg3, lib = window[self.dialogLib]; + e.preventDefault(); + e.stopPropagation(); + if (!self.showConfirmAlert) { + return; + } + msgs = self.messages; + msg1 = isEmpty(self.alertMsg) ? '' : self.alertMsg; + msg2 = isEmpty(msgs.allowPopups) ? '' : msgs.allowPopups; + msg3 = isEmpty(msgs.confirmDownload) ? '' : msgs.confirmDownload; + if (msg1.length && msg2.length) { + msg = msg1 + '\n\n' + msg2; + } else { + if (!msg1.length && msg2.length) { + msg = msg2; + } else { + msg = (msg1.length && !msg2.length) ? msg1 : ''; + } + } + if (msg3.length) { + msg = msg + '\n\n' + msg3; + } + if (isEmpty(msg)) { + return; + } + fmt = $(this).data('format'); + lib.confirm(msg, function(result) { + var $selected, cols = []; + if (!result) { + return; + } self.$form.find('[name="export_type"]').val(fmt); if (self.target === '_popup') { self.popup = popupDialog('', 'kvExportFullDialog', 350, 120); @@ -124,15 +124,8 @@ self.$form.find('input[name="export_columns"]').val(JSON.stringify(cols)); } self.$form.trigger('submit'); - } - }); - if (self.target === '_popup') { - self.$form.off('submit').on('submit', function () { - setTimeout(function () { - self.setPopupAlert(self.messages.downloadComplete, true); - }, 1000); }); - } + }); } }; @@ -162,6 +155,7 @@ showConfirmAlert: true, columnSelectorId: null, alertMsg: '', + dialogLib: 'krajeeDialog', settings: { formId: '', messages: { diff --git a/assets/js/kv-export-data.min.js b/assets/js/kv-export-data.min.js old mode 100644 new mode 100755 index b7c9c2b..42d9da1 --- a/assets/js/kv-export-data.min.js +++ b/assets/js/kv-export-data.min.js @@ -2,7 +2,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Data Validation Module. * @@ -10,4 +10,4 @@ * Copyright: 2015, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com - */!function(t){"use strict";var e=function(e,o){return null===e||void 0===e||e===[]||""===e||o&&""===t.trim(e)},o=function(t,e,o,n){var r=screen.width/2-o/2,a=60,i=window.open("",e,"",!0);return i.close(),window.open(t,e,"toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+o+", height="+n+", top="+a+", left="+r)},n='Export Data - © Krajee{msg}',r=function(t){if(e(t))return!0;try{return window.confirm(t)}catch(o){return!0}},a=function(e,o){var n=this;n.$element=t(e),t.each(o,function(t,e){n[t]=e});var r=o.settings;n.$form=t("#"+r.formId),n.messages=r.messages,n.popup="",n.listen()};a.prototype={constructor:a,notify:function(t){var o,n,a,i,l=this,s="";return l.showConfirmAlert?(o=l.messages,n=e(l.alertMsg)?"":l.alertMsg,a=e(o.allowPopups)?"":o.allowPopups,i=e(o.confirmDownload)?"":o.confirmDownload,s=n.length&&a.length?n+"\n\n"+a:!n.length&&a.length?a:n.length&&!a.length?n:"",i.length&&(s=s+"\n\n"+i),t.preventDefault(),e(s)?!0:r(s)):(t.preventDefault(),!0)},setPopupAlert:function(t){var e=this;if(e.popup.document)if(arguments.length&&arguments[1]){var o=e.popup.document.getElementsByTagName("body");setTimeout(function(){o[0].innerHTML=t},4e3)}else{var r=n.replace("{msg}",t);e.popup.document.write(r)}},listen:function(){var n=this;n.$form.attr("action",window.location.href).appendTo("body"),n.$element.off("click").on("click",function(r){var a,i=[];if(n.notify(r)){var l=t(this).data("format");n.$form.find('[name="export_type"]').val(l),"_popup"===n.target&&(n.popup=o("","kvExportFullDialog",350,120),n.popup.focus(),n.setPopupAlert(n.messages.downloadProgress)),e(n.columnSelectorId)||(a=t("#"+n.columnSelectorId).parent().find('input[name="export_columns_selector[]"]'),a.each(function(){var e=t(this);e.is(":checked")&&i.push(e.attr("data-key"))}),n.$form.find('input[name="export_columns"]').val(JSON.stringify(i))),n.$form.trigger("submit")}}),"_popup"===n.target&&n.$form.off("submit").on("submit",function(){setTimeout(function(){n.setPopupAlert(n.messages.downloadComplete,!0)},1e3)})}},t.fn.exportdata=function(e){var o=Array.apply(null,arguments);return o.shift(),this.each(function(){var n=t(this),r=n.data("exportdata"),i="object"==typeof e&&e;r||n.data("exportdata",r=new a(this,t.extend({},t.fn.exportdata.defaults,i,t(this).data()))),"string"==typeof e&&r[e].apply(r,o)})},t.fn.exportdata.defaults={filename:"export",target:"_popup",showConfirmAlert:!0,columnSelectorId:null,alertMsg:"",settings:{formId:"",messages:{allowPopups:"",confirmDownload:"",downloadProgress:"",downloadComplete:""}}}}(window.jQuery); \ No newline at end of file + */!function(t){"use strict";var e=function(e,o){return null===e||void 0===e||e===[]||""===e||o&&""===t.trim(e)},o=function(t,e,o,n){var a=screen.width/2-o/2,i=60,r=window.open("",e,"",!0);return r.close(),window.open(t,e,"toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+o+", height="+n+", top="+i+", left="+a)},n='Export Data - © Krajee{msg}',a=function(e,o){var n=this;n.$element=t(e),t.each(o,function(t,e){n[t]=e});var a=o.settings;n.$form=t("#"+a.formId),n.messages=a.messages,n.popup="",n.listen()};a.prototype={constructor:a,setPopupAlert:function(t){var e=this;if(e.popup.document)if(arguments.length&&arguments[1]){var o=e.popup.document.getElementsByTagName("body");setTimeout(function(){o[0].innerHTML=t},4e3)}else{var a=n.replace("{msg}",t);e.popup.document.write(a)}},listen:function(){var t=this;t.$form.attr("action",window.location.href).appendTo("body"),t.listenClick(),"_popup"===t.target&&t.$form.off("submit.exportmenu").on("submit.exportmenu",function(){setTimeout(function(){t.setPopupAlert(t.messages.downloadComplete,!0)},1e3)})},listenClick:function(){var n=this;n.$element.off("click.exportmenu").on("click.exportmenu",function(a){var i,r,l,s,p,u="",c=window[n.dialogLib];a.preventDefault(),a.stopPropagation(),n.showConfirmAlert&&(r=n.messages,l=e(n.alertMsg)?"":n.alertMsg,s=e(r.allowPopups)?"":r.allowPopups,p=e(r.confirmDownload)?"":r.confirmDownload,u=l.length&&s.length?l+"\n\n"+s:!l.length&&s.length?s:l.length&&!s.length?l:"",p.length&&(u=u+"\n\n"+p),e(u)||(i=t(this).data("format"),c.confirm(u,function(a){var r,l=[];a&&(n.$form.find('[name="export_type"]').val(i),"_popup"===n.target&&(n.popup=o("","kvExportFullDialog",350,120),n.popup.focus(),n.setPopupAlert(n.messages.downloadProgress)),e(n.columnSelectorId)||(r=t("#"+n.columnSelectorId).parent().find('input[name="export_columns_selector[]"]'),r.each(function(){var e=t(this);e.is(":checked")&&l.push(e.attr("data-key"))}),n.$form.find('input[name="export_columns"]').val(JSON.stringify(l))),n.$form.trigger("submit"))})))})}},t.fn.exportdata=function(e){var o=Array.apply(null,arguments);return o.shift(),this.each(function(){var n=t(this),i=n.data("exportdata"),r="object"==typeof e&&e;i||n.data("exportdata",i=new a(this,t.extend({},t.fn.exportdata.defaults,r,t(this).data()))),"string"==typeof e&&i[e].apply(i,o)})},t.fn.exportdata.defaults={filename:"export",target:"_popup",showConfirmAlert:!0,columnSelectorId:null,alertMsg:"",dialogLib:"krajeeDialog",settings:{formId:"",messages:{allowPopups:"",confirmDownload:"",downloadProgress:"",downloadComplete:""}}}}(window.jQuery); \ No newline at end of file diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/messages/cs/kvexport.php b/messages/cs/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/de/kvexport.php b/messages/de/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/en/kvexport.php b/messages/en/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/es/kvexport.php b/messages/es/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/et/kvexport.php b/messages/et/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/hu/kvexport.php b/messages/hu/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/id/kvexport.php b/messages/id/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/it/kvexport.php b/messages/it/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/lt/kvexport.php b/messages/lt/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/nl/kvexport.php b/messages/nl/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/pl/kvexport.php b/messages/pl/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/pt-BR/kvexport.php b/messages/pt-BR/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/pt-PT/kvexport.php b/messages/pt-PT/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/ru/kvexport.php b/messages/ru/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/tr_TR/kvexport.php b/messages/tr_TR/kvexport.php old mode 100644 new mode 100755 diff --git a/messages/zh-CN/kvexport.php b/messages/zh-CN/kvexport.php old mode 100644 new mode 100755 diff --git a/views/_columns.php b/views/_columns.php old mode 100644 new mode 100755 index 6fddd39..005298a --- a/views/_columns.php +++ b/views/_columns.php @@ -3,7 +3,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 */ use yii\helpers\Html; diff --git a/views/_form.php b/views/_form.php old mode 100644 new mode 100755 index b076c8d..a2427e3 --- a/views/_form.php +++ b/views/_form.php @@ -3,7 +3,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Submission Form * diff --git a/views/_view.php b/views/_view.php old mode 100644 new mode 100755 index 1330672..d6ceb26 --- a/views/_view.php +++ b/views/_view.php @@ -3,7 +3,7 @@ * @package yii2-export * @author Kartik Visweswaran * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2016 - * @version 1.2.7 + * @version 1.2.6 * * Export Submission View *