From 86809f8711a6bfa62274db5fcffaadcce3d8df93 Mon Sep 17 00:00:00 2001 From: tinygg Date: Wed, 4 Mar 2020 00:02:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AEgroup.id?= =?UTF-8?q?=E5=92=8C=E5=90=84=E4=B8=AA=E5=AD=90module=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 117 +- {ruoyi-admin => infosouth-admin}/pom.xml | 18 +- .../cn/com/infosouth/RuoYiApplication.java | 21 + .../infosouth}/RuoYiServletInitializer.java | 36 +- .../controller/common/CommonController.java | 224 +- .../demo/controller/DemoDialogController.java | 160 +- .../demo/controller/DemoFormController.java | 540 +- .../demo/controller/DemoIconController.java | 70 +- .../controller/DemoOperateController.java | 628 +- .../demo/controller/DemoReportController.java | 106 +- .../demo/controller/DemoTableController.java | 806 +- .../demo/domain/UserOperateModel.java | 292 +- .../controller/monitor/DruidController.java | 52 +- .../controller/monitor/ServerController.java | 62 +- .../monitor/SysLogininforController.java | 188 +- .../monitor/SysOperlogController.java | 178 +- .../monitor/SysUserOnlineController.java | 228 +- .../system/SysCaptchaController.java | 182 +- .../system/SysConfigController.java | 288 +- .../controller/system/SysDeptController.java | 360 +- .../system/SysDictDataController.java | 240 +- .../system/SysDictTypeController.java | 364 +- .../controller/system/SysIndexController.java | 110 +- .../controller/system/SysLoginController.java | 10 +- .../controller/system/SysMenuController.java | 390 +- .../system/SysNoticeController.java | 224 +- .../controller/system/SysPostController.java | 326 +- .../system/SysProfileController.java | 346 +- .../controller/system/SysRoleController.java | 606 +- .../controller/system/SysUserController.java | 520 +- .../web/controller/tool/BuildController.java | 52 +- .../controller/tool/SwaggerController.java | 48 +- .../web/controller/tool/TestController.java | 350 +- .../web/core/config/SwaggerConfig.java | 124 +- .../src/main/resources/application-druid.yml | 112 +- .../src/main/resources/application.yml | 260 +- infosouth-admin/src/main/resources/banner.txt | 7 + .../main/resources/ehcache/ehcache-shiro.xml | 112 +- .../src/main/resources/logback.xml | 184 +- .../main/resources/mybatis/mybatis-config.xml | 0 .../ajax/libs/beautifyhtml/beautifyhtml.js | 1234 +- .../ajax/libs/blockUI/jquery.blockUI.js | 1238 +- .../libs/bootstrap-fileinput/fileinput.css | 1098 +- .../libs/bootstrap-fileinput/fileinput.js | 11392 ++++++------- .../bootstrap-fileinput/fileinput.min.css | 22 +- .../libs/bootstrap-fileinput/fileinput.min.js | 18 +- .../libs/bootstrap-fileinput/loading-sm.gif | Bin .../ajax/libs/bootstrap-fileinput/loading.gif | Bin .../bootstrap-select/bootstrap-select.css | 14 +- .../libs/bootstrap-select/bootstrap-select.js | 6276 +++---- .../bootstrap-select/bootstrap-select.min.css | 10 +- .../bootstrap-select/bootstrap-select.min.js | 16 +- .../bootstrap-table/bootstrap-table.min.css | 0 .../bootstrap-table/bootstrap-table.min.js | 12 +- .../columns/bootstrap-table-fixed-columns.js | 0 .../editable/bootstrap-editable.css | 1324 +- .../editable/bootstrap-editable.min.js | 12 +- .../editable/bootstrap-table-editable.js | 290 +- .../extensions/editable/clear.png | Bin .../extensions/editable/loading.gif | Bin .../export/bootstrap-table-export.js | 238 +- .../extensions/export/tableExport.js | 4514 ++--- .../mobile/bootstrap-table-mobile.js | 182 +- .../reorder/bootstrap-table-reorder.js | 0 .../extensions/reorder/jquery.tablednd.js | 0 .../toolbar/bootstrap-table-toolbar.js | 420 +- .../toolbar/bootstrap-table-toolbar.min.js | 12 +- .../locale/bootstrap-table-zh-CN.js | 84 +- .../locale/bootstrap-table-zh-CN.min.js | 0 .../bootstrap-treetable.js | 1484 +- .../static/ajax/libs/cropbox/cropbox.css | 254 +- .../static/ajax/libs/cropbox/cropbox.js | 272 +- .../datapicker/bootstrap-datetimepicker.css | 0 .../datapicker/bootstrap-datetimepicker.js | 0 .../bootstrap-datetimepicker.min.css | 0 .../bootstrap-datetimepicker.min.js | 0 .../duallistbox/bootstrap-duallistbox.css | 172 +- .../libs/duallistbox/bootstrap-duallistbox.js | 1682 +- .../duallistbox/bootstrap-duallistbox.min.css | 0 .../duallistbox/bootstrap-duallistbox.min.js | 18 +- .../static/ajax/libs/flot/curvedLines.js | 0 .../static/ajax/libs/flot/jquery.flot.js | 0 .../static/ajax/libs/flot/jquery.flot.pie.js | 0 .../ajax/libs/flot/jquery.flot.resize.js | 0 .../ajax/libs/flot/jquery.flot.spline.js | 0 .../ajax/libs/flot/jquery.flot.symbol.js | 0 .../ajax/libs/flot/jquery.flot.tooltip.min.js | 0 .../ajax/libs/fullscreen/jquery.fullscreen.js | 362 +- .../static/ajax/libs/iCheck/custom.css | 144 +- .../static/ajax/libs/iCheck/green-login.png | Bin .../static/ajax/libs/iCheck/green.png | Bin .../static/ajax/libs/iCheck/green@2x.png | Bin .../static/ajax/libs/iCheck/icheck.min.js | 22 +- .../ajax/libs/jasny/jasny-bootstrap.css | 0 .../static/ajax/libs/jasny/jasny-bootstrap.js | 0 .../ajax/libs/jasny/jasny-bootstrap.min.css | 0 .../ajax/libs/jasny/jasny-bootstrap.min.js | 0 .../jquery-layout/jquery.layout-latest.css | 0 .../jquery-layout/jquery.layout-latest.js | 34 +- .../3.5/css/default/img/diy/1_close.png | Bin .../3.5/css/default/img/diy/1_open.png | Bin .../3.5/css/default/img/diy/2.png | Bin .../3.5/css/default/img/diy/3.png | Bin .../3.5/css/default/img/diy/4.png | Bin .../3.5/css/default/img/diy/5.png | Bin .../3.5/css/default/img/diy/6.png | Bin .../3.5/css/default/img/diy/7.png | Bin .../3.5/css/default/img/diy/8.png | Bin .../3.5/css/default/img/diy/9.png | Bin .../3.5/css/default/img/line_conn.gif | Bin .../3.5/css/default/img/loading.gif | Bin .../3.5/css/default/img/zTreeStandard.gif | Bin .../3.5/css/default/img/zTreeStandard.png | Bin .../3.5/css/default/zTreeStyle.css | 204 +- .../3.5/css/metro/img/line_conn.gif | Bin .../3.5/css/metro/img/line_conn.png | Bin .../3.5/css/metro/img/loading.gif | Bin .../jquery-ztree/3.5/css/metro/img/metro.gif | Bin .../jquery-ztree/3.5/css/metro/img/metro.png | Bin .../jquery-ztree/3.5/css/metro/zTreeStyle.css | 214 +- .../3.5/css/simple/img/left_menu.gif | Bin .../3.5/css/simple/img/left_menu.png | Bin .../3.5/css/simple/img/line_conn.gif | Bin .../3.5/css/simple/img/loading.gif | Bin .../3.5/css/simple/img/zTreeStandard.gif | Bin .../3.5/css/simple/img/zTreeStandard.png | Bin .../3.5/css/simple/zTreeStyle.css | 236 +- .../3.5/js/jquery.ztree.all-3.5.js | 7638 ++++----- .../3.5/js/jquery.ztree.core-3.5.js | 3298 ++-- .../3.5/js/jquery.ztree.excheck-3.5.js | 1246 +- .../3.5/js/jquery.ztree.exedit-3.5.js | 2354 +-- .../3.5/js/jquery.ztree.exhide-3.5.js | 730 +- .../ajax/libs/jquery-ztree/3.5/log v3.x.txt | 340 +- .../ajax/libs/jsonview/jquery.jsonview.css | 0 .../ajax/libs/jsonview/jquery.jsonview.js | 0 .../static/ajax/libs/layer/layer.min.js | 2 +- .../libs/layer/theme/default/icon-ext.png | Bin .../ajax/libs/layer/theme/default/icon.png | Bin .../ajax/libs/layer/theme/default/layer.css | 0 .../libs/layer/theme/default/loading-0.gif | Bin .../libs/layer/theme/default/loading-1.gif | Bin .../libs/layer/theme/default/loading-2.gif | Bin .../ajax/libs/layer/theme/moon/default.png | Bin .../ajax/libs/layer/theme/moon/style.css | 0 .../modules/laydate/default/font/iconfont.eot | Bin .../modules/laydate/default/font/iconfont.svg | 90 +- .../modules/laydate/default/font/iconfont.ttf | Bin .../laydate/default/font/iconfont.woff | Bin .../css/modules/laydate/default/laydate.css | 2 +- .../ajax/libs/layui/lay/modules/laydate.js | 4 +- .../resources/static/ajax/libs/layui/layui.js | 2 +- .../ajax/libs/report/echarts/echarts-all.js | 0 .../libs/report/peity/jquery.peity.min.js | 0 .../report/sparkline/jquery.sparkline.min.js | 0 .../ajax/libs/select2/select2-bootstrap.css | 14 +- .../static/ajax/libs/select2/select2.css | 968 +- .../static/ajax/libs/select2/select2.js | 11770 ++++++------- .../static/ajax/libs/select2/select2.min.css | 2 +- .../static/ajax/libs/select2/select2.min.js | 0 .../static/ajax/libs/staps/jquery.steps.css | 0 .../static/ajax/libs/staps/jquery.steps.js | 4082 ++--- .../ajax/libs/staps/jquery.steps.min.js | 10 +- .../ajax/libs/suggest/bootstrap-suggest.js | 2084 +-- .../libs/suggest/bootstrap-suggest.min.js | 18 +- .../ajax/libs/summernote/font/summernote.eot | Bin .../ajax/libs/summernote/font/summernote.ttf | Bin .../ajax/libs/summernote/font/summernote.woff | Bin .../ajax/libs/summernote/summernote-bs3.css | 11944 ++++++------- .../ajax/libs/summernote/summernote-zh-CN.js | 0 .../ajax/libs/summernote/summernote.css | 0 .../static/ajax/libs/summernote/summernote.js | 0 .../ajax/libs/summernote/summernote.min.js | 0 .../libs/typeahead/bootstrap3-typeahead.js | 1548 +- .../typeahead/bootstrap3-typeahead.min.js | 0 .../libs/validate/additional-methods.min.js | 8 +- .../libs/validate/jquery.validate.extend.js | 358 +- .../ajax/libs/validate/jquery.validate.min.js | 8 +- .../ajax/libs/validate/messages_zh.min.js | 54 +- .../src/main/resources/static/css/animate.css | 5758 +++---- .../resources/static/css/bootstrap.min.css | 12 +- .../resources/static/css/font-awesome.min.css | 8 +- .../static/css/jquery.contextMenu.min.css | 0 .../src/main/resources/static/css/login.css | 292 +- .../main/resources/static/css/login.min.css | 0 .../resources/static/css/main/animate.min.css | 24 +- .../static/css/main/bootstrap.min14ed.css | 12 +- .../static/css/main/font-awesome.min93e3.css | 8 +- .../static/css/main/style.min862f.css | 2 +- .../css/patterns/header-profile-skin-blue.png | Bin .../patterns/header-profile-skin-yellow.png | Bin .../static/css/patterns/header-profile.png | Bin .../static/css/patterns/shattered.png | Bin .../src/main/resources/static/css/skins.css | 0 .../src/main/resources/static/css/style.css | 14062 ++++++++-------- .../src/main/resources/static/favicon.ico | Bin .../src/main/resources/static/file/rml.txt | 0 .../resources/static/fonts/FontAwesome.otf | Bin .../static/fonts/Simple-Line-Icons.woff2 | Bin .../static/fonts/fontawesome-webfont.eot | Bin .../static/fonts/fontawesome-webfont.svg | 5342 +++--- .../static/fonts/fontawesome-webfont.ttf | Bin .../static/fonts/fontawesome-webfont.woff | Bin .../static/fonts/fontawesome-webfont.woff2 | Bin .../fonts/glyphicons-halflings-regular.eot | Bin .../fonts/glyphicons-halflings-regular.svg | 576 +- .../fonts/glyphicons-halflings-regular.ttf | Bin .../fonts/glyphicons-halflings-regular.woff | Bin .../fonts/glyphicons-halflings-regular.woff2 | Bin .../resources/static/i18n/messages.properties | 70 +- .../src/main/resources/static/img/blue.png | Bin .../resources/static/img/loading-upload.gif | Bin .../src/main/resources/static/img/loading.gif | Bin .../src/main/resources/static/img/locked.png | Bin .../resources/static/img/login-background.jpg | Bin .../src/main/resources/static/img/pay.png | Bin .../src/main/resources/static/img/profile.jpg | Bin .../main/resources/static/img/progress.png | Bin .../src/main/resources/static/img/qr_code.png | Bin .../src/main/resources/static/img/user.png | Bin .../main/resources/static/js/bootstrap.min.js | 14 +- .../static/js/jquery-ui-1.10.4.min.js | 24 +- .../static/js/jquery.contextMenu.min.js | 0 .../static/js/jquery.i18n.properties.min.js | 0 .../main/resources/static/js/jquery.min.js | 8 +- .../main/resources/static/js/jquery.tmpl.js | 984 +- .../js/plugins/metisMenu/jquery.metisMenu.js | 240 +- .../slimscroll/jquery.slimscroll.min.js | 16 +- .../src/main/resources/static/ruoyi.png | Bin .../main/resources/static/ruoyi/css/ry-ui.css | 2050 +-- .../src/main/resources/static/ruoyi/index.js | 1186 +- .../main/resources/static/ruoyi/js/common.js | 560 +- .../main/resources/static/ruoyi/js/ry-ui.js | 0 .../src/main/resources/static/ruoyi/login.js | 188 +- .../templates/demo/form/autocomplete.html | 644 +- .../resources/templates/demo/form/basic.html | 1186 +- .../resources/templates/demo/form/button.html | 1240 +- .../resources/templates/demo/form/cards.html | 0 .../templates/demo/form/datetime.html | 472 +- .../templates/demo/form/duallistbox.html | 130 +- .../resources/templates/demo/form/grid.html | 864 +- .../resources/templates/demo/form/jasny.html | 236 +- .../resources/templates/demo/form/select.html | 296 +- .../templates/demo/form/sortable.html | 396 +- .../templates/demo/form/summernote.html | 0 .../templates/demo/form/tabs_panels.html | 706 +- .../templates/demo/form/timeline.html | 0 .../resources/templates/demo/form/upload.html | 110 +- .../templates/demo/form/validate.html | 386 +- .../resources/templates/demo/form/wizard.html | 384 +- .../templates/demo/icon/fontawesome.html | 3888 ++--- .../templates/demo/icon/glyphicons.html | 2728 +-- .../templates/demo/modal/dialog.html | 430 +- .../resources/templates/demo/modal/form.html | 190 +- .../resources/templates/demo/modal/layer.html | 512 +- .../resources/templates/demo/modal/table.html | 112 +- .../templates/demo/modal/table/check.html | 170 +- .../templates/demo/modal/table/parent.html | 178 +- .../templates/demo/modal/table/radio.html | 170 +- .../resources/templates/demo/operate/add.html | 156 +- .../templates/demo/operate/detail.html | 138 +- .../templates/demo/operate/edit.html | 158 +- .../templates/demo/operate/other.html | 152 +- .../templates/demo/operate/table.html | 248 +- .../templates/demo/report/echarts.html | 2526 +-- .../templates/demo/report/metrics.html | 954 +- .../templates/demo/report/peity.html | 410 +- .../templates/demo/report/sparkline.html | 462 +- .../templates/demo/table/button.html | 182 +- .../resources/templates/demo/table/child.html | 0 .../resources/templates/demo/table/curd.html | 0 .../templates/demo/table/detail.html | 170 +- .../templates/demo/table/editable.html | 254 +- .../resources/templates/demo/table/event.html | 212 +- .../templates/demo/table/export.html | 158 +- .../templates/demo/table/fixedColumns.html | 284 +- .../templates/demo/table/footer.html | 164 +- .../templates/demo/table/groupHeader.html | 158 +- .../resources/templates/demo/table/image.html | 156 +- .../resources/templates/demo/table/multi.html | 442 +- .../resources/templates/demo/table/other.html | 210 +- .../templates/demo/table/pageGo.html | 152 +- .../templates/demo/table/params.html | 314 +- .../templates/demo/table/remember.html | 170 +- .../templates/demo/table/reorder.html | 0 .../templates/demo/table/search.html | 336 +- .../main/resources/templates/error/404.html | 54 +- .../main/resources/templates/error/500.html | 56 +- .../resources/templates/error/business.html | 0 .../resources/templates/error/unauth.html | 56 +- .../src/main/resources/templates/include.html | 366 +- .../src/main/resources/templates/index.html | 632 +- .../src/main/resources/templates/login.html | 174 +- .../src/main/resources/templates/main.html | 1754 +- .../src/main/resources/templates/main_v1.html | 672 +- .../monitor/logininfor/logininfor.html | 264 +- .../templates/monitor/online/online.html | 294 +- .../templates/monitor/operlog/detail.html | 146 +- .../templates/monitor/operlog/operlog.html | 324 +- .../templates/monitor/server/server.html | 508 +- .../src/main/resources/templates/skin.html | 0 .../templates/system/config/add.html | 164 +- .../templates/system/config/config.html | 270 +- .../templates/system/config/edit.html | 172 +- .../resources/templates/system/dept/add.html | 256 +- .../resources/templates/system/dept/dept.html | 222 +- .../resources/templates/system/dept/edit.html | 280 +- .../resources/templates/system/dept/tree.html | 98 +- .../templates/system/dict/data/add.html | 200 +- .../templates/system/dict/data/data.html | 286 +- .../templates/system/dict/data/edit.html | 202 +- .../templates/system/dict/type/add.html | 154 +- .../templates/system/dict/type/edit.html | 162 +- .../templates/system/dict/type/tree.html | 84 +- .../templates/system/dict/type/type.html | 272 +- .../resources/templates/system/menu/add.html | 376 +- .../resources/templates/system/menu/edit.html | 432 +- .../resources/templates/system/menu/icon.html | 1854 +- .../resources/templates/system/menu/menu.html | 306 +- .../resources/templates/system/menu/tree.html | 98 +- .../templates/system/notice/add.html | 194 +- .../templates/system/notice/edit.html | 204 +- .../templates/system/notice/notice.html | 232 +- .../resources/templates/system/post/add.html | 206 +- .../resources/templates/system/post/edit.html | 220 +- .../resources/templates/system/post/post.html | 238 +- .../resources/templates/system/role/add.html | 300 +- .../templates/system/role/authUser.html | 296 +- .../templates/system/role/dataScope.html | 214 +- .../resources/templates/system/role/edit.html | 318 +- .../resources/templates/system/role/role.html | 324 +- .../templates/system/role/selectUser.html | 238 +- .../resources/templates/system/user/add.html | 512 +- .../resources/templates/system/user/edit.html | 454 +- .../templates/system/user/profile/avatar.html | 168 +- .../system/user/profile/profile.html | 544 +- .../system/user/profile/resetPwd.html | 184 +- .../templates/system/user/resetPwd.html | 90 +- .../resources/templates/system/user/user.html | 520 +- .../resources/templates/tool/build/build.html | 346 +- {ruoyi-common => infosouth-common}/pom.xml | 198 +- .../common/annotation/DataScope.java | 56 +- .../common/annotation/DataSource.java | 53 +- .../infosouth}/common/annotation/Excel.java | 224 +- .../infosouth}/common/annotation/Excels.java | 2 +- .../com/infosouth}/common/annotation/Log.java | 81 +- .../common/annotation/RepeatSubmit.java | 2 +- .../com/infosouth}/common/config/Global.java | 232 +- .../common/config/ServerConfig.java | 67 +- .../DynamicDataSourceContextHolder.java | 90 +- .../config/thread/ThreadPoolConfig.java | 125 +- .../infosouth}/common/constant/Constants.java | 128 +- .../common/constant/GenConstants.java | 188 +- .../common/constant/PermissionConstants.java | 54 +- .../common/constant/ScheduleConstants.java | 100 +- .../common/constant/ShiroConstants.java | 148 +- .../common/constant/UserConstants.java | 202 +- .../core/controller/BaseController.java | 371 +- .../common/core/domain/AjaxResult.java | 365 +- .../common/core/domain/BaseEntity.java | 228 +- .../common/core/domain/TreeEntity.java | 124 +- .../infosouth}/common/core/domain/Ztree.java | 208 +- .../common/core/page/PageDomain.java | 138 +- .../common/core/page/TableDataInfo.java | 168 +- .../common/core/page/TableSupport.java | 60 +- .../common/core/text/CharsetKit.java | 173 +- .../infosouth}/common/core/text/Convert.java | 1999 +-- .../common/core/text/StrFormatter.java | 184 +- .../common/enums/BusinessStatus.java | 38 +- .../infosouth}/common/enums/BusinessType.java | 118 +- .../common/enums/DataSourceType.java | 38 +- .../infosouth}/common/enums/OnlineStatus.java | 48 +- .../infosouth}/common/enums/OperatorType.java | 48 +- .../infosouth}/common/enums/UserStatus.java | 60 +- .../common/exception/BusinessException.java | 2 +- .../common/exception/DemoModeException.java | 30 +- .../common/exception/base/BaseException.java | 194 +- .../common/exception/file/FileException.java | 4 +- .../FileNameLengthLimitExceededException.java | 32 +- .../file/FileSizeLimitExceededException.java | 2 +- .../file/InvalidExtensionException.java | 142 +- .../common/exception/job/TaskException.java | 66 +- .../exception/user/CaptchaException.java | 32 +- .../exception/user/RoleBlockedException.java | 32 +- .../exception/user/UserBlockedException.java | 32 +- .../exception/user/UserDeleteException.java | 32 +- .../common/exception/user/UserException.java | 36 +- .../user/UserNotExistsException.java | 32 +- .../user/UserPasswordNotMatchException.java | 32 +- .../UserPasswordRetryLimitCountException.java | 32 +- ...UserPasswordRetryLimitExceedException.java | 32 +- .../cn/com/infosouth}/common/json/JSON.java | 374 +- .../infosouth}/common/json/JSONObject.java | 1499 +- .../infosouth}/common/utils/AddressUtils.java | 108 +- .../cn/com/infosouth}/common/utils/Arith.java | 228 +- .../infosouth}/common/utils/DateUtils.java | 310 +- .../common/utils/ExceptionUtil.java | 80 +- .../com/infosouth}/common/utils/IpUtils.java | 374 +- .../infosouth}/common/utils/MapDataUtil.java | 100 +- .../infosouth}/common/utils/MessageUtils.java | 52 +- .../infosouth}/common/utils/ServletUtils.java | 270 +- .../infosouth}/common/utils/StringUtils.java | 794 +- .../com/infosouth}/common/utils/Threads.java | 2 +- .../com/infosouth}/common/utils/YamlUtil.java | 171 +- .../common/utils/bean/BeanUtils.java | 220 +- .../common/utils/file/FileUploadUtils.java | 484 +- .../common/utils/file/FileUtils.java | 284 +- .../common/utils/file/MimeTypeUtils.java | 2 +- .../common/utils/html/EscapeUtil.java | 4 +- .../common/utils/html/HTMLFilter.java | 2 +- .../common/utils/http/HttpUtils.java | 494 +- .../common/utils/poi/ExcelUtil.java | 24 +- .../common/utils/reflect/ReflectUtils.java | 7 +- .../common/utils/security/Md5Utils.java | 132 +- .../utils/security/PermissionUtils.java | 237 +- .../common/utils/spring/SpringUtils.java | 228 +- .../infosouth}/common/utils/sql/SqlUtil.java | 4 +- .../com/infosouth}/common/xss/XssFilter.java | 193 +- .../xss/XssHttpServletRequestWrapper.java | 76 +- .../pom.xml | 10 +- .../framework/aspectj/DataScopeAspect.java | 323 +- .../framework/aspectj/DataSourceAspect.java | 152 +- .../framework/aspectj/LogAspect.java | 353 +- .../framework/config/ApplicationConfig.java | 4 +- .../framework/config/CaptchaConfig.java | 166 +- .../framework/config/DruidConfig.java | 256 +- .../framework/config/FilterConfig.java | 92 +- .../framework/config/I18nConfig.java | 84 +- .../framework/config/KaptchaTextCreator.java | 152 +- .../framework/config/MyBatisConfig.java | 2 +- .../framework/config/ResourcesConfig.java | 116 +- .../framework/config/ShiroConfig.java | 740 +- .../config/properties/DruidProperties.java | 2 +- .../datasource/DynamicDataSource.java | 52 +- .../interceptor/RepeatSubmitInterceptor.java | 10 +- .../impl/SameUrlDataInterceptor.java | 6 +- .../framework/manager/AsyncManager.java | 110 +- .../framework/manager/ShutdownManager.java | 4 +- .../manager/factory/AsyncFactory.java | 271 +- .../framework/shiro/realm/UserRealm.java | 283 +- .../shiro/service/SysLoginService.java | 272 +- .../shiro/service/SysPasswordService.java | 180 +- .../shiro/service/SysShiroService.java | 10 +- .../shiro/session/OnlineSession.java | 296 +- .../shiro/session/OnlineSessionDAO.java | 235 +- .../shiro/session/OnlineSessionFactory.java | 86 +- .../shiro/web/filter/LogoutFilter.java | 204 +- .../filter/captcha/CaptchaValidateFilter.java | 155 +- .../filter/kickout/KickoutSessionFilter.java | 13 +- .../filter/online/OnlineSessionFilter.java | 193 +- .../filter/sync/SyncOnlineSessionFilter.java | 73 +- .../web/session/OnlineWebSessionManager.java | 339 +- .../SpringSessionValidationScheduler.java | 262 +- .../infosouth}/framework/util/LogUtils.java | 272 +- .../infosouth}/framework/util/ShiroUtils.java | 192 +- .../framework/web/domain/Server.java | 483 +- .../framework/web/domain/server/Cpu.java | 202 +- .../framework/web/domain/server/Jvm.java | 244 +- .../framework/web/domain/server/Mem.java | 122 +- .../framework/web/domain/server/Sys.java | 168 +- .../framework/web/domain/server/SysFile.java | 228 +- .../web/exception/GlobalExceptionHandler.java | 12 +- .../framework/web/service/ConfigService.java | 56 +- .../framework/web/service/DictService.java | 84 +- .../web/service/PermissionService.java | 524 +- .../pom.xml | 66 +- .../generator/config/GenConfig.java | 146 +- .../generator/controller/GenController.java | 24 +- .../infosouth}/generator/domain/GenTable.java | 540 +- .../generator/domain/GenTableColumn.java | 734 +- .../mapper/GenTableColumnMapper.java | 102 +- .../generator/mapper/GenTableMapper.java | 150 +- .../service/IGenTableColumnService.java | 88 +- .../generator/service/IGenTableService.java | 200 +- .../impl/GenTableColumnServiceImpl.java | 136 +- .../service/impl/GenTableServiceImpl.java | 682 +- .../infosouth}/generator/util/GenUtils.java | 475 +- .../generator/util/VelocityInitializer.java | 70 +- .../generator/util/VelocityUtils.java | 15 +- .../src/main/resources/generator.yml | 20 +- .../mapper/generator/GenTableColumnMapper.xml | 238 +- .../mapper/generator/GenTableMapper.xml | 336 +- .../resources/templates/tool/gen/edit.html | 966 +- .../resources/templates/tool/gen/gen.html | 370 +- .../templates/tool/gen/importTable.html | 196 +- .../src/main/resources/vm/html/add.html.vm | 316 +- .../src/main/resources/vm/html/edit.html.vm | 316 +- .../main/resources/vm/html/list-tree.html.vm | 298 +- .../src/main/resources/vm/html/list.html.vm | 294 +- .../src/main/resources/vm/html/tree.html.vm | 100 +- .../main/resources/vm/java/controller.java.vm | 402 +- .../src/main/resources/vm/java/domain.java.vm | 168 +- .../src/main/resources/vm/java/mapper.java.vm | 122 +- .../main/resources/vm/java/service.java.vm | 146 +- .../resources/vm/java/serviceImpl.java.vm | 282 +- .../src/main/resources/vm/sql/sql.vm | 44 +- .../src/main/resources/vm/xml/mapper.xml.vm | 214 +- {ruoyi-quartz => infosouth-quartz}/pom.xml | 78 +- .../quartz/config/ScheduleConfig.java | 114 +- .../quartz/controller/SysJobController.java | 331 +- .../controller/SysJobLogController.java | 183 +- .../com/infosouth}/quartz/domain/SysJob.java | 336 +- .../infosouth}/quartz/domain/SysJobLog.java | 310 +- .../quartz/mapper/SysJobLogMapper.java | 128 +- .../quartz/mapper/SysJobMapper.java | 134 +- .../quartz/service/ISysJobLogService.java | 112 +- .../quartz/service/ISysJobService.java | 202 +- .../service/impl/SysJobLogServiceImpl.java | 10 +- .../service/impl/SysJobServiceImpl.java | 510 +- .../cn/com/infosouth}/quartz/task/RyTask.java | 56 +- .../quartz/util/AbstractQuartzJob.java | 215 +- .../com/infosouth}/quartz/util/CronUtils.java | 2 +- .../infosouth}/quartz/util/JobInvokeUtil.java | 365 +- .../QuartzDisallowConcurrentExecution.java | 42 +- .../quartz/util/QuartzJobExecution.java | 38 +- .../infosouth}/quartz/util/ScheduleUtils.java | 224 +- .../mapper/quartz/SysJobLogMapper.xml | 184 +- .../resources/mapper/quartz/SysJobMapper.xml | 220 +- .../resources/templates/monitor/job/add.html | 218 +- .../templates/monitor/job/detail.html | 196 +- .../resources/templates/monitor/job/edit.html | 222 +- .../resources/templates/monitor/job/job.html | 344 +- .../templates/monitor/job/jobLog.html | 266 +- {ruoyi-system => infosouth-system}/pom.xml | 66 +- .../infosouth}/system/domain/SysConfig.java | 220 +- .../com/infosouth}/system/domain/SysDept.java | 370 +- .../infosouth}/system/domain/SysDictData.java | 352 +- .../infosouth}/system/domain/SysDictType.java | 186 +- .../system/domain/SysLogininfor.java | 316 +- .../com/infosouth}/system/domain/SysMenu.java | 402 +- .../infosouth}/system/domain/SysNotice.java | 198 +- .../infosouth}/system/domain/SysOperLog.java | 554 +- .../com/infosouth}/system/domain/SysPost.java | 244 +- .../com/infosouth}/system/domain/SysRole.java | 392 +- .../infosouth}/system/domain/SysRoleDept.java | 92 +- .../infosouth}/system/domain/SysRoleMenu.java | 92 +- .../com/infosouth}/system/domain/SysUser.java | 702 +- .../system/domain/SysUserOnline.java | 354 +- .../infosouth}/system/domain/SysUserPost.java | 92 +- .../infosouth}/system/domain/SysUserRole.java | 92 +- .../system/mapper/SysConfigMapper.java | 118 +- .../system/mapper/SysDeptMapper.java | 216 +- .../system/mapper/SysDictDataMapper.java | 190 +- .../system/mapper/SysDictTypeMapper.java | 166 +- .../system/mapper/SysLogininforMapper.java | 84 +- .../system/mapper/SysMenuMapper.java | 248 +- .../system/mapper/SysNoticeMapper.java | 102 +- .../system/mapper/SysOperLogMapper.java | 96 +- .../system/mapper/SysPostMapper.java | 166 +- .../system/mapper/SysRoleDeptMapper.java | 88 +- .../system/mapper/SysRoleMapper.java | 168 +- .../system/mapper/SysRoleMenuMapper.java | 88 +- .../system/mapper/SysUserMapper.java | 248 +- .../system/mapper/SysUserOnlineMapper.java | 104 +- .../system/mapper/SysUserPostMapper.java | 88 +- .../system/mapper/SysUserRoleMapper.java | 124 +- .../system/service/ISysConfigService.java | 136 +- .../system/service/ISysDeptService.java | 188 +- .../system/service/ISysDictDataService.java | 154 +- .../system/service/ISysDictTypeService.java | 186 +- .../system/service/ISysLogininforService.java | 80 +- .../system/service/ISysMenuService.java | 262 +- .../system/service/ISysNoticeService.java | 104 +- .../system/service/ISysOperLogService.java | 96 +- .../system/service/ISysPostService.java | 184 +- .../system/service/ISysRoleService.java | 318 +- .../system/service/ISysUserOnlineService.java | 134 +- .../system/service/ISysUserService.java | 364 +- .../service/impl/SysConfigServiceImpl.java | 236 +- .../service/impl/SysDeptServiceImpl.java | 542 +- .../service/impl/SysDictDataServiceImpl.java | 236 +- .../service/impl/SysDictTypeServiceImpl.java | 376 +- .../impl/SysLogininforServiceImpl.java | 132 +- .../service/impl/SysMenuServiceImpl.java | 790 +- .../service/impl/SysNoticeServiceImpl.java | 164 +- .../service/impl/SysOperLogServiceImpl.java | 154 +- .../service/impl/SysPostServiceImpl.java | 362 +- .../service/impl/SysRoleServiceImpl.java | 758 +- .../impl/SysUserOnlineServiceImpl.java | 230 +- .../service/impl/SysUserServiceImpl.java | 960 +- .../mapper/system/SysConfigMapper.xml | 214 +- .../resources/mapper/system/SysDeptMapper.xml | 306 +- .../mapper/system/SysDictDataMapper.xml | 244 +- .../mapper/system/SysDictTypeMapper.xml | 208 +- .../mapper/system/SysLogininforMapper.xml | 110 +- .../resources/mapper/system/SysMenuMapper.xml | 356 +- .../mapper/system/SysNoticeMapper.xml | 168 +- .../mapper/system/SysOperLogMapper.xml | 162 +- .../resources/mapper/system/SysPostMapper.xml | 218 +- .../mapper/system/SysRoleDeptMapper.xml | 66 +- .../resources/mapper/system/SysRoleMapper.xml | 260 +- .../mapper/system/SysRoleMenuMapper.xml | 66 +- .../resources/mapper/system/SysUserMapper.xml | 436 +- .../mapper/system/SysUserOnlineMapper.xml | 112 +- .../mapper/system/SysUserPostMapper.xml | 66 +- .../mapper/system/SysUserRoleMapper.xml | 86 +- pom.xml | 530 +- .../main/java/com/ruoyi/RuoYiApplication.java | 30 - ruoyi-admin/src/main/resources/banner.txt | 24 - 598 files changed, 108214 insertions(+), 108275 deletions(-) rename {ruoyi-admin => infosouth-admin}/pom.xml (87%) create mode 100644 infosouth-admin/src/main/java/cn/com/infosouth/RuoYiApplication.java rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/RuoYiServletInitializer.java (92%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/common/CommonController.java (88%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoDialogController.java (90%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoFormController.java (93%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoIconController.java (88%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoOperateController.java (92%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoReportController.java (89%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/controller/DemoTableController.java (93%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/demo/domain/UserOperateModel.java (88%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/monitor/DruidController.java (82%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/monitor/ServerController.java (80%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/monitor/SysLogininforController.java (81%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/monitor/SysOperlogController.java (82%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/monitor/SysUserOnlineController.java (83%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysCaptchaController.java (93%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysConfigController.java (85%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysDeptController.java (87%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysDictDataController.java (85%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysDictTypeController.java (87%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysIndexController.java (76%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysLoginController.java (86%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysMenuController.java (88%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysNoticeController.java (83%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysPostController.java (87%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysProfileController.java (87%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysRoleController.java (89%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/system/SysUserController.java (89%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/tool/BuildController.java (82%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/tool/SwaggerController.java (81%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/controller/tool/TestController.java (92%) rename {ruoyi-admin/src/main/java/com/ruoyi => infosouth-admin/src/main/java/cn/com/infosouth}/web/core/config/SwaggerConfig.java (94%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/application-druid.yml (89%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/application.yml (94%) create mode 100644 infosouth-admin/src/main/resources/banner.txt rename {ruoyi-admin => infosouth-admin}/src/main/resources/ehcache/ehcache-shiro.xml (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/logback.xml (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/mybatis/mybatis-config.xml (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.css (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/clear.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/export/tableExport.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder/bootstrap-table-reorder.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder/jquery.tablednd.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/cropbox/cropbox.css (94%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/cropbox/cropbox.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.css (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/duallistbox/bootstrap-duallistbox.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/curvedLines.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.pie.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.resize.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.spline.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.symbol.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/flot/jquery.flot.tooltip.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/fullscreen/jquery.fullscreen.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/iCheck/custom.css (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/iCheck/green-login.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/iCheck/green.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/iCheck/green@2x.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/iCheck/icheck.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jasny/jasny-bootstrap.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-layout/jquery.layout-latest.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-layout/jquery.layout-latest.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/1_close.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/1_open.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/2.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/3.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/4.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/5.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/6.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/7.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/8.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/diy/9.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/line_conn.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/zTreeStandard.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/img/zTreeStandard.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/default/zTreeStyle.css (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/line_conn.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/line_conn.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/metro.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/img/metro.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/left_menu.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/left_menu.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/line_conn.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/zTreeStandard.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/img/zTreeStandard.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/css/simple/zTreeStyle.css (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.core-3.5.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.excheck-3.5.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.exedit-3.5.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.exhide-3.5.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jquery-ztree/3.5/log v3.x.txt (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/layer.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/icon-ext.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/icon.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/layer.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/loading-0.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/loading-1.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/default/loading-2.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/moon/default.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layer/theme/moon/style.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/css/modules/laydate/default/font/iconfont.eot (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/css/modules/laydate/default/font/iconfont.svg (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/css/modules/laydate/default/font/iconfont.ttf (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/css/modules/laydate/default/font/iconfont.woff (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/css/modules/laydate/default/laydate.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/lay/modules/laydate.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/layui/layui.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/report/echarts/echarts-all.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/report/peity/jquery.peity.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/report/sparkline/jquery.sparkline.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/select2/select2-bootstrap.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/select2/select2.css (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/select2/select2.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/select2/select2.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/select2/select2.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/staps/jquery.steps.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/staps/jquery.steps.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/staps/jquery.steps.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/suggest/bootstrap-suggest.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/suggest/bootstrap-suggest.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/font/summernote.eot (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/font/summernote.ttf (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/font/summernote.woff (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/summernote-bs3.css (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/summernote-zh-CN.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/summernote.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/summernote.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/summernote/summernote.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/typeahead/bootstrap3-typeahead.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/typeahead/bootstrap3-typeahead.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/validate/additional-methods.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/validate/jquery.validate.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ajax/libs/validate/messages_zh.min.js (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/animate.css (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/bootstrap.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/font-awesome.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/jquery.contextMenu.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/login.css (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/login.min.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/main/animate.min.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/main/bootstrap.min14ed.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/main/font-awesome.min93e3.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/main/style.min862f.css (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/patterns/header-profile-skin-blue.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/patterns/header-profile-skin-yellow.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/patterns/header-profile.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/patterns/shattered.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/skins.css (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/css/style.css (94%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/favicon.ico (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/file/rml.txt (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/FontAwesome.otf (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/Simple-Line-Icons.woff2 (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/fontawesome-webfont.eot (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/fontawesome-webfont.svg (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/fontawesome-webfont.ttf (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/fontawesome-webfont.woff (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/fontawesome-webfont.woff2 (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/glyphicons-halflings-regular.eot (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/glyphicons-halflings-regular.svg (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/glyphicons-halflings-regular.woff (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/i18n/messages.properties (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/blue.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/loading-upload.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/loading.gif (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/locked.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/login-background.jpg (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/pay.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/profile.jpg (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/progress.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/qr_code.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/img/user.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/bootstrap.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/jquery-ui-1.10.4.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/jquery.contextMenu.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/jquery.i18n.properties.min.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/jquery.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/jquery.tmpl.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js (99%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi.png (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi/css/ry-ui.css (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi/index.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi/js/common.js (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi/js/ry-ui.js (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/static/ruoyi/login.js (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/autocomplete.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/basic.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/button.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/cards.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/datetime.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/duallistbox.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/grid.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/jasny.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/select.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/sortable.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/summernote.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/tabs_panels.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/timeline.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/upload.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/validate.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/form/wizard.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/icon/fontawesome.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/icon/glyphicons.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/dialog.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/form.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/layer.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/table.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/table/check.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/table/parent.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/modal/table/radio.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/operate/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/operate/detail.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/operate/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/operate/other.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/operate/table.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/report/echarts.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/report/metrics.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/report/peity.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/report/sparkline.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/button.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/child.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/curd.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/detail.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/editable.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/event.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/export.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/fixedColumns.html (95%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/footer.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/groupHeader.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/image.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/multi.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/other.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/pageGo.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/params.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/remember.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/reorder.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/demo/table/search.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/error/404.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/error/500.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/error/business.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/error/unauth.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/include.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/index.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/login.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/main.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/main_v1.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/monitor/logininfor/logininfor.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/monitor/online/online.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/monitor/operlog/detail.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/monitor/operlog/operlog.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/monitor/server/server.html (98%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/skin.html (100%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/config/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/config/config.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/config/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dept/add.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dept/dept.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dept/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dept/tree.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/data/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/data/data.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/data/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/type/add.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/type/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/type/tree.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/dict/type/type.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/menu/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/menu/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/menu/icon.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/menu/menu.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/menu/tree.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/notice/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/notice/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/notice/notice.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/post/add.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/post/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/post/post.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/add.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/authUser.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/dataScope.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/edit.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/role.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/role/selectUser.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/add.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/edit.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/profile/avatar.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/profile/profile.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/profile/resetPwd.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/resetPwd.html (96%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/system/user/user.html (97%) rename {ruoyi-admin => infosouth-admin}/src/main/resources/templates/tool/build/build.html (98%) rename {ruoyi-common => infosouth-common}/pom.xml (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/DataScope.java (89%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/DataSource.java (83%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/Excel.java (94%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/Excels.java (87%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/Log.java (82%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/annotation/RepeatSubmit.java (90%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/config/Global.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/config/ServerConfig.java (87%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/config/datasource/DynamicDataSourceContextHolder.java (92%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/config/thread/ThreadPoolConfig.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/Constants.java (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/GenConstants.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/PermissionConstants.java (90%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/ScheduleConstants.java (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/ShiroConstants.java (92%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/constant/UserConstants.java (96%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/controller/BaseController.java (86%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/domain/AjaxResult.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/domain/BaseEntity.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/domain/TreeEntity.java (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/domain/Ztree.java (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/page/PageDomain.java (89%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/page/TableDataInfo.java (91%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/page/TableSupport.java (81%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/text/CharsetKit.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/text/Convert.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/core/text/StrFormatter.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/BusinessStatus.java (75%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/BusinessType.java (85%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/DataSourceType.java (75%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/OnlineStatus.java (84%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/OperatorType.java (79%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/enums/UserStatus.java (87%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/BusinessException.java (92%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/DemoModeException.java (80%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/base/BaseException.java (88%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/file/FileException.java (71%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/file/FileNameLengthLimitExceededException.java (86%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/file/FileSizeLimitExceededException.java (87%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/file/InvalidExtensionException.java (94%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/job/TaskException.java (89%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/CaptchaException.java (81%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/RoleBlockedException.java (81%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserBlockedException.java (81%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserDeleteException.java (82%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserException.java (70%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserNotExistsException.java (82%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserPasswordNotMatchException.java (84%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserPasswordRetryLimitCountException.java (86%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/exception/user/UserPasswordRetryLimitExceedException.java (86%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/json/JSON.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/json/JSONObject.java (96%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/AddressUtils.java (84%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/Arith.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/DateUtils.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/ExceptionUtil.java (92%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/IpUtils.java (96%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/MapDataUtil.java (94%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/MessageUtils.java (85%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/ServletUtils.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/StringUtils.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/Threads.java (98%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/YamlUtil.java (94%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/bean/BeanUtils.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/file/FileUploadUtils.java (90%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/file/FileUtils.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/file/MimeTypeUtils.java (97%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/html/EscapeUtil.java (97%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/html/HTMLFilter.java (99%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/http/HttpUtils.java (96%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/poi/ExcelUtil.java (97%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/reflect/ReflectUtils.java (98%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/security/Md5Utils.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/security/PermissionUtils.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/spring/SpringUtils.java (95%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/utils/sql/SqlUtil.java (88%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/xss/XssFilter.java (93%) rename {ruoyi-common/src/main/java/com/ruoyi => infosouth-common/src/main/java/cn/com/infosouth}/common/xss/XssHttpServletRequestWrapper.java (88%) rename {ruoyi-framework => infosouth-framework}/pom.xml (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/aspectj/DataScopeAspect.java (89%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/aspectj/DataSourceAspect.java (81%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/aspectj/LogAspect.java (87%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/ApplicationConfig.java (83%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/CaptchaConfig.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/DruidConfig.java (92%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/FilterConfig.java (89%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/I18nConfig.java (93%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/KaptchaTextCreator.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/MyBatisConfig.java (99%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/ResourcesConfig.java (88%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/ShiroConfig.java (91%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/config/properties/DruidProperties.java (98%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/datasource/DynamicDataSource.java (82%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/interceptor/RepeatSubmitInterceptor.java (86%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/interceptor/impl/SameUrlDataInterceptor.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/manager/AsyncManager.java (84%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/manager/ShutdownManager.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/manager/factory/AsyncFactory.java (84%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/realm/UserRealm.java (83%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/service/SysLoginService.java (79%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/service/SysPasswordService.java (81%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/service/SysShiroService.java (86%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/session/OnlineSession.java (91%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/session/OnlineSessionDAO.java (89%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/session/OnlineSessionFactory.java (89%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/filter/LogoutFilter.java (83%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java (89%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/filter/kickout/KickoutSessionFilter.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/filter/online/OnlineSessionFilter.java (87%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java (81%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/session/OnlineWebSessionManager.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/shiro/web/session/SpringSessionValidationScheduler.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/util/LogUtils.java (94%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/util/ShiroUtils.java (88%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/Server.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/server/Cpu.java (88%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/server/Jvm.java (88%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/server/Mem.java (85%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/server/Sys.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/domain/server/SysFile.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/exception/GlobalExceptionHandler.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/service/ConfigService.java (82%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/service/DictService.java (83%) rename {ruoyi-framework/src/main/java/com/ruoyi => infosouth-framework/src/main/java/cn/com/infosouth}/framework/web/service/PermissionService.java (95%) rename {ruoyi-generator => infosouth-generator}/pom.xml (75%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/config/GenConfig.java (93%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/controller/GenController.java (89%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/domain/GenTable.java (92%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/domain/GenTableColumn.java (93%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/mapper/GenTableColumnMapper.java (89%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/mapper/GenTableMapper.java (90%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/service/IGenTableColumnService.java (87%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/service/IGenTableService.java (91%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/service/impl/GenTableColumnServiceImpl.java (83%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/service/impl/GenTableServiceImpl.java (90%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/util/GenUtils.java (93%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/util/VelocityInitializer.java (88%) rename {ruoyi-generator/src/main/java/com/ruoyi => infosouth-generator/src/main/java/cn/com/infosouth}/generator/util/VelocityUtils.java (96%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/generator.yml (82%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/mapper/generator/GenTableColumnMapper.xml (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/mapper/generator/GenTableMapper.xml (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/templates/tool/gen/edit.html (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/templates/tool/gen/gen.html (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/templates/tool/gen/importTable.html (96%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/html/add.html.vm (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/html/edit.html.vm (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/html/list-tree.html.vm (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/html/list.html.vm (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/html/tree.html.vm (97%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/java/controller.java.vm (91%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/java/domain.java.vm (90%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/java/mapper.java.vm (96%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/java/service.java.vm (93%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/java/serviceImpl.java.vm (93%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/sql/sql.vm (98%) rename {ruoyi-generator => infosouth-generator}/src/main/resources/vm/xml/mapper.xml.vm (97%) rename {ruoyi-quartz => infosouth-quartz}/pom.xml (76%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/config/ScheduleConfig.java (96%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/controller/SysJobController.java (87%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/controller/SysJobLogController.java (83%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/domain/SysJob.java (89%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/domain/SysJobLog.java (91%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/mapper/SysJobLogMapper.java (90%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/mapper/SysJobMapper.java (89%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/service/ISysJobLogService.java (89%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/service/ISysJobService.java (90%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/service/impl/SysJobLogServiceImpl.java (87%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/service/impl/SysJobServiceImpl.java (90%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/task/RyTask.java (85%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/AbstractQuartzJob.java (84%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/CronUtils.java (97%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/JobInvokeUtil.java (94%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/QuartzDisallowConcurrentExecution.java (82%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/QuartzJobExecution.java (79%) rename {ruoyi-quartz/src/main/java/com/ruoyi => infosouth-quartz/src/main/java/cn/com/infosouth}/quartz/util/ScheduleUtils.java (91%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/mapper/quartz/SysJobLogMapper.xml (96%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/mapper/quartz/SysJobMapper.xml (96%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/templates/monitor/job/add.html (95%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/templates/monitor/job/detail.html (97%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/templates/monitor/job/edit.html (96%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/templates/monitor/job/job.html (97%) rename {ruoyi-quartz => infosouth-quartz}/src/main/resources/templates/monitor/job/jobLog.html (97%) rename {ruoyi-system => infosouth-system}/pom.xml (75%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysConfig.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysDept.java (93%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysDictData.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysDictType.java (89%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysLogininfor.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysMenu.java (93%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysNotice.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysOperLog.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysPost.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysRole.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysRoleDept.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysRoleMenu.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysUser.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysUserOnline.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysUserPost.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/domain/SysUserRole.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysConfigMapper.java (89%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysDeptMapper.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysDictDataMapper.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysDictTypeMapper.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysLogininforMapper.java (86%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysMenuMapper.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysNoticeMapper.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysOperLogMapper.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysPostMapper.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysRoleDeptMapper.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysRoleMapper.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysRoleMenuMapper.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysUserMapper.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysUserOnlineMapper.java (88%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysUserPostMapper.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/mapper/SysUserRoleMapper.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysConfigService.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysDeptService.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysDictDataService.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysDictTypeService.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysLogininforService.java (86%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysMenuService.java (88%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysNoticeService.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysOperLogService.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysPostService.java (91%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysRoleService.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysUserOnlineService.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/ISysUserService.java (93%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysConfigServiceImpl.java (86%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysDeptServiceImpl.java (90%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysDictDataServiceImpl.java (88%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysDictTypeServiceImpl.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysLogininforServiceImpl.java (81%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysMenuServiceImpl.java (92%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysNoticeServiceImpl.java (83%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysOperLogServiceImpl.java (83%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysPostServiceImpl.java (87%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysRoleServiceImpl.java (89%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysUserOnlineServiceImpl.java (86%) rename {ruoyi-system/src/main/java/com/ruoyi => infosouth-system/src/main/java/cn/com/infosouth}/system/service/impl/SysUserServiceImpl.java (90%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysConfigMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysDeptMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysDictDataMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysDictTypeMapper.xml (95%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysLogininforMapper.xml (95%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysMenuMapper.xml (97%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysNoticeMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysOperLogMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysPostMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysRoleDeptMapper.xml (91%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysRoleMapper.xml (96%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysRoleMenuMapper.xml (91%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysUserMapper.xml (97%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysUserOnlineMapper.xml (95%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysUserPostMapper.xml (91%) rename {ruoyi-system => infosouth-system}/src/main/resources/mapper/system/SysUserRoleMapper.xml (93%) delete mode 100644 ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java delete mode 100644 ruoyi-admin/src/main/resources/banner.txt diff --git a/README.md b/README.md index 237018201..e6b99e351 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,27 @@ -## 平台简介 - -一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 - -性别男,若依是给还没有出生女儿取的名字(寓意:你若不离不弃,我必生死相依) - -> 如需前后端分离版本,请移步 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) - -> 如需单应用,请移步 [RuoYi-fast](https://gitee.com/y_project/RuoYi-fast) `(保持同步更新)`,如需其他版本,请移步 [项目扩展](http://doc.ruoyi.vip/ruoyi/document/xmkz.html) `(不定时更新)` - -> 阿里云通用云产品1888优惠券 :[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof)    腾讯云通用云产品2860优惠券 :[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  `(仅限新用户)` - -> 阿里云Hi拼购 限量爆款 低至199元/年 [点我进入](https://www.aliyun.com/acts/hi-group-buying?userCode=brki8iof)  `(仅限新用户)` - -## 内置功能 - -1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 -2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 -3. 岗位管理:配置系统用户所属担任职务。 -4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 -5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 -6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 -7. 参数管理:对系统动态配置常用参数。 -8. 通知公告:系统通知公告信息发布维护。 -9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 -10. 登录日志:系统登录日志记录查询包含登录异常。 -11. 在线用户:当前系统中活跃用户状态监控。 -12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 -13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 -14. 系统接口:根据业务代码自动生成相关的api接口文档。 -15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 -16. 在线构建器:拖动表单元素生成相应的HTML代码。 -17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 -## 在线体验 -> admin/admin123 -> 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 - -演示地址:http://ruoyi.vip - -文档地址:http://doc.ruoyi.vip - -## 演示图 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -## 若依交流群 - -QQ群: [![加入QQ群](https://img.shields.io/badge/已满-1389287-blue.svg)](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [![加入QQ群](https://img.shields.io/badge/已满-1679294-blue.svg)](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [![加入QQ群](https://img.shields.io/badge/已满-1529866-blue.svg)](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [![加入QQ群](https://img.shields.io/badge/已满-1772718-blue.svg)](https://jq.qq.com/?_wv=1027&k=5g75dCU) [![加入QQ群](https://img.shields.io/badge/已满-1366522-blue.svg)](https://jq.qq.com/?_wv=1027&k=58cPoHA) [![加入QQ群](https://img.shields.io/badge/已满-1382251-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [![加入QQ群](https://img.shields.io/badge/已满-1145125-blue.svg)](https://jq.qq.com/?_wv=1027&k=5yugASz) [![加入QQ群](https://img.shields.io/badge/已满-86752435-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [![加入QQ群](https://img.shields.io/badge/已满-134072510-blue.svg)](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [![加入QQ群](https://img.shields.io/badge/已满-210336300-blue.svg)](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [![加入QQ群](https://img.shields.io/badge/339522636-blue.svg)](https://jq.qq.com/?_wv=1027&k=5omzbKc) \ No newline at end of file +## 平台简介 + +> 如需前后端分离版本,请移步 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) + +> 如需单应用,请移步 [RuoYi-fast](https://gitee.com/y_project/RuoYi-fast) `(保持同步更新)`,如需其他版本,请移步 [项目扩展](http://doc.ruoyi.vip/ruoyi/document/xmkz.html) `(不定时更新)` + +## 内置功能 + +1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 +2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 +3. 岗位管理:配置系统用户所属担任职务。 +4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 +5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 +6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 +7. 参数管理:对系统动态配置常用参数。 +8. 通知公告:系统通知公告信息发布维护。 +9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 +10. 登录日志:系统登录日志记录查询包含登录异常。 +11. 在线用户:当前系统中活跃用户状态监控。 +12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 +13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 +14. 系统接口:根据业务代码自动生成相关的api接口文档。 +15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 +16. 在线构建器:拖动表单元素生成相应的HTML代码。 +17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 +## 在线体验 +> admin/admin123 diff --git a/ruoyi-admin/pom.xml b/infosouth-admin/pom.xml similarity index 87% rename from ruoyi-admin/pom.xml rename to infosouth-admin/pom.xml index 0e5ebb834..ead7216a1 100644 --- a/ruoyi-admin/pom.xml +++ b/infosouth-admin/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - ruoyi - com.ruoyi + amas.comac + cn.com.infosouth 4.1.0 4.0.0 jar - ruoyi-admin + infosouth-admin web服务入口 @@ -57,20 +57,20 @@ - com.ruoyi - ruoyi-framework + cn.com.infosouth + infosouth-framework - com.ruoyi - ruoyi-quartz + cn.com.infosouth + infosouth-quartz - com.ruoyi - ruoyi-generator + cn.com.infosouth + infosouth-generator diff --git a/infosouth-admin/src/main/java/cn/com/infosouth/RuoYiApplication.java b/infosouth-admin/src/main/java/cn/com/infosouth/RuoYiApplication.java new file mode 100644 index 000000000..1bd20ce79 --- /dev/null +++ b/infosouth-admin/src/main/java/cn/com/infosouth/RuoYiApplication.java @@ -0,0 +1,21 @@ +package cn.com.infosouth; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +/** + * 启动程序 + * + * @author ruoyi + */ +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class RuoYiApplication +{ + public static void main(String[] args) + { + // System.setProperty("spring.devtools.restart.enabled", "false"); + SpringApplication.run(RuoYiApplication.class, args); + System.out.println(" 系统启动成功(◠‿◠) \n"); + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java b/infosouth-admin/src/main/java/cn/com/infosouth/RuoYiServletInitializer.java similarity index 92% rename from ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java rename to infosouth-admin/src/main/java/cn/com/infosouth/RuoYiServletInitializer.java index 9d82a2378..90350110a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/RuoYiServletInitializer.java @@ -1,18 +1,18 @@ -package com.ruoyi; - -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; - -/** - * web容器中进行部署 - * - * @author ruoyi - */ -public class RuoYiServletInitializer extends SpringBootServletInitializer -{ - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) - { - return application.sources(RuoYiApplication.class); - } -} +package cn.com.infosouth; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * web容器中进行部署 + * + * @author ruoyi + */ +public class RuoYiServletInitializer extends SpringBootServletInitializer +{ + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) + { + return application.sources(RuoYiApplication.class); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/common/CommonController.java similarity index 88% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/common/CommonController.java index c8f7e3ad0..1ef1bf751 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/common/CommonController.java @@ -1,112 +1,112 @@ -package com.ruoyi.web.controller.common; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.config.Global; -import com.ruoyi.common.config.ServerConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.common.utils.file.FileUtils; - -/** - * 通用请求处理 - * - * @author ruoyi - */ -@Controller -public class CommonController -{ - private static final Logger log = LoggerFactory.getLogger(CommonController.class); - - @Autowired - private ServerConfig serverConfig; - - /** - * 通用下载请求 - * - * @param fileName 文件名称 - * @param delete 是否删除 - */ - @GetMapping("common/download") - public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) - { - try - { - if (!FileUtils.isValidFilename(fileName)) - { - throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); - } - String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); - String filePath = Global.getDownloadPath() + fileName; - - response.setCharacterEncoding("utf-8"); - response.setContentType("multipart/form-data"); - response.setHeader("Content-Disposition", - "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); - FileUtils.writeBytes(filePath, response.getOutputStream()); - if (delete) - { - FileUtils.deleteFile(filePath); - } - } - catch (Exception e) - { - log.error("下载文件失败", e); - } - } - - /** - * 通用上传请求 - */ - @PostMapping("/common/upload") - @ResponseBody - public AjaxResult uploadFile(MultipartFile file) throws Exception - { - try - { - // 上传文件路径 - String filePath = Global.getUploadPath(); - // 上传并返回新文件名称 - String fileName = FileUploadUtils.upload(filePath, file); - String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); - ajax.put("fileName", fileName); - ajax.put("url", url); - return ajax; - } - catch (Exception e) - { - return AjaxResult.error(e.getMessage()); - } - } - - /** - * 本地资源通用下载 - */ - @GetMapping("/common/download/resource") - public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) - throws Exception - { - // 本地资源路径 - String localPath = Global.getProfile(); - // 数据库资源地址 - String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); - // 下载名称 - String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); - response.setCharacterEncoding("utf-8"); - response.setContentType("multipart/form-data"); - response.setHeader("Content-Disposition", - "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); - FileUtils.writeBytes(downloadPath, response.getOutputStream()); - } -} +package cn.com.infosouth.web.controller.common; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import cn.com.infosouth.common.config.Global; +import cn.com.infosouth.common.config.ServerConfig; +import cn.com.infosouth.common.constant.Constants; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.utils.StringUtils; +import cn.com.infosouth.common.utils.file.FileUploadUtils; +import cn.com.infosouth.common.utils.file.FileUtils; + +/** + * 通用请求处理 + * + * @author ruoyi + */ +@Controller +public class CommonController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @GetMapping("common/download") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) + { + try + { + if (!FileUtils.isValidFilename(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = Global.getDownloadPath() + fileName; + + response.setCharacterEncoding("utf-8"); + response.setContentType("multipart/form-data"); + response.setHeader("Content-Disposition", + "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) + { + FileUtils.deleteFile(filePath); + } + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + /** + * 通用上传请求 + */ + @PostMapping("/common/upload") + @ResponseBody + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = Global.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("fileName", fileName); + ajax.put("url", url); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @GetMapping("/common/download/resource") + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) + throws Exception + { + // 本地资源路径 + String localPath = Global.getProfile(); + // 数据库资源地址 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); + // 下载名称 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setCharacterEncoding("utf-8"); + response.setContentType("multipart/form-data"); + response.setHeader("Content-Disposition", + "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName)); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoDialogController.java similarity index 90% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoDialogController.java index 78d6da74b..9e6adcaeb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoDialogController.java @@ -1,80 +1,80 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 模态窗口 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/modal") -public class DemoDialogController -{ - private String prefix = "demo/modal"; - - /** - * 模态窗口 - */ - @GetMapping("/dialog") - public String dialog() - { - return prefix + "/dialog"; - } - - /** - * 弹层组件 - */ - @GetMapping("/layer") - public String layer() - { - return prefix + "/layer"; - } - - /** - * 表单 - */ - @GetMapping("/form") - public String form() - { - return prefix + "/form"; - } - - /** - * 表格 - */ - @GetMapping("/table") - public String table() - { - return prefix + "/table"; - } - - /** - * 表格check - */ - @GetMapping("/check") - public String check() - { - return prefix + "/table/check"; - } - - /** - * 表格radio - */ - @GetMapping("/radio") - public String radio() - { - return prefix + "/table/radio"; - } - - /** - * 表格回传父窗体 - */ - @GetMapping("/parent") - public String parent() - { - return prefix + "/table/parent"; - } -} +package cn.com.infosouth.web.controller.demo.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 模态窗口 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/modal") +public class DemoDialogController +{ + private String prefix = "demo/modal"; + + /** + * 模态窗口 + */ + @GetMapping("/dialog") + public String dialog() + { + return prefix + "/dialog"; + } + + /** + * 弹层组件 + */ + @GetMapping("/layer") + public String layer() + { + return prefix + "/layer"; + } + + /** + * 表单 + */ + @GetMapping("/form") + public String form() + { + return prefix + "/form"; + } + + /** + * 表格 + */ + @GetMapping("/table") + public String table() + { + return prefix + "/table"; + } + + /** + * 表格check + */ + @GetMapping("/check") + public String check() + { + return prefix + "/table/check"; + } + + /** + * 表格radio + */ + @GetMapping("/radio") + public String radio() + { + return prefix + "/table/radio"; + } + + /** + * 表格回传父窗体 + */ + @GetMapping("/parent") + public String parent() + { + return prefix + "/table/parent"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoFormController.java similarity index 93% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoFormController.java index f53537b6e..fbc2219cc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoFormController.java @@ -1,270 +1,270 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.List; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.core.domain.AjaxResult; - -/** - * 表单相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/form") -public class DemoFormController -{ - private String prefix = "demo/form"; - - private final static List users = new ArrayList(); - { - users.add(new UserFormModel(1, "1000001", "测试1", "15888888888")); - users.add(new UserFormModel(2, "1000002", "测试2", "15666666666")); - users.add(new UserFormModel(3, "1000003", "测试3", "15666666666")); - users.add(new UserFormModel(4, "1000004", "测试4", "15666666666")); - users.add(new UserFormModel(5, "1000005", "测试5", "15666666666")); - } - - /** - * 按钮页 - */ - @GetMapping("/button") - public String button() - { - return prefix + "/button"; - } - - /** - * 下拉框 - */ - @GetMapping("/select") - public String select() - { - return prefix + "/select"; - } - - /** - * 时间轴 - */ - @GetMapping("/timeline") - public String timeline() - { - return prefix + "/timeline"; - } - - /** - * 表单校验 - */ - @GetMapping("/validate") - public String validate() - { - return prefix + "/validate"; - } - - /** - * 功能扩展(包含文件上传) - */ - @GetMapping("/jasny") - public String jasny() - { - return prefix + "/jasny"; - } - - /** - * 拖动排序 - */ - @GetMapping("/sortable") - public String sortable() - { - return prefix + "/sortable"; - } - - /** - * 选项卡 & 面板 - */ - @GetMapping("/tabs_panels") - public String tabs_panels() - { - return prefix + "/tabs_panels"; - } - - /** - * 栅格 - */ - @GetMapping("/grid") - public String grid() - { - return prefix + "/grid"; - } - - /** - * 表单向导 - */ - @GetMapping("/wizard") - public String wizard() - { - return prefix + "/wizard"; - } - - /** - * 文件上传 - */ - @GetMapping("/upload") - public String upload() - { - return prefix + "/upload"; - } - - /** - * 日期和时间页 - */ - @GetMapping("/datetime") - public String datetime() - { - return prefix + "/datetime"; - } - - /** - * 左右互选组件 - */ - @GetMapping("/duallistbox") - public String duallistbox() - { - return prefix + "/duallistbox"; - } - - /** - * 基本表单 - */ - @GetMapping("/basic") - public String basic() - { - return prefix + "/basic"; - } - - /** - * 卡片列表 - */ - @GetMapping("/cards") - public String cards() - { - return prefix + "/cards"; - } - - /** - * summernote 富文本编辑器 - */ - @GetMapping("/summernote") - public String summernote() - { - return prefix + "/summernote"; - } - - /** - * 搜索自动补全 - */ - @GetMapping("/autocomplete") - public String autocomplete() - { - return prefix + "/autocomplete"; - } - - /** - * 获取用户数据 - */ - @GetMapping("/userModel") - @ResponseBody - public AjaxResult userModel() - { - AjaxResult ajax = new AjaxResult(); - - ajax.put("code", 200); - ajax.put("value", users); - return ajax; - } - - /** - * 获取数据集合 - */ - @GetMapping("/collection") - @ResponseBody - public AjaxResult collection() - { - String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" }; - AjaxResult ajax = new AjaxResult(); - ajax.put("value", array); - return ajax; - } -} - -class UserFormModel -{ - /** 用户ID */ - private int userId; - - /** 用户编号 */ - private String userCode; - - /** 用户姓名 */ - private String userName; - - /** 用户手机 */ - private String userPhone; - - public UserFormModel() - { - - } - - public UserFormModel(int userId, String userCode, String userName, String userPhone) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userPhone = userPhone; - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - -} +package cn.com.infosouth.web.controller.demo.controller; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.core.domain.AjaxResult; + +/** + * 表单相关 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/form") +public class DemoFormController +{ + private String prefix = "demo/form"; + + private final static List users = new ArrayList(); + { + users.add(new UserFormModel(1, "1000001", "测试1", "15888888888")); + users.add(new UserFormModel(2, "1000002", "测试2", "15666666666")); + users.add(new UserFormModel(3, "1000003", "测试3", "15666666666")); + users.add(new UserFormModel(4, "1000004", "测试4", "15666666666")); + users.add(new UserFormModel(5, "1000005", "测试5", "15666666666")); + } + + /** + * 按钮页 + */ + @GetMapping("/button") + public String button() + { + return prefix + "/button"; + } + + /** + * 下拉框 + */ + @GetMapping("/select") + public String select() + { + return prefix + "/select"; + } + + /** + * 时间轴 + */ + @GetMapping("/timeline") + public String timeline() + { + return prefix + "/timeline"; + } + + /** + * 表单校验 + */ + @GetMapping("/validate") + public String validate() + { + return prefix + "/validate"; + } + + /** + * 功能扩展(包含文件上传) + */ + @GetMapping("/jasny") + public String jasny() + { + return prefix + "/jasny"; + } + + /** + * 拖动排序 + */ + @GetMapping("/sortable") + public String sortable() + { + return prefix + "/sortable"; + } + + /** + * 选项卡 & 面板 + */ + @GetMapping("/tabs_panels") + public String tabs_panels() + { + return prefix + "/tabs_panels"; + } + + /** + * 栅格 + */ + @GetMapping("/grid") + public String grid() + { + return prefix + "/grid"; + } + + /** + * 表单向导 + */ + @GetMapping("/wizard") + public String wizard() + { + return prefix + "/wizard"; + } + + /** + * 文件上传 + */ + @GetMapping("/upload") + public String upload() + { + return prefix + "/upload"; + } + + /** + * 日期和时间页 + */ + @GetMapping("/datetime") + public String datetime() + { + return prefix + "/datetime"; + } + + /** + * 左右互选组件 + */ + @GetMapping("/duallistbox") + public String duallistbox() + { + return prefix + "/duallistbox"; + } + + /** + * 基本表单 + */ + @GetMapping("/basic") + public String basic() + { + return prefix + "/basic"; + } + + /** + * 卡片列表 + */ + @GetMapping("/cards") + public String cards() + { + return prefix + "/cards"; + } + + /** + * summernote 富文本编辑器 + */ + @GetMapping("/summernote") + public String summernote() + { + return prefix + "/summernote"; + } + + /** + * 搜索自动补全 + */ + @GetMapping("/autocomplete") + public String autocomplete() + { + return prefix + "/autocomplete"; + } + + /** + * 获取用户数据 + */ + @GetMapping("/userModel") + @ResponseBody + public AjaxResult userModel() + { + AjaxResult ajax = new AjaxResult(); + + ajax.put("code", 200); + ajax.put("value", users); + return ajax; + } + + /** + * 获取数据集合 + */ + @GetMapping("/collection") + @ResponseBody + public AjaxResult collection() + { + String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" }; + AjaxResult ajax = new AjaxResult(); + ajax.put("value", array); + return ajax; + } +} + +class UserFormModel +{ + /** 用户ID */ + private int userId; + + /** 用户编号 */ + private String userCode; + + /** 用户姓名 */ + private String userName; + + /** 用户手机 */ + private String userPhone; + + public UserFormModel() + { + + } + + public UserFormModel(int userId, String userCode, String userName, String userPhone) + { + this.userId = userId; + this.userCode = userCode; + this.userName = userName; + this.userPhone = userPhone; + } + + public int getUserId() + { + return userId; + } + + public void setUserId(int userId) + { + this.userId = userId; + } + + public String getUserCode() + { + return userCode; + } + + public void setUserCode(String userCode) + { + this.userCode = userCode; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserPhone() + { + return userPhone; + } + + public void setUserPhone(String userPhone) + { + this.userPhone = userPhone; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoIconController.java similarity index 88% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoIconController.java index 490c3e061..ad712c884 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoIconController.java @@ -1,35 +1,35 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 图标相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/icon") -public class DemoIconController -{ - private String prefix = "demo/icon"; - - /** - * FontAwesome图标 - */ - @GetMapping("/fontawesome") - public String fontAwesome() - { - return prefix + "/fontawesome"; - } - - /** - * Glyphicons图标 - */ - @GetMapping("/glyphicons") - public String glyphicons() - { - return prefix + "/glyphicons"; - } -} +package cn.com.infosouth.web.controller.demo.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 图标相关 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/icon") +public class DemoIconController +{ + private String prefix = "demo/icon"; + + /** + * FontAwesome图标 + */ + @GetMapping("/fontawesome") + public String fontAwesome() + { + return prefix + "/fontawesome"; + } + + /** + * Glyphicons图标 + */ + @GetMapping("/glyphicons") + public String glyphicons() + { + return prefix + "/glyphicons"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoOperateController.java similarity index 92% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoOperateController.java index a628ebecb..f28a8bbc5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoOperateController.java @@ -1,314 +1,314 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.web.controller.demo.domain.UserOperateModel; - -/** - * 操作控制 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/operate") -public class DemoOperateController extends BaseController -{ - private String prefix = "demo/operate"; - - private final static Map users = new LinkedHashMap(); - { - users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); - users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); - users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); - users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); - users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); - users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); - users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); - users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); - users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); - users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); - users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); - users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); - users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); - users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); - users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); - users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); - users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); - users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); - users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); - users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); - users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); - users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); - users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); - users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); - } - - /** - * 表格 - */ - @GetMapping("/table") - public String table() - { - return prefix + "/table"; - } - - /** - * 其他 - */ - @GetMapping("/other") - public String other() - { - return prefix + "/other"; - } - - /** - * 查询数据 - */ - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(UserOperateModel userModel) - { - TableDataInfo rspData = new TableDataInfo(); - List userList = new ArrayList(users.values()); - // 查询条件过滤 - if (StringUtils.isNotEmpty(userModel.getSearchValue())) - { - userList.clear(); - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(userModel.getSearchValue())) - { - userList.add(entry.getValue()); - } - } - } - else if (StringUtils.isNotEmpty(userModel.getUserName())) - { - userList.clear(); - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(userModel.getUserName())) - { - userList.add(entry.getValue()); - } - } - } - PageDomain pageDomain = TableSupport.buildPageRequest(); - if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) - { - rspData.setRows(userList); - rspData.setTotal(userList.size()); - return rspData; - } - Integer pageNum = (pageDomain.getPageNum() - 1) * 10; - Integer pageSize = pageDomain.getPageNum() * 10; - if (pageSize > userList.size()) - { - pageSize = userList.size(); - } - rspData.setRows(userList.subList(pageNum, pageSize)); - rspData.setTotal(userList.size()); - return rspData; - } - - /** - * 新增用户 - */ - @GetMapping("/add") - public String add(ModelMap mmap) - { - return prefix + "/add"; - } - - /** - * 新增保存用户 - */ - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(UserOperateModel user) - { - Integer userId = users.size() + 1; - user.setUserId(userId); - return AjaxResult.success(users.put(userId, user)); - } - - /** - * 修改用户 - */ - @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) - { - mmap.put("user", users.get(userId)); - return prefix + "/edit"; - } - - /** - * 修改保存用户 - */ - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(UserOperateModel user) - { - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - /** - * 导出 - */ - @PostMapping("/export") - @ResponseBody - public AjaxResult export(UserOperateModel user) - { - List list = new ArrayList(users.values()); - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - return util.exportExcel(list, "用户数据"); - } - - /** - * 下载模板 - */ - @GetMapping("/importTemplate") - @ResponseBody - public AjaxResult importTemplate() - { - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - return util.importTemplateExcel("用户数据"); - } - - /** - * 导入数据 - */ - @PostMapping("/importData") - @ResponseBody - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - List userList = util.importExcel(file.getInputStream()); - String message = importUser(userList, updateSupport); - return AjaxResult.success(message); - } - - /** - * 删除用户 - */ - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - Integer[] userIds = Convert.toIntArray(ids); - for (Integer userId : userIds) - { - users.remove(userId); - } - return AjaxResult.success(); - } - - /** - * 查看详细 - */ - @GetMapping("/detail/{userId}") - public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) - { - mmap.put("user", users.get(userId)); - return prefix + "/detail"; - } - - @PostMapping("/clean") - @ResponseBody - public AjaxResult clean() - { - users.clear(); - return success(); - } - - /** - * 导入用户数据 - * - * @param userList 用户数据列表 - * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 - * @return 结果 - */ - public String importUser(List userList, Boolean isUpdateSupport) - { - if (StringUtils.isNull(userList) || userList.size() == 0) - { - throw new BusinessException("导入用户数据不能为空!"); - } - int successNum = 0; - int failureNum = 0; - StringBuilder successMsg = new StringBuilder(); - StringBuilder failureMsg = new StringBuilder(); - for (UserOperateModel user : userList) - { - try - { - // 验证是否存在这个用户 - boolean userFlag = false; - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(user.getUserName())) - { - userFlag = true; - break; - } - } - if (!userFlag) - { - Integer userId = users.size() + 1; - user.setUserId(userId); - users.put(userId, user); - successNum++; - successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 导入成功"); - } - else if (isUpdateSupport) - { - users.put(user.getUserId(), user); - successNum++; - successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 更新成功"); - } - else - { - failureNum++; - failureMsg.append("
" + failureNum + "、用户 " + user.getUserName() + " 已存在"); - } - } - catch (Exception e) - { - failureNum++; - String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; - failureMsg.append(msg + e.getMessage()); - } - } - if (failureNum > 0) - { - failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); - throw new BusinessException(failureMsg.toString()); - } - else - { - successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); - } - return successMsg.toString(); - } -} +package cn.com.infosouth.web.controller.demo.controller; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.PageDomain; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.core.page.TableSupport; +import cn.com.infosouth.common.core.text.Convert; +import cn.com.infosouth.common.exception.BusinessException; +import cn.com.infosouth.common.utils.StringUtils; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.web.controller.demo.domain.UserOperateModel; + +/** + * 操作控制 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/operate") +public class DemoOperateController extends BaseController +{ + private String prefix = "demo/operate"; + + private final static Map users = new LinkedHashMap(); + { + users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); + users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); + users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); + users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); + users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); + users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); + users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); + users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); + users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); + users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); + users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); + users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); + users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); + users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); + users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); + users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); + users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); + users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); + users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); + users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); + users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); + users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); + users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); + users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); + users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); + users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); + } + + /** + * 表格 + */ + @GetMapping("/table") + public String table() + { + return prefix + "/table"; + } + + /** + * 其他 + */ + @GetMapping("/other") + public String other() + { + return prefix + "/other"; + } + + /** + * 查询数据 + */ + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(UserOperateModel userModel) + { + TableDataInfo rspData = new TableDataInfo(); + List userList = new ArrayList(users.values()); + // 查询条件过滤 + if (StringUtils.isNotEmpty(userModel.getSearchValue())) + { + userList.clear(); + for (Map.Entry entry : users.entrySet()) + { + if (entry.getValue().getUserName().equals(userModel.getSearchValue())) + { + userList.add(entry.getValue()); + } + } + } + else if (StringUtils.isNotEmpty(userModel.getUserName())) + { + userList.clear(); + for (Map.Entry entry : users.entrySet()) + { + if (entry.getValue().getUserName().equals(userModel.getUserName())) + { + userList.add(entry.getValue()); + } + } + } + PageDomain pageDomain = TableSupport.buildPageRequest(); + if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) + { + rspData.setRows(userList); + rspData.setTotal(userList.size()); + return rspData; + } + Integer pageNum = (pageDomain.getPageNum() - 1) * 10; + Integer pageSize = pageDomain.getPageNum() * 10; + if (pageSize > userList.size()) + { + pageSize = userList.size(); + } + rspData.setRows(userList.subList(pageNum, pageSize)); + rspData.setTotal(userList.size()); + return rspData; + } + + /** + * 新增用户 + */ + @GetMapping("/add") + public String add(ModelMap mmap) + { + return prefix + "/add"; + } + + /** + * 新增保存用户 + */ + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(UserOperateModel user) + { + Integer userId = users.size() + 1; + user.setUserId(userId); + return AjaxResult.success(users.put(userId, user)); + } + + /** + * 修改用户 + */ + @GetMapping("/edit/{userId}") + public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) + { + mmap.put("user", users.get(userId)); + return prefix + "/edit"; + } + + /** + * 修改保存用户 + */ + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(UserOperateModel user) + { + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + /** + * 导出 + */ + @PostMapping("/export") + @ResponseBody + public AjaxResult export(UserOperateModel user) + { + List list = new ArrayList(users.values()); + ExcelUtil util = new ExcelUtil(UserOperateModel.class); + return util.exportExcel(list, "用户数据"); + } + + /** + * 下载模板 + */ + @GetMapping("/importTemplate") + @ResponseBody + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(UserOperateModel.class); + return util.importTemplateExcel("用户数据"); + } + + /** + * 导入数据 + */ + @PostMapping("/importData") + @ResponseBody + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(UserOperateModel.class); + List userList = util.importExcel(file.getInputStream()); + String message = importUser(userList, updateSupport); + return AjaxResult.success(message); + } + + /** + * 删除用户 + */ + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + Integer[] userIds = Convert.toIntArray(ids); + for (Integer userId : userIds) + { + users.remove(userId); + } + return AjaxResult.success(); + } + + /** + * 查看详细 + */ + @GetMapping("/detail/{userId}") + public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) + { + mmap.put("user", users.get(userId)); + return prefix + "/detail"; + } + + @PostMapping("/clean") + @ResponseBody + public AjaxResult clean() + { + users.clear(); + return success(); + } + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @return 结果 + */ + public String importUser(List userList, Boolean isUpdateSupport) + { + if (StringUtils.isNull(userList) || userList.size() == 0) + { + throw new BusinessException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (UserOperateModel user : userList) + { + try + { + // 验证是否存在这个用户 + boolean userFlag = false; + for (Map.Entry entry : users.entrySet()) + { + if (entry.getValue().getUserName().equals(user.getUserName())) + { + userFlag = true; + break; + } + } + if (!userFlag) + { + Integer userId = users.size() + 1; + user.setUserId(userId); + users.put(userId, user); + successNum++; + successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 导入成功"); + } + else if (isUpdateSupport) + { + users.put(user.getUserId(), user); + successNum++; + successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、用户 " + user.getUserName() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new BusinessException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoReportController.java similarity index 89% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoReportController.java index 318e8f08b..6ca2b9c09 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoReportController.java @@ -1,53 +1,53 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 报表 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/report") -public class DemoReportController -{ - private String prefix = "demo/report"; - - /** - * 百度ECharts - */ - @GetMapping("/echarts") - public String echarts() - { - return prefix + "/echarts"; - } - - /** - * 图表插件 - */ - @GetMapping("/peity") - public String peity() - { - return prefix + "/peity"; - } - - /** - * 线状图插件 - */ - @GetMapping("/sparkline") - public String sparkline() - { - return prefix + "/sparkline"; - } - - /** - * 图表组合 - */ - @GetMapping("/metrics") - public String metrics() - { - return prefix + "/metrics"; - } -} +package cn.com.infosouth.web.controller.demo.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 报表 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/report") +public class DemoReportController +{ + private String prefix = "demo/report"; + + /** + * 百度ECharts + */ + @GetMapping("/echarts") + public String echarts() + { + return prefix + "/echarts"; + } + + /** + * 图表插件 + */ + @GetMapping("/peity") + public String peity() + { + return prefix + "/peity"; + } + + /** + * 线状图插件 + */ + @GetMapping("/sparkline") + public String sparkline() + { + return prefix + "/sparkline"; + } + + /** + * 图表组合 + */ + @GetMapping("/metrics") + public String metrics() + { + return prefix + "/metrics"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoTableController.java similarity index 93% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoTableController.java index e51c880a5..62e9ef926 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/controller/DemoTableController.java @@ -1,403 +1,403 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * 表格相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/table") -public class DemoTableController extends BaseController -{ - private String prefix = "demo/table"; - - private final static List users = new ArrayList(); - { - users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); - users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); - users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); - users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); - users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); - users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); - users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); - users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); - users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); - users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); - users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); - users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); - users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); - users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); - users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); - users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); - users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); - users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); - users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); - users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); - users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); - users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); - users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); - users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); - } - - /** - * 搜索相关 - */ - @GetMapping("/search") - public String search() - { - return prefix + "/search"; - } - - /** - * 数据汇总 - */ - @GetMapping("/footer") - public String footer() - { - return prefix + "/footer"; - } - - /** - * 组合表头 - */ - @GetMapping("/groupHeader") - public String groupHeader() - { - return prefix + "/groupHeader"; - } - - /** - * 表格导出 - */ - @GetMapping("/export") - public String export() - { - return prefix + "/export"; - } - - /** - * 翻页记住选择 - */ - @GetMapping("/remember") - public String remember() - { - return prefix + "/remember"; - } - - /** - * 跳转至指定页 - */ - @GetMapping("/pageGo") - public String pageGo() - { - return prefix + "/pageGo"; - } - - /** - * 自定义查询参数 - */ - @GetMapping("/params") - public String params() - { - return prefix + "/params"; - } - - /** - * 多表格 - */ - @GetMapping("/multi") - public String multi() - { - return prefix + "/multi"; - } - - /** - * 点击按钮加载表格 - */ - @GetMapping("/button") - public String button() - { - return prefix + "/button"; - } - - /** - * 表格冻结列 - */ - @GetMapping("/fixedColumns") - public String fixedColumns() - { - return prefix + "/fixedColumns"; - } - - /** - * 自定义触发事件 - */ - @GetMapping("/event") - public String event() - { - return prefix + "/event"; - } - - /** - * 表格细节视图 - */ - @GetMapping("/detail") - public String detail() - { - return prefix + "/detail"; - } - - /** - * 表格父子视图 - */ - @GetMapping("/child") - public String child() - { - return prefix + "/child"; - } - - /** - * 表格图片预览 - */ - @GetMapping("/image") - public String image() - { - return prefix + "/image"; - } - - /** - * 动态增删改查 - */ - @GetMapping("/curd") - public String curd() - { - return prefix + "/curd"; - } - - /** - * 表格拖拽操作 - */ - @GetMapping("/reorder") - public String reorder() - { - return prefix + "/reorder"; - } - - /** - * 表格行内编辑操作 - */ - @GetMapping("/editable") - public String editable() - { - return prefix + "/editable"; - } - - /** - * 表格其他操作 - */ - @GetMapping("/other") - public String other() - { - return prefix + "/other"; - } - - /** - * 查询数据 - */ - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(UserTableModel userModel) - { - TableDataInfo rspData = new TableDataInfo(); - List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()])); - Collections.copy(userList, users); - // 查询条件过滤 - if (StringUtils.isNotEmpty(userModel.getUserName())) - { - userList.clear(); - for (UserTableModel user : users) - { - if (user.getUserName().equals(userModel.getUserName())) - { - userList.add(user); - } - } - } - PageDomain pageDomain = TableSupport.buildPageRequest(); - if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) - { - rspData.setRows(userList); - rspData.setTotal(userList.size()); - return rspData; - } - Integer pageNum = (pageDomain.getPageNum() - 1) * 10; - Integer pageSize = pageDomain.getPageNum() * 10; - if (pageSize > userList.size()) - { - pageSize = userList.size(); - } - rspData.setRows(userList.subList(pageNum, pageSize)); - rspData.setTotal(userList.size()); - return rspData; - } -} - -class UserTableModel -{ - /** 用户ID */ - private int userId; - - /** 用户编号 */ - private String userCode; - - /** 用户姓名 */ - private String userName; - - /** 用户性别 */ - private String userSex; - - /** 用户手机 */ - private String userPhone; - - /** 用户邮箱 */ - private String userEmail; - - /** 用户余额 */ - private double userBalance; - - /** 用户状态(0正常 1停用) */ - private String status; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - public UserTableModel() - { - - } - - public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone, - String userEmail, double userBalance, String status) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userSex = userSex; - this.userPhone = userPhone; - this.userEmail = userEmail; - this.userBalance = userBalance; - this.status = status; - this.createTime = DateUtils.getNowDate(); - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserSex() - { - return userSex; - } - - public void setUserSex(String userSex) - { - this.userSex = userSex; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - - public String getUserEmail() - { - return userEmail; - } - - public void setUserEmail(String userEmail) - { - this.userEmail = userEmail; - } - - public double getUserBalance() - { - return userBalance; - } - - public void setUserBalance(double userBalance) - { - this.userBalance = userBalance; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } -} +package cn.com.infosouth.web.controller.demo.controller; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.fasterxml.jackson.annotation.JsonFormat; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.page.PageDomain; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.core.page.TableSupport; +import cn.com.infosouth.common.utils.DateUtils; +import cn.com.infosouth.common.utils.StringUtils; + +/** + * 表格相关 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/demo/table") +public class DemoTableController extends BaseController +{ + private String prefix = "demo/table"; + + private final static List users = new ArrayList(); + { + users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); + users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); + users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); + users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); + users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); + users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); + users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); + users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); + users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); + users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); + users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); + users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); + users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); + users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); + users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); + users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); + users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); + users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); + users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); + users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); + users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); + users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); + users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); + users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); + users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); + users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); + } + + /** + * 搜索相关 + */ + @GetMapping("/search") + public String search() + { + return prefix + "/search"; + } + + /** + * 数据汇总 + */ + @GetMapping("/footer") + public String footer() + { + return prefix + "/footer"; + } + + /** + * 组合表头 + */ + @GetMapping("/groupHeader") + public String groupHeader() + { + return prefix + "/groupHeader"; + } + + /** + * 表格导出 + */ + @GetMapping("/export") + public String export() + { + return prefix + "/export"; + } + + /** + * 翻页记住选择 + */ + @GetMapping("/remember") + public String remember() + { + return prefix + "/remember"; + } + + /** + * 跳转至指定页 + */ + @GetMapping("/pageGo") + public String pageGo() + { + return prefix + "/pageGo"; + } + + /** + * 自定义查询参数 + */ + @GetMapping("/params") + public String params() + { + return prefix + "/params"; + } + + /** + * 多表格 + */ + @GetMapping("/multi") + public String multi() + { + return prefix + "/multi"; + } + + /** + * 点击按钮加载表格 + */ + @GetMapping("/button") + public String button() + { + return prefix + "/button"; + } + + /** + * 表格冻结列 + */ + @GetMapping("/fixedColumns") + public String fixedColumns() + { + return prefix + "/fixedColumns"; + } + + /** + * 自定义触发事件 + */ + @GetMapping("/event") + public String event() + { + return prefix + "/event"; + } + + /** + * 表格细节视图 + */ + @GetMapping("/detail") + public String detail() + { + return prefix + "/detail"; + } + + /** + * 表格父子视图 + */ + @GetMapping("/child") + public String child() + { + return prefix + "/child"; + } + + /** + * 表格图片预览 + */ + @GetMapping("/image") + public String image() + { + return prefix + "/image"; + } + + /** + * 动态增删改查 + */ + @GetMapping("/curd") + public String curd() + { + return prefix + "/curd"; + } + + /** + * 表格拖拽操作 + */ + @GetMapping("/reorder") + public String reorder() + { + return prefix + "/reorder"; + } + + /** + * 表格行内编辑操作 + */ + @GetMapping("/editable") + public String editable() + { + return prefix + "/editable"; + } + + /** + * 表格其他操作 + */ + @GetMapping("/other") + public String other() + { + return prefix + "/other"; + } + + /** + * 查询数据 + */ + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(UserTableModel userModel) + { + TableDataInfo rspData = new TableDataInfo(); + List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()])); + Collections.copy(userList, users); + // 查询条件过滤 + if (StringUtils.isNotEmpty(userModel.getUserName())) + { + userList.clear(); + for (UserTableModel user : users) + { + if (user.getUserName().equals(userModel.getUserName())) + { + userList.add(user); + } + } + } + PageDomain pageDomain = TableSupport.buildPageRequest(); + if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) + { + rspData.setRows(userList); + rspData.setTotal(userList.size()); + return rspData; + } + Integer pageNum = (pageDomain.getPageNum() - 1) * 10; + Integer pageSize = pageDomain.getPageNum() * 10; + if (pageSize > userList.size()) + { + pageSize = userList.size(); + } + rspData.setRows(userList.subList(pageNum, pageSize)); + rspData.setTotal(userList.size()); + return rspData; + } +} + +class UserTableModel +{ + /** 用户ID */ + private int userId; + + /** 用户编号 */ + private String userCode; + + /** 用户姓名 */ + private String userName; + + /** 用户性别 */ + private String userSex; + + /** 用户手机 */ + private String userPhone; + + /** 用户邮箱 */ + private String userEmail; + + /** 用户余额 */ + private double userBalance; + + /** 用户状态(0正常 1停用) */ + private String status; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + public UserTableModel() + { + + } + + public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone, + String userEmail, double userBalance, String status) + { + this.userId = userId; + this.userCode = userCode; + this.userName = userName; + this.userSex = userSex; + this.userPhone = userPhone; + this.userEmail = userEmail; + this.userBalance = userBalance; + this.status = status; + this.createTime = DateUtils.getNowDate(); + } + + public int getUserId() + { + return userId; + } + + public void setUserId(int userId) + { + this.userId = userId; + } + + public String getUserCode() + { + return userCode; + } + + public void setUserCode(String userCode) + { + this.userCode = userCode; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserSex() + { + return userSex; + } + + public void setUserSex(String userSex) + { + this.userSex = userSex; + } + + public String getUserPhone() + { + return userPhone; + } + + public void setUserPhone(String userPhone) + { + this.userPhone = userPhone; + } + + public String getUserEmail() + { + return userEmail; + } + + public void setUserEmail(String userEmail) + { + this.userEmail = userEmail; + } + + public double getUserBalance() + { + return userBalance; + } + + public void setUserBalance(double userBalance) + { + this.userBalance = userBalance; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/domain/UserOperateModel.java similarity index 88% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/domain/UserOperateModel.java index ac95abf2f..1e1d7cb1b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/demo/domain/UserOperateModel.java @@ -1,147 +1,147 @@ -package com.ruoyi.web.controller.demo.domain; - -import java.util.Date; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.DateUtils; - -public class UserOperateModel extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - private int userId; - - @Excel(name = "用户编号") - private String userCode; - - @Excel(name = "用户姓名") - private String userName; - - @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") - private String userSex; - - @Excel(name = "用户手机") - private String userPhone; - - @Excel(name = "用户邮箱") - private String userEmail; - - @Excel(name = "用户余额") - private double userBalance; - - @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用") - private String status; - - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) - private Date createTime; - - public UserOperateModel() - { - - } - - public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone, - String userEmail, double userBalance, String status) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userSex = userSex; - this.userPhone = userPhone; - this.userEmail = userEmail; - this.userBalance = userBalance; - this.status = status; - this.createTime = DateUtils.getNowDate(); - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserSex() - { - return userSex; - } - - public void setUserSex(String userSex) - { - this.userSex = userSex; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - - public String getUserEmail() - { - return userEmail; - } - - public void setUserEmail(String userEmail) - { - this.userEmail = userEmail; - } - - public double getUserBalance() - { - return userBalance; - } - - public void setUserBalance(double userBalance) - { - this.userBalance = userBalance; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } +package cn.com.infosouth.web.controller.demo.domain; + +import java.util.Date; +import cn.com.infosouth.common.annotation.Excel; +import cn.com.infosouth.common.annotation.Excel.Type; +import cn.com.infosouth.common.core.domain.BaseEntity; +import cn.com.infosouth.common.utils.DateUtils; + +public class UserOperateModel extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + private int userId; + + @Excel(name = "用户编号") + private String userCode; + + @Excel(name = "用户姓名") + private String userName; + + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String userSex; + + @Excel(name = "用户手机") + private String userPhone; + + @Excel(name = "用户邮箱") + private String userEmail; + + @Excel(name = "用户余额") + private double userBalance; + + @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用") + private String status; + + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) + private Date createTime; + + public UserOperateModel() + { + + } + + public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone, + String userEmail, double userBalance, String status) + { + this.userId = userId; + this.userCode = userCode; + this.userName = userName; + this.userSex = userSex; + this.userPhone = userPhone; + this.userEmail = userEmail; + this.userBalance = userBalance; + this.status = status; + this.createTime = DateUtils.getNowDate(); + } + + public int getUserId() + { + return userId; + } + + public void setUserId(int userId) + { + this.userId = userId; + } + + public String getUserCode() + { + return userCode; + } + + public void setUserCode(String userCode) + { + this.userCode = userCode; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserSex() + { + return userSex; + } + + public void setUserSex(String userSex) + { + this.userSex = userSex; + } + + public String getUserPhone() + { + return userPhone; + } + + public void setUserPhone(String userPhone) + { + this.userPhone = userPhone; + } + + public String getUserEmail() + { + return userEmail; + } + + public void setUserEmail(String userEmail) + { + this.userEmail = userEmail; + } + + public double getUserBalance() + { + return userBalance; + } + + public void setUserBalance(double userBalance) + { + this.userBalance = userBalance; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/DruidController.java similarity index 82% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/DruidController.java index b2647893c..21ca9efea 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/DruidController.java @@ -1,26 +1,26 @@ -package com.ruoyi.web.controller.monitor; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * druid 监控 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/data") -public class DruidController extends BaseController -{ - private String prefix = "/druid"; - - @RequiresPermissions("monitor:data:view") - @GetMapping() - public String index() - { - return redirect(prefix + "/index"); - } -} +package cn.com.infosouth.web.controller.monitor; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import cn.com.infosouth.common.core.controller.BaseController; + +/** + * druid 监控 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/monitor/data") +public class DruidController extends BaseController +{ + private String prefix = "/druid"; + + @RequiresPermissions("monitor:data:view") + @GetMapping() + public String index() + { + return redirect(prefix + "/index"); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/ServerController.java similarity index 80% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/ServerController.java index 764197d39..b6b113cc9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/ServerController.java @@ -1,31 +1,31 @@ -package com.ruoyi.web.controller.monitor; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.framework.web.domain.Server; - -/** - * 服务器监控 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/server") -public class ServerController extends BaseController -{ - private String prefix = "monitor/server"; - - @RequiresPermissions("monitor:server:view") - @GetMapping() - public String server(ModelMap mmap) throws Exception - { - Server server = new Server(); - server.copyTo(); - mmap.put("server", server); - return prefix + "/server"; - } -} +package cn.com.infosouth.web.controller.monitor; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.framework.web.domain.Server; + +/** + * 服务器监控 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/monitor/server") +public class ServerController extends BaseController +{ + private String prefix = "monitor/server"; + + @RequiresPermissions("monitor:server:view") + @GetMapping() + public String server(ModelMap mmap) throws Exception + { + Server server = new Server(); + server.copyTo(); + mmap.put("server", server); + return prefix + "/server"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysLogininforController.java similarity index 81% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysLogininforController.java index 688c088b2..8d089f70a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysLogininforController.java @@ -1,94 +1,94 @@ -package com.ruoyi.web.controller.monitor; - -import java.util.List; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.system.domain.SysLogininfor; -import com.ruoyi.system.service.ISysLogininforService; - -/** - * 系统访问记录 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/logininfor") -public class SysLogininforController extends BaseController -{ - private String prefix = "monitor/logininfor"; - - @Autowired - private ISysLogininforService logininforService; - - @Autowired - private SysPasswordService passwordService; - - @RequiresPermissions("monitor:logininfor:view") - @GetMapping() - public String logininfor() - { - return prefix + "/logininfor"; - } - - @RequiresPermissions("monitor:logininfor:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysLogininfor logininfor) - { - startPage(); - List list = logininforService.selectLogininforList(logininfor); - return getDataTable(list); - } - - @Log(title = "登陆日志", businessType = BusinessType.EXPORT) - @RequiresPermissions("monitor:logininfor:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysLogininfor logininfor) - { - List list = logininforService.selectLogininforList(logininfor); - ExcelUtil util = new ExcelUtil(SysLogininfor.class); - return util.exportExcel(list, "登陆日志"); - } - - @RequiresPermissions("monitor:logininfor:remove") - @Log(title = "登陆日志", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(logininforService.deleteLogininforByIds(ids)); - } - - @RequiresPermissions("monitor:logininfor:remove") - @Log(title = "登陆日志", businessType = BusinessType.CLEAN) - @PostMapping("/clean") - @ResponseBody - public AjaxResult clean() - { - logininforService.cleanLogininfor(); - return success(); - } - - @RequiresPermissions("monitor:logininfor:unlock") - @Log(title = "账户解锁", businessType = BusinessType.OTHER) - @PostMapping("/unlock") - @ResponseBody - public AjaxResult unlock(String loginName) - { - passwordService.unlock(loginName); - return success(); - } -} +package cn.com.infosouth.web.controller.monitor; + +import java.util.List; +import cn.com.infosouth.framework.shiro.service.SysPasswordService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.system.domain.SysLogininfor; +import cn.com.infosouth.system.service.ISysLogininforService; + +/** + * 系统访问记录 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController +{ + private String prefix = "monitor/logininfor"; + + @Autowired + private ISysLogininforService logininforService; + + @Autowired + private SysPasswordService passwordService; + + @RequiresPermissions("monitor:logininfor:view") + @GetMapping() + public String logininfor() + { + return prefix + "/logininfor"; + } + + @RequiresPermissions("monitor:logininfor:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysLogininfor logininfor) + { + startPage(); + List list = logininforService.selectLogininforList(logininfor); + return getDataTable(list); + } + + @Log(title = "登陆日志", businessType = BusinessType.EXPORT) + @RequiresPermissions("monitor:logininfor:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysLogininfor logininfor) + { + List list = logininforService.selectLogininforList(logininfor); + ExcelUtil util = new ExcelUtil(SysLogininfor.class); + return util.exportExcel(list, "登陆日志"); + } + + @RequiresPermissions("monitor:logininfor:remove") + @Log(title = "登陆日志", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(logininforService.deleteLogininforByIds(ids)); + } + + @RequiresPermissions("monitor:logininfor:remove") + @Log(title = "登陆日志", businessType = BusinessType.CLEAN) + @PostMapping("/clean") + @ResponseBody + public AjaxResult clean() + { + logininforService.cleanLogininfor(); + return success(); + } + + @RequiresPermissions("monitor:logininfor:unlock") + @Log(title = "账户解锁", businessType = BusinessType.OTHER) + @PostMapping("/unlock") + @ResponseBody + public AjaxResult unlock(String loginName) + { + passwordService.unlock(loginName); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysOperlogController.java similarity index 82% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysOperlogController.java index 468866e18..fd8708406 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysOperlogController.java @@ -1,89 +1,89 @@ -package com.ruoyi.web.controller.monitor; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.system.domain.SysOperLog; -import com.ruoyi.system.service.ISysOperLogService; - -/** - * 操作日志记录 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/operlog") -public class SysOperlogController extends BaseController -{ - private String prefix = "monitor/operlog"; - - @Autowired - private ISysOperLogService operLogService; - - @RequiresPermissions("monitor:operlog:view") - @GetMapping() - public String operlog() - { - return prefix + "/operlog"; - } - - @RequiresPermissions("monitor:operlog:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysOperLog operLog) - { - startPage(); - List list = operLogService.selectOperLogList(operLog); - return getDataTable(list); - } - - @Log(title = "操作日志", businessType = BusinessType.EXPORT) - @RequiresPermissions("monitor:operlog:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysOperLog operLog) - { - List list = operLogService.selectOperLogList(operLog); - ExcelUtil util = new ExcelUtil(SysOperLog.class); - return util.exportExcel(list, "操作日志"); - } - - @RequiresPermissions("monitor:operlog:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(operLogService.deleteOperLogByIds(ids)); - } - - @RequiresPermissions("monitor:operlog:detail") - @GetMapping("/detail/{operId}") - public String detail(@PathVariable("operId") Long operId, ModelMap mmap) - { - mmap.put("operLog", operLogService.selectOperLogById(operId)); - return prefix + "/detail"; - } - - @Log(title = "操作日志", businessType = BusinessType.CLEAN) - @RequiresPermissions("monitor:operlog:remove") - @PostMapping("/clean") - @ResponseBody - public AjaxResult clean() - { - operLogService.cleanOperLog(); - return success(); - } -} +package cn.com.infosouth.web.controller.monitor; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.system.domain.SysOperLog; +import cn.com.infosouth.system.service.ISysOperLogService; + +/** + * 操作日志记录 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController +{ + private String prefix = "monitor/operlog"; + + @Autowired + private ISysOperLogService operLogService; + + @RequiresPermissions("monitor:operlog:view") + @GetMapping() + public String operlog() + { + return prefix + "/operlog"; + } + + @RequiresPermissions("monitor:operlog:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysOperLog operLog) + { + startPage(); + List list = operLogService.selectOperLogList(operLog); + return getDataTable(list); + } + + @Log(title = "操作日志", businessType = BusinessType.EXPORT) + @RequiresPermissions("monitor:operlog:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysOperLog operLog) + { + List list = operLogService.selectOperLogList(operLog); + ExcelUtil util = new ExcelUtil(SysOperLog.class); + return util.exportExcel(list, "操作日志"); + } + + @RequiresPermissions("monitor:operlog:remove") + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(operLogService.deleteOperLogByIds(ids)); + } + + @RequiresPermissions("monitor:operlog:detail") + @GetMapping("/detail/{operId}") + public String detail(@PathVariable("operId") Long operId, ModelMap mmap) + { + mmap.put("operLog", operLogService.selectOperLogById(operId)); + return prefix + "/detail"; + } + + @Log(title = "操作日志", businessType = BusinessType.CLEAN) + @RequiresPermissions("monitor:operlog:remove") + @PostMapping("/clean") + @ResponseBody + public AjaxResult clean() + { + operLogService.cleanOperLog(); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysUserOnlineController.java similarity index 83% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysUserOnlineController.java index c3ea3ad72..d0f9b5ca0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/monitor/SysUserOnlineController.java @@ -1,114 +1,114 @@ -package com.ruoyi.web.controller.monitor; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.enums.OnlineStatus; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.framework.shiro.session.OnlineSessionDAO; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysUserOnline; -import com.ruoyi.system.service.ISysUserOnlineService; - -/** - * 在线用户监控 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/online") -public class SysUserOnlineController extends BaseController -{ - private String prefix = "monitor/online"; - - @Autowired - private ISysUserOnlineService userOnlineService; - - @Autowired - private OnlineSessionDAO onlineSessionDAO; - - @RequiresPermissions("monitor:online:view") - @GetMapping() - public String online() - { - return prefix + "/online"; - } - - @RequiresPermissions("monitor:online:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysUserOnline userOnline) - { - startPage(); - List list = userOnlineService.selectUserOnlineList(userOnline); - return getDataTable(list); - } - - @RequiresPermissions("monitor:online:batchForceLogout") - @Log(title = "在线用户", businessType = BusinessType.FORCE) - @PostMapping("/batchForceLogout") - @ResponseBody - public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids) - { - for (String sessionId : ids) - { - SysUserOnline online = userOnlineService.selectOnlineById(sessionId); - if (online == null) - { - return error("用户已下线"); - } - OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); - if (onlineSession == null) - { - return error("用户已下线"); - } - if (sessionId.equals(ShiroUtils.getSessionId())) - { - return error("当前登陆用户无法强退"); - } - onlineSession.setStatus(OnlineStatus.off_line); - onlineSessionDAO.update(onlineSession); - online.setStatus(OnlineStatus.off_line); - userOnlineService.saveOnline(online); - } - return success(); - } - - @RequiresPermissions("monitor:online:forceLogout") - @Log(title = "在线用户", businessType = BusinessType.FORCE) - @PostMapping("/forceLogout") - @ResponseBody - public AjaxResult forceLogout(String sessionId) - { - SysUserOnline online = userOnlineService.selectOnlineById(sessionId); - if (sessionId.equals(ShiroUtils.getSessionId())) - { - return error("当前登陆用户无法强退"); - } - if (online == null) - { - return error("用户已下线"); - } - OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); - if (onlineSession == null) - { - return error("用户已下线"); - } - onlineSession.setStatus(OnlineStatus.off_line); - onlineSessionDAO.update(onlineSession); - online.setStatus(OnlineStatus.off_line); - userOnlineService.saveOnline(online); - return success(); - } -} +package cn.com.infosouth.web.controller.monitor; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.enums.OnlineStatus; +import cn.com.infosouth.framework.shiro.session.OnlineSession; +import cn.com.infosouth.framework.shiro.session.OnlineSessionDAO; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysUserOnline; +import cn.com.infosouth.system.service.ISysUserOnlineService; + +/** + * 在线用户监控 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/monitor/online") +public class SysUserOnlineController extends BaseController +{ + private String prefix = "monitor/online"; + + @Autowired + private ISysUserOnlineService userOnlineService; + + @Autowired + private OnlineSessionDAO onlineSessionDAO; + + @RequiresPermissions("monitor:online:view") + @GetMapping() + public String online() + { + return prefix + "/online"; + } + + @RequiresPermissions("monitor:online:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysUserOnline userOnline) + { + startPage(); + List list = userOnlineService.selectUserOnlineList(userOnline); + return getDataTable(list); + } + + @RequiresPermissions("monitor:online:batchForceLogout") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @PostMapping("/batchForceLogout") + @ResponseBody + public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids) + { + for (String sessionId : ids) + { + SysUserOnline online = userOnlineService.selectOnlineById(sessionId); + if (online == null) + { + return error("用户已下线"); + } + OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); + if (onlineSession == null) + { + return error("用户已下线"); + } + if (sessionId.equals(ShiroUtils.getSessionId())) + { + return error("当前登陆用户无法强退"); + } + onlineSession.setStatus(OnlineStatus.off_line); + onlineSessionDAO.update(onlineSession); + online.setStatus(OnlineStatus.off_line); + userOnlineService.saveOnline(online); + } + return success(); + } + + @RequiresPermissions("monitor:online:forceLogout") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @PostMapping("/forceLogout") + @ResponseBody + public AjaxResult forceLogout(String sessionId) + { + SysUserOnline online = userOnlineService.selectOnlineById(sessionId); + if (sessionId.equals(ShiroUtils.getSessionId())) + { + return error("当前登陆用户无法强退"); + } + if (online == null) + { + return error("用户已下线"); + } + OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); + if (onlineSession == null) + { + return error("用户已下线"); + } + onlineSession.setStatus(OnlineStatus.off_line); + onlineSessionDAO.update(onlineSession); + online.setStatus(OnlineStatus.off_line); + userOnlineService.saveOnline(online); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysCaptchaController.java similarity index 93% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysCaptchaController.java index 230cc3b29..f1e7de3f5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysCaptchaController.java @@ -1,92 +1,92 @@ -package com.ruoyi.web.controller.system; - -import java.awt.image.BufferedImage; -import java.io.IOException; -import javax.annotation.Resource; -import javax.imageio.ImageIO; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; -import com.google.code.kaptcha.Constants; -import com.google.code.kaptcha.Producer; -import com.ruoyi.common.core.controller.BaseController; - -/** - * 图片验证码(支持算术形式) - * - * @author ruoyi - */ -@Controller -@RequestMapping("/captcha") -public class SysCaptchaController extends BaseController -{ - @Resource(name = "captchaProducer") - private Producer captchaProducer; - - @Resource(name = "captchaProducerMath") - private Producer captchaProducerMath; - - /** - * 验证码生成 - */ - @GetMapping(value = "/captchaImage") - public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) - { - ServletOutputStream out = null; - try - { - HttpSession session = request.getSession(); - response.setDateHeader("Expires", 0); - response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); - response.addHeader("Cache-Control", "post-check=0, pre-check=0"); - response.setHeader("Pragma", "no-cache"); - response.setContentType("image/jpeg"); - - String type = request.getParameter("type"); - String capStr = null; - String code = null; - BufferedImage bi = null; - if ("math".equals(type)) - { - String capText = captchaProducerMath.createText(); - capStr = capText.substring(0, capText.lastIndexOf("@")); - code = capText.substring(capText.lastIndexOf("@") + 1); - bi = captchaProducerMath.createImage(capStr); - } - else if ("char".equals(type)) - { - capStr = code = captchaProducer.createText(); - bi = captchaProducer.createImage(capStr); - } - session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code); - out = response.getOutputStream(); - ImageIO.write(bi, "jpg", out); - out.flush(); - - } - catch (Exception e) - { - e.printStackTrace(); - } - finally - { - try - { - if (out != null) - { - out.close(); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - } - return null; - } +package cn.com.infosouth.web.controller.system; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; +import com.google.code.kaptcha.Constants; +import com.google.code.kaptcha.Producer; +import cn.com.infosouth.common.core.controller.BaseController; + +/** + * 图片验证码(支持算术形式) + * + * @author ruoyi + */ +@Controller +@RequestMapping("/captcha") +public class SysCaptchaController extends BaseController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + /** + * 验证码生成 + */ + @GetMapping(value = "/captchaImage") + public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) + { + ServletOutputStream out = null; + try + { + HttpSession session = request.getSession(); + response.setDateHeader("Expires", 0); + response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); + response.addHeader("Cache-Control", "post-check=0, pre-check=0"); + response.setHeader("Pragma", "no-cache"); + response.setContentType("image/jpeg"); + + String type = request.getParameter("type"); + String capStr = null; + String code = null; + BufferedImage bi = null; + if ("math".equals(type)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + bi = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(type)) + { + capStr = code = captchaProducer.createText(); + bi = captchaProducer.createImage(capStr); + } + session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code); + out = response.getOutputStream(); + ImageIO.write(bi, "jpg", out); + out.flush(); + + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + } + return null; + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysConfigController.java similarity index 85% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysConfigController.java index 139469d25..2b698cb65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysConfigController.java @@ -1,144 +1,144 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysConfig; -import com.ruoyi.system.service.ISysConfigService; - -/** - * 参数配置 信息操作处理 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/config") -public class SysConfigController extends BaseController -{ - private String prefix = "system/config"; - - @Autowired - private ISysConfigService configService; - - @RequiresPermissions("system:config:view") - @GetMapping() - public String config() - { - return prefix + "/config"; - } - - /** - * 查询参数配置列表 - */ - @RequiresPermissions("system:config:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysConfig config) - { - startPage(); - List list = configService.selectConfigList(config); - return getDataTable(list); - } - - @Log(title = "参数管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:config:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysConfig config) - { - List list = configService.selectConfigList(config); - ExcelUtil util = new ExcelUtil(SysConfig.class); - return util.exportExcel(list, "参数数据"); - } - - /** - * 新增参数配置 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存参数配置 - */ - @RequiresPermissions("system:config:add") - @Log(title = "参数管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysConfig config) - { - if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) - { - return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); - } - config.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(configService.insertConfig(config)); - } - - /** - * 修改参数配置 - */ - @GetMapping("/edit/{configId}") - public String edit(@PathVariable("configId") Long configId, ModelMap mmap) - { - mmap.put("config", configService.selectConfigById(configId)); - return prefix + "/edit"; - } - - /** - * 修改保存参数配置 - */ - @RequiresPermissions("system:config:edit") - @Log(title = "参数管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysConfig config) - { - if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) - { - return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); - } - config.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(configService.updateConfig(config)); - } - - /** - * 删除参数配置 - */ - @RequiresPermissions("system:config:remove") - @Log(title = "参数管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(configService.deleteConfigByIds(ids)); - } - - /** - * 校验参数键名 - */ - @PostMapping("/checkConfigKeyUnique") - @ResponseBody - public String checkConfigKeyUnique(SysConfig config) - { - return configService.checkConfigKeyUnique(config); - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysConfig; +import cn.com.infosouth.system.service.ISysConfigService; + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/config") +public class SysConfigController extends BaseController +{ + private String prefix = "system/config"; + + @Autowired + private ISysConfigService configService; + + @RequiresPermissions("system:config:view") + @GetMapping() + public String config() + { + return prefix + "/config"; + } + + /** + * 查询参数配置列表 + */ + @RequiresPermissions("system:config:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysConfig config) + { + startPage(); + List list = configService.selectConfigList(config); + return getDataTable(list); + } + + @Log(title = "参数管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:config:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(SysConfig.class); + return util.exportExcel(list, "参数数据"); + } + + /** + * 新增参数配置 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存参数配置 + */ + @RequiresPermissions("system:config:add") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysConfig config) + { + if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(configService.insertConfig(config)); + } + + /** + * 修改参数配置 + */ + @GetMapping("/edit/{configId}") + public String edit(@PathVariable("configId") Long configId, ModelMap mmap) + { + mmap.put("config", configService.selectConfigById(configId)); + return prefix + "/edit"; + } + + /** + * 修改保存参数配置 + */ + @RequiresPermissions("system:config:edit") + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysConfig config) + { + if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(configService.updateConfig(config)); + } + + /** + * 删除参数配置 + */ + @RequiresPermissions("system:config:remove") + @Log(title = "参数管理", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(configService.deleteConfigByIds(ids)); + } + + /** + * 校验参数键名 + */ + @PostMapping("/checkConfigKeyUnique") + @ResponseBody + public String checkConfigKeyUnique(SysConfig config) + { + return configService.checkConfigKeyUnique(config); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDeptController.java similarity index 87% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDeptController.java index bb17d9f3b..f03c8a0f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDeptController.java @@ -1,180 +1,180 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysDept; -import com.ruoyi.system.domain.SysRole; -import com.ruoyi.system.service.ISysDeptService; - -/** - * 部门信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/dept") -public class SysDeptController extends BaseController -{ - private String prefix = "system/dept"; - - @Autowired - private ISysDeptService deptService; - - @RequiresPermissions("system:dept:view") - @GetMapping() - public String dept() - { - return prefix + "/dept"; - } - - @RequiresPermissions("system:dept:list") - @PostMapping("/list") - @ResponseBody - public List list(SysDept dept) - { - List deptList = deptService.selectDeptList(dept); - return deptList; - } - - /** - * 新增部门 - */ - @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) - { - mmap.put("dept", deptService.selectDeptById(parentId)); - return prefix + "/add"; - } - - /** - * 新增保存部门 - */ - @Log(title = "部门管理", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dept:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDept dept) - { - if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) - { - return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); - } - dept.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(deptService.insertDept(dept)); - } - - /** - * 修改 - */ - @GetMapping("/edit/{deptId}") - public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) - { - SysDept dept = deptService.selectDeptById(deptId); - if (StringUtils.isNotNull(dept) && 100L == deptId) - { - dept.setParentName("无"); - } - mmap.put("dept", dept); - return prefix + "/edit"; - } - - /** - * 保存 - */ - @Log(title = "部门管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dept:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDept dept) - { - if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) - { - return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); - } - else if (dept.getParentId().equals(dept.getDeptId())) - { - return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); - } - dept.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(deptService.updateDept(dept)); - } - - /** - * 删除 - */ - @Log(title = "部门管理", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dept:remove") - @GetMapping("/remove/{deptId}") - @ResponseBody - public AjaxResult remove(@PathVariable("deptId") Long deptId) - { - if (deptService.selectDeptCount(deptId) > 0) - { - return AjaxResult.warn("存在下级部门,不允许删除"); - } - if (deptService.checkDeptExistUser(deptId)) - { - return AjaxResult.warn("部门存在用户,不允许删除"); - } - return toAjax(deptService.deleteDeptById(deptId)); - } - - /** - * 校验部门名称 - */ - @PostMapping("/checkDeptNameUnique") - @ResponseBody - public String checkDeptNameUnique(SysDept dept) - { - return deptService.checkDeptNameUnique(dept); - } - - /** - * 选择部门树 - */ - @GetMapping("/selectDeptTree/{deptId}") - public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) - { - mmap.put("dept", deptService.selectDeptById(deptId)); - return prefix + "/tree"; - } - - /** - * 加载部门列表树 - */ - @GetMapping("/treeData") - @ResponseBody - public List treeData() - { - List ztrees = deptService.selectDeptTree(new SysDept()); - return ztrees; - } - - /** - * 加载角色部门(数据权限)列表树 - */ - @GetMapping("/roleDeptTreeData") - @ResponseBody - public List deptTreeData(SysRole role) - { - List ztrees = deptService.roleDeptTreeData(role); - return ztrees; - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.domain.Ztree; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.StringUtils; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysDept; +import cn.com.infosouth.system.domain.SysRole; +import cn.com.infosouth.system.service.ISysDeptService; + +/** + * 部门信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/dept") +public class SysDeptController extends BaseController +{ + private String prefix = "system/dept"; + + @Autowired + private ISysDeptService deptService; + + @RequiresPermissions("system:dept:view") + @GetMapping() + public String dept() + { + return prefix + "/dept"; + } + + @RequiresPermissions("system:dept:list") + @PostMapping("/list") + @ResponseBody + public List list(SysDept dept) + { + List deptList = deptService.selectDeptList(dept); + return deptList; + } + + /** + * 新增部门 + */ + @GetMapping("/add/{parentId}") + public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) + { + mmap.put("dept", deptService.selectDeptById(parentId)); + return prefix + "/add"; + } + + /** + * 新增保存部门 + */ + @Log(title = "部门管理", businessType = BusinessType.INSERT) + @RequiresPermissions("system:dept:add") + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysDept dept) + { + if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + dept.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(deptService.insertDept(dept)); + } + + /** + * 修改 + */ + @GetMapping("/edit/{deptId}") + public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) + { + SysDept dept = deptService.selectDeptById(deptId); + if (StringUtils.isNotNull(dept) && 100L == deptId) + { + dept.setParentName("无"); + } + mmap.put("dept", dept); + return prefix + "/edit"; + } + + /** + * 保存 + */ + @Log(title = "部门管理", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:dept:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysDept dept) + { + if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(dept.getDeptId())) + { + return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + dept.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(deptService.updateDept(dept)); + } + + /** + * 删除 + */ + @Log(title = "部门管理", businessType = BusinessType.DELETE) + @RequiresPermissions("system:dept:remove") + @GetMapping("/remove/{deptId}") + @ResponseBody + public AjaxResult remove(@PathVariable("deptId") Long deptId) + { + if (deptService.selectDeptCount(deptId) > 0) + { + return AjaxResult.warn("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return AjaxResult.warn("部门存在用户,不允许删除"); + } + return toAjax(deptService.deleteDeptById(deptId)); + } + + /** + * 校验部门名称 + */ + @PostMapping("/checkDeptNameUnique") + @ResponseBody + public String checkDeptNameUnique(SysDept dept) + { + return deptService.checkDeptNameUnique(dept); + } + + /** + * 选择部门树 + */ + @GetMapping("/selectDeptTree/{deptId}") + public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) + { + mmap.put("dept", deptService.selectDeptById(deptId)); + return prefix + "/tree"; + } + + /** + * 加载部门列表树 + */ + @GetMapping("/treeData") + @ResponseBody + public List treeData() + { + List ztrees = deptService.selectDeptTree(new SysDept()); + return ztrees; + } + + /** + * 加载角色部门(数据权限)列表树 + */ + @GetMapping("/roleDeptTreeData") + @ResponseBody + public List deptTreeData(SysRole role) + { + List ztrees = deptService.roleDeptTreeData(role); + return ztrees; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictDataController.java similarity index 85% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictDataController.java index 945109858..2976c67c0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictDataController.java @@ -1,120 +1,120 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysDictData; -import com.ruoyi.system.service.ISysDictDataService; - -/** - * 数据字典信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/dict/data") -public class SysDictDataController extends BaseController -{ - private String prefix = "system/dict/data"; - - @Autowired - private ISysDictDataService dictDataService; - - @RequiresPermissions("system:dict:view") - @GetMapping() - public String dictData() - { - return prefix + "/data"; - } - - @PostMapping("/list") - @RequiresPermissions("system:dict:list") - @ResponseBody - public TableDataInfo list(SysDictData dictData) - { - startPage(); - List list = dictDataService.selectDictDataList(dictData); - return getDataTable(list); - } - - @Log(title = "字典数据", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:dict:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysDictData dictData) - { - List list = dictDataService.selectDictDataList(dictData); - ExcelUtil util = new ExcelUtil(SysDictData.class); - return util.exportExcel(list, "字典数据"); - } - - /** - * 新增字典类型 - */ - @GetMapping("/add/{dictType}") - public String add(@PathVariable("dictType") String dictType, ModelMap mmap) - { - mmap.put("dictType", dictType); - return prefix + "/add"; - } - - /** - * 新增保存字典类型 - */ - @Log(title = "字典数据", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDictData dict) - { - dict.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(dictDataService.insertDictData(dict)); - } - - /** - * 修改字典类型 - */ - @GetMapping("/edit/{dictCode}") - public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) - { - mmap.put("dict", dictDataService.selectDictDataById(dictCode)); - return prefix + "/edit"; - } - - /** - * 修改保存字典类型 - */ - @Log(title = "字典数据", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDictData dict) - { - dict.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(dictDataService.updateDictData(dict)); - } - - @Log(title = "字典数据", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dict:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(dictDataService.deleteDictDataByIds(ids)); - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysDictData; +import cn.com.infosouth.system.service.ISysDictDataService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/dict/data") +public class SysDictDataController extends BaseController +{ + private String prefix = "system/dict/data"; + + @Autowired + private ISysDictDataService dictDataService; + + @RequiresPermissions("system:dict:view") + @GetMapping() + public String dictData() + { + return prefix + "/data"; + } + + @PostMapping("/list") + @RequiresPermissions("system:dict:list") + @ResponseBody + public TableDataInfo list(SysDictData dictData) + { + startPage(); + List list = dictDataService.selectDictDataList(dictData); + return getDataTable(list); + } + + @Log(title = "字典数据", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:dict:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + return util.exportExcel(list, "字典数据"); + } + + /** + * 新增字典类型 + */ + @GetMapping("/add/{dictType}") + public String add(@PathVariable("dictType") String dictType, ModelMap mmap) + { + mmap.put("dictType", dictType); + return prefix + "/add"; + } + + /** + * 新增保存字典类型 + */ + @Log(title = "字典数据", businessType = BusinessType.INSERT) + @RequiresPermissions("system:dict:add") + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysDictData dict) + { + dict.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改字典类型 + */ + @GetMapping("/edit/{dictCode}") + public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) + { + mmap.put("dict", dictDataService.selectDictDataById(dictCode)); + return prefix + "/edit"; + } + + /** + * 修改保存字典类型 + */ + @Log(title = "字典数据", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:dict:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysDictData dict) + { + dict.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(dictDataService.updateDictData(dict)); + } + + @Log(title = "字典数据", businessType = BusinessType.DELETE) + @RequiresPermissions("system:dict:remove") + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(dictDataService.deleteDictDataByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictTypeController.java similarity index 87% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictTypeController.java index bc8950d76..1579b3e1d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysDictTypeController.java @@ -1,182 +1,182 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysDictType; -import com.ruoyi.system.service.ISysDictTypeService; - -/** - * 数据字典信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/dict") -public class SysDictTypeController extends BaseController -{ - private String prefix = "system/dict/type"; - - @Autowired - private ISysDictTypeService dictTypeService; - - @RequiresPermissions("system:dict:view") - @GetMapping() - public String dictType() - { - return prefix + "/type"; - } - - @PostMapping("/list") - @RequiresPermissions("system:dict:list") - @ResponseBody - public TableDataInfo list(SysDictType dictType) - { - startPage(); - List list = dictTypeService.selectDictTypeList(dictType); - return getDataTable(list); - } - - @Log(title = "字典类型", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:dict:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysDictType dictType) - { - - List list = dictTypeService.selectDictTypeList(dictType); - ExcelUtil util = new ExcelUtil(SysDictType.class); - return util.exportExcel(list, "字典类型"); - } - - /** - * 新增字典类型 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存字典类型 - */ - @Log(title = "字典类型", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDictType dict) - { - if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) - { - return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); - } - dict.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(dictTypeService.insertDictType(dict)); - } - - /** - * 修改字典类型 - */ - @GetMapping("/edit/{dictId}") - public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) - { - mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); - return prefix + "/edit"; - } - - /** - * 修改保存字典类型 - */ - @Log(title = "字典类型", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDictType dict) - { - if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) - { - return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); - } - dict.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(dictTypeService.updateDictType(dict)); - } - - @Log(title = "字典类型", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dict:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - try - { - return toAjax(dictTypeService.deleteDictTypeByIds(ids)); - } - catch (Exception e) - { - return error(e.getMessage()); - } - } - - /** - * 查询字典详细 - */ - @RequiresPermissions("system:dict:list") - @GetMapping("/detail/{dictId}") - public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) - { - mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); - mmap.put("dictList", dictTypeService.selectDictTypeAll()); - return "system/dict/data/data"; - } - - /** - * 校验字典类型 - */ - @PostMapping("/checkDictTypeUnique") - @ResponseBody - public String checkDictTypeUnique(SysDictType dictType) - { - return dictTypeService.checkDictTypeUnique(dictType); - } - - /** - * 选择字典树 - */ - @GetMapping("/selectDictTree/{columnId}/{dictType}") - public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, - ModelMap mmap) - { - mmap.put("columnId", columnId); - mmap.put("dict", dictTypeService.selectDictTypeByType(dictType)); - return prefix + "/tree"; - } - - /** - * 加载字典列表树 - */ - @GetMapping("/treeData") - @ResponseBody - public List treeData() - { - List ztrees = dictTypeService.selectDictTree(new SysDictType()); - return ztrees; - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.domain.Ztree; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysDictType; +import cn.com.infosouth.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/dict") +public class SysDictTypeController extends BaseController +{ + private String prefix = "system/dict/type"; + + @Autowired + private ISysDictTypeService dictTypeService; + + @RequiresPermissions("system:dict:view") + @GetMapping() + public String dictType() + { + return prefix + "/type"; + } + + @PostMapping("/list") + @RequiresPermissions("system:dict:list") + @ResponseBody + public TableDataInfo list(SysDictType dictType) + { + startPage(); + List list = dictTypeService.selectDictTypeList(dictType); + return getDataTable(list); + } + + @Log(title = "字典类型", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:dict:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysDictType dictType) + { + + List list = dictTypeService.selectDictTypeList(dictType); + ExcelUtil util = new ExcelUtil(SysDictType.class); + return util.exportExcel(list, "字典类型"); + } + + /** + * 新增字典类型 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存字典类型 + */ + @Log(title = "字典类型", businessType = BusinessType.INSERT) + @RequiresPermissions("system:dict:add") + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysDictType dict) + { + if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(dictTypeService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @GetMapping("/edit/{dictId}") + public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) + { + mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); + return prefix + "/edit"; + } + + /** + * 修改保存字典类型 + */ + @Log(title = "字典类型", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:dict:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysDictType dict) + { + if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(dictTypeService.updateDictType(dict)); + } + + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @RequiresPermissions("system:dict:remove") + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + try + { + return toAjax(dictTypeService.deleteDictTypeByIds(ids)); + } + catch (Exception e) + { + return error(e.getMessage()); + } + } + + /** + * 查询字典详细 + */ + @RequiresPermissions("system:dict:list") + @GetMapping("/detail/{dictId}") + public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) + { + mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); + mmap.put("dictList", dictTypeService.selectDictTypeAll()); + return "system/dict/data/data"; + } + + /** + * 校验字典类型 + */ + @PostMapping("/checkDictTypeUnique") + @ResponseBody + public String checkDictTypeUnique(SysDictType dictType) + { + return dictTypeService.checkDictTypeUnique(dictType); + } + + /** + * 选择字典树 + */ + @GetMapping("/selectDictTree/{columnId}/{dictType}") + public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, + ModelMap mmap) + { + mmap.put("columnId", columnId); + mmap.put("dict", dictTypeService.selectDictTypeByType(dictType)); + return prefix + "/tree"; + } + + /** + * 加载字典列表树 + */ + @GetMapping("/treeData") + @ResponseBody + public List treeData() + { + List ztrees = dictTypeService.selectDictTree(new SysDictType()); + return ztrees; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysIndexController.java similarity index 76% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysIndexController.java index 8c0a0eed5..0ee6d77b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysIndexController.java @@ -1,55 +1,55 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import com.ruoyi.common.config.Global; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysMenu; -import com.ruoyi.system.domain.SysUser; -import com.ruoyi.system.service.ISysMenuService; - -/** - * 首页 业务处理 - * - * @author ruoyi - */ -@Controller -public class SysIndexController extends BaseController -{ - @Autowired - private ISysMenuService menuService; - - // 系统首页 - @GetMapping("/index") - public String index(ModelMap mmap) - { - // 取身份信息 - SysUser user = ShiroUtils.getSysUser(); - // 根据用户id取出菜单 - List menus = menuService.selectMenusByUser(user); - mmap.put("menus", menus); - mmap.put("user", user); - mmap.put("copyrightYear", Global.getCopyrightYear()); - mmap.put("demoEnabled", Global.isDemoEnabled()); - return "index"; - } - - // 切换主题 - @GetMapping("/system/switchSkin") - public String switchSkin(ModelMap mmap) - { - return "skin"; - } - - // 系统介绍 - @GetMapping("/system/main") - public String main(ModelMap mmap) - { - mmap.put("version", Global.getVersion()); - return "main"; - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import cn.com.infosouth.common.config.Global; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysMenu; +import cn.com.infosouth.system.domain.SysUser; +import cn.com.infosouth.system.service.ISysMenuService; + +/** + * 首页 业务处理 + * + * @author ruoyi + */ +@Controller +public class SysIndexController extends BaseController +{ + @Autowired + private ISysMenuService menuService; + + // 系统首页 + @GetMapping("/index") + public String index(ModelMap mmap) + { + // 取身份信息 + SysUser user = ShiroUtils.getSysUser(); + // 根据用户id取出菜单 + List menus = menuService.selectMenusByUser(user); + mmap.put("menus", menus); + mmap.put("user", user); + mmap.put("copyrightYear", Global.getCopyrightYear()); + mmap.put("demoEnabled", Global.isDemoEnabled()); + return "index"; + } + + // 切换主题 + @GetMapping("/system/switchSkin") + public String switchSkin(ModelMap mmap) + { + return "skin"; + } + + // 系统介绍 + @GetMapping("/system/main") + public String main(ModelMap mmap) + { + mmap.put("version", Global.getVersion()); + return "main"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysLoginController.java similarity index 86% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysLoginController.java index 1652f74ef..ebd3773be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysLoginController.java @@ -1,4 +1,4 @@ -package com.ruoyi.web.controller.system; +package cn.com.infosouth.web.controller.system; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -10,10 +10,10 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.utils.ServletUtils; +import cn.com.infosouth.common.utils.StringUtils; /** * 登录验证 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysMenuController.java similarity index 88% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysMenuController.java index 3615c7599..cb9a66bdc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysMenuController.java @@ -1,196 +1,196 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysMenu; -import com.ruoyi.system.domain.SysRole; -import com.ruoyi.system.service.ISysMenuService; - -/** - * 菜单信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/menu") -public class SysMenuController extends BaseController -{ - private String prefix = "system/menu"; - - @Autowired - private ISysMenuService menuService; - - @RequiresPermissions("system:menu:view") - @GetMapping() - public String menu() - { - return prefix + "/menu"; - } - - @RequiresPermissions("system:menu:list") - @PostMapping("/list") - @ResponseBody - public List list(SysMenu menu) - { - Long userId = ShiroUtils.getUserId(); - List menuList = menuService.selectMenuList(menu, userId); - return menuList; - } - - /** - * 删除菜单 - */ - @Log(title = "菜单管理", businessType = BusinessType.DELETE) - @RequiresPermissions("system:menu:remove") - @GetMapping("/remove/{menuId}") - @ResponseBody - public AjaxResult remove(@PathVariable("menuId") Long menuId) - { - if (menuService.selectCountMenuByParentId(menuId) > 0) - { - return AjaxResult.warn("存在子菜单,不允许删除"); - } - if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) - { - return AjaxResult.warn("菜单已分配,不允许删除"); - } - ShiroUtils.clearCachedAuthorizationInfo(); - return toAjax(menuService.deleteMenuById(menuId)); - } - - /** - * 新增 - */ - @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) - { - SysMenu menu = null; - if (0L != parentId) - { - menu = menuService.selectMenuById(parentId); - } - else - { - menu = new SysMenu(); - menu.setMenuId(0L); - menu.setMenuName("主目录"); - } - mmap.put("menu", menu); - return prefix + "/add"; - } - - /** - * 新增保存菜单 - */ - @Log(title = "菜单管理", businessType = BusinessType.INSERT) - @RequiresPermissions("system:menu:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysMenu menu) - { - if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { - return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); - } - menu.setCreateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return toAjax(menuService.insertMenu(menu)); - } - - /** - * 修改菜单 - */ - @GetMapping("/edit/{menuId}") - public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) - { - mmap.put("menu", menuService.selectMenuById(menuId)); - return prefix + "/edit"; - } - - /** - * 修改保存菜单 - */ - @Log(title = "菜单管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:menu:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysMenu menu) - { - if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) - { - return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); - } - menu.setUpdateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return toAjax(menuService.updateMenu(menu)); - } - - /** - * 选择菜单图标 - */ - @GetMapping("/icon") - public String icon() - { - return prefix + "/icon"; - } - - /** - * 校验菜单名称 - */ - @PostMapping("/checkMenuNameUnique") - @ResponseBody - public String checkMenuNameUnique(SysMenu menu) - { - return menuService.checkMenuNameUnique(menu); - } - - /** - * 加载角色菜单列表树 - */ - @GetMapping("/roleMenuTreeData") - @ResponseBody - public List roleMenuTreeData(SysRole role) - { - Long userId = ShiroUtils.getUserId(); - List ztrees = menuService.roleMenuTreeData(role, userId); - return ztrees; - } - - /** - * 加载所有菜单列表树 - */ - @GetMapping("/menuTreeData") - @ResponseBody - public List menuTreeData() - { - Long userId = ShiroUtils.getUserId(); - List ztrees = menuService.menuTreeData(userId); - return ztrees; - } - - /** - * 选择菜单树 - */ - @GetMapping("/selectMenuTree/{menuId}") - public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) - { - mmap.put("menu", menuService.selectMenuById(menuId)); - return prefix + "/tree"; - } +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.domain.Ztree; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysMenu; +import cn.com.infosouth.system.domain.SysRole; +import cn.com.infosouth.system.service.ISysMenuService; + +/** + * 菜单信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/menu") +public class SysMenuController extends BaseController +{ + private String prefix = "system/menu"; + + @Autowired + private ISysMenuService menuService; + + @RequiresPermissions("system:menu:view") + @GetMapping() + public String menu() + { + return prefix + "/menu"; + } + + @RequiresPermissions("system:menu:list") + @PostMapping("/list") + @ResponseBody + public List list(SysMenu menu) + { + Long userId = ShiroUtils.getUserId(); + List menuList = menuService.selectMenuList(menu, userId); + return menuList; + } + + /** + * 删除菜单 + */ + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @RequiresPermissions("system:menu:remove") + @GetMapping("/remove/{menuId}") + @ResponseBody + public AjaxResult remove(@PathVariable("menuId") Long menuId) + { + if (menuService.selectCountMenuByParentId(menuId) > 0) + { + return AjaxResult.warn("存在子菜单,不允许删除"); + } + if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) + { + return AjaxResult.warn("菜单已分配,不允许删除"); + } + ShiroUtils.clearCachedAuthorizationInfo(); + return toAjax(menuService.deleteMenuById(menuId)); + } + + /** + * 新增 + */ + @GetMapping("/add/{parentId}") + public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) + { + SysMenu menu = null; + if (0L != parentId) + { + menu = menuService.selectMenuById(parentId); + } + else + { + menu = new SysMenu(); + menu.setMenuId(0L); + menu.setMenuName("主目录"); + } + mmap.put("menu", menu); + return prefix + "/add"; + } + + /** + * 新增保存菜单 + */ + @Log(title = "菜单管理", businessType = BusinessType.INSERT) + @RequiresPermissions("system:menu:add") + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysMenu menu) + { + if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + menu.setCreateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return toAjax(menuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @GetMapping("/edit/{menuId}") + public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) + { + mmap.put("menu", menuService.selectMenuById(menuId)); + return prefix + "/edit"; + } + + /** + * 修改保存菜单 + */ + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:menu:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysMenu menu) + { + if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + menu.setUpdateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return toAjax(menuService.updateMenu(menu)); + } + + /** + * 选择菜单图标 + */ + @GetMapping("/icon") + public String icon() + { + return prefix + "/icon"; + } + + /** + * 校验菜单名称 + */ + @PostMapping("/checkMenuNameUnique") + @ResponseBody + public String checkMenuNameUnique(SysMenu menu) + { + return menuService.checkMenuNameUnique(menu); + } + + /** + * 加载角色菜单列表树 + */ + @GetMapping("/roleMenuTreeData") + @ResponseBody + public List roleMenuTreeData(SysRole role) + { + Long userId = ShiroUtils.getUserId(); + List ztrees = menuService.roleMenuTreeData(role, userId); + return ztrees; + } + + /** + * 加载所有菜单列表树 + */ + @GetMapping("/menuTreeData") + @ResponseBody + public List menuTreeData() + { + Long userId = ShiroUtils.getUserId(); + List ztrees = menuService.menuTreeData(userId); + return ztrees; + } + + /** + * 选择菜单树 + */ + @GetMapping("/selectMenuTree/{menuId}") + public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) + { + mmap.put("menu", menuService.selectMenuById(menuId)); + return prefix + "/tree"; + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysNoticeController.java similarity index 83% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysNoticeController.java index 671dc11e3..f7d8974a4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysNoticeController.java @@ -1,112 +1,112 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysNotice; -import com.ruoyi.system.service.ISysNoticeService; - -/** - * 公告 信息操作处理 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/notice") -public class SysNoticeController extends BaseController -{ - private String prefix = "system/notice"; - - @Autowired - private ISysNoticeService noticeService; - - @RequiresPermissions("system:notice:view") - @GetMapping() - public String notice() - { - return prefix + "/notice"; - } - - /** - * 查询公告列表 - */ - @RequiresPermissions("system:notice:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysNotice notice) - { - startPage(); - List list = noticeService.selectNoticeList(notice); - return getDataTable(list); - } - - /** - * 新增公告 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存公告 - */ - @RequiresPermissions("system:notice:add") - @Log(title = "通知公告", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(SysNotice notice) - { - notice.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(noticeService.insertNotice(notice)); - } - - /** - * 修改公告 - */ - @GetMapping("/edit/{noticeId}") - public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) - { - mmap.put("notice", noticeService.selectNoticeById(noticeId)); - return prefix + "/edit"; - } - - /** - * 修改保存公告 - */ - @RequiresPermissions("system:notice:edit") - @Log(title = "通知公告", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(SysNotice notice) - { - notice.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(noticeService.updateNotice(notice)); - } - - /** - * 删除公告 - */ - @RequiresPermissions("system:notice:remove") - @Log(title = "通知公告", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(noticeService.deleteNoticeByIds(ids)); - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysNotice; +import cn.com.infosouth.system.service.ISysNoticeService; + +/** + * 公告 信息操作处理 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/notice") +public class SysNoticeController extends BaseController +{ + private String prefix = "system/notice"; + + @Autowired + private ISysNoticeService noticeService; + + @RequiresPermissions("system:notice:view") + @GetMapping() + public String notice() + { + return prefix + "/notice"; + } + + /** + * 查询公告列表 + */ + @RequiresPermissions("system:notice:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysNotice notice) + { + startPage(); + List list = noticeService.selectNoticeList(notice); + return getDataTable(list); + } + + /** + * 新增公告 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存公告 + */ + @RequiresPermissions("system:notice:add") + @Log(title = "通知公告", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(SysNotice notice) + { + notice.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(noticeService.insertNotice(notice)); + } + + /** + * 修改公告 + */ + @GetMapping("/edit/{noticeId}") + public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) + { + mmap.put("notice", noticeService.selectNoticeById(noticeId)); + return prefix + "/edit"; + } + + /** + * 修改保存公告 + */ + @RequiresPermissions("system:notice:edit") + @Log(title = "通知公告", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(SysNotice notice) + { + notice.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(noticeService.updateNotice(notice)); + } + + /** + * 删除公告 + */ + @RequiresPermissions("system:notice:remove") + @Log(title = "通知公告", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(noticeService.deleteNoticeByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysPostController.java similarity index 87% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysPostController.java index d6db9fdf0..5b1c24857 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysPostController.java @@ -1,163 +1,163 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysPost; -import com.ruoyi.system.service.ISysPostService; - -/** - * 岗位信息操作处理 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/post") -public class SysPostController extends BaseController -{ - private String prefix = "system/post"; - - @Autowired - private ISysPostService postService; - - @RequiresPermissions("system:post:view") - @GetMapping() - public String operlog() - { - return prefix + "/post"; - } - - @RequiresPermissions("system:post:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysPost post) - { - startPage(); - List list = postService.selectPostList(post); - return getDataTable(list); - } - - @Log(title = "岗位管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:post:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysPost post) - { - List list = postService.selectPostList(post); - ExcelUtil util = new ExcelUtil(SysPost.class); - return util.exportExcel(list, "岗位数据"); - } - - @RequiresPermissions("system:post:remove") - @Log(title = "岗位管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - try - { - return toAjax(postService.deletePostByIds(ids)); - } - catch (Exception e) - { - return error(e.getMessage()); - } - } - - /** - * 新增岗位 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存岗位 - */ - @RequiresPermissions("system:post:add") - @Log(title = "岗位管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysPost post) - { - if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { - return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); - } - else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { - return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); - } - post.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(postService.insertPost(post)); - } - - /** - * 修改岗位 - */ - @GetMapping("/edit/{postId}") - public String edit(@PathVariable("postId") Long postId, ModelMap mmap) - { - mmap.put("post", postService.selectPostById(postId)); - return prefix + "/edit"; - } - - /** - * 修改保存岗位 - */ - @RequiresPermissions("system:post:edit") - @Log(title = "岗位管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysPost post) - { - if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) - { - return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); - } - else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) - { - return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); - } - post.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(postService.updatePost(post)); - } - - /** - * 校验岗位名称 - */ - @PostMapping("/checkPostNameUnique") - @ResponseBody - public String checkPostNameUnique(SysPost post) - { - return postService.checkPostNameUnique(post); - } - - /** - * 校验岗位编码 - */ - @PostMapping("/checkPostCodeUnique") - @ResponseBody - public String checkPostCodeUnique(SysPost post) - { - return postService.checkPostCodeUnique(post); - } -} +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysPost; +import cn.com.infosouth.system.service.ISysPostService; + +/** + * 岗位信息操作处理 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/post") +public class SysPostController extends BaseController +{ + private String prefix = "system/post"; + + @Autowired + private ISysPostService postService; + + @RequiresPermissions("system:post:view") + @GetMapping() + public String operlog() + { + return prefix + "/post"; + } + + @RequiresPermissions("system:post:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysPost post) + { + startPage(); + List list = postService.selectPostList(post); + return getDataTable(list); + } + + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:post:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysPost post) + { + List list = postService.selectPostList(post); + ExcelUtil util = new ExcelUtil(SysPost.class); + return util.exportExcel(list, "岗位数据"); + } + + @RequiresPermissions("system:post:remove") + @Log(title = "岗位管理", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + try + { + return toAjax(postService.deletePostByIds(ids)); + } + catch (Exception e) + { + return error(e.getMessage()); + } + } + + /** + * 新增岗位 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存岗位 + */ + @RequiresPermissions("system:post:add") + @Log(title = "岗位管理", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysPost post) + { + if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(postService.insertPost(post)); + } + + /** + * 修改岗位 + */ + @GetMapping("/edit/{postId}") + public String edit(@PathVariable("postId") Long postId, ModelMap mmap) + { + mmap.put("post", postService.selectPostById(postId)); + return prefix + "/edit"; + } + + /** + * 修改保存岗位 + */ + @RequiresPermissions("system:post:edit") + @Log(title = "岗位管理", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysPost post) + { + if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(postService.updatePost(post)); + } + + /** + * 校验岗位名称 + */ + @PostMapping("/checkPostNameUnique") + @ResponseBody + public String checkPostNameUnique(SysPost post) + { + return postService.checkPostNameUnique(post); + } + + /** + * 校验岗位编码 + */ + @PostMapping("/checkPostCodeUnique") + @ResponseBody + public String checkPostCodeUnique(SysPost post) + { + return postService.checkPostCodeUnique(post); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysProfileController.java similarity index 87% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysProfileController.java index f8a462dda..d98e42019 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysProfileController.java @@ -1,173 +1,173 @@ -package com.ruoyi.web.controller.system; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.config.Global; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysUser; -import com.ruoyi.system.service.ISysUserService; - -/** - * 个人信息 业务处理 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/user/profile") -public class SysProfileController extends BaseController -{ - private static final Logger log = LoggerFactory.getLogger(SysProfileController.class); - - private String prefix = "system/user/profile"; - - @Autowired - private ISysUserService userService; - - @Autowired - private SysPasswordService passwordService; - - /** - * 个人信息 - */ - @GetMapping() - public String profile(ModelMap mmap) - { - SysUser user = ShiroUtils.getSysUser(); - mmap.put("user", user); - mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); - mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); - return prefix + "/profile"; - } - - @GetMapping("/checkPassword") - @ResponseBody - public boolean checkPassword(String password) - { - SysUser user = ShiroUtils.getSysUser(); - if (passwordService.matches(user, password)) - { - return true; - } - return false; - } - - @GetMapping("/resetPwd") - public String resetPwd(ModelMap mmap) - { - SysUser user = ShiroUtils.getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/resetPwd"; - } - - @Log(title = "重置密码", businessType = BusinessType.UPDATE) - @PostMapping("/resetPwd") - @ResponseBody - public AjaxResult resetPwd(String oldPassword, String newPassword) - { - SysUser user = ShiroUtils.getSysUser(); - if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword)) - { - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); - if (userService.resetUserPwd(user) > 0) - { - ShiroUtils.setSysUser(userService.selectUserById(user.getUserId())); - return success(); - } - return error(); - } - else - { - return error("修改密码失败,旧密码错误"); - } - } - - /** - * 修改用户 - */ - @GetMapping("/edit") - public String edit(ModelMap mmap) - { - SysUser user = ShiroUtils.getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/edit"; - } - - /** - * 修改头像 - */ - @GetMapping("/avatar") - public String avatar(ModelMap mmap) - { - SysUser user = ShiroUtils.getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/avatar"; - } - - /** - * 修改用户 - */ - @Log(title = "个人信息", businessType = BusinessType.UPDATE) - @PostMapping("/update") - @ResponseBody - public AjaxResult update(SysUser user) - { - SysUser currentUser = ShiroUtils.getSysUser(); - currentUser.setUserName(user.getUserName()); - currentUser.setEmail(user.getEmail()); - currentUser.setPhonenumber(user.getPhonenumber()); - currentUser.setSex(user.getSex()); - if (userService.updateUserInfo(currentUser) > 0) - { - ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); - return success(); - } - return error(); - } - - /** - * 保存头像 - */ - @Log(title = "个人信息", businessType = BusinessType.UPDATE) - @PostMapping("/updateAvatar") - @ResponseBody - public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) - { - SysUser currentUser = ShiroUtils.getSysUser(); - try - { - if (!file.isEmpty()) - { - String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file); - currentUser.setAvatar(avatar); - if (userService.updateUserInfo(currentUser) > 0) - { - ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); - return success(); - } - } - return error(); - } - catch (Exception e) - { - log.error("修改头像失败!", e); - return error(e.getMessage()); - } - } -} +package cn.com.infosouth.web.controller.system; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.config.Global; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.StringUtils; +import cn.com.infosouth.common.utils.file.FileUploadUtils; +import cn.com.infosouth.framework.shiro.service.SysPasswordService; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysUser; +import cn.com.infosouth.system.service.ISysUserService; + +/** + * 个人信息 业务处理 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/user/profile") +public class SysProfileController extends BaseController +{ + private static final Logger log = LoggerFactory.getLogger(SysProfileController.class); + + private String prefix = "system/user/profile"; + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPasswordService passwordService; + + /** + * 个人信息 + */ + @GetMapping() + public String profile(ModelMap mmap) + { + SysUser user = ShiroUtils.getSysUser(); + mmap.put("user", user); + mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); + mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); + return prefix + "/profile"; + } + + @GetMapping("/checkPassword") + @ResponseBody + public boolean checkPassword(String password) + { + SysUser user = ShiroUtils.getSysUser(); + if (passwordService.matches(user, password)) + { + return true; + } + return false; + } + + @GetMapping("/resetPwd") + public String resetPwd(ModelMap mmap) + { + SysUser user = ShiroUtils.getSysUser(); + mmap.put("user", userService.selectUserById(user.getUserId())); + return prefix + "/resetPwd"; + } + + @Log(title = "重置密码", businessType = BusinessType.UPDATE) + @PostMapping("/resetPwd") + @ResponseBody + public AjaxResult resetPwd(String oldPassword, String newPassword) + { + SysUser user = ShiroUtils.getSysUser(); + if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword)) + { + user.setSalt(ShiroUtils.randomSalt()); + user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); + if (userService.resetUserPwd(user) > 0) + { + ShiroUtils.setSysUser(userService.selectUserById(user.getUserId())); + return success(); + } + return error(); + } + else + { + return error("修改密码失败,旧密码错误"); + } + } + + /** + * 修改用户 + */ + @GetMapping("/edit") + public String edit(ModelMap mmap) + { + SysUser user = ShiroUtils.getSysUser(); + mmap.put("user", userService.selectUserById(user.getUserId())); + return prefix + "/edit"; + } + + /** + * 修改头像 + */ + @GetMapping("/avatar") + public String avatar(ModelMap mmap) + { + SysUser user = ShiroUtils.getSysUser(); + mmap.put("user", userService.selectUserById(user.getUserId())); + return prefix + "/avatar"; + } + + /** + * 修改用户 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PostMapping("/update") + @ResponseBody + public AjaxResult update(SysUser user) + { + SysUser currentUser = ShiroUtils.getSysUser(); + currentUser.setUserName(user.getUserName()); + currentUser.setEmail(user.getEmail()); + currentUser.setPhonenumber(user.getPhonenumber()); + currentUser.setSex(user.getSex()); + if (userService.updateUserInfo(currentUser) > 0) + { + ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); + return success(); + } + return error(); + } + + /** + * 保存头像 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PostMapping("/updateAvatar") + @ResponseBody + public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) + { + SysUser currentUser = ShiroUtils.getSysUser(); + try + { + if (!file.isEmpty()) + { + String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file); + currentUser.setAvatar(avatar); + if (userService.updateUserInfo(currentUser) > 0) + { + ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); + return success(); + } + } + return error(); + } + catch (Exception e) + { + log.error("修改头像失败!", e); + return error(e.getMessage()); + } + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysRoleController.java similarity index 89% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysRoleController.java index 0f7379d1a..08293f6b9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysRoleController.java @@ -1,304 +1,304 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysRole; -import com.ruoyi.system.domain.SysUser; -import com.ruoyi.system.domain.SysUserRole; -import com.ruoyi.system.service.ISysRoleService; -import com.ruoyi.system.service.ISysUserService; - -/** - * 角色信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/role") -public class SysRoleController extends BaseController -{ - private String prefix = "system/role"; - - @Autowired - private ISysRoleService roleService; - - @Autowired - private ISysUserService userService; - - @RequiresPermissions("system:role:view") - @GetMapping() - public String role() - { - return prefix + "/role"; - } - - @RequiresPermissions("system:role:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysRole role) - { - startPage(); - List list = roleService.selectRoleList(role); - return getDataTable(list); - } - - @Log(title = "角色管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:role:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysRole role) - { - List list = roleService.selectRoleList(role); - ExcelUtil util = new ExcelUtil(SysRole.class); - return util.exportExcel(list, "角色数据"); - } - - /** - * 新增角色 - */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存角色 - */ - @RequiresPermissions("system:role:add") - @Log(title = "角色管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysRole role) - { - if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) - { - return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); - } - else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) - { - return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); - } - role.setCreateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return toAjax(roleService.insertRole(role)); - - } - - /** - * 修改角色 - */ - @GetMapping("/edit/{roleId}") - public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/edit"; - } - - /** - * 修改保存角色 - */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysRole role) - { - roleService.checkRoleAllowed(role); - if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) - { - return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); - } - else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) - { - return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); - } - role.setUpdateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return toAjax(roleService.updateRole(role)); - } - - /** - * 角色分配数据权限 - */ - @GetMapping("/authDataScope/{roleId}") - public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/dataScope"; - } - - /** - * 保存角色分配数据权限 - */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @PostMapping("/authDataScope") - @ResponseBody - public AjaxResult authDataScopeSave(SysRole role) - { - roleService.checkRoleAllowed(role); - role.setUpdateBy(ShiroUtils.getLoginName()); - if (roleService.authDataScope(role) > 0) - { - ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId())); - return success(); - } - return error(); - } - - @RequiresPermissions("system:role:remove") - @Log(title = "角色管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - try - { - return toAjax(roleService.deleteRoleByIds(ids)); - } - catch (Exception e) - { - return error(e.getMessage()); - } - } - - /** - * 校验角色名称 - */ - @PostMapping("/checkRoleNameUnique") - @ResponseBody - public String checkRoleNameUnique(SysRole role) - { - return roleService.checkRoleNameUnique(role); - } - - /** - * 校验角色权限 - */ - @PostMapping("/checkRoleKeyUnique") - @ResponseBody - public String checkRoleKeyUnique(SysRole role) - { - return roleService.checkRoleKeyUnique(role); - } - - /** - * 选择菜单树 - */ - @GetMapping("/selectMenuTree") - public String selectMenuTree() - { - return prefix + "/tree"; - } - - /** - * 角色状态修改 - */ - @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:role:edit") - @PostMapping("/changeStatus") - @ResponseBody - public AjaxResult changeStatus(SysRole role) - { - roleService.checkRoleAllowed(role); - return toAjax(roleService.changeStatus(role)); - } - - /** - * 分配用户 - */ - @RequiresPermissions("system:role:edit") - @GetMapping("/authUser/{roleId}") - public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/authUser"; - } - - /** - * 查询已分配用户角色列表 - */ - @RequiresPermissions("system:role:list") - @PostMapping("/authUser/allocatedList") - @ResponseBody - public TableDataInfo allocatedList(SysUser user) - { - startPage(); - List list = userService.selectAllocatedList(user); - return getDataTable(list); - } - - /** - * 取消授权 - */ - @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/cancel") - @ResponseBody - public AjaxResult cancelAuthUser(SysUserRole userRole) - { - return toAjax(roleService.deleteAuthUser(userRole)); - } - - /** - * 批量取消授权 - */ - @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/cancelAll") - @ResponseBody - public AjaxResult cancelAuthUserAll(Long roleId, String userIds) - { - return toAjax(roleService.deleteAuthUsers(roleId, userIds)); - } - - /** - * 选择用户 - */ - @GetMapping("/authUser/selectUser/{roleId}") - public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/selectUser"; - } - - /** - * 查询未分配用户角色列表 - */ - @RequiresPermissions("system:role:list") - @PostMapping("/authUser/unallocatedList") - @ResponseBody - public TableDataInfo unallocatedList(SysUser user) - { - startPage(); - List list = userService.selectUnallocatedList(user); - return getDataTable(list); - } - - /** - * 批量选择用户授权 - */ - @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/selectAll") - @ResponseBody - public AjaxResult selectAuthUserAll(Long roleId, String userIds) - { - return toAjax(roleService.insertAuthUsers(roleId, userIds)); - } +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysRole; +import cn.com.infosouth.system.domain.SysUser; +import cn.com.infosouth.system.domain.SysUserRole; +import cn.com.infosouth.system.service.ISysRoleService; +import cn.com.infosouth.system.service.ISysUserService; + +/** + * 角色信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/role") +public class SysRoleController extends BaseController +{ + private String prefix = "system/role"; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysUserService userService; + + @RequiresPermissions("system:role:view") + @GetMapping() + public String role() + { + return prefix + "/role"; + } + + @RequiresPermissions("system:role:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysRole role) + { + startPage(); + List list = roleService.selectRoleList(role); + return getDataTable(list); + } + + @Log(title = "角色管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:role:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysRole role) + { + List list = roleService.selectRoleList(role); + ExcelUtil util = new ExcelUtil(SysRole.class); + return util.exportExcel(list, "角色数据"); + } + + /** + * 新增角色 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存角色 + */ + @RequiresPermissions("system:role:add") + @Log(title = "角色管理", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysRole role) + { + if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return toAjax(roleService.insertRole(role)); + + } + + /** + * 修改角色 + */ + @GetMapping("/edit/{roleId}") + public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) + { + mmap.put("role", roleService.selectRoleById(roleId)); + return prefix + "/edit"; + } + + /** + * 修改保存角色 + */ + @RequiresPermissions("system:role:edit") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysRole role) + { + roleService.checkRoleAllowed(role); + if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setUpdateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return toAjax(roleService.updateRole(role)); + } + + /** + * 角色分配数据权限 + */ + @GetMapping("/authDataScope/{roleId}") + public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) + { + mmap.put("role", roleService.selectRoleById(roleId)); + return prefix + "/dataScope"; + } + + /** + * 保存角色分配数据权限 + */ + @RequiresPermissions("system:role:edit") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PostMapping("/authDataScope") + @ResponseBody + public AjaxResult authDataScopeSave(SysRole role) + { + roleService.checkRoleAllowed(role); + role.setUpdateBy(ShiroUtils.getLoginName()); + if (roleService.authDataScope(role) > 0) + { + ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId())); + return success(); + } + return error(); + } + + @RequiresPermissions("system:role:remove") + @Log(title = "角色管理", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + try + { + return toAjax(roleService.deleteRoleByIds(ids)); + } + catch (Exception e) + { + return error(e.getMessage()); + } + } + + /** + * 校验角色名称 + */ + @PostMapping("/checkRoleNameUnique") + @ResponseBody + public String checkRoleNameUnique(SysRole role) + { + return roleService.checkRoleNameUnique(role); + } + + /** + * 校验角色权限 + */ + @PostMapping("/checkRoleKeyUnique") + @ResponseBody + public String checkRoleKeyUnique(SysRole role) + { + return roleService.checkRoleKeyUnique(role); + } + + /** + * 选择菜单树 + */ + @GetMapping("/selectMenuTree") + public String selectMenuTree() + { + return prefix + "/tree"; + } + + /** + * 角色状态修改 + */ + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:role:edit") + @PostMapping("/changeStatus") + @ResponseBody + public AjaxResult changeStatus(SysRole role) + { + roleService.checkRoleAllowed(role); + return toAjax(roleService.changeStatus(role)); + } + + /** + * 分配用户 + */ + @RequiresPermissions("system:role:edit") + @GetMapping("/authUser/{roleId}") + public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) + { + mmap.put("role", roleService.selectRoleById(roleId)); + return prefix + "/authUser"; + } + + /** + * 查询已分配用户角色列表 + */ + @RequiresPermissions("system:role:list") + @PostMapping("/authUser/allocatedList") + @ResponseBody + public TableDataInfo allocatedList(SysUser user) + { + startPage(); + List list = userService.selectAllocatedList(user); + return getDataTable(list); + } + + /** + * 取消授权 + */ + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PostMapping("/authUser/cancel") + @ResponseBody + public AjaxResult cancelAuthUser(SysUserRole userRole) + { + return toAjax(roleService.deleteAuthUser(userRole)); + } + + /** + * 批量取消授权 + */ + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PostMapping("/authUser/cancelAll") + @ResponseBody + public AjaxResult cancelAuthUserAll(Long roleId, String userIds) + { + return toAjax(roleService.deleteAuthUsers(roleId, userIds)); + } + + /** + * 选择用户 + */ + @GetMapping("/authUser/selectUser/{roleId}") + public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) + { + mmap.put("role", roleService.selectRoleById(roleId)); + return prefix + "/selectUser"; + } + + /** + * 查询未分配用户角色列表 + */ + @RequiresPermissions("system:role:list") + @PostMapping("/authUser/unallocatedList") + @ResponseBody + public TableDataInfo unallocatedList(SysUser user) + { + startPage(); + List list = userService.selectUnallocatedList(user); + return getDataTable(list); + } + + /** + * 批量选择用户授权 + */ + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PostMapping("/authUser/selectAll") + @ResponseBody + public AjaxResult selectAuthUserAll(Long roleId, String userIds) + { + return toAjax(roleService.insertAuthUsers(roleId, userIds)); + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysUserController.java similarity index 89% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysUserController.java index 76fc16b89..05afe288d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/system/SysUserController.java @@ -1,261 +1,261 @@ -package com.ruoyi.web.controller.system; - -import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysUser; -import com.ruoyi.system.service.ISysPostService; -import com.ruoyi.system.service.ISysRoleService; -import com.ruoyi.system.service.ISysUserService; - -/** - * 用户信息 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/system/user") -public class SysUserController extends BaseController -{ - private String prefix = "system/user"; - - @Autowired - private ISysUserService userService; - - @Autowired - private ISysRoleService roleService; - - @Autowired - private ISysPostService postService; - - @Autowired - private SysPasswordService passwordService; - - @RequiresPermissions("system:user:view") - @GetMapping() - public String user() - { - return prefix + "/user"; - } - - @RequiresPermissions("system:user:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysUser user) - { - startPage(); - List list = userService.selectUserList(user); - return getDataTable(list); - } - - @Log(title = "用户管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:user:export") - @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysUser user) - { - List list = userService.selectUserList(user); - ExcelUtil util = new ExcelUtil(SysUser.class); - return util.exportExcel(list, "用户数据"); - } - - @Log(title = "用户管理", businessType = BusinessType.IMPORT) - @RequiresPermissions("system:user:import") - @PostMapping("/importData") - @ResponseBody - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { - ExcelUtil util = new ExcelUtil(SysUser.class); - List userList = util.importExcel(file.getInputStream()); - String operName = ShiroUtils.getSysUser().getLoginName(); - String message = userService.importUser(userList, updateSupport, operName); - return AjaxResult.success(message); - } - - @RequiresPermissions("system:user:view") - @GetMapping("/importTemplate") - @ResponseBody - public AjaxResult importTemplate() - { - ExcelUtil util = new ExcelUtil(SysUser.class); - return util.importTemplateExcel("用户数据"); - } - - /** - * 新增用户 - */ - @GetMapping("/add") - public String add(ModelMap mmap) - { - mmap.put("roles", roleService.selectRoleAll()); - mmap.put("posts", postService.selectPostAll()); - return prefix + "/add"; - } - - /** - * 新增保存用户 - */ - @RequiresPermissions("system:user:add") - @Log(title = "用户管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysUser user) - { - if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))) - { - return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); - } - else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) - { - return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); - } - else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) - { - return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); - } - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); - user.setCreateBy(ShiroUtils.getLoginName()); - return toAjax(userService.insertUser(user)); - } - - /** - * 修改用户 - */ - @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Long userId, ModelMap mmap) - { - mmap.put("user", userService.selectUserById(userId)); - mmap.put("roles", roleService.selectRolesByUserId(userId)); - mmap.put("posts", postService.selectPostsByUserId(userId)); - return prefix + "/edit"; - } - - /** - * 修改保存用户 - */ - @RequiresPermissions("system:user:edit") - @Log(title = "用户管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysUser user) - { - userService.checkUserAllowed(user); - if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) - { - return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); - } - else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) - { - return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); - } - user.setUpdateBy(ShiroUtils.getLoginName()); - return toAjax(userService.updateUser(user)); - } - - @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", businessType = BusinessType.UPDATE) - @GetMapping("/resetPwd/{userId}") - public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) - { - mmap.put("user", userService.selectUserById(userId)); - return prefix + "/resetPwd"; - } - - @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", businessType = BusinessType.UPDATE) - @PostMapping("/resetPwd") - @ResponseBody - public AjaxResult resetPwdSave(SysUser user) - { - userService.checkUserAllowed(user); - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); - if (userService.resetUserPwd(user) > 0) - { - if (ShiroUtils.getUserId() == user.getUserId()) - { - ShiroUtils.setSysUser(userService.selectUserById(user.getUserId())); - } - return success(); - } - return error(); - } - - @RequiresPermissions("system:user:remove") - @Log(title = "用户管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - try - { - return toAjax(userService.deleteUserByIds(ids)); - } - catch (Exception e) - { - return error(e.getMessage()); - } - } - - /** - * 校验用户名 - */ - @PostMapping("/checkLoginNameUnique") - @ResponseBody - public String checkLoginNameUnique(SysUser user) - { - return userService.checkLoginNameUnique(user.getLoginName()); - } - - /** - * 校验手机号码 - */ - @PostMapping("/checkPhoneUnique") - @ResponseBody - public String checkPhoneUnique(SysUser user) - { - return userService.checkPhoneUnique(user); - } - - /** - * 校验email邮箱 - */ - @PostMapping("/checkEmailUnique") - @ResponseBody - public String checkEmailUnique(SysUser user) - { - return userService.checkEmailUnique(user); - } - - /** - * 用户状态修改 - */ - @Log(title = "用户管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:user:edit") - @PostMapping("/changeStatus") - @ResponseBody - public AjaxResult changeStatus(SysUser user) - { - userService.checkUserAllowed(user); - return toAjax(userService.changeStatus(user)); - } +package cn.com.infosouth.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import cn.com.infosouth.common.annotation.Log; +import cn.com.infosouth.common.constant.UserConstants; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.core.page.TableDataInfo; +import cn.com.infosouth.common.enums.BusinessType; +import cn.com.infosouth.common.utils.poi.ExcelUtil; +import cn.com.infosouth.framework.shiro.service.SysPasswordService; +import cn.com.infosouth.framework.util.ShiroUtils; +import cn.com.infosouth.system.domain.SysUser; +import cn.com.infosouth.system.service.ISysPostService; +import cn.com.infosouth.system.service.ISysRoleService; +import cn.com.infosouth.system.service.ISysUserService; + +/** + * 用户信息 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/system/user") +public class SysUserController extends BaseController +{ + private String prefix = "system/user"; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysPostService postService; + + @Autowired + private SysPasswordService passwordService; + + @RequiresPermissions("system:user:view") + @GetMapping() + public String user() + { + return prefix + "/user"; + } + + @RequiresPermissions("system:user:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(SysUser user) + { + startPage(); + List list = userService.selectUserList(user); + return getDataTable(list); + } + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:user:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(SysUser user) + { + List list = userService.selectUserList(user); + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.exportExcel(list, "用户数据"); + } + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) + @RequiresPermissions("system:user:import") + @PostMapping("/importData") + @ResponseBody + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = ShiroUtils.getSysUser().getLoginName(); + String message = userService.importUser(userList, updateSupport, operName); + return AjaxResult.success(message); + } + + @RequiresPermissions("system:user:view") + @GetMapping("/importTemplate") + @ResponseBody + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.importTemplateExcel("用户数据"); + } + + /** + * 新增用户 + */ + @GetMapping("/add") + public String add(ModelMap mmap) + { + mmap.put("roles", roleService.selectRoleAll()); + mmap.put("posts", postService.selectPostAll()); + return prefix + "/add"; + } + + /** + * 新增保存用户 + */ + @RequiresPermissions("system:user:add") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(@Validated SysUser user) + { + if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))) + { + return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); + } + else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); + } + else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); + } + user.setSalt(ShiroUtils.randomSalt()); + user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + user.setCreateBy(ShiroUtils.getLoginName()); + return toAjax(userService.insertUser(user)); + } + + /** + * 修改用户 + */ + @GetMapping("/edit/{userId}") + public String edit(@PathVariable("userId") Long userId, ModelMap mmap) + { + mmap.put("user", userService.selectUserById(userId)); + mmap.put("roles", roleService.selectRolesByUserId(userId)); + mmap.put("posts", postService.selectPostsByUserId(userId)); + return prefix + "/edit"; + } + + /** + * 修改保存用户 + */ + @RequiresPermissions("system:user:edit") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(@Validated SysUser user) + { + userService.checkUserAllowed(user); + if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); + } + else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(ShiroUtils.getLoginName()); + return toAjax(userService.updateUser(user)); + } + + @RequiresPermissions("system:user:resetPwd") + @Log(title = "重置密码", businessType = BusinessType.UPDATE) + @GetMapping("/resetPwd/{userId}") + public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) + { + mmap.put("user", userService.selectUserById(userId)); + return prefix + "/resetPwd"; + } + + @RequiresPermissions("system:user:resetPwd") + @Log(title = "重置密码", businessType = BusinessType.UPDATE) + @PostMapping("/resetPwd") + @ResponseBody + public AjaxResult resetPwdSave(SysUser user) + { + userService.checkUserAllowed(user); + user.setSalt(ShiroUtils.randomSalt()); + user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + if (userService.resetUserPwd(user) > 0) + { + if (ShiroUtils.getUserId() == user.getUserId()) + { + ShiroUtils.setSysUser(userService.selectUserById(user.getUserId())); + } + return success(); + } + return error(); + } + + @RequiresPermissions("system:user:remove") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + try + { + return toAjax(userService.deleteUserByIds(ids)); + } + catch (Exception e) + { + return error(e.getMessage()); + } + } + + /** + * 校验用户名 + */ + @PostMapping("/checkLoginNameUnique") + @ResponseBody + public String checkLoginNameUnique(SysUser user) + { + return userService.checkLoginNameUnique(user.getLoginName()); + } + + /** + * 校验手机号码 + */ + @PostMapping("/checkPhoneUnique") + @ResponseBody + public String checkPhoneUnique(SysUser user) + { + return userService.checkPhoneUnique(user); + } + + /** + * 校验email邮箱 + */ + @PostMapping("/checkEmailUnique") + @ResponseBody + public String checkEmailUnique(SysUser user) + { + return userService.checkEmailUnique(user); + } + + /** + * 用户状态修改 + */ + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:user:edit") + @PostMapping("/changeStatus") + @ResponseBody + public AjaxResult changeStatus(SysUser user) + { + userService.checkUserAllowed(user); + return toAjax(userService.changeStatus(user)); + } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/BuildController.java similarity index 82% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/BuildController.java index 53ce0f1ba..dae8f3ca9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/BuildController.java @@ -1,26 +1,26 @@ -package com.ruoyi.web.controller.tool; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * build 表单构建 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/tool/build") -public class BuildController extends BaseController -{ - private String prefix = "tool/build"; - - @RequiresPermissions("tool:build:view") - @GetMapping() - public String build() - { - return prefix + "/build"; - } -} +package cn.com.infosouth.web.controller.tool; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import cn.com.infosouth.common.core.controller.BaseController; + +/** + * build 表单构建 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/tool/build") +public class BuildController extends BaseController +{ + private String prefix = "tool/build"; + + @RequiresPermissions("tool:build:view") + @GetMapping() + public String build() + { + return prefix + "/build"; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/SwaggerController.java similarity index 81% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/SwaggerController.java index cfa748f30..d3befafef 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/SwaggerController.java @@ -1,24 +1,24 @@ -package com.ruoyi.web.controller.tool; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * swagger 接口 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/tool/swagger") -public class SwaggerController extends BaseController -{ - @RequiresPermissions("tool:swagger:view") - @GetMapping() - public String index() - { - return redirect("/swagger-ui.html"); - } -} +package cn.com.infosouth.web.controller.tool; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import cn.com.infosouth.common.core.controller.BaseController; + +/** + * swagger 接口 + * + * @author ruoyi + */ +@Controller +@RequestMapping("/tool/swagger") +public class SwaggerController extends BaseController +{ + @RequiresPermissions("tool:swagger:view") + @GetMapping() + public String index() + { + return redirect("/swagger-ui.html"); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/TestController.java similarity index 92% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/TestController.java index bddbe7789..355598742 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/controller/tool/TestController.java @@ -1,175 +1,175 @@ -package com.ruoyi.web.controller.tool; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.StringUtils; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; - -/** - * swagger 用户测试方法 - * - * @author ruoyi - */ -@Api("用户信息管理") -@RestController -@RequestMapping("/test/user") -public class TestController extends BaseController -{ - private final static Map users = new LinkedHashMap(); - { - users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); - users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); - } - - @ApiOperation("获取用户列表") - @GetMapping("/list") - public AjaxResult userList() - { - List userList = new ArrayList(users.values()); - return AjaxResult.success(userList); - } - - @ApiOperation("获取用户详细") - @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") - @GetMapping("/{userId}") - public AjaxResult getUser(@PathVariable Integer userId) - { - if (!users.isEmpty() && users.containsKey(userId)) - { - return AjaxResult.success(users.get(userId)); - } - else - { - return error("用户不存在"); - } - } - - @ApiOperation("新增用户") - @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") - @PostMapping("/save") - public AjaxResult save(UserEntity user) - { - if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) - { - return error("用户ID不能为空"); - } - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - @ApiOperation("更新用户") - @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") - @PutMapping("/update") - public AjaxResult update(UserEntity user) - { - if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) - { - return error("用户ID不能为空"); - } - if (users.isEmpty() || !users.containsKey(user.getUserId())) - { - return error("用户不存在"); - } - users.remove(user.getUserId()); - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - @ApiOperation("删除用户信息") - @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") - @DeleteMapping("/{userId}") - public AjaxResult delete(@PathVariable Integer userId) - { - if (!users.isEmpty() && users.containsKey(userId)) - { - users.remove(userId); - return success(); - } - else - { - return error("用户不存在"); - } - } -} - -@ApiModel("用户实体") -class UserEntity -{ - @ApiModelProperty("用户ID") - private Integer userId; - - @ApiModelProperty("用户名称") - private String username; - - @ApiModelProperty("用户密码") - private String password; - - @ApiModelProperty("用户手机") - private String mobile; - - public UserEntity() - { - - } - - public UserEntity(Integer userId, String username, String password, String mobile) - { - this.userId = userId; - this.username = username; - this.password = password; - this.mobile = mobile; - } - - public Integer getUserId() - { - return userId; - } - - public void setUserId(Integer userId) - { - this.userId = userId; - } - - public String getUsername() - { - return username; - } - - public void setUsername(String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public String getMobile() - { - return mobile; - } - - public void setMobile(String mobile) - { - this.mobile = mobile; - } -} +package cn.com.infosouth.web.controller.tool; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import cn.com.infosouth.common.core.controller.BaseController; +import cn.com.infosouth.common.core.domain.AjaxResult; +import cn.com.infosouth.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; + +/** + * swagger 用户测试方法 + * + * @author ruoyi + */ +@Api("用户信息管理") +@RestController +@RequestMapping("/test/user") +public class TestController extends BaseController +{ + private final static Map users = new LinkedHashMap(); + { + users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); + users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); + } + + @ApiOperation("获取用户列表") + @GetMapping("/list") + public AjaxResult userList() + { + List userList = new ArrayList(users.values()); + return AjaxResult.success(userList); + } + + @ApiOperation("获取用户详细") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") + @GetMapping("/{userId}") + public AjaxResult getUser(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + return AjaxResult.success(users.get(userId)); + } + else + { + return error("用户不存在"); + } + } + + @ApiOperation("新增用户") + @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") + @PostMapping("/save") + public AjaxResult save(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("更新用户") + @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity") + @PutMapping("/update") + public AjaxResult update(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + if (users.isEmpty() || !users.containsKey(user.getUserId())) + { + return error("用户不存在"); + } + users.remove(user.getUserId()); + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("删除用户信息") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") + @DeleteMapping("/{userId}") + public AjaxResult delete(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + users.remove(userId); + return success(); + } + else + { + return error("用户不存在"); + } + } +} + +@ApiModel("用户实体") +class UserEntity +{ + @ApiModelProperty("用户ID") + private Integer userId; + + @ApiModelProperty("用户名称") + private String username; + + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户手机") + private String mobile; + + public UserEntity() + { + + } + + public UserEntity(Integer userId, String username, String password, String mobile) + { + this.userId = userId; + this.username = username; + this.password = password; + this.mobile = mobile; + } + + public Integer getUserId() + { + return userId; + } + + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getMobile() + { + return mobile; + } + + public void setMobile(String mobile) + { + this.mobile = mobile; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/infosouth-admin/src/main/java/cn/com/infosouth/web/core/config/SwaggerConfig.java similarity index 94% rename from ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java rename to infosouth-admin/src/main/java/cn/com/infosouth/web/core/config/SwaggerConfig.java index 43353914a..f9b325766 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/infosouth-admin/src/main/java/cn/com/infosouth/web/core/config/SwaggerConfig.java @@ -1,62 +1,62 @@ -package com.ruoyi.web.core.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import com.ruoyi.common.config.Global; -import io.swagger.annotations.ApiOperation; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * Swagger2的接口配置 - * - * @author ruoyi - */ -@Configuration -@EnableSwagger2 -public class SwaggerConfig -{ - /** - * 创建API - */ - @Bean - public Docket createRestApi() - { - return new Docket(DocumentationType.SWAGGER_2) - // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) - .apiInfo(apiInfo()) - // 设置哪些接口暴露给Swagger展示 - .select() - // 扫描所有有注解的api,用这种方式更灵活 - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - // 扫描指定包中的swagger注解 - //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) - // 扫描所有 .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build(); - } - - /** - * 添加摘要信息 - */ - private ApiInfo apiInfo() - { - // 用ApiInfoBuilder进行定制 - return new ApiInfoBuilder() - // 设置标题 - .title("标题:若依管理系统_接口文档") - // 描述 - .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") - // 作者信息 - .contact(new Contact(Global.getName(), null, null)) - // 版本 - .version("版本号:" + Global.getVersion()) - .build(); - } -} +package cn.com.infosouth.web.core.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import cn.com.infosouth.common.config.Global; +import io.swagger.annotations.ApiOperation; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger2的接口配置 + * + * @author ruoyi + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig +{ + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket(DocumentationType.SWAGGER_2) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); + } + + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() + { + // 用ApiInfoBuilder进行定制 + return new ApiInfoBuilder() + // 设置标题 + .title("标题:若依管理系统_接口文档") + // 描述 + .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + // 作者信息 + .contact(new Contact(Global.getName(), null, null)) + // 版本 + .version("版本号:" + Global.getVersion()) + .build(); + } +} diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/infosouth-admin/src/main/resources/application-druid.yml similarity index 89% rename from ruoyi-admin/src/main/resources/application-druid.yml rename to infosouth-admin/src/main/resources/application-druid.yml index 7e28db369..d78c541ef 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/infosouth-admin/src/main/resources/application-druid.yml @@ -1,57 +1,57 @@ -# 数据源配置 -spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driverClassName: com.mysql.cj.jdbc.Driver - druid: - # 主库数据源 - master: - url: jdbc:mysql://10.0.0.13:3306/amas_comac_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: COMAC - password: root - # 从库数据源 - slave: - # 从数据源开关/默认关闭 - enabled: false - url: - username: - password: - # 初始连接数 - initialSize: 5 - # 最小连接池数量 - minIdle: 10 - # 最大连接池数量 - maxActive: 20 - # 配置获取连接等待超时的时间 - maxWait: 60000 - # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 - timeBetweenEvictionRunsMillis: 60000 - # 配置一个连接在池中最小生存的时间,单位是毫秒 - minEvictableIdleTimeMillis: 300000 - # 配置一个连接在池中最大生存的时间,单位是毫秒 - maxEvictableIdleTimeMillis: 900000 - # 配置检测连接是否有效 - validationQuery: SELECT 1 FROM DUAL - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - webStatFilter: - enabled: true - statViewServlet: - enabled: true - # 设置白名单,不填则允许所有访问 - allow: - url-pattern: /druid/* - # 控制台管理用户名和密码 - login-username: - login-password: - filter: - stat: - enabled: true - # 慢SQL记录 - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: true - wall: - config: +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://c3.shell.vpn.foqa.com.cn:13306/amas_comac_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: COMAC + password: root + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: + login-password: + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: multi-statement-allow: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.yml b/infosouth-admin/src/main/resources/application.yml similarity index 94% rename from ruoyi-admin/src/main/resources/application.yml rename to infosouth-admin/src/main/resources/application.yml index 26361c6f8..a4c7a00c5 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/infosouth-admin/src/main/resources/application.yml @@ -1,130 +1,130 @@ -# 项目相关配置 -ruoyi: - # 名称 - name: RuoYi - # 版本 - version: 4.1.0 - # 版权年份 - copyrightYear: 2019 - # 实例演示开关 - demoEnabled: true - # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) - profile: D:/ruoyi/uploadPath - # 获取ip地址开关 - addressEnabled: true - -# 开发环境配置 -server: - # 服务器的HTTP端口,默认为80 - port: 80 - servlet: - # 应用的访问路径 - context-path: / - tomcat: - # tomcat的URI编码 - uri-encoding: UTF-8 - # tomcat最大线程数,默认为200 - max-threads: 800 - # Tomcat启动初始化的线程数,默认值25 - min-spare-threads: 30 - -# 日志配置 -logging: - level: - com.ruoyi: debug - org.springframework: warn - -# 用户配置 -user: - password: - # 密码错误{maxRetryCount}次锁定10分钟 - maxRetryCount: 5 - -# Spring配置 -spring: - # 模板引擎 - thymeleaf: - mode: HTML - encoding: utf-8 - # 禁用缓存 - cache: false - # 资源信息 - messages: - # 国际化资源文件路径 - basename: static/i18n/messages - jackson: - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - profiles: - active: druid - # 文件上传 - servlet: - multipart: - # 单个文件大小 - max-file-size: 10MB - # 设置总上传的文件大小 - max-request-size: 20MB - # 服务模块 - devtools: - restart: - # 热部署开关 - enabled: true - -# MyBatis -mybatis: - # 搜索指定包别名 - typeAliasesPackage: com.ruoyi.**.domain - # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml - -# PageHelper分页插件 -pagehelper: - helperDialect: mysql - reasonable: true - supportMethodsArguments: true - params: count=countSql - -# Shiro -shiro: - user: - # 登录地址 - loginUrl: /login - # 权限认证失败地址 - unauthorizedUrl: /unauth - # 首页地址 - indexUrl: /index - # 验证码开关 - captchaEnabled: true - # 验证码类型 math 数组计算 char 字符 - captchaType: math - cookie: - # 设置Cookie的域名 默认空,即当前访问的域名 - domain: - # 设置cookie的有效访问路径 - path: / - # 设置HttpOnly属性 - httpOnly: true - # 设置Cookie的过期时间,天为单位 - maxAge: 30 - session: - # Session超时时间,-1代表永不过期(默认30分钟) - expireTime: 30 - # 同步session到数据库的周期(默认1分钟) - dbSyncPeriod: 1 - # 相隔多久检查一次session的有效性,默认就是10分钟 - validationInterval: 10 - # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制) - maxSession: -1 - # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 - kickoutAfter: false - -# 防止XSS攻击 -xss: - # 过滤开关 - enabled: true - # 排除链接(多个用逗号分隔) - excludes: /system/notice/* - # 匹配链接 - urlPatterns: /system/*,/monitor/*,/tool/* +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 4.1.0 + # 版权年份 + copyrightYear: 2020 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: D:/ruoyi/uploadPath + # 获取ip地址开关 + addressEnabled: true + +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为80 + port: 80 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # tomcat最大线程数,默认为200 + max-threads: 800 + # Tomcat启动初始化的线程数,默认值25 + min-spare-threads: 30 + +# 日志配置 +logging: + level: + com.ruoyi: debug + org.springframework: warn + +# 用户配置 +user: + password: + # 密码错误{maxRetryCount}次锁定10分钟 + maxRetryCount: 5 + +# Spring配置 +spring: + # 模板引擎 + thymeleaf: + mode: HTML + encoding: utf-8 + # 禁用缓存 + cache: false + # 资源信息 + messages: + # 国际化资源文件路径 + basename: static/i18n/messages + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + profiles: + active: druid + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + +# MyBatis +mybatis: + # 搜索指定包别名 + typeAliasesPackage: cn.com.infosouth.**.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml + +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: true + params: count=countSql + +# Shiro +shiro: + user: + # 登录地址 + loginUrl: /login + # 权限认证失败地址 + unauthorizedUrl: /unauth + # 首页地址 + indexUrl: /index + # 验证码开关 + captchaEnabled: true + # 验证码类型 math 数组计算 char 字符 + captchaType: math + cookie: + # 设置Cookie的域名 默认空,即当前访问的域名 + domain: + # 设置cookie的有效访问路径 + path: / + # 设置HttpOnly属性 + httpOnly: true + # 设置Cookie的过期时间,天为单位 + maxAge: 30 + session: + # Session超时时间,-1代表永不过期(默认30分钟) + expireTime: 30 + # 同步session到数据库的周期(默认1分钟) + dbSyncPeriod: 1 + # 相隔多久检查一次session的有效性,默认就是10分钟 + validationInterval: 10 + # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制) + maxSession: -1 + # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 + kickoutAfter: false + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice/* + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* diff --git a/infosouth-admin/src/main/resources/banner.txt b/infosouth-admin/src/main/resources/banner.txt new file mode 100644 index 000000000..263924d26 --- /dev/null +++ b/infosouth-admin/src/main/resources/banner.txt @@ -0,0 +1,7 @@ +Application Version: ${ruoyi.version} +Spring Boot Version: ${spring-boot.version} +//////////////////////////////////////////////////////////////////// +╔═╗╔╦╗╔═╗╔═╗ ╔═╗╔═╗╔╦╗╔═╗╔═╗ +╠═╣║║║╠═╣╚═╗ ║ ║ ║║║║╠═╣║ +╩ ╩╩ ╩╩ ╩╚═╝ o ╚═╝╚═╝╩ ╩╩ ╩╚═╝ +//////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml b/infosouth-admin/src/main/resources/ehcache/ehcache-shiro.xml similarity index 97% rename from ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml rename to infosouth-admin/src/main/resources/ehcache/ehcache-shiro.xml index 0ff3c1e23..be4020b76 100644 --- a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml +++ b/infosouth-admin/src/main/resources/ehcache/ehcache-shiro.xml @@ -1,57 +1,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/logback.xml b/infosouth-admin/src/main/resources/logback.xml similarity index 97% rename from ruoyi-admin/src/main/resources/logback.xml rename to infosouth-admin/src/main/resources/logback.xml index d69a57207..a360583fa 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/infosouth-admin/src/main/resources/logback.xml @@ -1,93 +1,93 @@ - - - - - - - - - - - ${log.pattern} - - - - - - ${log.path}/sys-info.log - - - - ${log.path}/sys-info.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - INFO - - ACCEPT - - DENY - - - - - ${log.path}/sys-error.log - - - - ${log.path}/sys-error.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - ERROR - - ACCEPT - - DENY - - - - - - ${log.path}/sys-user.log - - - ${log.path}/sys-user.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/infosouth-admin/src/main/resources/mybatis/mybatis-config.xml similarity index 100% rename from ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml rename to infosouth-admin/src/main/resources/mybatis/mybatis-config.xml diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js b/infosouth-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js similarity index 97% rename from ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js rename to infosouth-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js index 4f7dd9273..ea69dece1 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js @@ -1,617 +1,617 @@ -/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */ -/* - - The MIT License (MIT) - - Copyright (c) 2007-2013 Einar Lielmanis and contributors. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - - - Style HTML ---------------- - - Written by Nochum Sossonko, (nsossonko@hotmail.com) - - Based on code initially developed by: Einar Lielmanis, - http://jsbeautifier.org/ - - Usage: - style_html(html_source); - - style_html(html_source, options); - - The options are: - indent_size (default 4) — indentation size, - indent_char (default space) — character to indent with, - max_char (default 250) - maximum amount of characters per line (0 = disable) - brace_style (default "collapse") - "collapse" | "expand" | "end-expand" - put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line. - unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted - indent_scripts (default normal) - "keep"|"separate"|"normal" - - e.g. - - style_html(html_source, { - 'indent_size': 2, - 'indent_char': ' ', - 'max_char': 78, - 'brace_style': 'expand', - 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'] - }); -*/ - -(function() { - - function style_html(html_source, options, js_beautify, css_beautify) { - //Wrapper function to invoke all the necessary constructors and deal with the output. - - var multi_parser, - indent_size, - indent_character, - max_char, - brace_style, - unformatted; - - options = options || {}; - indent_size = options.indent_size || 4; - indent_character = options.indent_char || ' '; - brace_style = options.brace_style || 'collapse'; - max_char = options.max_char === 0 ? Infinity : options.max_char || 250; - unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; - - function Parser() { - - this.pos = 0; //Parser position - this.token = ''; - this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT - this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values - parent: 'parent1', - parentcount: 1, - parent1: '' - }; - this.tag_type = ''; - this.token_text = this.last_token = this.last_text = this.token_type = ''; - - this.Utils = { //Uilities made available to the various functions - whitespace: "\n\r\t ".split(''), - single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML - extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them - in_array: function (what, arr) { - for (var i=0; i= this.input.length) { - return content.length?content.join(''):['', 'TK_EOF']; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - this.line_char_count++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { - if (content.length) { - space = true; - } - this.line_char_count--; - continue; //don't want to insert unnecessary space - } - else if (space) { - if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached - content.push('\n'); - for (var i=0; i', 'igm'); - reg_match.lastIndex = this.pos; - var reg_array = reg_match.exec(this.input); - var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script - if(this.pos < end_script) { //get everything in between the script tags - content = this.input.substring(this.pos, end_script); - this.pos = end_script; - } - return content; - }; - - this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object - if (this.tags[tag + 'count']) { //check for the existence of this tag type - this.tags[tag + 'count']++; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level - } - else { //otherwise initialize this tag type - this.tags[tag + 'count'] = 1; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level - } - this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent) - this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1') - }; - - this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer - if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it - var temp_parent = this.tags.parent; //check to see if it's a closable tag. - while (temp_parent) { //till we reach '' (the initial value); - if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it - break; - } - temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree - } - if (temp_parent) { //if we caught something - this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly - this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent - } - delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference... - delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself - if (this.tags[tag + 'count'] === 1) { - delete this.tags[tag + 'count']; - } - else { - this.tags[tag + 'count']--; - } - } - }; - - this.get_tag = function (peek) { //function to get a full tag and parse its type - var input_char = '', - content = [], - comment = '', - space = false, - tag_start, tag_end, - orig_pos = this.pos, - orig_line_char_count = this.line_char_count; - - peek = peek !== undefined ? peek : false; - - do { - if (this.pos >= this.input.length) { - if (peek) { - this.pos = orig_pos; - this.line_char_count = orig_line_char_count; - } - return content.length?content.join(''):['', 'TK_EOF']; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - this.line_char_count++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space - space = true; - this.line_char_count--; - continue; - } - - if (input_char === "'" || input_char === '"') { - if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially - input_char += this.get_unformatted(input_char); - space = true; - } - } - - if (input_char === '=') { //no space before = - space = false; - } - - if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) { - //no space after = or before > - if (this.line_char_count >= this.max_char) { - this.print_newline(false, content); - this.line_char_count = 0; - } - else { - content.push(' '); - this.line_char_count++; - } - space = false; - } - if (input_char === '<') { - tag_start = this.pos - 1; - } - content.push(input_char); //inserts character at-a-time (or string) - } while (input_char !== '>'); - - var tag_complete = content.join(''); - var tag_index; - if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends - tag_index = tag_complete.indexOf(' '); - } - else { //otherwise go with the tag ending - tag_index = tag_complete.indexOf('>'); - } - var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); - if (tag_complete.charAt(tag_complete.length-2) === '/' || - this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /) - if ( ! peek) { - this.tag_type = 'SINGLE'; - } - } - else if (tag_check === 'script') { //for later script handling - if ( ! peek) { - this.record_tag(tag_check); - this.tag_type = 'SCRIPT'; - } - } - else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content) - if ( ! peek) { - this.record_tag(tag_check); - this.tag_type = 'STYLE'; - } - } - else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags - comment = this.get_unformatted('', tag_complete); //...delegate to get_unformatted function - content.push(comment); - // Preserve collapsed whitespace either before or after this tag. - if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){ - content.splice(0, 0, this.input.charAt(tag_start - 1)); - } - tag_end = this.pos - 1; - if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){ - content.push(this.input.charAt(tag_end + 1)); - } - this.tag_type = 'SINGLE'; - } - else if (tag_check.charAt(0) === '!') { //peek for so... - comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted - content.push(comment); - } - if ( ! peek) { - this.tag_type = 'START'; - } - } - else if (tag_check.indexOf('[endif') !== -1) {//peek for ', tag_complete); - content.push(comment); - this.tag_type = 'SINGLE'; - } - } - else if ( ! peek) { - if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending - this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors - this.tag_type = 'END'; - } - else { //otherwise it's a start-tag - this.record_tag(tag_check); //push it on the tag stack - this.tag_type = 'START'; - } - if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line - this.print_newline(true, this.output); - } - } - - if (peek) { - this.pos = orig_pos; - this.line_char_count = orig_line_char_count; - } - - return content.join(''); //returns fully formatted tag - }; - - this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety - - if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) { - return ''; - } - var input_char = ''; - var content = ''; - var space = true; - do { - - if (this.pos >= this.input.length) { - return content; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { - if (!space) { - this.line_char_count--; - continue; - } - if (input_char === '\n' || input_char === '\r') { - content += '\n'; - /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect
 tags if they are specified in the 'unformatted array'
-                for (var i=0; i]*>\s*$/);
-
-            // if next_tag comes back but is not an isolated tag, then
-            // let's treat the 'a' tag as having content
-            // and respect the unformatted option
-            if (!tag || this.Utils.in_array(tag, unformatted)){
-                return true;
-            } else {
-                return false;
-            }
-        };
-
-        this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
-
-          this.input = js_source || ''; //gets the input for the Parser
-          this.output = [];
-          this.indent_character = indent_character;
-          this.indent_string = '';
-          this.indent_size = indent_size;
-          this.brace_style = brace_style;
-          this.indent_level = 0;
-          this.max_char = max_char;
-          this.line_char_count = 0; //count to see if max_char was exceeded
-
-          for (var i=0; i 0) {
-              this.indent_level--;
-            }
-          };
-        };
-        return this;
-      }
-
-      /*_____________________--------------------_____________________*/
-
-      multi_parser = new Parser(); //wrapping functions Parser
-      multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
-
-      while (true) {
-          var t = multi_parser.get_token();
-          multi_parser.token_text = t[0];
-          multi_parser.token_type = t[1];
-
-        if (multi_parser.token_type === 'TK_EOF') {
-          break;
-        }
-
-        switch (multi_parser.token_type) {
-          case 'TK_TAG_START':
-            multi_parser.print_newline(false, multi_parser.output);
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.indent();
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_STYLE':
-          case 'TK_TAG_SCRIPT':
-            multi_parser.print_newline(false, multi_parser.output);
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_END':
-            //Print new line only if the tag has no content and has child
-            if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
-                var tag_name = multi_parser.token_text.match(/\w+/)[0];
-                var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
-                if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
-                    multi_parser.print_newline(true, multi_parser.output);
-                }
-            }
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_SINGLE':
-            // Don't add a newline before elements that should remain unformatted.
-            var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
-            if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
-                multi_parser.print_newline(false, multi_parser.output);
-            }
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_CONTENT':
-            if (multi_parser.token_text !== '') {
-              multi_parser.print_token(multi_parser.token_text);
-            }
-            multi_parser.current_mode = 'TAG';
-            break;
-          case 'TK_STYLE':
-          case 'TK_SCRIPT':
-            if (multi_parser.token_text !== '') {
-              multi_parser.output.push('\n');
-              var text = multi_parser.token_text,
-                  _beautifier,
-                  script_indent_level = 1;
-              if (multi_parser.token_type === 'TK_SCRIPT') {
-                _beautifier = typeof js_beautify === 'function' && js_beautify;
-              } else if (multi_parser.token_type === 'TK_STYLE') {
-                _beautifier = typeof css_beautify === 'function' && css_beautify;
-              }
-
-              if (options.indent_scripts === "keep") {
-                script_indent_level = 0;
-              } else if (options.indent_scripts === "separate") {
-                script_indent_level = -multi_parser.indent_level;
-              }
-
-              var indentation = multi_parser.get_full_indent(script_indent_level);
-              if (_beautifier) {
-                // call the Beautifier if avaliable
-                text = _beautifier(text.replace(/^\s*/, indentation), options);
-              } else {
-                // simply indent the string otherwise
-                var white = text.match(/^\s*/)[0];
-                var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
-                var reindent = multi_parser.get_full_indent(script_indent_level -_level);
-                text = text.replace(/^\s*/, indentation)
-                       .replace(/\r\n|\r|\n/g, '\n' + reindent)
-                       .replace(/\s*$/, '');
-              }
-              if (text) {
-                multi_parser.print_token(text);
-                multi_parser.print_newline(true, multi_parser.output);
-              }
-            }
-            multi_parser.current_mode = 'TAG';
-            break;
-        }
-        multi_parser.last_token = multi_parser.token_type;
-        multi_parser.last_text = multi_parser.token_text;
-      }
-      return multi_parser.output.join('');
-    }
-
-    // If we're running a web page and don't have either of the above, add our one global
-    window.html_beautify = function(html_source, options) {
-        return style_html(html_source, options, window.js_beautify, window.css_beautify);
-    };
-
-}());
+/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */
+/*
+
+  The MIT License (MIT)
+
+  Copyright (c) 2007-2013 Einar Lielmanis and contributors.
+
+  Permission is hereby granted, free of charge, to any person
+  obtaining a copy of this software and associated documentation files
+  (the "Software"), to deal in the Software without restriction,
+  including without limitation the rights to use, copy, modify, merge,
+  publish, distribute, sublicense, and/or sell copies of the Software,
+  and to permit persons to whom the Software is furnished to do so,
+  subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be
+  included in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+
+
+ Style HTML
+---------------
+
+  Written by Nochum Sossonko, (nsossonko@hotmail.com)
+
+  Based on code initially developed by: Einar Lielmanis, 
+    http://jsbeautifier.org/
+
+  Usage:
+    style_html(html_source);
+
+    style_html(html_source, options);
+
+  The options are:
+    indent_size (default 4)          — indentation size,
+    indent_char (default space)      — character to indent with,
+    max_char (default 250)            -  maximum amount of characters per line (0 = disable)
+    brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
+            put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
+    unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
+    indent_scripts (default normal)  - "keep"|"separate"|"normal"
+
+    e.g.
+
+    style_html(html_source, {
+      'indent_size': 2,
+      'indent_char': ' ',
+      'max_char': 78,
+      'brace_style': 'expand',
+      'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']
+    });
+*/
+
+(function() {
+
+    function style_html(html_source, options, js_beautify, css_beautify) {
+    //Wrapper function to invoke all the necessary constructors and deal with the output.
+
+      var multi_parser,
+          indent_size,
+          indent_character,
+          max_char,
+          brace_style,
+          unformatted;
+
+      options = options || {};
+      indent_size = options.indent_size || 4;
+      indent_character = options.indent_char || ' ';
+      brace_style = options.brace_style || 'collapse';
+      max_char = options.max_char === 0 ? Infinity : options.max_char || 250;
+      unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
+
+      function Parser() {
+
+        this.pos = 0; //Parser position
+        this.token = '';
+        this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
+        this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
+          parent: 'parent1',
+          parentcount: 1,
+          parent1: ''
+        };
+        this.tag_type = '';
+        this.token_text = this.last_token = this.last_text = this.token_type = '';
+
+        this.Utils = { //Uilities made available to the various functions
+          whitespace: "\n\r\t ".split(''),
+          single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML
+          extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them
+          in_array: function (what, arr) {
+            for (var i=0; i= this.input.length) {
+              return content.length?content.join(''):['', 'TK_EOF'];
+            }
+
+            input_char = this.input.charAt(this.pos);
+            this.pos++;
+            this.line_char_count++;
+
+            if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
+              if (content.length) {
+                space = true;
+              }
+              this.line_char_count--;
+              continue; //don't want to insert unnecessary space
+            }
+            else if (space) {
+              if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached
+                content.push('\n');
+                for (var i=0; i', 'igm');
+          reg_match.lastIndex = this.pos;
+          var reg_array = reg_match.exec(this.input);
+          var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script
+          if(this.pos < end_script) { //get everything in between the script tags
+            content = this.input.substring(this.pos, end_script);
+            this.pos = end_script;
+          }
+          return content;
+        };
+
+        this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object
+          if (this.tags[tag + 'count']) { //check for the existence of this tag type
+            this.tags[tag + 'count']++;
+            this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
+          }
+          else { //otherwise initialize this tag type
+            this.tags[tag + 'count'] = 1;
+            this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
+          }
+          this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
+          this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
+        };
+
+        this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer
+          if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
+            var temp_parent = this.tags.parent; //check to see if it's a closable tag.
+            while (temp_parent) { //till we reach '' (the initial value);
+              if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
+                break;
+              }
+              temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
+            }
+            if (temp_parent) { //if we caught something
+              this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
+              this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
+            }
+            delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
+            delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
+            if (this.tags[tag + 'count'] === 1) {
+              delete this.tags[tag + 'count'];
+            }
+            else {
+              this.tags[tag + 'count']--;
+            }
+          }
+        };
+
+        this.get_tag = function (peek) { //function to get a full tag and parse its type
+          var input_char = '',
+              content = [],
+              comment = '',
+              space = false,
+              tag_start, tag_end,
+              orig_pos = this.pos,
+              orig_line_char_count = this.line_char_count;
+
+          peek = peek !== undefined ? peek : false;
+
+          do {
+            if (this.pos >= this.input.length) {
+              if (peek) {
+                this.pos = orig_pos;
+                this.line_char_count = orig_line_char_count;
+              }
+              return content.length?content.join(''):['', 'TK_EOF'];
+            }
+
+            input_char = this.input.charAt(this.pos);
+            this.pos++;
+            this.line_char_count++;
+
+            if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
+              space = true;
+              this.line_char_count--;
+              continue;
+            }
+
+            if (input_char === "'" || input_char === '"') {
+              if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially
+                input_char += this.get_unformatted(input_char);
+                space = true;
+              }
+            }
+
+            if (input_char === '=') { //no space before =
+              space = false;
+            }
+
+            if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) {
+                //no space after = or before >
+              if (this.line_char_count >= this.max_char) {
+                this.print_newline(false, content);
+                this.line_char_count = 0;
+              }
+              else {
+                content.push(' ');
+                this.line_char_count++;
+              }
+              space = false;
+            }
+            if (input_char === '<') {
+              tag_start = this.pos - 1;
+            }
+            content.push(input_char); //inserts character at-a-time (or string)
+          } while (input_char !== '>');
+
+          var tag_complete = content.join('');
+          var tag_index;
+          if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
+            tag_index = tag_complete.indexOf(' ');
+          }
+          else { //otherwise go with the tag ending
+            tag_index = tag_complete.indexOf('>');
+          }
+          var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
+          if (tag_complete.charAt(tag_complete.length-2) === '/' ||
+            this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
+            if ( ! peek) {
+              this.tag_type = 'SINGLE';
+            }
+          }
+          else if (tag_check === 'script') { //for later script handling
+            if ( ! peek) {
+              this.record_tag(tag_check);
+              this.tag_type = 'SCRIPT';
+            }
+          }
+          else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)
+            if ( ! peek) {
+              this.record_tag(tag_check);
+              this.tag_type = 'STYLE';
+            }
+          }
+          else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
+            comment = this.get_unformatted('', tag_complete); //...delegate to get_unformatted function
+            content.push(comment);
+            // Preserve collapsed whitespace either before or after this tag.
+            if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){
+                content.splice(0, 0, this.input.charAt(tag_start - 1));
+            }
+            tag_end = this.pos - 1;
+            if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){
+                content.push(this.input.charAt(tag_end + 1));
+            }
+            this.tag_type = 'SINGLE';
+          }
+          else if (tag_check.charAt(0) === '!') { //peek for  so...
+                comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted
+                content.push(comment);
+              }
+              if ( ! peek) {
+                this.tag_type = 'START';
+              }
+            }
+            else if (tag_check.indexOf('[endif') !== -1) {//peek for ', tag_complete);
+              content.push(comment);
+              this.tag_type = 'SINGLE';
+            }
+          }
+          else if ( ! peek) {
+            if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
+              this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
+              this.tag_type = 'END';
+            }
+            else { //otherwise it's a start-tag
+              this.record_tag(tag_check); //push it on the tag stack
+              this.tag_type = 'START';
+            }
+            if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
+              this.print_newline(true, this.output);
+            }
+          }
+
+          if (peek) {
+            this.pos = orig_pos;
+            this.line_char_count = orig_line_char_count;
+          }
+
+          return content.join(''); //returns fully formatted tag
+        };
+
+        this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety
+
+          if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
+            return '';
+          }
+          var input_char = '';
+          var content = '';
+          var space = true;
+          do {
+
+            if (this.pos >= this.input.length) {
+              return content;
+            }
+
+            input_char = this.input.charAt(this.pos);
+            this.pos++;
+
+            if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
+              if (!space) {
+                this.line_char_count--;
+                continue;
+              }
+              if (input_char === '\n' || input_char === '\r') {
+                content += '\n';
+                /*  Don't change tab indention for unformatted blocks.  If using code for html editing, this will greatly affect 
 tags if they are specified in the 'unformatted array'
+                for (var i=0; i]*>\s*$/);
+
+            // if next_tag comes back but is not an isolated tag, then
+            // let's treat the 'a' tag as having content
+            // and respect the unformatted option
+            if (!tag || this.Utils.in_array(tag, unformatted)){
+                return true;
+            } else {
+                return false;
+            }
+        };
+
+        this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
+
+          this.input = js_source || ''; //gets the input for the Parser
+          this.output = [];
+          this.indent_character = indent_character;
+          this.indent_string = '';
+          this.indent_size = indent_size;
+          this.brace_style = brace_style;
+          this.indent_level = 0;
+          this.max_char = max_char;
+          this.line_char_count = 0; //count to see if max_char was exceeded
+
+          for (var i=0; i 0) {
+              this.indent_level--;
+            }
+          };
+        };
+        return this;
+      }
+
+      /*_____________________--------------------_____________________*/
+
+      multi_parser = new Parser(); //wrapping functions Parser
+      multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
+
+      while (true) {
+          var t = multi_parser.get_token();
+          multi_parser.token_text = t[0];
+          multi_parser.token_type = t[1];
+
+        if (multi_parser.token_type === 'TK_EOF') {
+          break;
+        }
+
+        switch (multi_parser.token_type) {
+          case 'TK_TAG_START':
+            multi_parser.print_newline(false, multi_parser.output);
+            multi_parser.print_token(multi_parser.token_text);
+            multi_parser.indent();
+            multi_parser.current_mode = 'CONTENT';
+            break;
+          case 'TK_TAG_STYLE':
+          case 'TK_TAG_SCRIPT':
+            multi_parser.print_newline(false, multi_parser.output);
+            multi_parser.print_token(multi_parser.token_text);
+            multi_parser.current_mode = 'CONTENT';
+            break;
+          case 'TK_TAG_END':
+            //Print new line only if the tag has no content and has child
+            if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
+                var tag_name = multi_parser.token_text.match(/\w+/)[0];
+                var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
+                if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
+                    multi_parser.print_newline(true, multi_parser.output);
+                }
+            }
+            multi_parser.print_token(multi_parser.token_text);
+            multi_parser.current_mode = 'CONTENT';
+            break;
+          case 'TK_TAG_SINGLE':
+            // Don't add a newline before elements that should remain unformatted.
+            var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
+            if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
+                multi_parser.print_newline(false, multi_parser.output);
+            }
+            multi_parser.print_token(multi_parser.token_text);
+            multi_parser.current_mode = 'CONTENT';
+            break;
+          case 'TK_CONTENT':
+            if (multi_parser.token_text !== '') {
+              multi_parser.print_token(multi_parser.token_text);
+            }
+            multi_parser.current_mode = 'TAG';
+            break;
+          case 'TK_STYLE':
+          case 'TK_SCRIPT':
+            if (multi_parser.token_text !== '') {
+              multi_parser.output.push('\n');
+              var text = multi_parser.token_text,
+                  _beautifier,
+                  script_indent_level = 1;
+              if (multi_parser.token_type === 'TK_SCRIPT') {
+                _beautifier = typeof js_beautify === 'function' && js_beautify;
+              } else if (multi_parser.token_type === 'TK_STYLE') {
+                _beautifier = typeof css_beautify === 'function' && css_beautify;
+              }
+
+              if (options.indent_scripts === "keep") {
+                script_indent_level = 0;
+              } else if (options.indent_scripts === "separate") {
+                script_indent_level = -multi_parser.indent_level;
+              }
+
+              var indentation = multi_parser.get_full_indent(script_indent_level);
+              if (_beautifier) {
+                // call the Beautifier if avaliable
+                text = _beautifier(text.replace(/^\s*/, indentation), options);
+              } else {
+                // simply indent the string otherwise
+                var white = text.match(/^\s*/)[0];
+                var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
+                var reindent = multi_parser.get_full_indent(script_indent_level -_level);
+                text = text.replace(/^\s*/, indentation)
+                       .replace(/\r\n|\r|\n/g, '\n' + reindent)
+                       .replace(/\s*$/, '');
+              }
+              if (text) {
+                multi_parser.print_token(text);
+                multi_parser.print_newline(true, multi_parser.output);
+              }
+            }
+            multi_parser.current_mode = 'TAG';
+            break;
+        }
+        multi_parser.last_token = multi_parser.token_type;
+        multi_parser.last_text = multi_parser.token_text;
+      }
+      return multi_parser.output.join('');
+    }
+
+    // If we're running a web page and don't have either of the above, add our one global
+    window.html_beautify = function(html_source, options) {
+        return style_html(html_source, options, window.js_beautify, window.css_beautify);
+    };
+
+}());
diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js b/infosouth-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
similarity index 97%
rename from ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
rename to infosouth-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
index 8a9d70893..552613d96 100644
--- a/ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
+++ b/infosouth-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
@@ -1,620 +1,620 @@
-/*!
- * jQuery blockUI plugin
- * Version 2.70.0-2014.11.23
- * Requires jQuery v1.7 or later
- *
- * Examples at: http://malsup.com/jquery/block/
- * Copyright (c) 2007-2013 M. Alsup
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Thanks to Amir-Hossein Sobhi for some excellent contributions!
- */
-
-;(function() {
-/*jshint eqeqeq:false curly:false latedef:false */
-"use strict";
-
-	function setup($) {
-		$.fn._fadeIn = $.fn.fadeIn;
-
-		var noOp = $.noop || function() {};
-
-		// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
-		// confusing userAgent strings on Vista)
-		var msie = /MSIE/.test(navigator.userAgent);
-		var ie6  = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
-		var mode = document.documentMode || 0;
-		var setExpr = $.isFunction( document.createElement('div').style.setExpression );
-
-		// global $ methods for blocking/unblocking the entire page
-		$.blockUI   = function(opts) { install(window, opts); };
-		$.unblockUI = function(opts) { remove(window, opts); };
-
-		// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
-		$.growlUI = function(title, message, timeout, onClose) {
-			var $m = $('
'); - if (title) $m.append('

'+title+'

'); - if (message) $m.append('

'+message+'

'); - if (timeout === undefined) timeout = 3000; - - // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications - var callBlock = function(opts) { - opts = opts || {}; - - $.blockUI({ - message: $m, - fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, - fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, - timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, - centerY: false, - showOverlay: false, - onUnblock: onClose, - css: $.blockUI.defaults.growlCSS - }); - }; - - callBlock(); - var nonmousedOpacity = $m.css('opacity'); - $m.mouseover(function() { - callBlock({ - fadeIn: 0, - timeout: 30000 - }); - - var displayBlock = $('.blockMsg'); - displayBlock.stop(); // cancel fadeout if it has started - displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency - }).mouseout(function() { - $('.blockMsg').fadeOut(1000); - }); - // End konapun additions - }; - - // plugin method for blocking element content - $.fn.block = function(opts) { - if ( this[0] === window ) { - $.blockUI( opts ); - return this; - } - var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); - this.each(function() { - var $el = $(this); - if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) - return; - $el.unblock({ fadeOut: 0 }); - }); - - return this.each(function() { - if ($.css(this,'position') == 'static') { - this.style.position = 'relative'; - $(this).data('blockUI.static', true); - } - this.style.zoom = 1; // force 'hasLayout' in ie - install(this, opts); - }); - }; - - // plugin method for unblocking element content - $.fn.unblock = function(opts) { - if ( this[0] === window ) { - $.unblockUI( opts ); - return this; - } - return this.each(function() { - remove(this, opts); - }); - }; - - $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! - - // override these in your code to change the default behavior and style - $.blockUI.defaults = { - // message displayed when blocking (use null for no message) - message: '
加载中......
', - - title: null, // title string; only used when theme == true - draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) - - theme: false, // set to true to use with jQuery UI themes - - // styles for the message when blocking; if you wish to disable - // these and use an external stylesheet then do this in your code: - // $.blockUI.defaults.css = {}; - css: { - padding: 0, - margin: 0, - width: '30%', - top: '40%', - left: '35%', - textAlign: 'center', - color: '#000', - border: '0px', - backgroundColor:'transparent', - cursor: 'wait' - }, - - // minimal style set used when themes are used - themedCSS: { - width: '30%', - top: '40%', - left: '35%' - }, - - // styles for the overlay - overlayCSS: { - backgroundColor: '#000', - opacity: 0.6, - cursor: 'wait' - }, - - // style to replace wait cursor before unblocking to correct issue - // of lingering wait cursor - cursorReset: 'default', - - // styles applied when using $.growlUI - growlCSS: { - width: '350px', - top: '10px', - left: '', - right: '10px', - border: 'none', - padding: '5px', - opacity: 0.6, - cursor: 'default', - color: '#fff', - backgroundColor: '#000', - '-webkit-border-radius':'10px', - '-moz-border-radius': '10px', - 'border-radius': '10px' - }, - - // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w - // (hat tip to Jorge H. N. de Vasconcelos) - /*jshint scripturl:true */ - iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', - - // force usage of iframe in non-IE browsers (handy for blocking applets) - forceIframe: false, - - // z-index for the blocking overlay - baseZ: 1000, - - // set these to true to have the message automatically centered - centerX: true, // <-- only effects element blocking (page block controlled via css above) - centerY: true, - - // allow body element to be stetched in ie6; this makes blocking look better - // on "short" pages. disable if you wish to prevent changes to the body height - allowBodyStretch: true, - - // enable if you want key and mouse events to be disabled for content that is blocked - bindEvents: true, - - // be default blockUI will supress tab navigation from leaving blocking content - // (if bindEvents is true) - constrainTabKey: true, - - // fadeIn time in millis; set to 0 to disable fadeIn on block - fadeIn: 200, - - // fadeOut time in millis; set to 0 to disable fadeOut on unblock - fadeOut: 400, - - // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock - timeout: 0, - - // disable if you don't want to show the overlay - showOverlay: true, - - // if true, focus will be placed in the first available input field when - // page blocking - focusInput: true, - - // elements that can receive focus - focusableElements: ':input:enabled:visible', - - // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) - // no longer needed in 2012 - // applyPlatformOpacityRules: true, - - // callback method invoked when fadeIn has completed and blocking message is visible - onBlock: null, - - // callback method invoked when unblocking has completed; the callback is - // passed the element that has been unblocked (which is the window object for page - // blocks) and the options that were passed to the unblock call: - // onUnblock(element, options) - onUnblock: null, - - // callback method invoked when the overlay area is clicked. - // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. - onOverlayClick: null, - - // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 - quirksmodeOffsetHack: 4, - - // class name of the message block - blockMsgClass: 'blockMsg', - - // if it is already blocked, then ignore it (don't unblock and reblock) - ignoreIfBlocked: false - }; - - // private data and functions follow... - - var pageBlock = null; - var pageBlockEls = []; - - function install(el, opts) { - var css, themedCSS; - var full = (el == window); - var msg = (opts && opts.message !== undefined ? opts.message : undefined); - opts = $.extend({}, $.blockUI.defaults, opts || {}); - - if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) - return; - - opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); - css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); - if (opts.onOverlayClick) - opts.overlayCSS.cursor = 'pointer'; - - themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); - msg = msg === undefined ? opts.message : msg; - - // remove the current block (if there is one) - if (full && pageBlock) - remove(window, {fadeOut:0}); - - // if an existing element is being used as the blocking content then we capture - // its current place in the DOM (and current display style) so we can restore - // it when we unblock - if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { - var node = msg.jquery ? msg[0] : msg; - var data = {}; - $(el).data('blockUI.history', data); - data.el = node; - data.parent = node.parentNode; - data.display = node.style.display; - data.position = node.style.position; - if (data.parent) - data.parent.removeChild(node); - } - - $(el).data('blockUI.onUnblock', opts.onUnblock); - var z = opts.baseZ; - - // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; - // layer1 is the iframe layer which is used to supress bleed through of underlying content - // layer2 is the overlay layer which has opacity and a wait cursor (by default) - // layer3 is the message content that is displayed while blocking - var lyr1, lyr2, lyr3, s; - if (msie || opts.forceIframe) - lyr1 = $(''); - else - lyr1 = $(''); - - if (opts.theme) - lyr2 = $(''); - else - lyr2 = $(''); - - if (opts.theme && full) { - s = ''; - } - else if (opts.theme) { - s = ''; - } - else if (full) { - s = ''; - } - else { - s = ''; - } - lyr3 = $(s); - - // if we have a message, style it - if (msg) { - if (opts.theme) { - lyr3.css(themedCSS); - lyr3.addClass('ui-widget-content'); - } - else - lyr3.css(css); - } - - // style the overlay - if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) - lyr2.css(opts.overlayCSS); - lyr2.css('position', full ? 'fixed' : 'absolute'); - - // make iframe layer transparent in IE - if (msie || opts.forceIframe) - lyr1.css('opacity',0.0); - - //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); - var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); - $.each(layers, function() { - this.appendTo($par); - }); - - if (opts.theme && opts.draggable && $.fn.draggable) { - lyr3.draggable({ - handle: '.ui-dialog-titlebar', - cancel: 'li' - }); - } - - // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) - var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); - if (ie6 || expr) { - // give body 100% height - if (full && opts.allowBodyStretch && $.support.boxModel) - $('html,body').css('height','100%'); - - // fix ie6 issue when blocked element has a border width - if ((ie6 || !$.support.boxModel) && !full) { - var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); - var fixT = t ? '(0 - '+t+')' : 0; - var fixL = l ? '(0 - '+l+')' : 0; - } - - // simulate fixed position - $.each(layers, function(i,o) { - var s = o[0].style; - s.position = 'absolute'; - if (i < 2) { - if (full) - s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); - else - s.setExpression('height','this.parentNode.offsetHeight + "px"'); - if (full) - s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); - else - s.setExpression('width','this.parentNode.offsetWidth + "px"'); - if (fixL) s.setExpression('left', fixL); - if (fixT) s.setExpression('top', fixT); - } - else if (opts.centerY) { - if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); - s.marginTop = 0; - } - else if (!opts.centerY && full) { - var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; - var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; - s.setExpression('top',expression); - } - }); - } - - // show the message - if (msg) { - if (opts.theme) - lyr3.find('.ui-widget-content').append(msg); - else - lyr3.append(msg); - if (msg.jquery || msg.nodeType) - $(msg).show(); - } - - if ((msie || opts.forceIframe) && opts.showOverlay) - lyr1.show(); // opacity is zero - if (opts.fadeIn) { - var cb = opts.onBlock ? opts.onBlock : noOp; - var cb1 = (opts.showOverlay && !msg) ? cb : noOp; - var cb2 = msg ? cb : noOp; - if (opts.showOverlay) - lyr2._fadeIn(opts.fadeIn, cb1); - if (msg) - lyr3._fadeIn(opts.fadeIn, cb2); - } - else { - if (opts.showOverlay) - lyr2.show(); - if (msg) - lyr3.show(); - if (opts.onBlock) - opts.onBlock.bind(lyr3)(); - } - - // bind key and mouse events - bind(1, el, opts); - - if (full) { - pageBlock = lyr3[0]; - pageBlockEls = $(opts.focusableElements,pageBlock); - if (opts.focusInput) - setTimeout(focus, 20); - } - else - center(lyr3[0], opts.centerX, opts.centerY); - - if (opts.timeout) { - // auto-unblock - var to = setTimeout(function() { - if (full) - $.unblockUI(opts); - else - $(el).unblock(opts); - }, opts.timeout); - $(el).data('blockUI.timeout', to); - } - } - - // remove the block - function remove(el, opts) { - var count; - var full = (el == window); - var $el = $(el); - var data = $el.data('blockUI.history'); - var to = $el.data('blockUI.timeout'); - if (to) { - clearTimeout(to); - $el.removeData('blockUI.timeout'); - } - opts = $.extend({}, $.blockUI.defaults, opts || {}); - bind(0, el, opts); // unbind events - - if (opts.onUnblock === null) { - opts.onUnblock = $el.data('blockUI.onUnblock'); - $el.removeData('blockUI.onUnblock'); - } - - var els; - if (full) // crazy selector to handle odd field errors in ie6/7 - els = $('body').children().filter('.blockUI').add('body > .blockUI'); - else - els = $el.find('>.blockUI'); - - // fix cursor issue - if ( opts.cursorReset ) { - if ( els.length > 1 ) - els[1].style.cursor = opts.cursorReset; - if ( els.length > 2 ) - els[2].style.cursor = opts.cursorReset; - } - - if (full) - pageBlock = pageBlockEls = null; - - if (opts.fadeOut) { - count = els.length; - els.stop().fadeOut(opts.fadeOut, function() { - if ( --count === 0) - reset(els,data,opts,el); - }); - } - else - reset(els, data, opts, el); - } - - // move blocking element back into the DOM where it started - function reset(els,data,opts,el) { - var $el = $(el); - if ( $el.data('blockUI.isBlocked') ) - return; - - els.each(function(i,o) { - // remove via DOM calls so we don't lose event handlers - if (this.parentNode) - this.parentNode.removeChild(this); - }); - - if (data && data.el) { - data.el.style.display = data.display; - data.el.style.position = data.position; - data.el.style.cursor = 'default'; // #59 - if (data.parent) - data.parent.appendChild(data.el); - $el.removeData('blockUI.history'); - } - - if ($el.data('blockUI.static')) { - $el.css('position', 'static'); // #22 - } - - if (typeof opts.onUnblock == 'function') - opts.onUnblock(el,opts); - - // fix issue in Safari 6 where block artifacts remain until reflow - var body = $(document.body), w = body.width(), cssW = body[0].style.width; - body.width(w-1).width(w); - body[0].style.width = cssW; - } - - // bind/unbind the handler - function bind(b, el, opts) { - var full = el == window, $el = $(el); - - // don't bother unbinding if there is nothing to unbind - if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) - return; - - $el.data('blockUI.isBlocked', b); - - // don't bind events when overlay is not in use or if bindEvents is false - if (!full || !opts.bindEvents || (b && !opts.showOverlay)) - return; - - // bind anchors and inputs for mouse and key events - var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; - if (b) - $(document).bind(events, opts, handler); - else - $(document).unbind(events, handler); - - // former impl... - // var $e = $('a,:input'); - // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); - } - - // event handler to suppress keyboard/mouse events when blocking - function handler(e) { - // allow tab navigation (conditionally) - if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { - if (pageBlock && e.data.constrainTabKey) { - var els = pageBlockEls; - var fwd = !e.shiftKey && e.target === els[els.length-1]; - var back = e.shiftKey && e.target === els[0]; - if (fwd || back) { - setTimeout(function(){focus(back);},10); - return false; - } - } - } - var opts = e.data; - var target = $(e.target); - if (target.hasClass('blockOverlay') && opts.onOverlayClick) - opts.onOverlayClick(e); - - // allow events within the message content - if (target.parents('div.' + opts.blockMsgClass).length > 0) - return true; - - // allow events for content that is not being blocked - return target.parents().children().filter('div.blockUI').length === 0; - } - - function focus(back) { - if (!pageBlockEls) - return; - var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; - if (e) - e.focus(); - } - - function center(el, x, y) { - var p = el.parentNode, s = el.style; - var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); - var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); - if (x) s.left = l > 0 ? (l+'px') : '0'; - if (y) s.top = t > 0 ? (t+'px') : '0'; - } - - function sz(el, p) { - return parseInt($.css(el,p),10)||0; - } - - } - - - /*global define:true */ - if (typeof define === 'function' && define.amd && define.amd.jQuery) { - define(['jquery'], setup); - } else { - setup(jQuery); - } - +/*! + * jQuery blockUI plugin + * Version 2.70.0-2014.11.23 + * Requires jQuery v1.7 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2013 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function() { +/*jshint eqeqeq:false curly:false latedef:false */ +"use strict"; + + function setup($) { + $.fn._fadeIn = $.fn.fadeIn; + + var noOp = $.noop || function() {}; + + // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle + // confusing userAgent strings on Vista) + var msie = /MSIE/.test(navigator.userAgent); + var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent); + var mode = document.documentMode || 0; + var setExpr = $.isFunction( document.createElement('div').style.setExpression ); + + // global $ methods for blocking/unblocking the entire page + $.blockUI = function(opts) { install(window, opts); }; + $.unblockUI = function(opts) { remove(window, opts); }; + + // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) + $.growlUI = function(title, message, timeout, onClose) { + var $m = $('
'); + if (title) $m.append('

'+title+'

'); + if (message) $m.append('

'+message+'

'); + if (timeout === undefined) timeout = 3000; + + // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications + var callBlock = function(opts) { + opts = opts || {}; + + $.blockUI({ + message: $m, + fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, + fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, + timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, + centerY: false, + showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); + }; + + callBlock(); + var nonmousedOpacity = $m.css('opacity'); + $m.mouseover(function() { + callBlock({ + fadeIn: 0, + timeout: 30000 + }); + + var displayBlock = $('.blockMsg'); + displayBlock.stop(); // cancel fadeout if it has started + displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency + }).mouseout(function() { + $('.blockMsg').fadeOut(1000); + }); + // End konapun additions + }; + + // plugin method for blocking element content + $.fn.block = function(opts) { + if ( this[0] === window ) { + $.blockUI( opts ); + return this; + } + var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); + this.each(function() { + var $el = $(this); + if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) + return; + $el.unblock({ fadeOut: 0 }); + }); + + return this.each(function() { + if ($.css(this,'position') == 'static') { + this.style.position = 'relative'; + $(this).data('blockUI.static', true); + } + this.style.zoom = 1; // force 'hasLayout' in ie + install(this, opts); + }); + }; + + // plugin method for unblocking element content + $.fn.unblock = function(opts) { + if ( this[0] === window ) { + $.unblockUI( opts ); + return this; + } + return this.each(function() { + remove(this, opts); + }); + }; + + $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! + + // override these in your code to change the default behavior and style + $.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '
加载中......
', + + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + + theme: false, // set to true to use with jQuery UI themes + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '0px', + backgroundColor:'transparent', + cursor: 'wait' + }, + + // minimal style set used when themes are used + themedCSS: { + width: '30%', + top: '40%', + left: '35%' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // style to replace wait cursor before unblocking to correct issue + // of lingering wait cursor + cursorReset: 'default', + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: 'default', + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius':'10px', + '-moz-border-radius': '10px', + 'border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + /*jshint scripturl:true */ + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // elements that can receive focus + focusableElements: ':input:enabled:visible', + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + // no longer needed in 2012 + // applyPlatformOpacityRules: true, + + // callback method invoked when fadeIn has completed and blocking message is visible + onBlock: null, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // callback method invoked when the overlay area is clicked. + // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. + onOverlayClick: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4, + + // class name of the message block + blockMsgClass: 'blockMsg', + + // if it is already blocked, then ignore it (don't unblock and reblock) + ignoreIfBlocked: false + }; + + // private data and functions follow... + + var pageBlock = null; + var pageBlockEls = []; + + function install(el, opts) { + var css, themedCSS; + var full = (el == window); + var msg = (opts && opts.message !== undefined ? opts.message : undefined); + opts = $.extend({}, $.blockUI.defaults, opts || {}); + + if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) + return; + + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + if (opts.onOverlayClick) + opts.overlayCSS.cursor = 'pointer'; + + themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + $(el).data('blockUI.onUnblock', opts.onUnblock); + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + var lyr1, lyr2, lyr3, s; + if (msie || opts.forceIframe) + lyr1 = $(''); + else + lyr1 = $(''); + + if (opts.theme) + lyr2 = $(''); + else + lyr2 = $(''); + + if (opts.theme && full) { + s = ''; + } + else if (opts.theme) { + s = ''; + } + else if (full) { + s = ''; + } + else { + s = ''; + } + lyr3 = $(s); + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if (msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.support.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.support.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each(layers, function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + if (full) + s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); + else + s.setExpression('height','this.parentNode.offsetHeight + "px"'); + if (full) + s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); + else + s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if ((msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock.bind(lyr3)(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(opts.focusableElements,pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + if (full) + $.unblockUI(opts); + else + $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } + } + + // remove the block + function remove(el, opts) { + var count; + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + if (opts.onUnblock === null) { + opts.onUnblock = $el.data('blockUI.onUnblock'); + $el.removeData('blockUI.onUnblock'); + } + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $el.find('>.blockUI'); + + // fix cursor issue + if ( opts.cursorReset ) { + if ( els.length > 1 ) + els[1].style.cursor = opts.cursorReset; + if ( els.length > 2 ) + els[2].style.cursor = opts.cursorReset; + } + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + count = els.length; + els.stop().fadeOut(opts.fadeOut, function() { + if ( --count === 0) + reset(els,data,opts,el); + }); + } + else + reset(els, data, opts, el); + } + + // move blocking element back into the DOM where it started + function reset(els,data,opts,el) { + var $el = $(el); + if ( $el.data('blockUI.isBlocked') ) + return; + + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + data.el.style.cursor = 'default'; // #59 + if (data.parent) + data.parent.appendChild(data.el); + $el.removeData('blockUI.history'); + } + + if ($el.data('blockUI.static')) { + $el.css('position', 'static'); // #22 + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); + + // fix issue in Safari 6 where block artifacts remain until reflow + var body = $(document.body), w = body.width(), cssW = body[0].style.width; + body.width(w-1).width(w); + body[0].style.width = cssW; + } + + // bind/unbind the handler + function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!full || !opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; + if (b) + $(document).bind(events, opts, handler); + else + $(document).unbind(events, handler); + + // former impl... + // var $e = $('a,:input'); + // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); + } + + // event handler to suppress keyboard/mouse events when blocking + function handler(e) { + // allow tab navigation (conditionally) + if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target === els[els.length-1]; + var back = e.shiftKey && e.target === els[0]; + if (fwd || back) { + setTimeout(function(){focus(back);},10); + return false; + } + } + } + var opts = e.data; + var target = $(e.target); + if (target.hasClass('blockOverlay') && opts.onOverlayClick) + opts.onOverlayClick(e); + + // allow events within the message content + if (target.parents('div.' + opts.blockMsgClass).length > 0) + return true; + + // allow events for content that is not being blocked + return target.parents().children().filter('div.blockUI').length === 0; + } + + function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); + } + + function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; + } + + function sz(el, p) { + return parseInt($.css(el,p),10)||0; + } + + } + + + /*global define:true */ + if (typeof define === 'function' && define.amd && define.amd.jQuery) { + define(['jquery'], setup); + } else { + setup(jQuery); + } + })(); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css similarity index 95% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css index 63a56c7af..a9ac56efc 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css @@ -1,550 +1,550 @@ -/*! - * bootstrap-fileinput v5.0.4 - * http://plugins.krajee.com/file-input - * - * Krajee default styling for bootstrap-fileinput. - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ -.file-loading input[type=file], input[type=file].file-loading { - width: 0; - height: 0; -} - -.file-no-browse { - position: absolute; - left: 50%; - bottom: 20%; - width: 1px; - height: 1px; - font-size: 0; - opacity: 0; - border: none; - background: none; - outline: none; - box-shadow: none; -} - -.kv-hidden, .file-caption-icon, .file-zoom-dialog .modal-header:before, .file-zoom-dialog .modal-header:after, .file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, .file-input-new .no-browse .input-group-btn, .file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button, .file-input-ajax-new .no-browse .input-group-btn, .hide-content .kv-file-content, .is-locked .fileinput-upload-button, .is-locked .fileinput-remove-button { - display: none; -} - -.btn-file input[type=file], .file-caption-icon, .file-preview .fileinput-remove, .krajee-default .file-thumb-progress, .file-zoom-dialog .btn-navigate, .file-zoom-dialog .floating-buttons { - position: absolute; -} - -.file-caption-icon .kv-caption-icon { - line-height: inherit; -} - -.file-input, .file-loading:before, .btn-file, .file-caption, .file-preview, .krajee-default.file-preview-frame, .krajee-default .file-thumbnail-footer, .file-zoom-dialog .modal-dialog { - position: relative; -} - -.file-error-message pre, .file-error-message ul, .krajee-default .file-actions, .krajee-default .file-other-error { - text-align: left; -} - -.file-error-message pre, .file-error-message ul { - margin: 0; -} - -.krajee-default .file-drag-handle, .krajee-default .file-upload-indicator { - float: left; - margin-top: 10px; - width: 16px; - height: 16px; -} - -.krajee-default .file-thumb-progress .progress, .krajee-default .file-thumb-progress .progress-bar { - height: 20px; - font-family: Verdana, Helvetica, sans-serif; - font-size: 9px; -} - -.krajee-default .file-thumb-progress .progress, .kv-upload-progress .progress { - background-color: #ccc; -} - -.krajee-default .file-caption-info, .krajee-default .file-size-info { - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: 160px; - height: 15px; - margin: auto; -} - -.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash, .file-zoom-content > .file-object.type-image { - max-width: 100%; - max-height: 100%; - width: auto; -} - -.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash { - height: 100%; -} - -.file-zoom-content > .file-object.type-pdf, .file-zoom-content > .file-object.type-html, .file-zoom-content > .file-object.type-text, .file-zoom-content > .file-object.type-default { - width: 100%; -} - -.file-loading:before { - content: " Loading..."; - display: inline-block; - padding-left: 20px; - line-height: 16px; - font-size: 13px; - font-variant: small-caps; - color: #999; - background: transparent url(loading.gif) top left no-repeat; -} - -.file-object { - margin: 0 0 -5px 0; - padding: 0; -} - -.btn-file { - overflow: hidden; -} - -.btn-file input[type=file] { - top: 0; - left: 0; - min-width: 100%; - min-height: 100%; - text-align: right; - opacity: 0; - background: none repeat scroll 0 0 transparent; - cursor: inherit; - display: block; -} - -.btn-file ::-ms-browse { - font-size: 10000px; - width: 100%; - height: 100%; -} - -.file-caption .file-caption-name { - width: 100%; - margin: 0; - padding: 0; - box-shadow: none; - border: none; - background: none; - outline: none; -} - -.file-caption.icon-visible .file-caption-icon { - display: inline-block; -} - -.file-caption.icon-visible .file-caption-name { - padding-left: 15px; -} - -.file-caption-icon { - left: 8px; -} - -.file-error-message { - color: #a94442; - background-color: #f2dede; - margin: 5px; - border: 1px solid #ebccd1; - border-radius: 4px; - padding: 15px; -} - -.file-error-message pre { - margin: 5px 0; -} - -.file-caption-disabled { - background-color: #eee; - cursor: not-allowed; - opacity: 1; -} - -.file-preview { - border-radius: 5px; - border: 1px solid #ddd; - padding: 8px; - width: 100%; - margin-bottom: 5px; -} - -.file-preview .btn-xs { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} - -.file-preview .fileinput-remove { - top: 1px; - right: 1px; - line-height: 10px; -} - -.file-preview .clickable { - cursor: pointer; -} - -.file-preview-image { - font: 40px Impact, Charcoal, sans-serif; - color: #008000; -} - -.krajee-default.file-preview-frame { - margin: 8px; - border: 1px solid rgba(0,0,0,0.2); - box-shadow: 0 0 10px 0 rgba(0,0,0,0.2); - padding: 6px; - float: left; - text-align: center; -} - -.krajee-default.file-preview-frame .kv-file-content { - width: 213px; - height: 160px; -} - -.krajee-default .file-preview-other-frame { - display: flex; - align-items: center; - justify-content: center; -} - -.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { - width: 400px; -} - -.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content { - width: 240px; - height: 55px; -} - -.krajee-default.file-preview-frame .file-thumbnail-footer { - height: 70px; -} - -.krajee-default.file-preview-frame:not(.file-preview-error):hover { - border: 1px solid rgba(0,0,0,0.3); - box-shadow: 0 0 10px 0 rgba(0,0,0,0.4); -} - -.krajee-default .file-preview-text { - display: block; - color: #428bca; - border: 1px solid #ddd; - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - outline: none; - padding: 8px; - resize: none; -} - -.krajee-default .file-preview-html { - border: 1px solid #ddd; - padding: 8px; - overflow: auto; -} - -.krajee-default .file-other-icon { - font-size: 6em; - line-height: 1; -} - -.krajee-default .file-footer-buttons { - float: right; -} - -.krajee-default .file-footer-caption { - display: block; - text-align: center; - padding-top: 4px; - font-size: 11px; - color: #777; - margin-bottom: 30px; -} - -.file-upload-stats { - font-size: 10px; - text-align: center; - width: 100%; -} - -.kv-upload-progress .file-upload-stats { - font-size: 12px; - margin: -10px 0 5px; -} - -.krajee-default .file-preview-error { - opacity: 0.65; - box-shadow: none; -} - -.krajee-default .file-thumb-progress { - height: 11px; - top: 37px; - left: 0; - right: 0; -} - -.krajee-default.kvsortable-ghost { - background: #e1edf7; - border: 2px solid #a1abff; -} - -.krajee-default .file-preview-other:hover { - opacity: 0.8; -} - -.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover { - color: #000; -} - -.kv-upload-progress .progress { - height: 20px; - margin: 10px 0; - overflow: hidden; -} - -.kv-upload-progress .progress-bar { - height: 20px; - font-family: Verdana, Helvetica, sans-serif; -} - -/*noinspection CssOverwrittenProperties*/ -.file-zoom-dialog .file-other-icon { - font-size: 22em; - font-size: 50vmin; -} - -.file-zoom-dialog .modal-dialog { - width: auto; -} - -.file-zoom-dialog .modal-header { - display: flex; - align-items: center; - justify-content: space-between; -} - -.file-zoom-dialog .btn-navigate { - padding: 0; - margin: 0; - background: transparent; - text-decoration: none; - outline: none; - opacity: 0.7; - top: 45%; - font-size: 4em; - color: #1c94c4; -} - -.file-zoom-dialog .btn-navigate:not([disabled]):hover { - outline: none; - box-shadow: none; - opacity: 0.6; -} - -.file-zoom-dialog .floating-buttons { - top: 5px; - right: 10px; -} - -.file-zoom-dialog .btn-navigate[disabled] { - opacity: 0.3; -} - -.file-zoom-dialog .btn-prev { - left: 1px; -} - -.file-zoom-dialog .btn-next { - right: 1px; -} - -.file-zoom-dialog .kv-zoom-title { - font-weight: 300; - color: #999; - max-width: 50%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.file-input-new .no-browse .form-control { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.file-input-ajax-new .no-browse .form-control { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.file-caption-main { - width: 100%; -} - -.file-thumb-loading { - background: transparent url(loading.gif) no-repeat scroll center center content-box !important; -} - -.file-drop-zone { - border: 1px dashed #aaa; - border-radius: 4px; - text-align: center; - vertical-align: middle; - margin: 12px 15px 12px 12px; - padding: 5px; -} - -.file-drop-zone.clickable:hover { - border: 2px dashed #999; -} - -.file-drop-zone.clickable:focus { - border: 2px solid #5acde2; -} - -.file-drop-zone .file-preview-thumbnails { - cursor: default; -} - -.file-drop-zone-title { - color: #aaa; - font-size: 1.6em; - padding: 85px 10px; - cursor: default; -} - -.file-highlighted { - border: 2px dashed #999 !important; - background-color: #eee; -} - -.file-uploading { - background: url(loading-sm.gif) no-repeat center bottom 10px; - opacity: 0.65; -} - -.file-zoom-fullscreen .modal-dialog { - min-width: 100%; - margin: 0; -} - -.file-zoom-fullscreen .modal-content { - border-radius: 0; - box-shadow: none; - min-height: 100vh; -} - -.file-zoom-fullscreen .modal-body { - overflow-y: auto; -} - -.floating-buttons { - z-index: 3000; -} - -.floating-buttons .btn-kv { - margin-left: 3px; - z-index: 3000; -} - -.kv-zoom-actions .btn-kv { - margin-left: 3px; -} - -.file-zoom-content { - height: 480px; - text-align: center; -} - -.file-zoom-content .file-preview-image { - max-height: 100%; -} - -.file-zoom-content .file-preview-video { - max-height: 100%; -} - -.file-zoom-content > .file-object.type-image { - height: auto; - min-height: inherit; -} - -.file-zoom-content > .file-object.type-audio { - width: auto; - height: 30px; -} - -@media (min-width: 576px) { - .file-zoom-dialog .modal-dialog { - max-width: 500px; - } -} - -@media (min-width: 992px) { - .file-zoom-dialog .modal-lg { - max-width: 800px; - } -} - -@media (max-width: 767px) { - .file-preview-thumbnails { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; - } - - .file-zoom-dialog .modal-header { - flex-direction: column; - } -} - -@media (max-width: 350px) { - .krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content { - width: 160px; - } -} - -@media (max-width: 420px) { - .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { - width: 100%; - } -} - -.file-loading[dir=rtl]:before { - background: transparent url(loading.gif) top right no-repeat; - padding-left: 0; - padding-right: 20px; -} - -.file-sortable .file-drag-handle { - cursor: move; - opacity: 1; -} - -.file-sortable .file-drag-handle:hover { - opacity: 0.7; -} - -.clickable .file-drop-zone-title { - cursor: pointer; -} - -.file-preview-initial.sortable-chosen { - background-color: #d9edf7; +/*! + * bootstrap-fileinput v5.0.4 + * http://plugins.krajee.com/file-input + * + * Krajee default styling for bootstrap-fileinput. + * + * Author: Kartik Visweswaran + * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com + * + * Licensed under the BSD-3-Clause + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md + */ +.file-loading input[type=file], input[type=file].file-loading { + width: 0; + height: 0; +} + +.file-no-browse { + position: absolute; + left: 50%; + bottom: 20%; + width: 1px; + height: 1px; + font-size: 0; + opacity: 0; + border: none; + background: none; + outline: none; + box-shadow: none; +} + +.kv-hidden, .file-caption-icon, .file-zoom-dialog .modal-header:before, .file-zoom-dialog .modal-header:after, .file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, .file-input-new .no-browse .input-group-btn, .file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button, .file-input-ajax-new .no-browse .input-group-btn, .hide-content .kv-file-content, .is-locked .fileinput-upload-button, .is-locked .fileinput-remove-button { + display: none; +} + +.btn-file input[type=file], .file-caption-icon, .file-preview .fileinput-remove, .krajee-default .file-thumb-progress, .file-zoom-dialog .btn-navigate, .file-zoom-dialog .floating-buttons { + position: absolute; +} + +.file-caption-icon .kv-caption-icon { + line-height: inherit; +} + +.file-input, .file-loading:before, .btn-file, .file-caption, .file-preview, .krajee-default.file-preview-frame, .krajee-default .file-thumbnail-footer, .file-zoom-dialog .modal-dialog { + position: relative; +} + +.file-error-message pre, .file-error-message ul, .krajee-default .file-actions, .krajee-default .file-other-error { + text-align: left; +} + +.file-error-message pre, .file-error-message ul { + margin: 0; +} + +.krajee-default .file-drag-handle, .krajee-default .file-upload-indicator { + float: left; + margin-top: 10px; + width: 16px; + height: 16px; +} + +.krajee-default .file-thumb-progress .progress, .krajee-default .file-thumb-progress .progress-bar { + height: 20px; + font-family: Verdana, Helvetica, sans-serif; + font-size: 9px; +} + +.krajee-default .file-thumb-progress .progress, .kv-upload-progress .progress { + background-color: #ccc; +} + +.krajee-default .file-caption-info, .krajee-default .file-size-info { + display: block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 160px; + height: 15px; + margin: auto; +} + +.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash, .file-zoom-content > .file-object.type-image { + max-width: 100%; + max-height: 100%; + width: auto; +} + +.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash { + height: 100%; +} + +.file-zoom-content > .file-object.type-pdf, .file-zoom-content > .file-object.type-html, .file-zoom-content > .file-object.type-text, .file-zoom-content > .file-object.type-default { + width: 100%; +} + +.file-loading:before { + content: " Loading..."; + display: inline-block; + padding-left: 20px; + line-height: 16px; + font-size: 13px; + font-variant: small-caps; + color: #999; + background: transparent url(loading.gif) top left no-repeat; +} + +.file-object { + margin: 0 0 -5px 0; + padding: 0; +} + +.btn-file { + overflow: hidden; +} + +.btn-file input[type=file] { + top: 0; + left: 0; + min-width: 100%; + min-height: 100%; + text-align: right; + opacity: 0; + background: none repeat scroll 0 0 transparent; + cursor: inherit; + display: block; +} + +.btn-file ::-ms-browse { + font-size: 10000px; + width: 100%; + height: 100%; +} + +.file-caption .file-caption-name { + width: 100%; + margin: 0; + padding: 0; + box-shadow: none; + border: none; + background: none; + outline: none; +} + +.file-caption.icon-visible .file-caption-icon { + display: inline-block; +} + +.file-caption.icon-visible .file-caption-name { + padding-left: 15px; +} + +.file-caption-icon { + left: 8px; +} + +.file-error-message { + color: #a94442; + background-color: #f2dede; + margin: 5px; + border: 1px solid #ebccd1; + border-radius: 4px; + padding: 15px; +} + +.file-error-message pre { + margin: 5px 0; +} + +.file-caption-disabled { + background-color: #eee; + cursor: not-allowed; + opacity: 1; +} + +.file-preview { + border-radius: 5px; + border: 1px solid #ddd; + padding: 8px; + width: 100%; + margin-bottom: 5px; +} + +.file-preview .btn-xs { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} + +.file-preview .fileinput-remove { + top: 1px; + right: 1px; + line-height: 10px; +} + +.file-preview .clickable { + cursor: pointer; +} + +.file-preview-image { + font: 40px Impact, Charcoal, sans-serif; + color: #008000; +} + +.krajee-default.file-preview-frame { + margin: 8px; + border: 1px solid rgba(0,0,0,0.2); + box-shadow: 0 0 10px 0 rgba(0,0,0,0.2); + padding: 6px; + float: left; + text-align: center; +} + +.krajee-default.file-preview-frame .kv-file-content { + width: 213px; + height: 160px; +} + +.krajee-default .file-preview-other-frame { + display: flex; + align-items: center; + justify-content: center; +} + +.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { + width: 400px; +} + +.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content { + width: 240px; + height: 55px; +} + +.krajee-default.file-preview-frame .file-thumbnail-footer { + height: 70px; +} + +.krajee-default.file-preview-frame:not(.file-preview-error):hover { + border: 1px solid rgba(0,0,0,0.3); + box-shadow: 0 0 10px 0 rgba(0,0,0,0.4); +} + +.krajee-default .file-preview-text { + display: block; + color: #428bca; + border: 1px solid #ddd; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + outline: none; + padding: 8px; + resize: none; +} + +.krajee-default .file-preview-html { + border: 1px solid #ddd; + padding: 8px; + overflow: auto; +} + +.krajee-default .file-other-icon { + font-size: 6em; + line-height: 1; +} + +.krajee-default .file-footer-buttons { + float: right; +} + +.krajee-default .file-footer-caption { + display: block; + text-align: center; + padding-top: 4px; + font-size: 11px; + color: #777; + margin-bottom: 30px; +} + +.file-upload-stats { + font-size: 10px; + text-align: center; + width: 100%; +} + +.kv-upload-progress .file-upload-stats { + font-size: 12px; + margin: -10px 0 5px; +} + +.krajee-default .file-preview-error { + opacity: 0.65; + box-shadow: none; +} + +.krajee-default .file-thumb-progress { + height: 11px; + top: 37px; + left: 0; + right: 0; +} + +.krajee-default.kvsortable-ghost { + background: #e1edf7; + border: 2px solid #a1abff; +} + +.krajee-default .file-preview-other:hover { + opacity: 0.8; +} + +.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover { + color: #000; +} + +.kv-upload-progress .progress { + height: 20px; + margin: 10px 0; + overflow: hidden; +} + +.kv-upload-progress .progress-bar { + height: 20px; + font-family: Verdana, Helvetica, sans-serif; +} + +/*noinspection CssOverwrittenProperties*/ +.file-zoom-dialog .file-other-icon { + font-size: 22em; + font-size: 50vmin; +} + +.file-zoom-dialog .modal-dialog { + width: auto; +} + +.file-zoom-dialog .modal-header { + display: flex; + align-items: center; + justify-content: space-between; +} + +.file-zoom-dialog .btn-navigate { + padding: 0; + margin: 0; + background: transparent; + text-decoration: none; + outline: none; + opacity: 0.7; + top: 45%; + font-size: 4em; + color: #1c94c4; +} + +.file-zoom-dialog .btn-navigate:not([disabled]):hover { + outline: none; + box-shadow: none; + opacity: 0.6; +} + +.file-zoom-dialog .floating-buttons { + top: 5px; + right: 10px; +} + +.file-zoom-dialog .btn-navigate[disabled] { + opacity: 0.3; +} + +.file-zoom-dialog .btn-prev { + left: 1px; +} + +.file-zoom-dialog .btn-next { + right: 1px; +} + +.file-zoom-dialog .kv-zoom-title { + font-weight: 300; + color: #999; + max-width: 50%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.file-input-new .no-browse .form-control { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +.file-input-ajax-new .no-browse .form-control { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +.file-caption-main { + width: 100%; +} + +.file-thumb-loading { + background: transparent url(loading.gif) no-repeat scroll center center content-box !important; +} + +.file-drop-zone { + border: 1px dashed #aaa; + border-radius: 4px; + text-align: center; + vertical-align: middle; + margin: 12px 15px 12px 12px; + padding: 5px; +} + +.file-drop-zone.clickable:hover { + border: 2px dashed #999; +} + +.file-drop-zone.clickable:focus { + border: 2px solid #5acde2; +} + +.file-drop-zone .file-preview-thumbnails { + cursor: default; +} + +.file-drop-zone-title { + color: #aaa; + font-size: 1.6em; + padding: 85px 10px; + cursor: default; +} + +.file-highlighted { + border: 2px dashed #999 !important; + background-color: #eee; +} + +.file-uploading { + background: url(loading-sm.gif) no-repeat center bottom 10px; + opacity: 0.65; +} + +.file-zoom-fullscreen .modal-dialog { + min-width: 100%; + margin: 0; +} + +.file-zoom-fullscreen .modal-content { + border-radius: 0; + box-shadow: none; + min-height: 100vh; +} + +.file-zoom-fullscreen .modal-body { + overflow-y: auto; +} + +.floating-buttons { + z-index: 3000; +} + +.floating-buttons .btn-kv { + margin-left: 3px; + z-index: 3000; +} + +.kv-zoom-actions .btn-kv { + margin-left: 3px; +} + +.file-zoom-content { + height: 480px; + text-align: center; +} + +.file-zoom-content .file-preview-image { + max-height: 100%; +} + +.file-zoom-content .file-preview-video { + max-height: 100%; +} + +.file-zoom-content > .file-object.type-image { + height: auto; + min-height: inherit; +} + +.file-zoom-content > .file-object.type-audio { + width: auto; + height: 30px; +} + +@media (min-width: 576px) { + .file-zoom-dialog .modal-dialog { + max-width: 500px; + } +} + +@media (min-width: 992px) { + .file-zoom-dialog .modal-lg { + max-width: 800px; + } +} + +@media (max-width: 767px) { + .file-preview-thumbnails { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + } + + .file-zoom-dialog .modal-header { + flex-direction: column; + } +} + +@media (max-width: 350px) { + .krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content { + width: 160px; + } +} + +@media (max-width: 420px) { + .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { + width: 100%; + } +} + +.file-loading[dir=rtl]:before { + background: transparent url(loading.gif) top right no-repeat; + padding-left: 0; + padding-right: 20px; +} + +.file-sortable .file-drag-handle { + cursor: move; + opacity: 1; +} + +.file-sortable .file-drag-handle:hover { + opacity: 0.7; +} + +.clickable .file-drop-zone-title { + cursor: pointer; +} + +.file-preview-initial.sortable-chosen { + background-color: #d9edf7; } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js similarity index 97% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js index c0723da97..56245011e 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js @@ -1,5697 +1,5697 @@ -/*! - * bootstrap-fileinput v5.0.4 - * http://plugins.krajee.com/file-input - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ -(function (factory) { - 'use strict'; - //noinspection JSUnresolvedVariable - if (typeof define === 'function' && define.amd) { // jshint ignore:line - // AMD. Register as an anonymous module. - define(['jquery'], factory); // jshint ignore:line - } else { // noinspection JSUnresolvedVariable - if (typeof module === 'object' && module.exports) { // jshint ignore:line - // Node/CommonJS - // noinspection JSUnresolvedVariable - module.exports = factory(require('jquery')); // jshint ignore:line - } else { - // Browser globals - factory(window.jQuery); - } - } -}(function ($) { - 'use strict'; - - $.fn.fileinputLocales = {}; - $.fn.fileinputThemes = {}; - - String.prototype.setTokens = function (replacePairs) { - var str = this.toString(), key, re; - for (key in replacePairs) { - if (replacePairs.hasOwnProperty(key)) { - re = new RegExp('\{' + key + '\}', 'g'); - str = str.replace(re, replacePairs[key]); - } - } - return str; - }; - - var $h, FileInput; - - // fileinput helper object for all global variables and internal helper methods - //noinspection JSUnresolvedVariable - $h = { - FRAMES: '.kv-preview-thumb', - SORT_CSS: 'file-sortable', - OBJECT_PARAMS: '\n' + - '\n' + - '\n' + - '\n' + - '\n' + - '\n', - DEFAULT_PREVIEW: '
\n' + - '{previewFileIcon}\n' + - '
', - MODAL_ID: 'kvFileinputModal', - MODAL_EVENTS: ['show', 'shown', 'hide', 'hidden', 'loaded'], - logMessages: { - ajaxError: '{status}: {error}. Error Details: {text}.', - badDroppedFiles: 'Error scanning dropped files!', - badExifParser: 'Error loading the piexif.js library. {details}', - badInputType: 'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.', - exifWarning: 'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded ' + - 'the "piexif.js" library correctly on your page before the "fileinput.js" script.', - invalidChunkSize: 'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.', - invalidThumb: 'Invalid thumb frame with id: "{id}".', - noResumableSupport: 'The browser does not support resumable or chunk uploads.', - noUploadUrl: 'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.', - retryStatus: 'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.' - }, - objUrl: window.URL || window.webkitURL, - now: function () { - return new Date(); - }, - round: function (num) { - num = parseFloat(num); - return isNaN(num) ? 0 : Math.floor(Math.round(num)); - }, - getFileRelativePath: function (file) { - /** @namespace file.relativePath */ - /** @namespace file.webkitRelativePath */ - return String(file.relativePath || file.webkitRelativePath || $h.getFileName(file) || null); - - }, - getFileId: function (file, generateFileId) { - var relativePath = $h.getFileRelativePath(file); - if (typeof generateFileId === 'function') { - return generateFileId(file); - } - if (!file) { - return null; - } - if (!relativePath) { - return null; - } - return (file.size + '_' + relativePath.replace(/\s/img, '_')); - }, - getElapsed: function (seconds) { - var delta = seconds, out = '', result = {}, structure = { - year: 31536000, - month: 2592000, - week: 604800, // uncomment row to ignore - day: 86400, // feel free to add your own row - hour: 3600, - minute: 60, - second: 1 - }; - Object.keys(structure).forEach(function (key) { - result[key] = Math.floor(delta / structure[key]); - delta -= result[key] * structure[key]; - }); - $.each(result, function (key, value) { - if (value > 0) { - out += (out ? ' ' : '') + value + key.substring(0, 1); - } - }); - return out; - }, - debounce: function (func, delay) { - var inDebounce; - return function () { - var args = arguments, context = this; - clearTimeout(inDebounce); - inDebounce = setTimeout(function () { - func.apply(context, args); - }, delay); - }; - }, - stopEvent: function (e) { - e.stopPropagation(); - e.preventDefault(); - }, - getFileName: function (file) { - /** @namespace file.fileName */ - return file ? (file.fileName || file.name || '') : ''; // some confusion in different versions of Firefox - }, - createObjectURL: function (data) { - if ($h.objUrl && $h.objUrl.createObjectURL && data) { - return $h.objUrl.createObjectURL(data); - } - return ''; - }, - revokeObjectURL: function (data) { - if ($h.objUrl && $h.objUrl.revokeObjectURL && data) { - $h.objUrl.revokeObjectURL(data); - } - }, - compare: function (input, str, exact) { - return input !== undefined && (exact ? input === str : input.match(str)); - }, - isIE: function (ver) { - var div, status; - // check for IE versions < 11 - if (navigator.appName !== 'Microsoft Internet Explorer') { - return false; - } - if (ver === 10) { - return new RegExp('msie\\s' + ver, 'i').test(navigator.userAgent); - } - div = document.createElement('div'); - div.innerHTML = ''; - status = div.getElementsByTagName('i').length; - document.body.appendChild(div); - div.parentNode.removeChild(div); - return status; - }, - canAssignFilesToInput: function () { - var input = document.createElement('input'); - try { - input.type = 'file'; - input.files = null; - return true; - } catch (err) { - return false; - } - }, - getDragDropFolders: function (items) { - var i, item, len = items ? items.length : 0, folders = 0; - if (len > 0 && items[0].webkitGetAsEntry()) { - for (i = 0; i < len; i++) { - item = items[i].webkitGetAsEntry(); - if (item && item.isDirectory) { - folders++; - } - } - } - return folders; - }, - initModal: function ($modal) { - var $body = $('body'); - if ($body.length) { - $modal.appendTo($body); - } - }, - isEmpty: function (value, trim) { - return value === undefined || value === null || value.length === 0 || (trim && $.trim(value) === ''); - }, - isArray: function (a) { - return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]'; - }, - ifSet: function (needle, haystack, def) { - def = def || ''; - return (haystack && typeof haystack === 'object' && needle in haystack) ? haystack[needle] : def; - }, - cleanArray: function (arr) { - if (!(arr instanceof Array)) { - arr = []; - } - return arr.filter(function (e) { - return (e !== undefined && e !== null); - }); - }, - spliceArray: function (arr, index, reverseOrder) { - var i, j = 0, out = [], newArr; - if (!(arr instanceof Array)) { - return []; - } - newArr = $.extend(true, [], arr); - if (reverseOrder) { - newArr.reverse(); - } - for (i = 0; i < newArr.length; i++) { - if (i !== index) { - out[j] = newArr[i]; - j++; - } - } - if (reverseOrder) { - out.reverse(); - } - return out; - }, - getNum: function (num, def) { - def = def || 0; - if (typeof num === 'number') { - return num; - } - if (typeof num === 'string') { - num = parseFloat(num); - } - return isNaN(num) ? def : num; - }, - hasFileAPISupport: function () { - return !!(window.File && window.FileReader); - }, - hasDragDropSupport: function () { - var div = document.createElement('div'); - /** @namespace div.draggable */ - /** @namespace div.ondragstart */ - /** @namespace div.ondrop */ - return !$h.isIE(9) && - (div.draggable !== undefined || (div.ondragstart !== undefined && div.ondrop !== undefined)); - }, - hasFileUploadSupport: function () { - return $h.hasFileAPISupport() && window.FormData; - }, - hasBlobSupport: function () { - try { - return !!window.Blob && Boolean(new Blob()); - } catch (e) { - return false; - } - }, - hasArrayBufferViewSupport: function () { - try { - return new Blob([new Uint8Array(100)]).size === 100; - } catch (e) { - return false; - } - }, - hasResumableUploadSupport: function () { - /** @namespace Blob.prototype.webkitSlice */ - /** @namespace Blob.prototype.mozSlice */ - return $h.hasFileUploadSupport() && $h.hasBlobSupport() && $h.hasArrayBufferViewSupport() && - (!!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || !!Blob.prototype.slice || false); - }, - dataURI2Blob: function (dataURI) { - //noinspection JSUnresolvedVariable - var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || - window.MSBlobBuilder, canBlob = $h.hasBlobSupport(), byteStr, arrayBuffer, intArray, i, mimeStr, bb, - canProceed = (canBlob || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array; - if (!canProceed) { - return null; - } - if (dataURI.split(',')[0].indexOf('base64') >= 0) { - byteStr = atob(dataURI.split(',')[1]); - } else { - byteStr = decodeURIComponent(dataURI.split(',')[1]); - } - arrayBuffer = new ArrayBuffer(byteStr.length); - intArray = new Uint8Array(arrayBuffer); - for (i = 0; i < byteStr.length; i += 1) { - intArray[i] = byteStr.charCodeAt(i); - } - mimeStr = dataURI.split(',')[0].split(':')[1].split(';')[0]; - if (canBlob) { - return new Blob([$h.hasArrayBufferViewSupport() ? intArray : arrayBuffer], {type: mimeStr}); - } - bb = new BlobBuilder(); - bb.append(arrayBuffer); - return bb.getBlob(mimeStr); - }, - arrayBuffer2String: function (buffer) { - //noinspection JSUnresolvedVariable - if (window.TextDecoder) { - // noinspection JSUnresolvedFunction - return new TextDecoder('utf-8').decode(buffer); - } - var array = Array.prototype.slice.apply(new Uint8Array(buffer)), out = '', i = 0, len, c, char2, char3; - len = array.length; - while (i < len) { - c = array[i++]; - switch (c >> 4) { // jshint ignore:line - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - // 0xxxxxxx - out += String.fromCharCode(c); - break; - case 12: - case 13: - // 110x xxxx 10xx xxxx - char2 = array[i++]; - out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); // jshint ignore:line - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - char2 = array[i++]; - char3 = array[i++]; - out += String.fromCharCode(((c & 0x0F) << 12) | // jshint ignore:line - ((char2 & 0x3F) << 6) | // jshint ignore:line - ((char3 & 0x3F) << 0)); // jshint ignore:line - break; - } - } - return out; - }, - isHtml: function (str) { - var a = document.createElement('div'); - a.innerHTML = str; - for (var c = a.childNodes, i = c.length; i--;) { - if (c[i].nodeType === 1) { - return true; - } - } - return false; - }, - isSvg: function (str) { - return str.match(/^\s*<\?xml/i) && (str.match(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); - }, - replaceTags: function (str, tags) { - var out = str; - if (!tags) { - return out; - } - $.each(tags, function (key, value) { - if (typeof value === 'function') { - value = value(); - } - out = out.split(key).join(value); - }); - return out; - }, - cleanMemory: function ($thumb) { - var data = $thumb.is('img') ? $thumb.attr('src') : $thumb.find('source').attr('src'); - $h.revokeObjectURL(data); - }, - findFileName: function (filePath) { - var sepIndex = filePath.lastIndexOf('/'); - if (sepIndex === -1) { - sepIndex = filePath.lastIndexOf('\\'); - } - return filePath.split(filePath.substring(sepIndex, sepIndex + 1)).pop(); - }, - checkFullScreen: function () { - //noinspection JSUnresolvedVariable - return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || - document.msFullscreenElement; - }, - toggleFullScreen: function (maximize) { - var doc = document, de = doc.documentElement; - if (de && maximize && !$h.checkFullScreen()) { - /** @namespace document.requestFullscreen */ - /** @namespace document.msRequestFullscreen */ - /** @namespace document.mozRequestFullScreen */ - /** @namespace document.webkitRequestFullscreen */ - /** @namespace Element.ALLOW_KEYBOARD_INPUT */ - if (de.requestFullscreen) { - de.requestFullscreen(); - } else { - if (de.msRequestFullscreen) { - de.msRequestFullscreen(); - } else { - if (de.mozRequestFullScreen) { - de.mozRequestFullScreen(); - } else { - if (de.webkitRequestFullscreen) { - de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); - } - } - } - } - } else { - /** @namespace document.exitFullscreen */ - /** @namespace document.msExitFullscreen */ - /** @namespace document.mozCancelFullScreen */ - /** @namespace document.webkitExitFullscreen */ - if (doc.exitFullscreen) { - doc.exitFullscreen(); - } else { - if (doc.msExitFullscreen) { - doc.msExitFullscreen(); - } else { - if (doc.mozCancelFullScreen) { - doc.mozCancelFullScreen(); - } else { - if (doc.webkitExitFullscreen) { - doc.webkitExitFullscreen(); - } - } - } - } - } - }, - moveArray: function (arr, oldIndex, newIndex, reverseOrder) { - var newArr = $.extend(true, [], arr); - if (reverseOrder) { - newArr.reverse(); - } - if (newIndex >= newArr.length) { - var k = newIndex - newArr.length; - while ((k--) + 1) { - newArr.push(undefined); - } - } - newArr.splice(newIndex, 0, newArr.splice(oldIndex, 1)[0]); - if (reverseOrder) { - newArr.reverse(); - } - return newArr; - }, - cleanZoomCache: function ($el) { - var $cache = $el.closest('.kv-zoom-cache-theme'); - if (!$cache.length) { - $cache = $el.closest('.kv-zoom-cache'); - } - $cache.remove(); - }, - closeButton: function (css) { - css = css ? 'close ' + css : 'close'; - return ''; - }, - getRotation: function (value) { - switch (value) { - case 2: - return 'rotateY(180deg)'; - case 3: - return 'rotate(180deg)'; - case 4: - return 'rotate(180deg) rotateY(180deg)'; - case 5: - return 'rotate(270deg) rotateY(180deg)'; - case 6: - return 'rotate(90deg)'; - case 7: - return 'rotate(90deg) rotateY(180deg)'; - case 8: - return 'rotate(270deg)'; - default: - return ''; - } - }, - setTransform: function (el, val) { - if (!el) { - return; - } - el.style.transform = val; - el.style.webkitTransform = val; - el.style['-moz-transform'] = val; - el.style['-ms-transform'] = val; - el.style['-o-transform'] = val; - } - }; - FileInput = function (element, options) { - var self = this; - self.$element = $(element); - self.$parent = self.$element.parent(); - if (!self._validate()) { - return; - } - self.isPreviewable = $h.hasFileAPISupport(); - self.isIE9 = $h.isIE(9); - self.isIE10 = $h.isIE(10); - if (self.isPreviewable || self.isIE9) { - self._init(options); - self._listen(); - } - self.$element.removeClass('file-loading'); - }; - //noinspection JSUnusedGlobalSymbols - FileInput.prototype = { - constructor: FileInput, - _cleanup: function () { - var self = this; - self.reader = null; - self.clearFileStack(); - self.fileBatchCompleted = true; - self.isError = false; - self.cancelling = false; - self.paused = false; - self.lastProgress = 0; - self._initAjax(); - }, - _initAjax: function () { - var self = this; - self.ajaxQueue = []; - self.ajaxRequests = []; - self.ajaxQueueIntervalId = null; - self.ajaxCurrentThreads = 0; - self.ajaxAborted = false; - }, - _init: function (options, refreshMode) { - var self = this, f, $el = self.$element, $cont, t, tmp; - self.options = options; - $.each(options, function (key, value) { - switch (key) { - case 'minFileCount': - case 'maxFileCount': - case 'minFileSize': - case 'maxFileSize': - case 'maxFilePreviewSize': - case 'resizeImageQuality': - case 'resizeIfSizeMoreThan': - case 'progressUploadThreshold': - case 'initialPreviewCount': - case 'zoomModalHeight': - case 'minImageHeight': - case 'maxImageHeight': - case 'minImageWidth': - case 'maxImageWidth': - self[key] = $h.getNum(value); - break; - default: - self[key] = value; - break; - } - }); - if (self.rtl) { // swap buttons for rtl - tmp = self.previewZoomButtonIcons.prev; - self.previewZoomButtonIcons.prev = self.previewZoomButtonIcons.next; - self.previewZoomButtonIcons.next = tmp; - } - // validate chunk threads to not exceed maxAjaxThreads - if (!isNaN(self.maxAjaxThreads) && self.maxAjaxThreads < self.resumableUploadOptions.maxThreads) { - self.resumableUploadOptions.maxThreads = self.maxAjaxThreads; - } - self._initFileManager(); - if (typeof self.autoOrientImage === 'function') { - self.autoOrientImage = self.autoOrientImage(); - } - if (typeof self.autoOrientImageInitial === 'function') { - self.autoOrientImageInitial = self.autoOrientImageInitial(); - } - if (!refreshMode) { - self._cleanup(); - } - self.$form = $el.closest('form'); - self._initTemplateDefaults(); - self.uploadFileAttr = !$h.isEmpty($el.attr('name')) ? $el.attr('name') : 'file_data'; - t = self._getLayoutTemplate('progress'); - self.progressTemplate = t.replace('{class}', self.progressClass); - self.progressInfoTemplate = t.replace('{class}', self.progressInfoClass); - self.progressPauseTemplate = t.replace('{class}', self.progressPauseClass); - self.progressCompleteTemplate = t.replace('{class}', self.progressCompleteClass); - self.progressErrorTemplate = t.replace('{class}', self.progressErrorClass); - self.isDisabled = $el.attr('disabled') || $el.attr('readonly'); - if (self.isDisabled) { - $el.attr('disabled', true); - } - self.isClickable = self.browseOnZoneClick && self.showPreview && - (self.dropZoneEnabled || !$h.isEmpty(self.defaultPreviewContent)); - self.isAjaxUpload = $h.hasFileUploadSupport() && !$h.isEmpty(self.uploadUrl); - self.dropZoneEnabled = $h.hasDragDropSupport() && self.dropZoneEnabled; - if (!self.isAjaxUpload) { - self.dropZoneEnabled = self.dropZoneEnabled && $h.canAssignFilesToInput(); - } - self.slug = typeof options.slugCallback === 'function' ? options.slugCallback : self._slugDefault; - self.mainTemplate = self.showCaption ? self._getLayoutTemplate('main1') : self._getLayoutTemplate('main2'); - self.captionTemplate = self._getLayoutTemplate('caption'); - self.previewGenericTemplate = self._getPreviewTemplate('generic'); - if (!self.imageCanvas && self.resizeImage && (self.maxImageWidth || self.maxImageHeight)) { - self.imageCanvas = document.createElement('canvas'); - self.imageCanvasContext = self.imageCanvas.getContext('2d'); - } - if ($h.isEmpty($el.attr('id'))) { - $el.attr('id', $h.uniqId()); - } - self.namespace = '.fileinput_' + $el.attr('id').replace(/-/g, '_'); - if (self.$container === undefined) { - self.$container = self._createContainer(); - } else { - self._refreshContainer(); - } - $cont = self.$container; - self.$dropZone = $cont.find('.file-drop-zone'); - self.$progress = $cont.find('.kv-upload-progress'); - self.$btnUpload = $cont.find('.fileinput-upload'); - self.$captionContainer = $h.getElement(options, 'elCaptionContainer', $cont.find('.file-caption')); - self.$caption = $h.getElement(options, 'elCaptionText', $cont.find('.file-caption-name')); - if (!$h.isEmpty(self.msgPlaceholder)) { - f = $el.attr('multiple') ? self.filePlural : self.fileSingle; - self.$caption.attr('placeholder', self.msgPlaceholder.replace('{files}', f)); - } - self.$captionIcon = self.$captionContainer.find('.file-caption-icon'); - self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview')); - self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails')); - self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status')); - self.$errorContainer = $h.getElement(options, 'elErrorContainer', - self.$previewContainer.find('.kv-fileinput-error')); - self._validateDisabled(); - if (!$h.isEmpty(self.msgErrorClass)) { - $h.addCss(self.$errorContainer, self.msgErrorClass); - } - if (!refreshMode) { - self.$errorContainer.hide(); - self.previewInitId = 'preview-' + $h.uniqId(); - self._initPreviewCache(); - self._initPreview(true); - self._initPreviewActions(); - if (self.$parent.hasClass('file-loading')) { - self.$container.insertBefore(self.$parent); - self.$parent.remove(); - } - } else { - if (!self._errorsExist()) { - self.$errorContainer.hide(); - } - } - self._setFileDropZoneTitle(); - if ($el.attr('disabled')) { - self.disable(); - } - self._initZoom(); - if (self.hideThumbnailContent) { - $h.addCss(self.$preview, 'hide-content'); - } - }, - _initFileManager: function () { - var self = this; - self.fileManager = { - stack: {}, - processed: [], - errors: [], - loadedImages: {}, - totalImages: 0, - totalFiles: null, - totalSize: null, - uploadedSize: 0, - stats: {}, - initStats: function (id) { - var data = {started: $h.now().getTime()}; - if (id) { - self.fileManager.stats[id] = data; - } else { - self.fileManager.stats = data; - } - }, - getUploadStats: function (id, loaded, total) { - var fm = self.fileManager, started = id ? fm.stats[id] && fm.stats[id].started || null : null; - if (!started) { - started = $h.now().getTime(); - } - var elapsed = ($h.now().getTime() - started) / 1000, - speeds = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'], - bps = elapsed ? loaded / elapsed : 0, bitrate = self._getSize(bps, speeds), - pendingBytes = total - loaded, - out = { - fileId: id, - started: started, - elapsed: elapsed, - loaded: loaded, - total: total, - bps: bps, - bitrate: bitrate, - pendingBytes: pendingBytes - }; - if (id) { - fm.stats[id] = out; - } else { - fm.stats = out; - } - return out; - }, - exists: function (id) { - return $.inArray(id, self.fileManager.getIdList()) !== -1; - }, - count: function () { - return self.fileManager.getIdList().length; - }, - total: function () { - var fm = self.fileManager; - if (!fm.totalFiles) { - fm.totalFiles = fm.count(); - } - return fm.totalFiles; - }, - getTotalSize: function () { - var fm = self.fileManager; - if (fm.totalSize) { - return fm.totalSize; - } - fm.totalSize = 0; - $.each(self.fileManager.stack, function (id, f) { - var size = parseFloat(f.size); - fm.totalSize += isNaN(size) ? 0 : size; - }); - return fm.totalSize; - }, - add: function (file, id) { - if (!id) { - id = self.fileManager.getId(file); - } - if (!id) { - return; - } - self.fileManager.stack[id] = { - file: file, - name: $h.getFileName(file), - relativePath: $h.getFileRelativePath(file), - size: file.size, - nameFmt: self._getFileName(file, ''), - sizeFmt: self._getSize(file.size) - }; - }, - remove: function ($thumb) { - var id = $thumb.attr('data-fileid'); - if (id) { - self.fileManager.removeFile(id); - } - }, - removeFile: function (id) { - delete self.fileManager.stack[id]; - delete self.fileManager.loadedImages[id]; - }, - move: function (idFrom, idTo) { - var result = {}, stack = self.fileManager.stack; - if (!idFrom && !idTo || idFrom === idTo) { - return; - } - $.each(stack, function (k, v) { - if (k !== idFrom) { - result[k] = v; - } - if (k === idTo) { - result[idFrom] = stack[idFrom]; - } - }); - self.fileManager.stack = result; - }, - list: function () { - var files = []; - $.each(self.fileManager.stack, function (k, v) { - if (v && v.file) { - files.push(v.file); - } - }); - return files; - }, - isPending: function (id) { - return $.inArray(id, self.fileManager.processed) === -1 && self.fileManager.exists(id); - }, - isProcessed: function () { - var processed = true, fm = self.fileManager; - $.each(fm.stack, function (id) { - if (fm.isPending(id)) { - processed = false; - } - }); - return processed; - }, - clear: function () { - var fm = self.fileManager; - fm.totalFiles = null; - fm.totalSize = null; - fm.uploadedSize = 0; - fm.stack = {}; - fm.errors = []; - fm.processed = []; - fm.stats = {}; - fm.clearImages(); - }, - clearImages: function () { - self.fileManager.loadedImages = {}; - self.fileManager.totalImages = 0; - }, - addImage: function (id, config) { - self.fileManager.loadedImages[id] = config; - }, - removeImage: function (id) { - delete self.fileManager.loadedImages[id]; - }, - getImageIdList: function () { - return Object.keys(self.fileManager.loadedImages); - }, - getImageCount: function () { - return self.fileManager.getImageIdList().length; - }, - getId: function (file) { - return self._getFileId(file); - }, - getIndex: function (id) { - return self.fileManager.getIdList().indexOf(id); - }, - getThumb: function (id) { - var $thumb = null; - self._getThumbs().each(function () { - if ($(this).attr('data-fileid') === id) { - $thumb = $(this); - } - }); - return $thumb; - }, - getThumbIndex: function ($thumb) { - var id = $thumb.attr('data-fileid'); - return self.fileManager.getIndex(id); - }, - getIdList: function () { - return Object.keys(self.fileManager.stack); - }, - getFile: function (id) { - return self.fileManager.stack[id] || null; - }, - getFileName: function (id, fmt) { - var file = self.fileManager.getFile(id); - if (!file) { - return ''; - } - return fmt ? (file.nameFmt || '') : file.name || ''; - }, - getFirstFile: function () { - var ids = self.fileManager.getIdList(), id = ids && ids.length ? ids[0] : null; - return self.fileManager.getFile(id); - }, - setFile: function (id, file) { - if (self.fileManager.getFile(id)) { - self.fileManager.stack[id].file = file; - } else { - self.fileManager.add(file, id); - } - }, - setProcessed: function (id) { - self.fileManager.processed.push(id); - }, - getProgress: function () { - var total = self.fileManager.total(), processed = self.fileManager.processed.length; - if (!total) { - return 0; - } - return Math.ceil(processed / total * 100); - - }, - setProgress: function (id, pct) { - var f = self.fileManager.getFile(id); - if (!isNaN(pct) && f) { - f.progress = pct; - } - } - }; - }, - _setUploadData: function (fd, config) { - var self = this; - $.each(config, function (key, value) { - var param = self.uploadParamNames[key] || key; - if ($h.isArray(value)) { - fd.append(param, value[0], value[1]); - } else { - fd.append(param, value); - } - }); - }, - _initResumableUpload: function () { - var self = this, opts = self.resumableUploadOptions, logs = $h.logMessages; - if (!self.enableResumableUpload) { - return; - } - if (opts.fallback !== false && typeof opts.fallback !== 'function') { - opts.fallback = function (s) { - s._log(logs.noResumableSupport); - s.enableResumableUpload = false; - }; - } - if (!$h.hasResumableUploadSupport() && opts.fallback !== false) { - opts.fallback(self); - return; - } - if (!self.uploadUrl && self.enableResumableUpload) { - self._log(logs.noUploadUrl); - self.enableResumableUpload = false; - return; - - } - opts.chunkSize = parseFloat(opts.chunkSize); - if (opts.chunkSize <= 0 || isNaN(opts.chunkSize)) { - self._log(logs.invalidChunkSize, {chunkSize: opts.chunkSize}); - self.enableResumableUpload = false; - return; - } - self.resumableManager = { - init: function (id, f, index) { - var rm = self.resumableManager, fm = self.fileManager; - rm.currThreads = 0; - rm.logs = []; - rm.stack = []; - rm.error = ''; - rm.chunkIntervalId = null; - rm.id = id; - rm.file = f.file; - rm.fileName = f.name; - rm.fileIndex = index; - rm.completed = false; - rm.testing = false; - rm.lastProgress = 0; - if (self.showPreview) { - rm.$thumb = fm.getThumb(id) || null; - rm.$progress = rm.$btnDelete = null; - if (rm.$thumb && rm.$thumb.length) { - rm.$progress = rm.$thumb.find('.file-thumb-progress'); - rm.$btnDelete = rm.$thumb.find('.kv-file-remove'); - } - } - rm.chunkSize = self.resumableUploadOptions.chunkSize * 1024; - rm.chunkCount = rm.getTotalChunks(); - }, - logAjaxError: function (jqXHR, textStatus, errorThrown) { - if (self.resumableUploadOptions.showErrorLog) { - self._log(logs.ajaxError, { - status: jqXHR.status, - error: errorThrown, - text: jqXHR.responseText || '' - }); - } - }, - reset: function () { - var rm = self.resumableManager; - rm.processed = {}; - }, - setProcessed: function (status) { - var rm = self.resumableManager, fm = self.fileManager, id = rm.id, msg, - $thumb = rm.$thumb, $prog = rm.$progress, hasThumb = $thumb && $thumb.length, - params = {id: hasThumb ? $thumb.attr('id') : '', index: fm.getIndex(id), fileId: id}; - rm.completed = true; - rm.lastProgress = 0; - fm.uploadedSize += rm.file.size; - if (hasThumb) { - $thumb.removeClass('file-uploading'); - } - if (status === 'success') { - if (self.showPreview) { - self._setProgress(101, $prog); - self._setThumbStatus($thumb, 'Success'); - self._initUploadSuccess(rm.processed[id].data, $thumb); - } - self.fileManager.removeFile(id); - delete rm.processed[id]; - self._raise('fileuploaded', [params.id, params.index, params.fileId]); - if (fm.isProcessed()) { - self._setProgress(101); - } - } else { - if (self.showPreview) { - self._setThumbStatus($thumb, 'Error'); - self._setPreviewError($thumb, true); - self._setProgress(101, $prog, self.msgProgressError); - self._setProgress(101, self.$progress, self.msgProgressError); - self.cancelling = true; - } - if (!self.$errorContainer.find('li[data-file-id="' + params.fileId + '"]').length) { - msg = self.msgResumableUploadRetriesExceeded.setTokens({ - file: rm.fileName, - max: self.resumableUploadOptions.maxRetries, - error: rm.error - }); - self._showFileError(msg, params); - } - } - if (fm.isProcessed()) { - rm.reset(); - } - }, - check: function () { - var rm = self.resumableManager, status = true; - $.each(rm.logs, function (index, value) { - if (!value) { - status = false; - return false; - } - }); - if (status) { - clearInterval(rm.chunkIntervalId); - rm.setProcessed('success'); - } - }, - processedResumables: function () { - var logs = self.resumableManager.logs, i, count = 0; - if (!logs || !logs.length) { - return 0; - } - for (i = 0; i < logs.length; i++) { - if (logs[i] === true) { - count++; - } - } - return count; - }, - getUploadedSize: function () { - var rm = self.resumableManager, size = rm.processedResumables() * rm.chunkSize; - return size > rm.file.size ? rm.file.size : size; - }, - getTotalChunks: function () { - var rm = self.resumableManager, chunkSize = parseFloat(rm.chunkSize); - if (!isNaN(chunkSize) && chunkSize > 0) { - return Math.ceil(rm.file.size / chunkSize); - } - return 0; - }, - getProgress: function () { - var rm = self.resumableManager, processed = rm.processedResumables(), total = rm.chunkCount; - if (total === 0) { - return 0; - } - return Math.ceil(processed / total * 100); - }, - checkAborted: function (intervalId) { - if (self.paused || self.cancelling) { - clearInterval(intervalId); - self.unlock(); - } - }, - upload: function () { - var rm = self.resumableManager, fm = self.fileManager, ids = fm.getIdList(), flag = 'new', - intervalId; - intervalId = setInterval(function () { - var id; - rm.checkAborted(intervalId); - if (flag === 'new') { - self.lock(); - flag = 'processing'; - id = ids.shift(); - fm.initStats(id); - if (fm.stack[id]) { - rm.init(id, fm.stack[id], fm.getIndex(id)); - rm.testUpload(); - rm.uploadResumable(); - } - } - if (!fm.isPending(id) && rm.completed) { - flag = 'new'; - } - if (fm.isProcessed()) { - var $initThumbs = self.$preview.find('.file-preview-initial'); - if ($initThumbs.length) { - $h.addCss($initThumbs, $h.SORT_CSS); - self._initSortable(); - } - clearInterval(intervalId); - self._clearFileInput(); - self.unlock(); - setTimeout(function () { - var data = self.previewCache.data; - if (data) { - self.initialPreview = data.content; - self.initialPreviewConfig = data.config; - self.initialPreviewThumbTags = data.tags; - } - self._raise('filebatchuploadcomplete', [ - self.initialPreview, - self.initialPreviewConfig, - self.initialPreviewThumbTags, - self._getExtraData() - ]); - }, self.processDelay); - } - }, self.processDelay); - }, - uploadResumable: function () { - var i, rm = self.resumableManager, total = rm.chunkCount; - for (i = 0; i < total; i++) { - rm.logs[i] = !!(rm.processed[rm.id] && rm.processed[rm.id][i]); - } - for (i = 0; i < total; i++) { - rm.pushAjax(i, 0); - } - rm.chunkIntervalId = setInterval(rm.loopAjax, self.queueDelay); - }, - testUpload: function () { - var rm = self.resumableManager, opts = self.resumableUploadOptions, fd, f, - fm = self.fileManager, id = rm.id, fnBefore, fnSuccess, fnError, fnComplete, outData; - if (!opts.testUrl) { - rm.testing = false; - return; - } - rm.testing = true; - fd = new FormData(); - f = fm.stack[id]; - self._setUploadData(fd, { - fileId: id, - fileName: f.fileName, - fileSize: f.size, - fileRelativePath: f.relativePath, - chunkSize: rm.chunkSize, - chunkCount: rm.chunkCount - }); - fnBefore = function (jqXHR) { - outData = self._getOutData(fd, jqXHR); - self._raise('filetestbeforesend', [id, fm, rm, outData]); - }; - fnSuccess = function (data, textStatus, jqXHR) { - outData = self._getOutData(fd, jqXHR, data); - var pNames = self.uploadParamNames, chunksUploaded = pNames.chunksUploaded || 'chunksUploaded', - params = [id, fm, rm, outData]; - if (!data[chunksUploaded] || !$h.isArray(data[chunksUploaded])) { - self._raise('filetesterror', params); - } else { - if (!rm.processed[id]) { - rm.processed[id] = {}; - } - $.each(data[chunksUploaded], function (key, index) { - rm.logs[index] = true; - rm.processed[id][index] = true; - }); - rm.processed[id].data = data; - self._raise('filetestsuccess', params); - } - rm.testing = false; - }; - fnError = function (jqXHR, textStatus, errorThrown) { - outData = self._getOutData(fd, jqXHR); - self._raise('filetestajaxerror', [id, fm, rm, outData]); - rm.logAjaxError(jqXHR, textStatus, errorThrown); - rm.testing = false; - }; - fnComplete = function () { - self._raise('filetestcomplete', [id, fm, rm, self._getOutData(fd)]); - rm.testing = false; - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex, opts.testUrl); - }, - pushAjax: function (index, retry) { - self.resumableManager.stack.push([index, retry]); - }, - sendAjax: function (index, retry) { - var fm = self.fileManager, rm = self.resumableManager, opts = self.resumableUploadOptions, f, - chunkSize = rm.chunkSize, id = rm.id, file = rm.file, $thumb = rm.$thumb, - $btnDelete = rm.$btnDelete; - if (rm.processed[id] && rm.processed[id][index]) { - return; - } - rm.currThreads++; - if (retry > opts.maxRetries) { - rm.setProcessed('error'); - return; - } - var fd, outData, fnBefore, fnSuccess, fnError, fnComplete, slice = file.slice ? 'slice' : - (file.mozSlice ? 'mozSlice' : (file.webkitSlice ? 'webkitSlice' : 'slice')), - blob = file[slice](chunkSize * index, chunkSize * (index + 1)); - fd = new FormData(); - f = fm.stack[id]; - self._setUploadData(fd, { - chunkCount: rm.chunkCount, - chunkIndex: index, - chunkSize: chunkSize, - chunkSizeStart: chunkSize * index, - fileBlob: [blob, rm.fileName], - fileId: id, - fileName: rm.fileName, - fileRelativePath: f.relativePath, - fileSize: file.size, - retryCount: retry - }); - if (rm.$progress && rm.$progress.length) { - rm.$progress.show(); - } - fnBefore = function (jqXHR) { - outData = self._getOutData(fd, jqXHR); - if (self.showPreview) { - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnDelete.attr('disabled', true); - } - self._raise('filechunkbeforesend', [id, index, retry, fm, rm, outData]); - }; - fnSuccess = function (data, textStatus, jqXHR) { - outData = self._getOutData(fd, jqXHR, data); - var paramNames = self.uploadParamNames, chunkIndex = paramNames.chunkIndex || 'chunkIndex', - opts = self.resumableUploadOptions, params = [id, index, retry, fm, rm, outData]; - rm.currThreads--; - if (data.error) { - if (opts.showErrorLog) { - self._log(logs.retryStatus, { - retry: retry + 1, - filename: rm.fileName, - chunk: index - }); - } - rm.pushAjax(index, retry + 1); - rm.error = data.error; - self._raise('filechunkerror', params); - } else { - rm.logs[data[chunkIndex]] = true; - if (!rm.processed[id]) { - rm.processed[id] = {}; - } - rm.processed[id][data[chunkIndex]] = true; - rm.processed[id].data = data; - self._raise('filechunksuccess', params); - rm.check(); - } - }; - fnError = function (jqXHR, textStatus, errorThrown) { - outData = self._getOutData(fd, jqXHR); - rm.currThreads--; - rm.error = errorThrown; - rm.logAjaxError(jqXHR, textStatus, errorThrown); - self._raise('filechunkajaxerror', [id, index, retry, fm, rm, outData]); - rm.pushAjax(index, retry + 1); - }; - fnComplete = function () { - self._raise('filechunkcomplete', [id, index, retry, fm, rm, self._getOutData(fd)]); - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex); - }, - loopAjax: function () { - var rm = self.resumableManager; - if (rm.currThreads < self.resumableUploadOptions.maxThreads && !rm.testing) { - var arr = rm.stack.shift(), index; - if (typeof arr !== 'undefined') { - index = arr[0]; - if (!rm.processed[rm.id] || !rm.processed[rm.id][index]) { - rm.sendAjax(index, arr[1]); - } else { - if (rm.processedResumables() >= rm.getTotalChunks()) { - rm.setProcessed('success'); - clearInterval(rm.chunkIntervalId); - } - } - } - } - } - }; - self.resumableManager.reset(); - }, - _initTemplateDefaults: function () { - var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse, - tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionDownload, - tActionZoom, tActionDrag, tIndicator, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage, - tText, tOffice, tGdocs, tVideo, tAudio, tFlash, tObject, tPdf, tOther, tStyle, tZoomCache, vDefaultDim, - tStats; - tMain1 = '{preview}\n' + - '
\n' + - '
\n' + - ' {caption}\n' + - '
\n' + - ' {remove}\n' + - ' {cancel}\n' + - ' {pause}\n' + - ' {upload}\n' + - ' {browse}\n' + - '
\n' + - '
'; - tMain2 = '{preview}\n
\n
\n' + - '{remove}\n{cancel}\n{upload}\n{browse}\n'; - tPreview = '
\n' + - ' {close}' + - '
\n' + - '
\n' + - '
\n' + - '
' + - '
\n' + - '
\n' + - '
\n' + - '
'; - tClose = $h.closeButton('fileinput-remove'); - tFileIcon = ''; - // noinspection HtmlUnknownAttribute - tCaption = '
\n' + - ' \n' + - ' \n' + - '
'; - //noinspection HtmlUnknownAttribute - tBtnDefault = ''; - //noinspection HtmlUnknownAttribute - tBtnLink = '{icon} {label}'; - //noinspection HtmlUnknownAttribute - tBtnBrowse = '
{icon} {label}
'; - tModalMain = ''; - tModal = '\n'; - tProgress = '
\n' + - '
\n' + - ' {status}\n' + - '
\n' + - '
{stats}'; - tStats = '
' + - '{pendingTime} ' + - '{uploadSpeed}' + - '
'; - tSize = ' ({sizeText})'; - tFooter = ''; - tActions = '
\n' + - ' \n' + - '
\n' + - '{drag}\n' + - '
'; - //noinspection HtmlUnknownAttribute - tActionDelete = '\n'; - tActionUpload = ''; - tActionDownload = '{downloadIcon}'; - tActionZoom = ''; - tActionDrag = '{dragIcon}'; - tIndicator = '
{indicator}
'; - tTagBef = '
\n'; - tTagBef2 = tTagBef + ' title="{caption}">
\n'; - tTagAft = '
{footer}\n
\n'; - tGeneric = '{content}\n'; - tStyle = ' {style}'; - tHtml = '
{data}
\n'; - tImage = '\n'; - tText = '\n'; - tOffice = ''; - tGdocs = ''; - tVideo = '\n'; - tAudio = '\n'; - tFlash = '\n'; - tPdf = '\n'; - tObject = '\n' + '\n' + - $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n\n'; - tOther = '
\n' + $h.DEFAULT_PREVIEW + '\n
\n'; - tZoomCache = ''; - vDefaultDim = {width: '100%', height: '100%', 'min-height': '480px'}; - if (self._isPdfRendered()) { - tPdf = self.pdfRendererTemplate.replace('{renderer}', self._encodeURI(self.pdfRendererUrl)); - } - self.defaults = { - layoutTemplates: { - main1: tMain1, - main2: tMain2, - preview: tPreview, - close: tClose, - fileIcon: tFileIcon, - caption: tCaption, - modalMain: tModalMain, - modal: tModal, - progress: tProgress, - stats: tStats, - size: tSize, - footer: tFooter, - indicator: tIndicator, - actions: tActions, - actionDelete: tActionDelete, - actionUpload: tActionUpload, - actionDownload: tActionDownload, - actionZoom: tActionZoom, - actionDrag: tActionDrag, - btnDefault: tBtnDefault, - btnLink: tBtnLink, - btnBrowse: tBtnBrowse, - zoomCache: tZoomCache - }, - previewMarkupTags: { - tagBefore1: tTagBef1, - tagBefore2: tTagBef2, - tagAfter: tTagAft - }, - previewContentTemplates: { - generic: tGeneric, - html: tHtml, - image: tImage, - text: tText, - office: tOffice, - gdocs: tGdocs, - video: tVideo, - audio: tAudio, - flash: tFlash, - object: tObject, - pdf: tPdf, - other: tOther - }, - allowedPreviewTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'pdf', 'object'], - previewTemplates: {}, - previewSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '213px', height: '160px'}, - text: {width: '213px', height: '160px'}, - office: {width: '213px', height: '160px'}, - gdocs: {width: '213px', height: '160px'}, - video: {width: '213px', height: '160px'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '213px', height: '160px'}, - object: {width: '213px', height: '160px'}, - pdf: {width: '100%', height: '160px'}, - other: {width: '213px', height: '160px'} - }, - previewSettingsSmall: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '100%', height: '160px'}, - text: {width: '100%', height: '160px'}, - office: {width: '100%', height: '160px'}, - gdocs: {width: '100%', height: '160px'}, - video: {width: '100%', height: 'auto'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '100%', height: 'auto'}, - object: {width: '100%', height: 'auto'}, - pdf: {width: '100%', height: '160px'}, - other: {width: '100%', height: '160px'} - }, - previewZoomSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: vDefaultDim, - text: vDefaultDim, - office: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - gdocs: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - video: {width: 'auto', height: '100%', 'max-width': '100%'}, - audio: {width: '100%', height: '30px'}, - flash: {width: 'auto', height: '480px'}, - object: {width: 'auto', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - pdf: vDefaultDim, - other: {width: 'auto', height: '100%', 'min-height': '480px'} - }, - mimeTypeAliases: { - 'video/quicktime': 'video/mp4' - }, - fileTypeSettings: { - image: function (vType, vName) { - return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) || - $h.compare(vName, /\.(gif|png|jpe?g)$/i)); - }, - html: function (vType, vName) { - return $h.compare(vType, 'text/html') || $h.compare(vName, /\.(htm|html)$/i); - }, - office: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office)$/i) || - $h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?)$/i); - }, - gdocs: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office|iwork-pages|tiff?)$/i) || - $h.compare(vName, - /\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i); - }, - text: function (vType, vName) { - return $h.compare(vType, 'text.*') || $h.compare(vName, /\.(xml|javascript)$/i) || - $h.compare(vName, /\.(txt|md|csv|nfo|ini|json|php|js|css)$/i); - }, - video: function (vType, vName) { - return $h.compare(vType, 'video.*') && ($h.compare(vType, /(ogg|mp4|mp?g|mov|webm|3gp)$/i) || - $h.compare(vName, /\.(og?|mp4|webm|mp?g|mov|3gp)$/i)); - }, - audio: function (vType, vName) { - return $h.compare(vType, 'audio.*') && ($h.compare(vName, /(ogg|mp3|mp?g|wav)$/i) || - $h.compare(vName, /\.(og?|mp3|mp?g|wav)$/i)); - }, - flash: function (vType, vName) { - return $h.compare(vType, 'application/x-shockwave-flash', true) || $h.compare(vName, - /\.(swf)$/i); - }, - pdf: function (vType, vName) { - return $h.compare(vType, 'application/pdf', true) || $h.compare(vName, /\.(pdf)$/i); - }, - object: function () { - return true; - }, - other: function () { - return true; - } - }, - fileActionSettings: { - showRemove: true, - showUpload: true, - showDownload: true, - showZoom: true, - showDrag: true, - removeIcon: '', - removeClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - removeErrorClass: 'btn btn-sm btn-kv btn-danger', - removeTitle: 'Remove file', - uploadIcon: '', - uploadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - uploadTitle: 'Upload file', - uploadRetryIcon: '', - uploadRetryTitle: 'Retry upload', - downloadIcon: '', - downloadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - downloadTitle: 'Download file', - zoomIcon: '', - zoomClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - zoomTitle: 'View Details', - dragIcon: '', - dragClass: 'text-info', - dragTitle: 'Move / Rearrange', - dragSettings: {}, - indicatorNew: '', - indicatorSuccess: '', - indicatorError: '', - indicatorLoading: '', - indicatorPaused: '', - indicatorNewTitle: 'Not uploaded yet', - indicatorSuccessTitle: 'Uploaded', - indicatorErrorTitle: 'Upload Error', - indicatorLoadingTitle: 'Uploading ...', - indicatorPausedTitle: 'Upload Paused' - } - }; - $.each(self.defaults, function (key, setting) { - if (key === 'allowedPreviewTypes') { - if (self.allowedPreviewTypes === undefined) { - self.allowedPreviewTypes = setting; - } - return; - } - self[key] = $.extend(true, {}, setting, self[key]); - }); - self._initPreviewTemplates(); - }, - _initPreviewTemplates: function () { - var self = this, tags = self.previewMarkupTags, tagBef, tagAft = tags.tagAfter; - $.each(self.previewContentTemplates, function (key, value) { - if ($h.isEmpty(self.previewTemplates[key])) { - tagBef = tags.tagBefore2; - if (key === 'generic' || key === 'image' || key === 'html' || key === 'text') { - tagBef = tags.tagBefore1; - } - if (self._isPdfRendered() && key === 'pdf') { - tagBef = tagBef.replace('kv-file-content', 'kv-file-content kv-pdf-rendered'); - } - self.previewTemplates[key] = tagBef + value + tagAft; - } - }); - }, - _initPreviewCache: function () { - var self = this; - self.previewCache = { - data: {}, - init: function () { - var content = self.initialPreview; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - self.previewCache.data = { - content: content, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - }, - count: function (skipNull) { - if (!self.previewCache.data || !self.previewCache.data.content) { - return 0; - } - if (skipNull) { - var chk = self.previewCache.data.content.filter(function (n) { - return n !== null; - }); - return chk.length; - } - return self.previewCache.data.content.length; - }, - get: function (i, isDisabled) { - var ind = 'init_' + i, data = self.previewCache.data, config = data.config[i], fileId, - content = data.content[i], previewId = self.previewInitId + '-' + ind, out, $tmp, cat, ftr, - fname, ftype, frameClass, asData = $h.ifSet('previewAsData', config, self.initialPreviewAsData), - a = config ? {title: config.title || null, alt: config.alt || null} : {title: null, alt: null}, - parseTemplate = function (cat, dat, fn, ft, id, ftr, ind, fc, t) { - fc = ' file-preview-initial ' + $h.SORT_CSS + (fc ? ' ' + fc : ''); - /** @namespace config.zoomData */ - fileId = config && config.fileId || 'file_' + id; - return self._generatePreviewTemplate(cat, dat, fn, ft, id, fileId, false, null, fc, - ftr, ind, t, a, config && config.zoomData || dat); - }; - if (!content || !content.length) { - return ''; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - cat = $h.ifSet('type', config, self.initialPreviewFileType || 'generic'); - fname = $h.ifSet('filename', config, $h.ifSet('caption', config)); - ftype = $h.ifSet('filetype', config, cat); - ftr = self.previewCache.footer(i, isDisabled, (config && config.size || null)); - frameClass = $h.ifSet('frameClass', config); - if (asData) { - out = parseTemplate(cat, content, fname, ftype, previewId, ftr, ind, frameClass); - } else { - out = parseTemplate('generic', content, fname, ftype, previewId, ftr, ind, frameClass, cat) - .setTokens({'content': data.content[i]}); - } - if (data.tags.length && data.tags[i]) { - out = $h.replaceTags(out, data.tags[i]); - } - /** @namespace config.frameAttr */ - if (!$h.isEmpty(config) && !$h.isEmpty(config.frameAttr)) { - $tmp = $(document.createElement('div')).html(out); - $tmp.find('.file-preview-initial').attr(config.frameAttr); - out = $tmp.html(); - $tmp.remove(); - } - return out; - }, - clean: function (data) { - data.content = $h.cleanArray(data.content); - data.config = $h.cleanArray(data.config); - data.tags = $h.cleanArray(data.tags); - self.previewCache.data = data; - }, - add: function (content, config, tags, append) { - var data = self.previewCache.data, index = content.length - 1; - if (!content || !content.length) { - return index; - } - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (append) { - index = data.content.push(content[0]) - 1; - data.config[index] = config; - data.tags[index] = tags; - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - return index; - }, - set: function (content, config, tags, append) { - var data = self.previewCache.data, i, chk; - if (!content || !content.length) { - return; - } - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - chk = content.filter(function (n) { - return n !== null; - }); - if (!chk.length) { - return; - } - if (data.content === undefined) { - data.content = []; - } - if (data.config === undefined) { - data.config = []; - } - if (data.tags === undefined) { - data.tags = []; - } - if (append) { - for (i = 0; i < content.length; i++) { - if (content[i]) { - data.content.push(content[i]); - } - } - for (i = 0; i < config.length; i++) { - if (config[i]) { - data.config.push(config[i]); - } - } - for (i = 0; i < tags.length; i++) { - if (tags[i]) { - data.tags.push(tags[i]); - } - } - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - }, - unset: function (index) { - var chk = self.previewCache.count(), rev = self.reversePreviewOrder; - if (!chk) { - return; - } - if (chk === 1) { - self.previewCache.data.content = []; - self.previewCache.data.config = []; - self.previewCache.data.tags = []; - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - return; - } - self.previewCache.data.content = $h.spliceArray(self.previewCache.data.content, index, rev); - self.previewCache.data.config = $h.spliceArray(self.previewCache.data.config, index, rev); - self.previewCache.data.tags = $h.spliceArray(self.previewCache.data.tags, index, rev); - var data = $.extend(true, {}, self.previewCache.data); - self.previewCache.clean(data); - }, - out: function () { - var html = '', caption, len = self.previewCache.count(), i, content; - if (len === 0) { - return {content: '', caption: ''}; - } - for (i = 0; i < len; i++) { - content = self.previewCache.get(i); - html = self.reversePreviewOrder ? (content + html) : (html + content); - } - caption = self._getMsgSelected(len); - return {content: html, caption: caption}; - }, - footer: function (i, isDisabled, size) { - var data = self.previewCache.data || {}; - if ($h.isEmpty(data.content)) { - return ''; - } - if ($h.isEmpty(data.config) || $h.isEmpty(data.config[i])) { - data.config[i] = {}; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - var config = data.config[i], caption = $h.ifSet('caption', config), a, - width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false), - key = $h.ifSet('key', config, null), fileId = $h.ifSet('fileId', config, null), - fs = self.fileActionSettings, initPreviewShowDel = self.initialPreviewShowDelete || false, - downloadInitialUrl = !self.initialPreviewDownloadUrl ? '' : - self.initialPreviewDownloadUrl + '?key=' + key + (fileId ? '&fileId=' + fileId : ''), - dUrl = config.downloadUrl || downloadInitialUrl, - dFil = config.filename || config.caption || '', - initPreviewShowDwl = !!(dUrl), - sDel = $h.ifSet('showRemove', config, $h.ifSet('showRemove', fs, initPreviewShowDel)), - sDwl = $h.ifSet('showDownload', config, $h.ifSet('showDownload', fs, initPreviewShowDwl)), - sZm = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)), - sDrg = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)), - dis = (url === false) && isDisabled; - sDwl = sDwl && config.downloadUrl !== false && !!dUrl; - a = self._renderFileActions(config, false, sDwl, sDel, sZm, sDrg, dis, url, key, true, dUrl, dFil); - return self._getLayoutTemplate('footer').setTokens({ - 'progress': self._renderThumbProgress(), - 'actions': a, - 'caption': caption, - 'size': self._getSize(size), - 'width': width, - 'indicator': '' - }); - } - }; - self.previewCache.init(); - }, - _isPdfRendered: function () { - var self = this, useLib = self.usePdfRenderer, - flag = typeof useLib === 'function' ? useLib() : !!useLib; - return flag && self.pdfRendererUrl; - }, - _handler: function ($el, event, callback) { - var self = this, ns = self.namespace, ev = event.split(' ').join(ns + ' ') + ns; - if (!$el || !$el.length) { - return; - } - $el.off(ev).on(ev, callback); - }, - _encodeURI: function (vUrl) { - var self = this; - return self.encodeUrl ? encodeURI(vUrl) : vUrl; - }, - _log: function (msg, tokens) { - var self = this, id = self.$element.attr('id'); - if (id) { - msg = '"' + id + '": ' + msg; - } - msg = 'bootstrap-fileinput: ' + msg; - if (typeof tokens === 'object') { - msg.setTokens(tokens); - } - if (typeof window.console.log !== 'undefined') { - window.console.log(msg); - } else { - window.alert(msg); - } - }, - _validate: function () { - var self = this, status = self.$element.attr('type') === 'file'; - if (!status) { - self._log($h.logMessages.badInputType); - } - return status; - }, - _errorsExist: function () { - var self = this, $err, $errList = self.$errorContainer.find('li'); - if ($errList.length) { - return true; - } - $err = $(document.createElement('div')).html(self.$errorContainer.html()); - $err.find('.kv-error-close').remove(); - $err.find('ul').remove(); - return !!$.trim($err.text()).length; - }, - _errorHandler: function (evt, caption) { - var self = this, err = evt.target.error, showError = function (msg) { - self._showError(msg.replace('{name}', caption)); - }; - /** @namespace err.NOT_FOUND_ERR */ - /** @namespace err.SECURITY_ERR */ - /** @namespace err.NOT_READABLE_ERR */ - if (err.code === err.NOT_FOUND_ERR) { - showError(self.msgFileNotFound); - } else { - if (err.code === err.SECURITY_ERR) { - showError(self.msgFileSecured); - } else { - if (err.code === err.NOT_READABLE_ERR) { - showError(self.msgFileNotReadable); - } else { - if (err.code === err.ABORT_ERR) { - showError(self.msgFilePreviewAborted); - } else { - showError(self.msgFilePreviewError); - } - } - } - } - }, - _addError: function (msg) { - var self = this, $error = self.$errorContainer; - if (msg && $error.length) { - $error.html(self.errorCloseButton + msg); - self._handler($error.find('.kv-error-close'), 'click', function () { - setTimeout(function () { - if (self.showPreview && !self.getFrames().length) { - self.clear(); - } - $error.fadeOut('slow'); - }, self.processDelay); - }); - } - }, - _setValidationError: function (css) { - var self = this; - css = (css ? css + ' ' : '') + 'has-error'; - self.$container.removeClass(css).addClass('has-error'); - $h.addCss(self.$captionContainer, 'is-invalid'); - }, - _resetErrors: function (fade) { - var self = this, $error = self.$errorContainer; - self.isError = false; - self.$container.removeClass('has-error'); - self.$captionContainer.removeClass('is-invalid'); - $error.html(''); - if (fade) { - $error.fadeOut('slow'); - } else { - $error.hide(); - } - }, - _showFolderError: function (folders) { - var self = this, $error = self.$errorContainer, msg; - if (!folders) { - return; - } - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - msg = self.msgFoldersNotAllowed.replace('{n}', folders); - self._addError(msg); - self._setValidationError(); - $error.fadeIn(800); - self._raise('filefoldererror', [folders, msg]); - }, - _showFileError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', - fId = params && params.fileId || '', e = params && params.id ? - '
  • ' + msg + '
  • ' : '
  • ' + msg + '
  • '; - if ($error.find('ul').length === 0) { - self._addError('
      ' + e + '
    '); - } else { - $error.find('ul').append(e); - } - $error.fadeIn(800); - self._raise(ev, [params, msg]); - self._setValidationError('file-input-new'); - return true; - }, - _showError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileerror'; - params = params || {}; - params.reader = self.reader; - self._addError(msg); - $error.fadeIn(800); - self._raise(ev, [params, msg]); - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - self._setValidationError('file-input-new'); - self.$btnUpload.attr('disabled', true); - return true; - }, - _noFilesError: function (params) { - var self = this, label = self.minFileCount > 1 ? self.filePlural : self.fileSingle, - msg = self.msgFilesTooLess.replace('{n}', self.minFileCount).replace('{files}', label), - $error = self.$errorContainer; - self._addError(msg); - self.isError = true; - self._updateFileDetails(0); - $error.fadeIn(800); - self._raise('fileerror', [params, msg]); - self._clearFileInput(); - self._setValidationError(); - }, - _parseError: function (operation, jqXHR, errorThrown, fileName) { - /** @namespace jqXHR.responseJSON */ - var self = this, errMsg = $.trim(errorThrown + ''), textPre, - text = jqXHR.responseJSON !== undefined && jqXHR.responseJSON.error !== undefined ? - jqXHR.responseJSON.error : jqXHR.responseText; - if (self.cancelling && self.msgUploadAborted) { - errMsg = self.msgUploadAborted; - } - if (self.showAjaxErrorDetails && text) { - text = $.trim(text.replace(/\n\s*\n/g, '\n')); - textPre = text.length ? '
    ' + text + '
    ' : ''; - errMsg += errMsg ? textPre : text; - } - if (!errMsg) { - errMsg = self.msgAjaxError.replace('{operation}', operation); - } - self.cancelling = false; - return fileName ? '' + fileName + ': ' + errMsg : errMsg; - }, - _parseFileType: function (type, name) { - var self = this, isValid, vType, cat, i, types = self.allowedPreviewTypes || []; - if (type === 'application/text-plain') { - return 'text'; - } - for (i = 0; i < types.length; i++) { - cat = types[i]; - isValid = self.fileTypeSettings[cat]; - vType = isValid(type, name) ? cat : ''; - if (!$h.isEmpty(vType)) { - return vType; - } - } - return 'other'; - }, - _getPreviewIcon: function (fname) { - var self = this, ext, out = null; - if (fname && fname.indexOf('.') > -1) { - ext = fname.split('.').pop(); - if (self.previewFileIconSettings) { - out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null; - } - if (self.previewFileExtSettings) { - $.each(self.previewFileExtSettings, function (key, func) { - if (self.previewFileIconSettings[key] && func(ext)) { - out = self.previewFileIconSettings[key]; - //noinspection UnnecessaryReturnStatementJS - return; - } - }); - } - } - return out; - }, - _parseFilePreviewIcon: function (content, fname) { - var self = this, icn = self._getPreviewIcon(fname) || self.previewFileIcon, out = content; - if (out.indexOf('{previewFileIcon}') > -1) { - out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn}); - } - return out; - }, - _raise: function (event, params) { - var self = this, e = $.Event(event); - if (params !== undefined) { - self.$element.trigger(e, params); - } else { - self.$element.trigger(e); - } - if (e.isDefaultPrevented() || e.result === false) { - return false; - } - switch (event) { - // ignore these events - case 'filebatchuploadcomplete': - case 'filebatchuploadsuccess': - case 'fileuploaded': - case 'fileclear': - case 'filecleared': - case 'filereset': - case 'fileerror': - case 'filefoldererror': - case 'fileuploaderror': - case 'filebatchuploaderror': - case 'filedeleteerror': - case 'filecustomerror': - case 'filesuccessremove': - break; - // receive data response via `filecustomerror` event` - default: - if (!self.ajaxAborted) { - self.ajaxAborted = e.result; - } - break; - } - return true; - }, - _listenFullScreen: function (isFullScreen) { - var self = this, $modal = self.$modal, $btnFull, $btnBord; - if (!$modal || !$modal.length) { - return; - } - $btnFull = $modal && $modal.find('.btn-fullscreen'); - $btnBord = $modal && $modal.find('.btn-borderless'); - if (!$btnFull.length || !$btnBord.length) { - return; - } - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - if (isFullScreen) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - } else { - if (isFullScreen) { - self._maximizeZoomDialog(); - } else { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - }, - _listen: function () { - var self = this, $el = self.$element, $form = self.$form, $cont = self.$container, fullScreenEvents; - self._handler($el, 'click', function (e) { - if ($el.hasClass('file-no-browse')) { - if ($el.data('zoneClicked')) { - $el.data('zoneClicked', false); - } else { - e.preventDefault(); - } - } - }); - self._handler($el, 'change', $.proxy(self._change, self)); - if (self.showBrowse) { - self._handler(self.$btnFile, 'click', $.proxy(self._browse, self)); - } - self._handler($cont.find('.fileinput-remove:not([disabled])'), 'click', $.proxy(self.clear, self)); - self._handler($cont.find('.fileinput-cancel'), 'click', $.proxy(self.cancel, self)); - self._handler($cont.find('.fileinput-pause'), 'click', $.proxy(self.pause, self)); - self._initDragDrop(); - self._handler($form, 'reset', $.proxy(self.clear, self)); - if (!self.isAjaxUpload) { - self._handler($form, 'submit', $.proxy(self._submitForm, self)); - } - self._handler(self.$container.find('.fileinput-upload'), 'click', $.proxy(self._uploadClick, self)); - self._handler($(window), 'resize', function () { - self._listenFullScreen(screen.width === window.innerWidth && screen.height === window.innerHeight); - }); - fullScreenEvents = 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange'; - self._handler($(document), fullScreenEvents, function () { - self._listenFullScreen($h.checkFullScreen()); - }); - self._autoFitContent(); - self._initClickable(); - self._refreshPreview(); - }, - _autoFitContent: function () { - var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - self = this, config = width < 400 ? (self.previewSettingsSmall || self.defaults.previewSettingsSmall) : - (self.previewSettings || self.defaults.previewSettings), sel; - $.each(config, function (cat, settings) { - sel = '.file-preview-frame .file-preview-' + cat; - self.$preview.find(sel + '.kv-preview-data,' + sel + ' .kv-preview-data').css(settings); - }); - }, - _scanDroppedItems: function (item, files, path) { - path = path || ''; - var self = this, i, dirReader, readDir, errorHandler = function (e) { - self._log($h.logMessages.badDroppedFiles); - self._log(e); - }; - if (item.isFile) { - item.file(function (file) { - files.push(file); - }, errorHandler); - } else { - if (item.isDirectory) { - dirReader = item.createReader(); - readDir = function () { - dirReader.readEntries(function (entries) { - if (entries && entries.length > 0) { - for (i = 0; i < entries.length; i++) { - self._scanDroppedItems(entries[i], files, path + item.name + '/'); - } - // recursively call readDir() again, since browser can only handle first 100 entries. - readDir(); - } - return null; - }, errorHandler); - }; - readDir(); - } - } - - }, - _initDragDrop: function () { - var self = this, $zone = self.$dropZone; - if (self.dropZoneEnabled && self.showPreview) { - self._handler($zone, 'dragenter dragover', $.proxy(self._zoneDragEnter, self)); - self._handler($zone, 'dragleave', $.proxy(self._zoneDragLeave, self)); - self._handler($zone, 'drop', $.proxy(self._zoneDrop, self)); - self._handler($(document), 'dragenter dragover drop', self._zoneDragDropInit); - } - }, - _zoneDragDropInit: function (e) { - e.stopPropagation(); - e.preventDefault(); - }, - _zoneDragEnter: function (e) { - var self = this, dataTransfer = e.originalEvent.dataTransfer, - hasFiles = $.inArray('Files', dataTransfer.types) > -1; - self._zoneDragDropInit(e); - if (self.isDisabled || !hasFiles) { - e.originalEvent.dataTransfer.effectAllowed = 'none'; - e.originalEvent.dataTransfer.dropEffect = 'none'; - return; - } - if (self._raise('fileDragEnter', {'sourceEvent': e, 'files': dataTransfer.types.Files})) { - $h.addCss(self.$dropZone, 'file-highlighted'); - } - }, - _zoneDragLeave: function (e) { - var self = this; - self._zoneDragDropInit(e); - if (self.isDisabled) { - return; - } - if (self._raise('fileDragLeave', {'sourceEvent': e})) { - self.$dropZone.removeClass('file-highlighted'); - } - - }, - _zoneDrop: function (e) { - /** @namespace e.originalEvent.dataTransfer */ - var self = this, i, $el = self.$element, dataTransfer = e.originalEvent.dataTransfer, - files = dataTransfer.files, items = dataTransfer.items, folders = $h.getDragDropFolders(items), - processFiles = function () { - if (!self.isAjaxUpload) { - self.changeTriggered = true; - $el.get(0).files = files; - setTimeout(function () { - self.changeTriggered = false; - $el.trigger('change' + self.namespace); - }, self.processDelay); - } else { - self._change(e, files); - } - self.$dropZone.removeClass('file-highlighted'); - }; - e.preventDefault(); - if (self.isDisabled || $h.isEmpty(files)) { - return; - } - if (!self._raise('fileDragDrop', {'sourceEvent': e, 'files': files})) { - return; - } - if (folders > 0) { - if (!self.isAjaxUpload) { - self._showFolderError(folders); - return; - } - files = []; - for (i = 0; i < items.length; i++) { - var item = items[i].webkitGetAsEntry(); - if (item) { - self._scanDroppedItems(item, files); - } - } - setTimeout(function () { - processFiles(); - }, 500); - } else { - processFiles(); - } - }, - _uploadClick: function (e) { - var self = this, $btn = self.$container.find('.fileinput-upload'), $form, - isEnabled = !$btn.hasClass('disabled') && $h.isEmpty($btn.attr('disabled')); - if (e && e.isDefaultPrevented()) { - return; - } - if (!self.isAjaxUpload) { - if (isEnabled && $btn.attr('type') !== 'submit') { - $form = $btn.closest('form'); - // downgrade to normal form submit if possible - if ($form.length) { - $form.trigger('submit'); - } - e.preventDefault(); - } - return; - } - e.preventDefault(); - if (isEnabled) { - self.upload(); - } - }, - _submitForm: function () { - var self = this; - return self._isFileSelectionValid() && !self._abort({}); - }, - _clearPreview: function () { - var self = this, $p = self.$preview, - $thumbs = self.showUploadedThumbs ? self.getFrames(':not(.file-preview-success)') : self.getFrames(); - $thumbs.each(function () { - var $thumb = $(this); - $thumb.remove(); - $h.cleanZoomCache($p.find('#zoom-' + $thumb.attr('id'))); - }); - if (!self.getFrames().length || !self.showPreview) { - self._resetUpload(); - } - self._validateDefaultPreview(); - }, - _initSortable: function () { - var self = this, $el = self.$preview, settings, selector = '.' + $h.SORT_CSS, - rev = self.reversePreviewOrder; - if (!window.KvSortable || $el.find(selector).length === 0) { - return; - } - //noinspection JSUnusedGlobalSymbols - settings = { - handle: '.drag-handle-init', - dataIdAttr: 'data-preview-id', - scroll: false, - draggable: selector, - onSort: function (e) { - var oldIndex = e.oldIndex, newIndex = e.newIndex, i = 0; - self.initialPreview = $h.moveArray(self.initialPreview, oldIndex, newIndex, rev); - self.initialPreviewConfig = $h.moveArray(self.initialPreviewConfig, oldIndex, newIndex, rev); - self.previewCache.init(); - self.getFrames('.file-preview-initial').each(function () { - $(this).attr('data-fileindex', 'init_' + i); - i++; - }); - self._raise('filesorted', { - previewId: $(e.item).attr('id'), - 'oldIndex': oldIndex, - 'newIndex': newIndex, - stack: self.initialPreviewConfig - }); - } - }; - if ($el.data('kvsortable')) { - $el.kvsortable('destroy'); - } - $.extend(true, settings, self.fileActionSettings.dragSettings); - $el.kvsortable(settings); - }, - _setPreviewContent: function (content) { - var self = this; - self.$preview.html(content); - self._autoFitContent(); - }, - _initPreviewImageOrientations: function () { - var self = this, i = 0; - if (!self.autoOrientImageInitial) { - return; - } - self.getFrames('.file-preview-initial').each(function () { - var $thumb = $(this), $img, $zoomImg, id, config = self.initialPreviewConfig[i]; - /** @namespace config.exif */ - if (config && config.exif && config.exif.Orientation) { - id = $thumb.attr('id'); - $img = $thumb.find('>.kv-file-content img'); - $zoomImg = self.$preview.find('#zoom-' + id + ' >.kv-file-content img'); - self.setImageOrientation($img, $zoomImg, config.exif.Orientation, $thumb); - } - i++; - }); - }, - _initPreview: function (isInit) { - var self = this, cap = self.initialCaption || '', out; - if (!self.previewCache.count(true)) { - self._clearPreview(); - if (isInit) { - self._setCaption(cap); - } else { - self._initCaption(); - } - return; - } - out = self.previewCache.out(); - cap = isInit && self.initialCaption ? self.initialCaption : out.caption; - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(cap); - self._initSortable(); - if (!$h.isEmpty(out.content)) { - self.$container.removeClass('file-input-new'); - } - self._initPreviewImageOrientations(); - }, - _getZoomButton: function (type) { - var self = this, label = self.previewZoomButtonIcons[type], css = self.previewZoomButtonClasses[type], - title = ' title="' + (self.previewZoomButtonTitles[type] || '') + '" ', - params = title + (type === 'close' ? ' data-dismiss="modal" aria-hidden="true"' : ''); - if (type === 'fullscreen' || type === 'borderless' || type === 'toggleheader') { - params += ' data-toggle="button" aria-pressed="false" autocomplete="off"'; - } - return ''; - }, - _getModalContent: function () { - var self = this; - return self._getLayoutTemplate('modal').setTokens({ - 'rtl': self.rtl ? ' kv-rtl' : '', - 'zoomFrameClass': self.frameClass, - 'heading': self.msgZoomModalHeading, - 'prev': self._getZoomButton('prev'), - 'next': self._getZoomButton('next'), - 'toggleheader': self._getZoomButton('toggleheader'), - 'fullscreen': self._getZoomButton('fullscreen'), - 'borderless': self._getZoomButton('borderless'), - 'close': self._getZoomButton('close') - }); - }, - _listenModalEvent: function (event) { - var self = this, $modal = self.$modal, getParams = function (e) { - return { - sourceEvent: e, - previewId: $modal.data('previewId'), - modal: $modal - }; - }; - $modal.on(event + '.bs.modal', function (e) { - var $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'); - self._raise('filezoom' + event, getParams(e)); - if (event === 'shown') { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - if ($h.checkFullScreen()) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - } - } - }); - }, - _initZoom: function () { - var self = this, $dialog, modalMain = self._getLayoutTemplate('modalMain'), modalId = '#' + $h.MODAL_ID; - if (!self.showPreview) { - return; - } - self.$modal = $(modalId); - if (!self.$modal || !self.$modal.length) { - $dialog = $(document.createElement('div')).html(modalMain).insertAfter(self.$container); - self.$modal = $(modalId).insertBefore($dialog); - $dialog.remove(); - } - $h.initModal(self.$modal); - self.$modal.html(self._getModalContent()); - $.each($h.MODAL_EVENTS, function (key, event) { - self._listenModalEvent(event); - }); - }, - _initZoomButtons: function () { - var self = this, previewId = self.$modal.data('previewId') || '', $first, $last, - thumbs = self.getFrames().toArray(), len = thumbs.length, $prev = self.$modal.find('.btn-prev'), - $next = self.$modal.find('.btn-next'); - if (thumbs.length < 2) { - $prev.hide(); - $next.hide(); - return; - } else { - $prev.show(); - $next.show(); - } - if (!len) { - return; - } - $first = $(thumbs[0]); - $last = $(thumbs[len - 1]); - $prev.removeAttr('disabled'); - $next.removeAttr('disabled'); - if ($first.length && $first.attr('id') === previewId) { - $prev.attr('disabled', true); - } - if ($last.length && $last.attr('id') === previewId) { - $next.attr('disabled', true); - } - }, - _maximizeZoomDialog: function () { - var self = this, $modal = self.$modal, $head = $modal.find('.modal-header:visible'), - $foot = $modal.find('.modal-footer:visible'), $body = $modal.find('.modal-body'), - h = $(window).height(), diff = 0; - $modal.addClass('file-zoom-fullscreen'); - if ($head && $head.length) { - h -= $head.outerHeight(true); - } - if ($foot && $foot.length) { - h -= $foot.outerHeight(true); - } - if ($body && $body.length) { - diff = $body.outerHeight(true) - $body.height(); - h -= diff; - } - $modal.find('.kv-zoom-body').height(h); - }, - _resizeZoomDialog: function (fullScreen) { - var self = this, $modal = self.$modal, $btnFull = $modal.find('.btn-fullscreen'), - $btnBord = $modal.find('.btn-borderless'); - if ($modal.hasClass('file-zoom-fullscreen')) { - $h.toggleFullScreen(false); - if (!fullScreen) { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self.$modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); - } else { - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - } - } else { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self._resizeZoomDialog(true); - if ($btnBord.hasClass('active')) { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - } - } else { - if (!fullScreen) { - self._maximizeZoomDialog(); - return; - } - $h.toggleFullScreen(true); - } - $modal.focus(); - }, - _setZoomContent: function ($frame, animate) { - var self = this, $content, tmplt, body, title, $body, $dataEl, config, previewId = $frame.attr('id'), - $zoomPreview = self.$preview.find('#zoom-' + previewId), $modal = self.$modal, $tmp, - $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), cap, size, - $btnTogh = $modal.find('.btn-toggleheader'); - tmplt = $zoomPreview.attr('data-template') || 'generic'; - $content = $zoomPreview.find('.kv-file-content'); - body = $content.length ? $content.html() : ''; - cap = $frame.data('caption') || ''; - size = $frame.data('size') || ''; - title = cap + ' ' + size; - $modal.find('.kv-zoom-title').attr('title', $('
    ').html(title).text()).html(title); - $body = $modal.find('.kv-zoom-body'); - $modal.removeClass('kv-single-content'); - if (animate) { - $tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body); - $body.html(body).hide(); - $tmp.fadeOut('fast', function () { - $body.fadeIn('fast', function () { - $body.removeClass('file-thumb-loading'); - }); - $tmp.remove(); - }); - } else { - $body.html(body); - } - config = self.previewZoomSettings[tmplt]; - if (config) { - $dataEl = $body.find('.kv-preview-data'); - $h.addCss($dataEl, 'file-zoom-detail'); - $.each(config, function (key, value) { - $dataEl.css(key, value); - if (($dataEl.attr('width') && key === 'width') || ($dataEl.attr('height') && key === 'height')) { - $dataEl.removeAttr(key); - } - }); - } - $modal.data('previewId', previewId); - self._handler($modal.find('.btn-prev'), 'click', function () { - self._zoomSlideShow('prev', previewId); - }); - self._handler($modal.find('.btn-next'), 'click', function () { - self._zoomSlideShow('next', previewId); - }); - self._handler($btnFull, 'click', function () { - self._resizeZoomDialog(true); - }); - self._handler($btnBord, 'click', function () { - self._resizeZoomDialog(false); - }); - self._handler($btnTogh, 'click', function () { - var $header = $modal.find('.modal-header'), $floatBar = $modal.find('.modal-body .floating-buttons'), - ht, $actions = $header.find('.kv-zoom-actions'), resize = function (height) { - var $body = self.$modal.find('.kv-zoom-body'), h = self.zoomModalHeight; - if ($modal.hasClass('file-zoom-fullscreen')) { - h = $body.outerHeight(true); - if (!height) { - h = h - $header.outerHeight(true); - } - } - $body.css('height', height ? h + height : h); - }; - if ($header.is(':visible')) { - ht = $header.outerHeight(true); - $header.slideUp('slow', function () { - $actions.find('.btn').appendTo($floatBar); - resize(ht); - }); - } else { - $floatBar.find('.btn').appendTo($actions); - $header.slideDown('slow', function () { - resize(); - }); - } - $modal.focus(); - }); - self._handler($modal, 'keydown', function (e) { - var key = e.which || e.keyCode, $prev = $(this).find('.btn-prev'), $next = $(this).find('.btn-next'), - vId = $(this).data('previewId'), vPrevKey = self.rtl ? 39 : 37, vNextKey = self.rtl ? 37 : 39; - if (key === vPrevKey && $prev.length && !$prev.attr('disabled')) { - self._zoomSlideShow('prev', vId); - } - if (key === vNextKey && $next.length && !$next.attr('disabled')) { - self._zoomSlideShow('next', vId); - } - }); - }, - _zoomPreview: function ($btn) { - var self = this, $frame, $modal = self.$modal; - if (!$btn.length) { - throw 'Cannot zoom to detailed preview!'; - } - $h.initModal($modal); - $modal.html(self._getModalContent()); - $frame = $btn.closest($h.FRAMES); - self._setZoomContent($frame); - $modal.modal('show'); - self._initZoomButtons(); - }, - _zoomSlideShow: function (dir, previewId) { - var self = this, $btn = self.$modal.find('.kv-zoom-actions .btn-' + dir), $targFrame, i, - thumbs = self.getFrames().toArray(), len = thumbs.length, out; - if ($btn.attr('disabled')) { - return; - } - for (i = 0; i < len; i++) { - if ($(thumbs[i]).attr('id') === previewId) { - out = dir === 'prev' ? i - 1 : i + 1; - break; - } - } - if (out < 0 || out >= len || !thumbs[out]) { - return; - } - $targFrame = $(thumbs[out]); - if ($targFrame.length) { - self._setZoomContent($targFrame, true); - } - self._initZoomButtons(); - self._raise('filezoom' + dir, {'previewId': previewId, modal: self.$modal}); - }, - _initZoomButton: function () { - var self = this; - self.$preview.find('.kv-file-zoom').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - self._zoomPreview($el); - }); - }); - }, - _inputFileCount: function () { - return this.$element.get(0).files.length; - }, - _refreshPreview: function () { - var self = this, files; - if ((!self._inputFileCount() && !self.isAjaxUpload) || !self.showPreview || !self.isPreviewable) { - return; - } - if (self.isAjaxUpload) { - if (self.fileManager.count() > 0) { - files = $.extend(true, {}, self.fileManager.stack); - self.fileManager.clear(); - self._clearFileInput(); - } else { - files = self.$element.get(0).files; - } - } else { - files = self.$element.get(0).files; - } - if (files && files.length) { - self.readFiles(files); - self._setFileDropZoneTitle(); - } - }, - _clearObjects: function ($el) { - $el.find('video audio').each(function () { - this.pause(); - $(this).remove(); - }); - $el.find('img object div').each(function () { - $(this).remove(); - }); - }, - _clearFileInput: function () { - var self = this, $el = self.$element, $srcFrm, $tmpFrm, $tmpEl; - if (!self._inputFileCount()) { - return; - } - $srcFrm = $el.closest('form'); - $tmpFrm = $(document.createElement('form')); - $tmpEl = $(document.createElement('div')); - $el.before($tmpEl); - if ($srcFrm.length) { - $srcFrm.after($tmpFrm); - } else { - $tmpEl.after($tmpFrm); - } - $tmpFrm.append($el).trigger('reset'); - $tmpEl.before($el).remove(); - $tmpFrm.remove(); - }, - _resetUpload: function () { - var self = this; - self.uploadCache = {content: [], config: [], tags: [], append: true}; - self.$btnUpload.removeAttr('disabled'); - self._setProgress(0); - self.$progress.hide(); - self._resetErrors(false); - self._initAjax(); - self.fileManager.clearImages(); - self._resetCanvas(); - self.cacheInitialPreview = {}; - if (self.overwriteInitial) { - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - self.previewCache.data = { - content: [], - config: [], - tags: [] - }; - } - }, - _resetCanvas: function () { - var self = this; - if (self.canvas && self.imageCanvasContext) { - self.imageCanvasContext.clearRect(0, 0, self.canvas.width, self.canvas.height); - } - }, - _hasInitialPreview: function () { - var self = this; - return !self.overwriteInitial && self.previewCache.count(true); - }, - _resetPreview: function () { - var self = this, out, cap; - if (self.previewCache.count(true)) { - out = self.previewCache.out(); - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - cap = self.initialCaption ? self.initialCaption : out.caption; - self._setCaption(cap); - } else { - self._clearPreview(); - self._initCaption(); - } - if (self.showPreview) { - self._initZoom(); - self._initSortable(); - } - }, - _clearDefaultPreview: function () { - var self = this; - self.$preview.find('.file-default-preview').remove(); - }, - _validateDefaultPreview: function () { - var self = this; - if (!self.showPreview || $h.isEmpty(self.defaultPreviewContent)) { - return; - } - self._setPreviewContent('
    ' + self.defaultPreviewContent + '
    '); - self.$container.removeClass('file-input-new'); - self._initClickable(); - }, - _resetPreviewThumbs: function (isAjax) { - var self = this, out; - if (isAjax) { - self._clearPreview(); - self.clearFileStack(); - return; - } - if (self._hasInitialPreview()) { - out = self.previewCache.out(); - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(out.caption); - self._initPreviewActions(); - } else { - self._clearPreview(); - } - }, - _getLayoutTemplate: function (t) { - var self = this, template = self.layoutTemplates[t]; - if ($h.isEmpty(self.customLayoutTags)) { - return template; - } - return $h.replaceTags(template, self.customLayoutTags); - }, - _getPreviewTemplate: function (t) { - var self = this, template = self.previewTemplates[t]; - if ($h.isEmpty(self.customPreviewTags)) { - return template; - } - return $h.replaceTags(template, self.customPreviewTags); - }, - _getOutData: function (formdata, jqXHR, responseData, filesData) { - var self = this; - jqXHR = jqXHR || {}; - responseData = responseData || {}; - filesData = filesData || self.fileManager.list(); - return { - formdata: formdata, - files: filesData, - filenames: self.filenames, - filescount: self.getFilesCount(), - extra: self._getExtraData(), - response: responseData, - reader: self.reader, - jqXHR: jqXHR - }; - }, - _getMsgSelected: function (n) { - var self = this, strFiles = n === 1 ? self.fileSingle : self.filePlural; - return n > 0 ? self.msgSelected.replace('{n}', n).replace('{files}', strFiles) : self.msgNoFilesSelected; - }, - _getFrame: function (id) { - var self = this, $frame = $('#' + id); - if (!$frame.length) { - self._log($h.logMessages.invalidThumb, {id: id}); - return null; - } - return $frame; - }, - _getThumbs: function (css) { - css = css || ''; - return this.getFrames(':not(.file-preview-initial)' + css); - }, - _getExtraData: function (fileId, index) { - var self = this, data = self.uploadExtraData; - if (typeof self.uploadExtraData === 'function') { - data = self.uploadExtraData(fileId, index); - } - return data; - }, - _initXhr: function (xhrobj, fileId, fileCount) { - var self = this, fm = self.fileManager, func = function (event) { - var pct = 0, total = event.total, loaded = event.loaded || event.position, - stats = fm.getUploadStats(fileId, loaded, total); - /** @namespace event.lengthComputable */ - if (event.lengthComputable && !self.enableResumableUpload) { - pct = $h.round(loaded / total * 100); - } - if (fileId) { - self._setFileUploadStats(fileId, pct, fileCount, stats); - } else { - self._setProgress(pct, null, null, self._getStats(stats)); - } - self._raise('fileajaxprogress', [stats]); - }; - if (xhrobj.upload) { - if (self.progressDelay) { - func = $h.debounce(func, self.progressDelay); - } - xhrobj.upload.addEventListener('progress', func, false); - } - return xhrobj; - }, - _initAjaxSettings: function () { - var self = this; - self._ajaxSettings = $.extend(true, {}, self.ajaxSettings); - self._ajaxDeleteSettings = $.extend(true, {}, self.ajaxDeleteSettings); - }, - _mergeAjaxCallback: function (funcName, srcFunc, type) { - var self = this, settings = self._ajaxSettings, flag = self.mergeAjaxCallbacks, targFunc; - if (type === 'delete') { - settings = self._ajaxDeleteSettings; - flag = self.mergeAjaxDeleteCallbacks; - } - targFunc = settings[funcName]; - if (flag && typeof targFunc === 'function') { - if (flag === 'before') { - settings[funcName] = function () { - targFunc.apply(this, arguments); - srcFunc.apply(this, arguments); - }; - } else { - settings[funcName] = function () { - srcFunc.apply(this, arguments); - targFunc.apply(this, arguments); - }; - } - } else { - settings[funcName] = srcFunc; - } - }, - _ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, formdata, fileId, index, vUrl) { - var self = this, settings, defaults, data, processQueue; - if (!self._raise('filepreajax', [formdata, fileId, index])) { - return; - } - formdata.append('initialPreview', JSON.stringify(self.initialPreview)); - formdata.append('initialPreviewConfig', JSON.stringify(self.initialPreviewConfig)); - formdata.append('initialPreviewThumbTags', JSON.stringify(self.initialPreviewThumbTags)); - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore); - self._mergeAjaxCallback('success', fnSuccess); - self._mergeAjaxCallback('complete', fnComplete); - self._mergeAjaxCallback('error', fnError); - vUrl = vUrl || self.uploadUrlThumb || self.uploadUrl; - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - data = self._getExtraData(fileId, index) || {}; - if (typeof data === 'object') { - $.each(data, function (key, value) { - formdata.append(key, value); - }); - } - defaults = { - xhr: function () { - var xhrobj = $.ajaxSettings.xhr(); - return self._initXhr(xhrobj, fileId, self.fileManager.count()); - }, - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: formdata, - cache: false, - processData: false, - contentType: false - }; - settings = $.extend(true, {}, defaults, self._ajaxSettings); - self.ajaxQueue.push(settings); - processQueue = function () { - var config, xhr; - if (self.ajaxCurrentThreads < self.maxAjaxThreads) { - config = self.ajaxQueue.shift(); - if (typeof config !== 'undefined') { - self.ajaxCurrentThreads++; - xhr = $.ajax(config).done(function () { - clearInterval(self.ajaxQueueIntervalId); - self.ajaxCurrentThreads--; - }); - self.ajaxRequests.push(xhr); - } - } - }; - self.ajaxQueueIntervalId = setInterval(processQueue, self.queueDelay); - - }, - _mergeArray: function (prop, content) { - var self = this, arr1 = $h.cleanArray(self[prop]), arr2 = $h.cleanArray(content); - self[prop] = arr1.concat(arr2); - }, - _initUploadSuccess: function (out, $thumb, allFiles) { - var self = this, append, data, index, $div, $newCache, content, config, tags, i; - if (!self.showPreview || typeof out !== 'object' || $.isEmptyObject(out)) { - return; - } - if (out.initialPreview !== undefined && out.initialPreview.length > 0) { - self.hasInitData = true; - content = out.initialPreview || []; - config = out.initialPreviewConfig || []; - tags = out.initialPreviewThumbTags || []; - append = out.append === undefined || out.append; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (content.length) { - self._mergeArray('initialPreview', content); - self._mergeArray('initialPreviewConfig', config); - self._mergeArray('initialPreviewThumbTags', tags); - } - if ($thumb !== undefined) { - if (!allFiles) { - index = self.previewCache.add(content[0], config[0], tags[0], append); - data = self.previewCache.get(index, false); - $div = $(document.createElement('div')).html(data).hide().insertAfter($thumb); - $newCache = $div.find('.kv-zoom-cache'); - if ($newCache && $newCache.length) { - $newCache.insertAfter($thumb); - } - $thumb.fadeOut('slow', function () { - var $newThumb = $div.find('.file-preview-frame'); - if ($newThumb && $newThumb.length) { - $newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block'); - } - self._initPreviewActions(); - self._clearFileInput(); - $h.cleanZoomCache(self.$preview.find('#zoom-' + $thumb.attr('id'))); - $thumb.remove(); - $div.remove(); - self._initSortable(); - }); - } else { - i = $thumb.attr('data-fileindex'); - self.uploadCache.content[i] = content[0]; - self.uploadCache.config[i] = config[0] || []; - self.uploadCache.tags[i] = tags[0] || []; - self.uploadCache.append = append; - } - } else { - self.previewCache.set(content, config, tags, append); - self._initPreview(); - self._initPreviewActions(); - } - } - }, - _initSuccessThumbs: function () { - var self = this; - if (!self.showPreview) { - return; - } - self._getThumbs($h.FRAMES + '.file-preview-success').each(function () { - var $thumb = $(this), $preview = self.$preview, $remove = $thumb.find('.kv-file-remove'); - $remove.removeAttr('disabled'); - self._handler($remove, 'click', function () { - var id = $thumb.attr('id'), - out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]); - $h.cleanMemory($thumb); - if (out === false) { - return; - } - $thumb.fadeOut('slow', function () { - $h.cleanZoomCache($preview.find('#zoom-' + id)); - $thumb.remove(); - if (!self.getFrames().length) { - self.reset(); - } - }); - }); - }); - }, - _updateInitialPreview: function () { - var self = this, u = self.uploadCache, i, j, len = 0, data = self.cacheInitialPreview; - if (data && data.content) { - len = data.content.length; - } - if (self.showPreview) { - self.previewCache.set(u.content, u.config, u.tags, u.append); - if (len) { - for (i = 0; i < u.content.length; i++) { - j = i + len; - data.content[j] = u.content[i]; - //noinspection JSUnresolvedVariable - if (data.config.length) { - data.config[j] = u.config[i]; - } - if (data.tags.length) { - data.tags[j] = u.tags[i]; - } - } - self.initialPreview = $h.cleanArray(data.content); - self.initialPreviewConfig = $h.cleanArray(data.config); - self.initialPreviewThumbTags = $h.cleanArray(data.tags); - } else { - self.initialPreview = u.content; - self.initialPreviewConfig = u.config; - self.initialPreviewThumbTags = u.tags; - } - self.cacheInitialPreview = {}; - if (self.hasInitData) { - self._initPreview(); - self._initPreviewActions(); - } - } - }, - _uploadSingle: function (i, id, isBatch) { - var self = this, fm = self.fileManager, count = fm.count(), formdata = new FormData(), outData, - previewId = self.previewInitId + '-' + i, $thumb, chkComplete, $btnUpload, $btnDelete, - hasPostData = count > 0 || !$.isEmptyObject(self.uploadExtraData), uploadFailed, $prog, fnBefore, - errMsg, fnSuccess, fnComplete, fnError, updateUploadLog, op = self.ajaxOperations.uploadThumb, - fileObj = fm.getFile(id), params = {id: previewId, index: i, fileId: id}, - fileName = self.fileManager.getFileName(id, true); - if (self.enableResumableUpload) { // not enabled for resumable uploads - return; - } - if (self.showPreview) { - $thumb = self.fileManager.getThumb(id); - $prog = $thumb.find('.file-thumb-progress'); - $btnUpload = $thumb.find('.kv-file-upload'); - $btnDelete = $thumb.find('.kv-file-remove'); - $prog.show(); - } - if (count === 0 || !hasPostData || (self.showPreview && $btnUpload && $btnUpload.hasClass('disabled')) || - self._abort(params)) { - return; - } - updateUploadLog = function () { - if (!uploadFailed) { - fm.removeFile(id); - } else { - fm.errors.push(id); - } - fm.setProcessed(id); - if (fm.isProcessed()) { - self.fileBatchCompleted = true; - } - }; - chkComplete = function () { - var $initThumbs; - if (!self.fileBatchCompleted) { - return; - } - setTimeout(function () { - var triggerReset = fm.count() === 0, errCount = fm.errors.length; - self._updateInitialPreview(); - self.unlock(triggerReset); - if (triggerReset) { - self._clearFileInput(); - } - $initThumbs = self.$preview.find('.file-preview-initial'); - if (self.uploadAsync && $initThumbs.length) { - $h.addCss($initThumbs, $h.SORT_CSS); - self._initSortable(); - } - self._raise('filebatchuploadcomplete', [fm.stack, self._getExtraData()]); - if (!self.retryErrorUploads || errCount === 0) { - fm.clear(); - } - self._setProgress(101); - self.ajaxAborted = false; - }, self.processDelay); - }; - fnBefore = function (jqXHR) { - outData = self._getOutData(formdata, jqXHR); - fm.initStats(id); - self.fileBatchCompleted = false; - if (!isBatch) { - self.ajaxAborted = false; - } - if (self.showPreview) { - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - } - if (!isBatch) { - self.lock(); - } - if (fm.errors.indexOf(id) !== -1) { - delete fm.errors[id]; - } - self._raise('filepreupload', [outData, previewId, i]); - $.extend(true, params, outData); - if (self._abort(params)) { - jqXHR.abort(); - if (!isBatch) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - self.unlock(); - } - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var pid = self.showPreview && $thumb.attr('id') ? $thumb.attr('id') : previewId; - outData = self._getOutData(formdata, jqXHR, data); - $.extend(true, params, outData); - setTimeout(function () { - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - if (self.showPreview) { - self._setThumbStatus($thumb, 'Success'); - $btnUpload.hide(); - self._initUploadSuccess(data, $thumb, isBatch); - self._setProgress(101, $prog); - } - self._raise('fileuploaded', [outData, pid, i]); - if (!isBatch) { - self.fileManager.remove($thumb); - } else { - updateUploadLog(); - } - } else { - uploadFailed = true; - errMsg = self._parseError(op, jqXHR, self.msgUploadError, self.fileManager.getFileName(id)); - self._showFileError(errMsg, params); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - if (isBatch) { - updateUploadLog(); - } - self._setProgress(101, $('#' + pid).find('.file-thumb-progress'), self.msgUploadError); - } - }, self.processDelay); - }; - fnComplete = function () { - setTimeout(function () { - if (self.showPreview) { - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - $thumb.removeClass('file-uploading'); - } - if (!isBatch) { - self.unlock(false); - self._clearFileInput(); - } else { - chkComplete(); - } - self._initSuccessThumbs(); - }, self.processDelay); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - errMsg = self._parseError(op, jqXHR, errorThrown, self.fileManager.getFileName(id)); - uploadFailed = true; - setTimeout(function () { - if (isBatch) { - updateUploadLog(); - } - self.fileManager.setProgress(id, 100); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - $.extend(true, params, self._getOutData(formdata, jqXHR)); - self._setProgress(101, $prog, self.msgAjaxProgressError.replace('{operation}', op)); - self._setProgress(101, $thumb.find('.file-thumb-progress'), self.msgUploadError); - self._showFileError(errMsg, params); - }, self.processDelay); - }; - formdata.append(self.uploadFileAttr, fileObj.file, fileName); - self._setUploadData(formdata, {fileId: id}); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata, id, i); - }, - _uploadBatch: function () { - var self = this, fm = self.fileManager, total = fm.total(), params = {}, fnBefore, fnSuccess, fnError, - fnComplete, hasPostData = total > 0 || !$.isEmptyObject(self.uploadExtraData), errMsg, - setAllUploaded, formdata = new FormData(), op = self.ajaxOperations.uploadBatch; - if (total === 0 || !hasPostData || self._abort(params)) { - return; - } - setAllUploaded = function () { - self.fileManager.clear(); - self._clearFileInput(); - }; - fnBefore = function (jqXHR) { - self.lock(); - fm.initStats(); - var outData = self._getOutData(formdata, jqXHR); - self.ajaxAborted = false; - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - }); - } - self._raise('filebatchpreupload', [outData]); - if (self._abort(outData)) { - jqXHR.abort(); - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if ($thumb.hasClass('file-preview-loading')) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - } - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - }); - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - /** @namespace data.errorkeys */ - var outData = self._getOutData(formdata, jqXHR, data), key = 0, - $thumbs = self._getThumbs(':not(.file-preview-success)'), - keys = $h.isEmpty(data) || $h.isEmpty(data.errorkeys) ? [] : data.errorkeys; - - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - setAllUploaded(); - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - self._setThumbStatus($thumb, 'Success'); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').hide().removeAttr('disabled'); - }); - self._initUploadSuccess(data); - } else { - self.reset(); - } - self._setProgress(101); - } else { - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeAttr('disabled'); - if (keys.length === 0 || $.inArray(key, keys) !== -1) { - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $thumb.find('.kv-file-upload').hide(); - self.fileManager.remove($thumb); - } - } else { - $thumb.find('.kv-file-upload').hide(); - self._setThumbStatus($thumb, 'Success'); - self.fileManager.remove($thumb); - } - if (!$thumb.hasClass('file-preview-error') || self.retryErrorUploads) { - key++; - } - }); - self._initUploadSuccess(data); - } - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgUploadError); - } - }; - fnComplete = function () { - self.unlock(); - self._initSuccessThumbs(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self.uploadFileCount = total - 1; - if (!self.showPreview) { - return; - } - self._getThumbs().each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - if (self.fileManager.getFile($thumb.attr('data-fileid'))) { - self._setPreviewError($thumb); - } - }); - self._getThumbs().removeClass('file-uploading'); - self._getThumbs(' .kv-file-upload').removeAttr('disabled'); - self._getThumbs(' .kv-file-delete').removeAttr('disabled'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - var ctr = 0; - $.each(self.fileManager.stack, function (key, data) { - if (!$h.isEmpty(data.file)) { - formdata.append(self.uploadFileAttr, data.file, (data.nameFmt || ('untitled_' + ctr))); - } - ctr++; - }); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _uploadExtraOnly: function () { - var self = this, params = {}, fnBefore, fnSuccess, fnComplete, fnError, formdata = new FormData(), errMsg, - op = self.ajaxOperations.uploadExtra; - if (self._abort(params)) { - return; - } - fnBefore = function (jqXHR) { - self.lock(); - var outData = self._getOutData(formdata, jqXHR); - self._raise('filebatchpreupload', [outData]); - self._setProgress(50); - params.data = outData; - params.xhr = jqXHR; - if (self._abort(params)) { - jqXHR.abort(); - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var outData = self._getOutData(formdata, jqXHR, data); - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - self._clearFileInput(); - self._initUploadSuccess(data); - self._setProgress(101); - } else { - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - } - }; - fnComplete = function () { - self.unlock(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - params.data = outData; - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _deleteFileIndex: function ($frame) { - var self = this, ind = $frame.attr('data-fileindex'), rev = self.reversePreviewOrder; - if (ind.substring(0, 5) === 'init_') { - ind = parseInt(ind.replace('init_', '')); - self.initialPreview = $h.spliceArray(self.initialPreview, ind, rev); - self.initialPreviewConfig = $h.spliceArray(self.initialPreviewConfig, ind, rev); - self.initialPreviewThumbTags = $h.spliceArray(self.initialPreviewThumbTags, ind, rev); - self.getFrames().each(function () { - var $nFrame = $(this), nInd = $nFrame.attr('data-fileindex'); - if (nInd.substring(0, 5) === 'init_') { - nInd = parseInt(nInd.replace('init_', '')); - if (nInd > ind) { - nInd--; - $nFrame.attr('data-fileindex', 'init_' + nInd); - } - } - }); - if (self.uploadAsync || self.enableResumableUpload) { - self.cacheInitialPreview = self.getPreview(); - } - } - }, - _initFileActions: function () { - var self = this, $preview = self.$preview; - if (!self.showPreview) { - return; - } - self._initZoomButton(); - self.getFrames(' .kv-file-remove').each(function () { - var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'), - ind = $frame.attr('data-fileindex'), n, cap, status; - self._handler($el, 'click', function () { - status = self._raise('filepreremove', [id, ind]); - if (status === false || !self._validateMinCount()) { - return false; - } - hasError = $frame.hasClass('file-preview-error'); - $h.cleanMemory($frame); - $frame.fadeOut('slow', function () { - $h.cleanZoomCache($preview.find('#zoom-' + id)); - self.fileManager.remove($frame); - self._clearObjects($frame); - $frame.remove(); - if (id && hasError) { - self.$errorContainer.find('li[data-thumb-id="' + id + '"]').fadeOut('fast', function () { - $(this).remove(); - if (!self._errorsExist()) { - self._resetErrors(); - } - }); - } - self._clearFileInput(); - var chk = self.previewCache.count(true), len = self.fileManager.count(), - file, hasThumb = self.showPreview && self.getFrames().length; - if (len === 0 && chk === 0 && !hasThumb) { - self.reset(); - } else { - n = chk + len; - if (n > 1) { - cap = self._getMsgSelected(n); - } else { - file = self.fileManager.getFirstFile(); - cap = file ? file.nameFmt : '_'; - } - self._setCaption(cap); - } - self._raise('fileremoved', [id, ind]); - }); - }); - }); - self.getFrames(' .kv-file-upload').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - var $frame = $el.closest($h.FRAMES), id = $frame.attr('data-fileid'); - self.$progress.hide(); - if ($frame.hasClass('file-preview-error') && !self.retryErrorUploads) { - return; - } - self._uploadSingle(self.fileManager.getIndex(id), id, false); - }); - }); - }, - _initPreviewActions: function () { - var self = this, $preview = self.$preview, deleteExtraData = self.deleteExtraData || {}, - btnRemove = $h.FRAMES + ' .kv-file-remove', settings = self.fileActionSettings, - origClass = settings.removeClass, errClass = settings.removeErrorClass, - resetProgress = function () { - var hasFiles = self.isAjaxUpload ? self.previewCache.count(true) : self._inputFileCount(); - if (!self.getFrames().length && !hasFiles) { - self._setCaption(''); - self.reset(); - self.initialCaption = ''; - } - }; - self._initZoomButton(); - $preview.find(btnRemove).each(function () { - var $el = $(this), vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'), errMsg, fnBefore, - fnSuccess, fnError, op = self.ajaxOperations.deleteThumb; - if ($h.isEmpty(vUrl) || vKey === undefined) { - return; - } - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data, settings, params, config, - fileName, extraData, index = $frame.attr('data-fileindex'); - index = parseInt(index.replace('init_', '')); - 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; - fileName = config.filename || config.caption || ''; - if (typeof extraData === 'function') { - extraData = extraData(); - } - params = {id: $el.attr('id'), key: vKey, extra: extraData}; - fnBefore = function (jqXHR) { - self.ajaxAborted = false; - self._raise('filepredelete', [vKey, jqXHR, extraData]); - if (self._abort()) { - jqXHR.abort(); - } else { - $el.removeClass(errClass); - $h.addCss($frame, 'file-uploading'); - $h.addCss($el, 'disabled ' + origClass); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var n, cap; - if (!$h.isEmpty(data) && !$h.isEmpty(data.error)) { - params.jqXHR = jqXHR; - params.response = data; - errMsg = self._parseError(op, jqXHR, self.msgDeleteError, fileName); - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - return; - } - $frame.removeClass('file-uploading').addClass('file-deleted'); - $frame.fadeOut('slow', function () { - index = parseInt(($frame.attr('data-fileindex')).replace('init_', '')); - self.previewCache.unset(index); - self._deleteFileIndex($frame); - n = self.previewCache.count(true); - cap = n > 0 ? self._getMsgSelected(n) : ''; - self._setCaption(cap); - self._raise('filedeleted', [vKey, jqXHR, extraData]); - $h.cleanZoomCache($preview.find('#zoom-' + $frame.attr('id'))); - self._clearObjects($frame); - $frame.remove(); - resetProgress(); - }); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var errMsg = self._parseError(op, jqXHR, errorThrown, fileName); - params.jqXHR = jqXHR; - params.response = {}; - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - }; - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore, 'delete'); - self._mergeAjaxCallback('success', fnSuccess, 'delete'); - self._mergeAjaxCallback('error', fnError, 'delete'); - settings = $.extend(true, {}, { - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: $.extend(true, {}, {key: vKey}, extraData) - }, self._ajaxDeleteSettings); - self._handler($el, 'click', function () { - if (!self._validateMinCount()) { - return false; - } - self.ajaxAborted = false; - self._raise('filebeforedelete', [vKey, extraData]); - //noinspection JSUnresolvedVariable,JSHint - if (self.ajaxAborted instanceof Promise) { - self.ajaxAborted.then(function (result) { - if (!result) { - $.ajax(settings); - } - }); - } else { - if (!self.ajaxAborted) { - $.ajax(settings); - } - } - }); - }); - }, - _hideFileIcon: function () { - var self = this; - if (self.overwriteInitial) { - self.$captionContainer.removeClass('icon-visible'); - } - }, - _showFileIcon: function () { - var self = this; - $h.addCss(self.$captionContainer, 'icon-visible'); - }, - _getSize: function (bytes, sizes) { - var self = this, size = parseFloat(bytes), i, func = self.fileSizeGetter, out; - if (!$.isNumeric(bytes) || !$.isNumeric(size)) { - return ''; - } - if (typeof func === 'function') { - out = func(size); - } else { - if (size === 0) { - out = '0.00 B'; - } else { - i = Math.floor(Math.log(size) / Math.log(1024)); - if (!sizes) { - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - } - out = (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]; - } - } - 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, - fileId, - isError, - size, - frameClass, - foot, - ind, - templ, - attrs, - zoomData - ) { - var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '', - screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - config, newCat = self.preferIconicPreview ? 'other' : cat, title = caption, alt = caption, - footer = foot || self._renderFileFooter(cat, caption, size, 'auto', isError), - hasIconSetting = self._getPreviewIcon(fname), typeCss = 'type-default', - forcePrevIcon = hasIconSetting && self.preferIconicPreview, - forceZoomIcon = hasIconSetting && self.preferIconicZoomPreview, getContent; - config = screenW < 400 ? (self.previewSettingsSmall[newCat] || self.defaults.previewSettingsSmall[newCat]) : - (self.previewSettings[newCat] || self.defaults.previewSettings[newCat]); - if (config) { - $.each(config, function (key, val) { - styleAttribs += key + ':' + val + ';'; - }); - } - getContent = function (c, d, zoom, frameCss) { - var id = zoom ? 'zoom-' + previewId : previewId, tmplt = self._getPreviewTemplate(c), - css = (frameClass || '') + ' ' + frameCss; - if (self.frameClass) { - css = self.frameClass + ' ' + css; - } - if (zoom) { - css = css.replace(' ' + $h.SORT_CSS, ''); - } - tmplt = self._parseFilePreviewIcon(tmplt, fname); - if (c === 'text') { - d = $h.htmlEncode(d); - } - if (cat === 'object' && !ftype) { - $.each(self.defaults.fileTypeSettings, function (key, func) { - if (key === 'object' || key === 'other') { - return; - } - if (func(fname, ftype)) { - typeCss = 'type-' + key; - } - }); - } - if (!$h.isEmpty(attrs)) { - if (attrs.title !== undefined && attrs.title !== null) { - title = attrs.title; - } - if (attrs.alt !== undefined && attrs.alt !== null) { - title = attrs.alt; - } - } - return tmplt.setTokens({ - 'previewId': id, - 'caption': caption, - 'title': title, - 'alt': alt, - 'frameClass': css, - 'type': self._getFileType(ftype), - 'fileindex': ind, - 'fileid': fileId || '', - 'typeCss': typeCss, - 'footer': footer, - 'data': d, - 'template': templ || cat, - 'style': styleAttribs ? 'style="' + styleAttribs + '"' : '' - }); - }; - ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1); - if (self.fileActionSettings.showZoom) { - zoomContent = getContent((forceZoomIcon ? 'other' : cat), zoomData ? zoomData : data, true, - 'kv-zoom-thumb'); - } - zoomContent = '\n' + self._getLayoutTemplate('zoomCache').replace('{zoomContent}', zoomContent); - if (typeof self.sanitizeZoomCache === 'function') { - zoomContent = self.sanitizeZoomCache(zoomContent); - } - prevContent = getContent((forcePrevIcon ? 'other' : cat), data, false, 'kv-preview-thumb'); - return prevContent + zoomContent; - }, - _addToPreview: function ($preview, content) { - var self = this; - return self.reversePreviewOrder ? $preview.prepend(content) : $preview.append(content); - }, - _previewDefault: function (file, previewId, isDisabled) { - var self = this, $preview = self.$preview; - if (!self.showPreview) { - return; - } - var fname = $h.getFileName(file), ftype = file ? file.type : '', content, size = file.size || 0, - caption = self._getFileName(file, ''), isError = isDisabled === true && !self.isAjaxUpload, - data = $h.createObjectURL(file), fileId = self.fileManager.getId(file); - self._clearDefaultPreview(); - content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, fileId, isError, size); - self._addToPreview($preview, content); - self._setThumbAttr(previewId, caption, size); - if (isDisabled === true && self.isAjaxUpload) { - self._setThumbStatus($('#' + previewId), 'Error'); - } - }, - canPreview: function (file) { - var self = this; - if (!file || !self.showPreview || !self.$preview || !self.$preview.length) { - return false; - } - var name = file.name || '', type = file.type || '', size = (file.size || 0) / 1000, - cat = self._parseFileType(type, name), allowedTypes, allowedMimes, allowedExts, skipPreview, - types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes, - exts = self.allowedPreviewExtensions || [], dTypes = self.disabledPreviewTypes, - dMimes = self.disabledPreviewMimeTypes, dExts = self.disabledPreviewExtensions || [], - maxSize = self.maxFilePreviewSize && parseFloat(self.maxFilePreviewSize) || 0, - expAllExt = new RegExp('\\.(' + exts.join('|') + ')$', 'i'), - expDisExt = new RegExp('\\.(' + dExts.join('|') + ')$', 'i'); - allowedTypes = !types || types.indexOf(cat) !== -1; - allowedMimes = !mimes || mimes.indexOf(type) !== -1; - allowedExts = !exts.length || $h.compare(name, expAllExt); - skipPreview = (dTypes && dTypes.indexOf(cat) !== -1) || (dMimes && dMimes.indexOf(type) !== -1) || - (dExts.length && $h.compare(name, expDisExt)) || (maxSize && !isNaN(maxSize) && size > maxSize); - return !skipPreview && (allowedTypes || allowedMimes || allowedExts); - }, - _previewFile: function (i, file, theFile, previewId, data, fileInfo) { - if (!this.showPreview) { - return; - } - var self = this, fname = $h.getFileName(file), ftype = fileInfo.type, caption = fileInfo.name, - cat = self._parseFileType(ftype, fname), content, $preview = self.$preview, fsize = file.size || 0, - iData = (cat === 'text' || cat === 'html' || cat === 'image') ? theFile.target.result : data, - fileId = self.fileManager.getId(file); - /** @namespace window.DOMPurify */ - if (cat === 'html' && self.purifyHtml && window.DOMPurify) { - iData = window.DOMPurify.sanitize(iData); - } - content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, fileId, false, fsize); - self._clearDefaultPreview(); - self._addToPreview($preview, content); - var $thumb = $preview.find('#' + previewId), $img = $thumb.find('img'), id = $thumb.attr('data-fileid'); - self._validateImageOrientation($img, file, previewId, id, caption, ftype, fsize, iData); - self._setThumbAttr(previewId, caption, fsize); - self._initSortable(); - }, - _setThumbAttr: function (id, caption, size) { - var self = this, $frame = $('#' + id); - if ($frame.length) { - size = size && size > 0 ? self._getSize(size) : ''; - $frame.data({'caption': caption, 'size': size}); - } - }, - _setInitThumbAttr: function () { - var self = this, data = self.previewCache.data, len = self.previewCache.count(true), config, - caption, size, previewId; - if (len === 0) { - return; - } - for (var i = 0; i < len; i++) { - config = data.config[i]; - previewId = self.previewInitId + '-' + 'init_' + i; - caption = $h.ifSet('caption', config, $h.ifSet('filename', config)); - size = $h.ifSet('size', config); - self._setThumbAttr(previewId, caption, size); - } - }, - _slugDefault: function (text) { - // noinspection RegExpRedundantEscape - return $h.isEmpty(text) ? '' : String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_'); - }, - _updateFileDetails: function (numFiles) { - var self = this, $el = self.$element, label, n, log, nFiles, file, - name = ($h.isIE(9) && $h.findFileName($el.val())) || ($el[0].files[0] && $el[0].files[0].name); - if (!name && self.fileManager.count() > 0) { - file = self.fileManager.getFirstFile(); - label = file.nameFmt; - } else { - label = name ? self.slug(name) : '_'; - } - n = self.isAjaxUpload ? self.fileManager.count() : numFiles; - nFiles = self.previewCache.count(true) + n; - log = n === 1 ? label : self._getMsgSelected(nFiles); - if (self.isError) { - self.$previewContainer.removeClass('file-thumb-loading'); - self.$previewStatus.html(''); - self.$captionContainer.removeClass('icon-visible'); - } else { - self._showFileIcon(); - } - self._setCaption(log, self.isError); - self.$container.removeClass('file-input-new file-input-ajax-new'); - if (arguments.length === 1) { - self._raise('fileselect', [numFiles, label]); - } - if (self.previewCache.count(true)) { - self._initPreviewActions(); - } - }, - _setThumbStatus: function ($thumb, status) { - var self = this; - if (!self.showPreview) { - return; - } - var icon = 'indicator' + status, msg = icon + 'Title', - css = 'file-preview-' + status.toLowerCase(), - $indicator = $thumb.find('.file-upload-indicator'), - config = self.fileActionSettings; - $thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading'); - if (status === 'Success') { - $thumb.find('.file-drag-handle').remove(); - } - $indicator.html(config[icon]); - $indicator.attr('title', config[msg]); - $thumb.addClass(css); - if (status === 'Error' && !self.retryErrorUploads) { - $thumb.find('.kv-file-upload').attr('disabled', true); - } - }, - _setProgressCancelled: function () { - var self = this; - self._setProgress(101, self.$progress, self.msgCancelled); - }, - _setProgress: function (p, $el, error, stats) { - var self = this; - $el = $el || self.$progress; - if (!$el.length) { - return; - } - var pct = Math.min(p, 100), out, pctLimit = self.progressUploadThreshold, - t = p <= 100 ? self.progressTemplate : self.progressCompleteTemplate, - template = pct < 100 ? self.progressTemplate : - (error ? (self.paused ? self.progressPauseTemplate : self.progressErrorTemplate) : t); - if (p >= 100) { - stats = ''; - } - if (!$h.isEmpty(template)) { - if (pctLimit && pct > pctLimit && p <= 100) { - out = template.setTokens({'percent': pctLimit, 'status': self.msgUploadThreshold}); - } else { - out = template.setTokens({'percent': pct, 'status': (p > 100 ? self.msgUploadEnd : pct + '%')}); - } - stats = stats || ''; - out = out.setTokens({stats: stats}); - $el.html(out); - if (error) { - $el.find('[role="progressbar"]').html(error); - } - } - }, - _setFileDropZoneTitle: function () { - var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles; - if (self.isClickable) { - strFiles = $h.isEmpty(self.$element.attr('multiple')) ? self.fileSingle : self.filePlural; - title += self.dropZoneClickTitle.replace('{files}', strFiles); - } - $zone.find('.' + self.dropZoneTitleClass).remove(); - if (!self.showPreview || $zone.length === 0 || self.fileManager.count() > 0 || !self.dropZoneEnabled || - (!self.isAjaxUpload && self.$element.files)) { - return; - } - if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) { - $zone.prepend('
    ' + title + '
    '); - } - self.$container.removeClass('file-input-new'); - $h.addCss(self.$container, 'file-input-ajax-new'); - }, - _getStats: function (stats) { - var self = this, pendingTime, t; - if (!self.showUploadStats || !stats || !stats.bitrate) { - return ''; - } - t = self._getLayoutTemplate('stats'); - pendingTime = (!stats.elapsed || !stats.bps) ? self.msgCalculatingTime : - self.msgPendingTime.setTokens({time: $h.getElapsed(Math.ceil(stats.pendingBytes / stats.bps))}); - - return t.setTokens({ - uploadSpeed: stats.bitrate, - pendingTime: pendingTime - }); - }, - _setResumableProgress: function (pct, stats, $thumb) { - var self = this, rm = self.resumableManager, obj = $thumb ? rm : self, - $prog = $thumb ? $thumb.find('.file-thumb-progress') : null; - if (obj.lastProgress === 0) { - obj.lastProgress = pct; - } - if (pct < obj.lastProgress) { - pct = obj.lastProgress; - } - self._setProgress(pct, $prog, null, self._getStats(stats)); - obj.lastProgress = pct; - }, - _setFileUploadStats: function (id, pct, total, stats) { - var self = this, $prog = self.$progress; - if (!self.showPreview && (!$prog || !$prog.length)) { - return; - } - var fm = self.fileManager, $thumb = fm.getThumb(id), pctTot, rm = self.resumableManager, - totUpSize = 0, totSize = fm.getTotalSize(), totStats = $.extend(true, {}, stats); - if (self.enableResumableUpload) { - var loaded = stats.loaded, currUplSize = rm.getUploadedSize(), currTotSize = rm.file.size, totLoaded; - loaded += currUplSize; - totLoaded = fm.uploadedSize + loaded; - pct = $h.round(100 * loaded / currTotSize); - stats.pendingBytes = currTotSize - currUplSize; - self._setResumableProgress(pct, stats, $thumb); - pctTot = Math.floor(100 * totLoaded / totSize); - totStats.pendingBytes = totSize - totLoaded; - self._setResumableProgress(pctTot, totStats); - } else { - fm.setProgress(id, pct); - $prog = $thumb && $thumb.length ? $thumb.find('.file-thumb-progress') : null; - self._setProgress(pct, $prog, null, self._getStats(stats)); - $.each(fm.stats, function (id, cfg) { - totUpSize += cfg.loaded; - }); - totStats.pendingBytes = totSize - totUpSize; - pctTot = $h.round(totUpSize / totSize * 100); - self._setProgress(pctTot, null, null, self._getStats(totStats)); - } - }, - _validateMinCount: function () { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - if (self.validateInitialCount && self.minFileCount > 0 && self._getFileCount(len - 1) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - _getFileCount: function (fileCount) { - var self = this, addCount = 0; - if (self.validateInitialCount && !self.overwriteInitial) { - addCount = self.previewCache.count(true); - fileCount += addCount; - } - return fileCount; - }, - _getFileId: function (file) { - return $h.getFileId(file, this.generateFileId); - }, - _getFileName: function (file, defaultValue) { - var self = this, fileName = $h.getFileName(file); - return fileName ? self.slug(fileName) : defaultValue; - }, - _getFileNames: function (skipNull) { - var self = this; - return self.filenames.filter(function (n) { - return (skipNull ? n !== undefined : n !== undefined && n !== null); - }); - }, - _setPreviewError: function ($thumb, keepFile) { - var self = this, removeFrame = self.removeFromPreviewOnError && !self.retryErrorUploads; - if (!keepFile || removeFrame) { - self.fileManager.remove($thumb); - } - if (!self.showPreview) { - return; - } - if (removeFrame) { - $thumb.remove(); - return; - } else { - self._setThumbStatus($thumb, 'Error'); - } - self._refreshUploadButton($thumb); - }, - _refreshUploadButton: function ($thumb) { - var self = this, $btn = $thumb.find('.kv-file-upload'), cfg = self.fileActionSettings, - icon = cfg.uploadIcon, title = cfg.uploadTitle; - if (!$btn.length) { - return; - } - if (self.retryErrorUploads) { - icon = cfg.uploadRetryIcon; - title = cfg.uploadRetryTitle; - } - $btn.attr('title', title).html(icon); - }, - _checkDimensions: function (i, chk, $img, $thumb, fname, type, params) { - var self = this, msg, dim, tag = chk === 'Small' ? 'min' : 'max', limit = self[tag + 'Image' + type], - $imgEl, isValid; - if ($h.isEmpty(limit) || !$img.length) { - return; - } - $imgEl = $img[0]; - dim = (type === 'Width') ? $imgEl.naturalWidth || $imgEl.width : $imgEl.naturalHeight || $imgEl.height; - isValid = chk === 'Small' ? dim >= limit : dim <= limit; - if (isValid) { - return; - } - msg = self['msgImage' + type + chk].setTokens({'name': fname, 'size': limit}); - self._showFileError(msg, params); - self._setPreviewError($thumb); - }, - _getExifObj: function (data) { - var self = this, exifObj = null, error = $h.logMessages.exifWarning; - if (data.slice(0, 23) !== 'data:image/jpeg;base64,' && data.slice(0, 22) !== 'data:image/jpg;base64,') { - exifObj = null; - return; - } - try { - exifObj = window.piexif ? window.piexif.load(data) : null; - } catch (err) { - exifObj = null; - error = err && err.message || ''; - } - if (!exifObj) { - self._log($h.logMessages.badExifParser, {details: error}); - } - return exifObj; - }, - setImageOrientation: function ($img, $zoomImg, value, $thumb) { - var self = this, invalidImg = !$img || !$img.length, invalidZoomImg = !$zoomImg || !$zoomImg.length, $mark, - isHidden = false, $div, zoomOnly = invalidImg && $thumb && $thumb.attr('data-template') === 'image', ev; - if (invalidImg && invalidZoomImg) { - return; - } - ev = 'load.fileinputimageorient'; - if (zoomOnly) { - $img = $zoomImg; - $zoomImg = null; - $img.css(self.previewSettings.image); - $div = $(document.createElement('div')).appendTo($thumb.find('.kv-file-content')); - $mark = $(document.createElement('span')).insertBefore($img); - $img.css('visibility', 'hidden').removeClass('file-zoom-detail').appendTo($div); - } else { - isHidden = !$img.is(':visible'); - } - $img.off(ev).on(ev, function () { - if (isHidden) { - self.$preview.removeClass('hide-content'); - $thumb.find('.kv-file-content').css('visibility', 'hidden'); - } - var img = $img.get(0), zoomImg = $zoomImg && $zoomImg.length ? $zoomImg.get(0) : null, - h = img.offsetHeight, w = img.offsetWidth, r = $h.getRotation(value); - if (isHidden) { - $thumb.find('.kv-file-content').css('visibility', 'visible'); - self.$preview.addClass('hide-content'); - } - $img.data('orientation', value); - if (zoomImg) { - $zoomImg.data('orientation', value); - } - if (value < 5) { - $h.setTransform(img, r); - $h.setTransform(zoomImg, r); - return; - } - var offsetAngle = Math.atan(w / h), origFactor = Math.sqrt(Math.pow(h, 2) + Math.pow(w, 2)), - scale = !origFactor ? 1 : (h / Math.cos(Math.PI / 2 + offsetAngle)) / origFactor, - s = ' scale(' + Math.abs(scale) + ')'; - $h.setTransform(img, r + s); - $h.setTransform(zoomImg, r + s); - if (zoomOnly) { - $img.css('visibility', 'visible').insertAfter($mark).addClass('file-zoom-detail'); - $mark.remove(); - $div.remove(); - } - }); - }, - _validateImageOrientation: function ($img, file, previewId, fileId, caption, ftype, fsize, iData) { - var self = this, exifObj, value, autoOrientImage = self.autoOrientImage; - exifObj = autoOrientImage ? self._getExifObj(iData) : null; - value = exifObj ? exifObj['0th'][piexif.ImageIFD.Orientation] : null; // jshint ignore:line - if (!value) { - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - return; - } - self.setImageOrientation($img, $('#zoom-' + previewId + ' img'), value, $('#' + previewId)); - self._raise('fileimageoriented', {'$img': $img, 'file': file}); - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - }, - _validateImage: function (previewId, fileId, fname, ftype, fsize, iData, exifObj) { - var self = this, $preview = self.$preview, params, w1, w2, $thumb = $preview.find('#' + previewId), - i = $thumb.attr('data-fileindex'), $img = $thumb.find('img'); - fname = fname || 'Untitled'; - $img.one('load', function () { - w1 = $thumb.width(); - w2 = $preview.width(); - if (w1 > w2) { - $img.css('width', '100%'); - } - params = {ind: i, id: previewId, fileId: fileId}; - self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Width', params); - self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Height', params); - if (!self.resizeImage) { - self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Width', params); - self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Height', params); - } - self._raise('fileimageloaded', [previewId]); - self.fileManager.addImage(fileId, { - ind: i, - img: $img, - thumb: $thumb, - pid: previewId, - typ: ftype, - siz: fsize, - validated: false, - imgData: iData, - exifObj: exifObj - }); - $thumb.data('exif', exifObj); - self._validateAllImages(); - }).one('error', function () { - self._raise('fileimageloaderror', [previewId]); - }).each(function () { - if (this.complete) { - $(this).trigger('load'); - } else { - if (this.error) { - $(this).trigger('error'); - } - } - }); - }, - _validateAllImages: function () { - var self = this, counter = {val: 0}, numImgs = self.fileManager.getImageCount(), fsize, - minSize = self.resizeIfSizeMoreThan; - if (numImgs !== self.fileManager.totalImages) { - return; - } - self._raise('fileimagesloaded'); - if (!self.resizeImage) { - return; - } - $.each(self.fileManager.loadedImages, function (id, config) { - if (!config.validated) { - fsize = config.siz; - if (fsize && fsize > minSize * 1000) { - self._getResizedImage(id, config, counter, numImgs); - } - config.validated = true; - } - }); - }, - _getResizedImage: function (id, config, counter, numImgs) { - var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight, blob, - ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height, - isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas, dataURI, - context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind, - $thumb = config.thumb, throwError, msg, exifObj = config.exifObj, exifStr, file, params, evParams; - throwError = function (msg, params, ev) { - if (self.isAjaxUpload) { - self._showFileError(msg, params, ev); - } else { - self._showError(msg, params, ev); - } - self._setPreviewError($thumb); - }; - file = self.fileManager.getFile(id); - params = {id: pid, 'index': ind, fileId: id}; - evParams = [id, pid, ind]; - if (!file || !isValidImage || (width <= maxWidth && height <= maxHeight)) { - if (isValidImage && file) { - self._raise('fileimageresized', evParams); - } - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized'); - } - if (!isValidImage) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - return; - } - } - type = type || self.resizeDefaultImageType; - chkWidth = width > maxWidth; - chkHeight = height > maxHeight; - if (self.resizePreference === 'width') { - ratio = chkWidth ? maxWidth / width : (chkHeight ? maxHeight / height : 1); - } else { - ratio = chkHeight ? maxHeight / height : (chkWidth ? maxWidth / width : 1); - } - self._resetCanvas(); - width *= ratio; - height *= ratio; - canvas.width = width; - canvas.height = height; - try { - context.drawImage(img, 0, 0, width, height); - dataURI = canvas.toDataURL(type, self.resizeQuality); - if (exifObj) { - exifStr = window.piexif.dump(exifObj); - dataURI = window.piexif.insert(exifStr, dataURI); - } - blob = $h.dataURI2Blob(dataURI); - self.fileManager.setFile(id, blob); - self._raise('fileimageresized', evParams); - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - if (!(blob instanceof Blob)) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - } - } - catch (err) { - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - msg = self.msgImageResizeException.replace('{errors}', err.message); - throwError(msg, params, 'fileimageresizeexception'); - } - }, - _initBrowse: function ($container) { - var self = this, $el = self.$element; - if (self.showBrowse) { - self.$btnFile = $container.find('.btn-file').append($el); - } else { - $el.appendTo($container).attr('tabindex', -1); - $h.addCss($el, 'file-no-browse'); - } - }, - _initClickable: function () { - var self = this, $zone, $tmpZone; - if (!self.isClickable) { - return; - } - $zone = self.$dropZone; - if (!self.isAjaxUpload) { - $tmpZone = self.$preview.find('.file-default-preview'); - if ($tmpZone.length) { - $zone = $tmpZone; - } - } - - $h.addCss($zone, 'clickable'); - $zone.attr('tabindex', -1); - self._handler($zone, 'click', function (e) { - var $tar = $(e.target); - if (!$(self.elErrorContainer + ':visible').length && - (!$tar.parents('.file-preview-thumbnails').length || $tar.parents( - '.file-default-preview').length)) { - self.$element.data('zoneClicked', true).trigger('click'); - $zone.blur(); - } - }); - }, - _initCaption: function () { - var self = this, cap = self.initialCaption || ''; - if (self.overwriteInitial || $h.isEmpty(cap)) { - self.$caption.val(''); - return false; - } - self._setCaption(cap); - return true; - }, - _setCaption: function (content, isError) { - var self = this, title, out, icon, n, cap, file; - if (!self.$caption.length) { - return; - } - self.$captionContainer.removeClass('icon-visible'); - if (isError) { - title = $('
    ' + self.msgValidationError + '
    ').text(); - n = self.fileManager.count(); - if (n) { - file = self.fileManager.getFirstFile(); - cap = n === 1 && file ? file.nameFmt : self._getMsgSelected(n); - } else { - cap = self._getMsgSelected(self.msgNo); - } - out = $h.isEmpty(content) ? cap : content; - icon = '' + self.msgValidationErrorIcon + ''; - } else { - if ($h.isEmpty(content)) { - return; - } - title = $('
    ' + content + '
    ').text(); - out = title; - icon = self._getLayoutTemplate('fileIcon'); - } - self.$captionContainer.addClass('icon-visible'); - self.$caption.attr('title', title).val(out); - self.$captionIcon.html(icon); - }, - _createContainer: function () { - var self = this, attribs = {'class': 'file-input file-input-new' + (self.rtl ? ' kv-rtl' : '')}, - $container = $(document.createElement('div')).attr(attribs).html(self._renderMain()); - $container.insertBefore(self.$element); - self._initBrowse($container); - if (self.theme) { - $container.addClass('theme-' + self.theme); - } - return $container; - }, - _refreshContainer: function () { - var self = this, $container = self.$container, $el = self.$element; - $el.insertAfter($container); - $container.html(self._renderMain()); - self._initBrowse($container); - self._validateDisabled(); - }, - _validateDisabled: function () { - var self = this; - self.$caption.attr({readonly: self.isDisabled}); - }, - _renderMain: function () { - var self = this, - dropCss = self.dropZoneEnabled ? ' file-drop-zone' : 'file-drop-disabled', - close = !self.showClose ? '' : self._getLayoutTemplate('close'), - preview = !self.showPreview ? '' : self._getLayoutTemplate('preview') - .setTokens({'class': self.previewClass, 'dropClass': dropCss}), - css = self.isDisabled ? self.captionClass + ' file-caption-disabled' : self.captionClass, - caption = self.captionTemplate.setTokens({'class': css + ' kv-fileinput-caption'}); - return self.mainTemplate.setTokens({ - 'class': self.mainClass + (!self.showBrowse && self.showCaption ? ' no-browse' : ''), - 'preview': preview, - 'close': close, - 'caption': caption, - 'upload': self._renderButton('upload'), - 'remove': self._renderButton('remove'), - 'cancel': self._renderButton('cancel'), - 'pause': self._renderButton('pause'), - 'browse': self._renderButton('browse') - }); - - }, - _renderButton: function (type) { - var self = this, tmplt = self._getLayoutTemplate('btnDefault'), css = self[type + 'Class'], - title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'], - status = self.isDisabled ? ' disabled' : '', btnType = 'button'; - switch (type) { - case 'remove': - if (!self.showRemove) { - return ''; - } - break; - case 'cancel': - if (!self.showCancel) { - return ''; - } - css += ' kv-hidden'; - break; - case 'pause': - if (!self.showPause) { - return ''; - } - css += ' kv-hidden'; - break; - case 'upload': - if (!self.showUpload) { - return ''; - } - if (self.isAjaxUpload && !self.isDisabled) { - tmplt = self._getLayoutTemplate('btnLink').replace('{href}', self.uploadUrl); - } else { - btnType = 'submit'; - } - break; - case 'browse': - if (!self.showBrowse) { - return ''; - } - tmplt = self._getLayoutTemplate('btnBrowse'); - break; - default: - return ''; - } - - css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button'; - if (!$h.isEmpty(label)) { - label = ' ' + label + ''; - } - return tmplt.setTokens({ - 'type': btnType, 'css': css, 'title': title, 'status': status, 'icon': icon, 'label': label - }); - }, - _renderThumbProgress: function () { - var self = this; - return '
    ' + - self.progressInfoTemplate.setTokens({percent: 101, status: self.msgUploadBegin, stats: ''}) + - '
    '; - }, - _renderFileFooter: function (cat, caption, size, width, isError) { - var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag, - upl = config.showUpload, zoom = config.showZoom, out, params, - template = self._getLayoutTemplate('footer'), tInd = self._getLayoutTemplate('indicator'), - ind = isError ? config.indicatorError : config.indicatorNew, - title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle, - indicator = tInd.setTokens({'indicator': ind, 'indicatorTitle': title}); - size = self._getSize(size); - params = {type: cat, caption: caption, size: size, width: width, progress: '', indicator: indicator}; - if (self.isAjaxUpload) { - params.progress = self._renderThumbProgress(); - params.actions = self._renderFileActions(params, upl, false, rem, zoom, drg, false, false, false); - } else { - params.actions = self._renderFileActions(params, false, false, false, zoom, drg, false, false, false); - } - out = template.setTokens(params); - out = $h.replaceTags(out, self.previewThumbTags); - return out; - }, - _renderFileActions: function ( - cfg, - showUpl, - showDwn, - showDel, - showZoom, - showDrag, - disabled, - url, - key, - isInit, - dUrl, - dFile - ) { - var self = this; - if (!cfg.type && isInit) { - cfg.type = 'image'; - } - if (self.enableResumableUpload) { - showUpl = false; - } else { - if (typeof showUpl === 'function') { - showUpl = showUpl(cfg); - } - } - if (typeof showDwn === 'function') { - showDwn = showDwn(cfg); - } - if (typeof showDel === 'function') { - showDel = showDel(cfg); - } - if (typeof showZoom === 'function') { - showZoom = showZoom(cfg); - } - if (typeof showDrag === 'function') { - showDrag = showDrag(cfg); - } - if (!showUpl && !showDwn && !showDel && !showZoom && !showDrag) { - return ''; - } - var vUrl = url === false ? '' : ' data-url="' + url + '"', btnZoom = '', btnDrag = '', css, - vKey = key === false ? '' : ' data-key="' + key + '"', btnDelete = '', btnUpload = '', btnDownload = '', - template = self._getLayoutTemplate('actions'), config = self.fileActionSettings, - otherButtons = self.otherActionButtons.setTokens({'dataKey': vKey, 'key': key}), - removeClass = disabled ? config.removeClass + ' disabled' : config.removeClass; - if (showDel) { - btnDelete = self._getLayoutTemplate('actionDelete').setTokens({ - 'removeClass': removeClass, - 'removeIcon': config.removeIcon, - 'removeTitle': config.removeTitle, - 'dataUrl': vUrl, - 'dataKey': vKey, - 'key': key - }); - } - if (showUpl) { - btnUpload = self._getLayoutTemplate('actionUpload').setTokens({ - 'uploadClass': config.uploadClass, - 'uploadIcon': config.uploadIcon, - 'uploadTitle': config.uploadTitle - }); - } - if (showDwn) { - btnDownload = self._getLayoutTemplate('actionDownload').setTokens({ - 'downloadClass': config.downloadClass, - 'downloadIcon': config.downloadIcon, - 'downloadTitle': config.downloadTitle, - 'downloadUrl': dUrl || self.initialPreviewDownloadUrl - }); - btnDownload = btnDownload.setTokens({'filename': dFile, 'key': key}); - } - if (showZoom) { - btnZoom = self._getLayoutTemplate('actionZoom').setTokens({ - 'zoomClass': config.zoomClass, - 'zoomIcon': config.zoomIcon, - 'zoomTitle': config.zoomTitle - }); - } - if (showDrag && isInit) { - css = 'drag-handle-init ' + config.dragClass; - btnDrag = self._getLayoutTemplate('actionDrag').setTokens({ - 'dragClass': css, - 'dragTitle': config.dragTitle, - 'dragIcon': config.dragIcon - }); - } - return template.setTokens({ - 'delete': btnDelete, - 'upload': btnUpload, - 'download': btnDownload, - 'zoom': btnZoom, - 'drag': btnDrag, - 'other': otherButtons - }); - }, - _browse: function (e) { - var self = this; - if (e && e.isDefaultPrevented() || !self._raise('filebrowse')) { - return; - } - if (self.isError && !self.isAjaxUpload) { - self.clear(); - } - self.$captionContainer.focus(); - }, - _change: function (e) { - var self = this; - if (self.changeTriggered) { - return; - } - var $el = self.$element, isDragDrop = arguments.length > 1, isAjaxUpload = self.isAjaxUpload, - tfiles, files = isDragDrop ? arguments[1] : $el.get(0).files, total, - maxCount = !isAjaxUpload && $h.isEmpty($el.attr('multiple')) ? 1 : self.maxFileCount, - len, ctr = self.fileManager.count(), isSingleUpload = $h.isEmpty($el.attr('multiple')), - flagSingle = (isSingleUpload && ctr > 0), - throwError = function (mesg, file, previewId, index) { - var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), {id: previewId, index: index}), - p2 = {id: previewId, index: index, file: file, files: files}; - return isAjaxUpload ? self._showFileError(mesg, p1) : self._showError(mesg, p2); - }, - maxCountCheck = function (n, m) { - var msg = self.msgFilesTooMany.replace('{m}', m).replace('{n}', n); - self.isError = throwError(msg, null, null, null); - self.$captionContainer.removeClass('icon-visible'); - self._setCaption('', true); - self.$container.removeClass('file-input-new file-input-ajax-new'); - }; - self.reader = null; - self._resetUpload(); - self._hideFileIcon(); - if (self.dropZoneEnabled) { - self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove(); - } - if (!isAjaxUpload) { - if (e.target && e.target.files === undefined) { - files = e.target.value ? [{name: e.target.value.replace(/^.+\\/, '')}] : []; - } else { - files = e.target.files || {}; - } - } - tfiles = files; - if ($h.isEmpty(tfiles) || tfiles.length === 0) { - if (!isAjaxUpload) { - self.clear(); - } - self._raise('fileselectnone'); - return; - } - self._resetErrors(); - len = tfiles.length; - total = self._getFileCount(isAjaxUpload ? (self.fileManager.count() + len) : len); - if (maxCount > 0 && total > maxCount) { - if (!self.autoReplace || len > maxCount) { - maxCountCheck((self.autoReplace && len > maxCount ? len : total), maxCount); - return; - } - if (total > maxCount) { - self._resetPreviewThumbs(isAjaxUpload); - } - } else { - if (!isAjaxUpload || flagSingle) { - self._resetPreviewThumbs(false); - if (flagSingle) { - self.clearFileStack(); - } - } else { - if (isAjaxUpload && ctr === 0 && (!self.previewCache.count(true) || self.overwriteInitial)) { - self._resetPreviewThumbs(true); - } - } - } - self.readFiles(tfiles); - }, - _abort: function (params) { - var self = this, data; - if (self.ajaxAborted && typeof self.ajaxAborted === 'object' && self.ajaxAborted.message !== undefined) { - data = $.extend(true, {}, self._getOutData(null), params); - data.abortData = self.ajaxAborted.data || {}; - data.abortMessage = self.ajaxAborted.message; - self._setProgress(101, self.$progress, self.msgCancelled); - self._showFileError(self.ajaxAborted.message, data, 'filecustomerror'); - self.cancel(); - return true; - } - return !!self.ajaxAborted; - }, - _resetFileStack: function () { - var self = this, i = 0; - self._getThumbs().each(function () { - var $thumb = $(this), ind = $thumb.attr('data-fileindex'), pid = $thumb.attr('id'); - if (ind === '-1' || ind === -1) { - return; - } - if (!self.fileManager.getFile($thumb.attr('data-fileid'))) { - $thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i}); - i++; - } else { - $thumb.attr({'id': 'uploaded-' + $h.uniqId(), 'data-fileindex': '-1'}); - } - self.$preview.find('#zoom-' + pid).attr({ - 'id': 'zoom-' + $thumb.attr('id'), - 'data-fileindex': $thumb.attr('data-fileindex') - }); - }); - }, - _isFileSelectionValid: function (cnt) { - var self = this; - cnt = cnt || 0; - if (self.required && !self.getFilesCount()) { - self.$errorContainer.html(''); - self._showFileError(self.msgFileRequired); - return false; - } - if (self.minFileCount > 0 && self._getFileCount(cnt) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - clearFileStack: function () { - var self = this; - self.fileManager.clear(); - self._initResumableUpload(); - if (self.enableResumableUpload) { - if (self.showPause === null) { - self.showPause = true; - } - if (self.showCancel === null) { - self.showCancel = false; - } - } else { - self.showPause = false; - if (self.showCancel === null) { - self.showCancel = true; - } - } - return self.$element; - }, - getFileStack: function () { - return this.fileManager.stack; - }, - getFileList: function () { - return this.fileManager.list(); - }, - getFilesCount: function () { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - return self._getFileCount(len); - }, - readFiles: function (files) { - this.reader = new FileReader(); - var self = this, $el = self.$element, reader = self.reader, - $container = self.$previewContainer, $status = self.$previewStatus, msgLoading = self.msgLoading, - msgProgress = self.msgProgress, previewInitId = self.previewInitId, numFiles = files.length, - settings = self.fileTypeSettings, ctr = self.fileManager.count(), readFile, - fileTypes = self.allowedFileTypes, typLen = fileTypes ? fileTypes.length : 0, - fileExt = self.allowedFileExtensions, strExt = $h.isEmpty(fileExt) ? '' : fileExt.join(', '), - throwError = function (msg, file, previewId, index, fileId) { - var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), - {id: previewId, index: index, fileId: fileId}), $thumb = $('#' + previewId), - p2 = {id: previewId, index: index, fileId: fileId, file: file, files: files}; - self._previewDefault(file, previewId, true); - if (self.isAjaxUpload) { - setTimeout(function () { - readFile(index + 1); - }, self.processDelay); - } else { - numFiles = 0; - } - self._initFileActions(); - $thumb.remove(); - self.isError = self.isAjaxUpload ? self._showFileError(msg, p1) : self._showError(msg, p2); - self._updateFileDetails(numFiles); - }; - self.fileManager.clearImages(); - $.each(files, function (key, file) { - var func = self.fileTypeSettings.image; - if (func && func(file.type)) { - self.fileManager.totalImages++; - } - }); - readFile = function (i) { - if ($h.isEmpty($el.attr('multiple'))) { - numFiles = 1; - } - if (i >= numFiles) { - if (self.isAjaxUpload && self.fileManager.count() > 0) { - self._raise('filebatchselected', [self.fileManager.stack]); - } else { - self._raise('filebatchselected', [files]); - } - $container.removeClass('file-thumb-loading'); - $status.html(''); - return; - } - var node = ctr + i, previewId = previewInitId + '-' + node, file = files[i], fSizeKB, j, msg, $thumb, - fnText = settings.text, fnImage = settings.image, fnHtml = settings.html, typ, chk, typ1, typ2, - caption = self._getFileName(file, ''), fileSize = (file && file.size || 0) / 1000, - fileExtExpr = '', previewData = $h.createObjectURL(file), fileCount = 0, - strTypes = '', fileId, - func, knownTypes = 0, isText, isHtml, isImage, txtFlag, processFileLoaded = function () { - var msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': 50, - 'name': caption - }); - setTimeout(function () { - $status.html(msg); - self._updateFileDetails(numFiles); - readFile(i + 1); - }, self.processDelay); - self._raise('fileloaded', [file, previewId, i, reader]); - }; - if (!file) { - return; - } - fileId = self.fileManager.getId(file); - if (typLen > 0) { - for (j = 0; j < typLen; j++) { - typ1 = fileTypes[j]; - typ2 = self.msgFileTypes[typ1] || typ1; - strTypes += j === 0 ? typ2 : ', ' + typ2; - } - } - if (caption === false) { - readFile(i + 1); - return; - } - if (caption.length === 0) { - msg = self.msgInvalidFileName.replace('{name}', $h.htmlEncode($h.getFileName(file), '[unknown]')); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileExt)) { - fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i'); - } - fSizeKB = fileSize.toFixed(2); - if (self.maxFileSize > 0 && fileSize > self.maxFileSize) { - msg = self.msgSizeTooLarge.setTokens({ - 'name': caption, - 'size': fSizeKB, - 'maxSize': self.maxFileSize - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (self.minFileSize !== null && fileSize <= $h.getNum(self.minFileSize)) { - msg = self.msgSizeTooSmall.setTokens({ - 'name': caption, - 'size': fSizeKB, - 'minSize': self.minFileSize - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileTypes) && $h.isArray(fileTypes)) { - for (j = 0; j < fileTypes.length; j += 1) { - typ = fileTypes[j]; - func = settings[typ]; - fileCount += !func || (typeof func !== 'function') ? 0 : (func(file.type, - $h.getFileName(file)) ? 1 : 0); - } - if (fileCount === 0) { - msg = self.msgInvalidFileType.setTokens({name: caption, types: strTypes}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (fileCount === 0 && !$h.isEmpty(fileExt) && $h.isArray(fileExt) && !$h.isEmpty(fileExtExpr)) { - chk = $h.compare(caption, fileExtExpr); - fileCount += $h.isEmpty(chk) ? 0 : chk.length; - if (fileCount === 0) { - msg = self.msgInvalidFileExtension.setTokens({name: caption, extensions: strExt}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (self.isAjaxUpload && self.fileManager.exists(fileId)) { - msg = self.msgDuplicateFile.setTokens({name: caption, size: fSizeKB}); - throwError(msg, file, previewId, i, fileId); - $thumb = $('#' + previewId); - if ($thumb && $thumb.length) { - $thumb.remove(); - } - return; - } - if (!self.canPreview(file)) { - if (self.isAjaxUpload) { - self.fileManager.add(file); - } - if (self.showPreview) { - $container.addClass('file-thumb-loading'); - self._previewDefault(file, previewId); - self._initFileActions(); - } - setTimeout(function () { - self._updateFileDetails(numFiles); - readFile(i + 1); - self._raise('fileloaded', [file, previewId, i]); - }, 10); - return; - } - isText = fnText(file.type, caption); - isHtml = fnHtml(file.type, caption); - isImage = fnImage(file.type, caption); - $status.html(msgLoading.replace('{index}', i + 1).replace('{files}', numFiles)); - $container.addClass('file-thumb-loading'); - reader.onerror = function (evt) { - self._errorHandler(evt, caption); - }; - reader.onload = function (theFile) { - var hex, fileInfo, uint, byte, bytes = [], contents, mime, readTextImage = function (textFlag) { - var newReader = new FileReader(); - newReader.onerror = function (theFileNew) { - self._errorHandler(theFileNew, caption); - }; - newReader.onload = function (theFileNew) { - self._previewFile(i, file, theFileNew, previewId, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - if (textFlag) { - newReader.readAsText(file, self.textEncoding); - } else { - newReader.readAsDataURL(file); - } - }; - fileInfo = {'name': caption, 'type': file.type}; - $.each(settings, function (k, f) { - if (k !== 'object' && k !== 'other' && typeof f === 'function' && f(file.type, caption)) { - knownTypes++; - } - }); - if (knownTypes === 0) {// auto detect mime types from content if no known file types detected - uint = new Uint8Array(theFile.target.result); - for (j = 0; j < uint.length; j++) { - byte = uint[j].toString(16); - bytes.push(byte); - } - hex = bytes.join('').toLowerCase().substring(0, 8); - mime = $h.getMimeType(hex, '', ''); - if ($h.isEmpty(mime)) { // look for ascii text content - contents = $h.arrayBuffer2String(reader.result); - mime = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type); - } - fileInfo = {'name': caption, 'type': mime}; - isText = fnText(mime, ''); - isHtml = fnHtml(mime, ''); - isImage = fnImage(mime, ''); - txtFlag = isText || isHtml; - if (txtFlag || isImage) { - readTextImage(txtFlag); - return; - } - } - self._previewFile(i, file, theFile, previewId, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - reader.onprogress = function (data) { - if (data.lengthComputable) { - var fact = (data.loaded / data.total) * 100, progress = Math.ceil(fact); - msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': progress, - 'name': caption - }); - setTimeout(function () { - $status.html(msg); - }, self.processDelay); - } - }; - - if (isText || isHtml) { - reader.readAsText(file, self.textEncoding); - } else { - if (isImage) { - reader.readAsDataURL(file); - } else { - reader.readAsArrayBuffer(file); - } - } - self.fileManager.add(file); - }; - - readFile(0); - self._updateFileDetails(numFiles, false); - }, - lock: function () { - var self = this, $container = self.$container; - self._resetErrors(); - self.disable(); - $container.addClass('is-locked'); - if (self.showCancel) { - $container.find('.fileinput-cancel').show(); - } - if (self.showPause) { - $container.find('.fileinput-pause').show(); - } - self._raise('filelock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - unlock: function (reset) { - var self = this, $container = self.$container; - if (reset === undefined) { - reset = true; - } - self.enable(); - $container.removeClass('is-locked'); - if (self.showCancel) { - $container.find('.fileinput-cancel').hide(); - } - if (self.showPause) { - $container.find('.fileinput-pause').hide(); - } - if (reset) { - self._resetFileStack(); - } - self._raise('fileunlock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - resume: function () { - var self = this, flag = false, $pr = self.$progress, rm = self.resumableManager; - if (!self.enableResumableUpload) { - return self.$element; - } - if (self.paused) { - $pr.html(self.progressPauseTemplate.setTokens({ - percent: 101, - status: self.msgUploadResume, - stats: '' - })); - } else { - flag = true; - } - self.paused = false; - if (flag) { - $pr.html(self.progressInfoTemplate.setTokens({ - percent: 101, - status: self.msgUploadBegin, - stats: '' - })); - } - setTimeout(function () { - rm.upload(); - }, self.processDelay); - return self.$element; - }, - pause: function () { - var self = this, rm = self.resumableManager, xhr = self.ajaxRequests, len = xhr.length, i, - pct = rm.getProgress(), actions = self.fileActionSettings; - if (!self.enableResumableUpload) { - return self.$element; - } - if (rm.chunkIntervalId) { - clearInterval(rm.chunkIntervalId); - } - if (self.ajaxQueueIntervalId) { - clearInterval(self.ajaxQueueIntervalId); - } - self._raise('fileuploadpaused', [self.fileManager, rm]); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.paused = true; - xhr[i].abort(); - } - } - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), fileId = $thumb.attr('data-fileid'), t = self._getLayoutTemplate('stats'), - stats, $indicator = $thumb.find('.file-upload-indicator'); - $thumb.removeClass('file-uploading'); - if ($indicator.attr('title') === actions.indicatorLoadingTitle) { - self._setThumbStatus($thumb, 'Paused'); - stats = t.setTokens({pendingTime: self.msgPaused, uploadSpeed: ''}); - self.paused = true; - self._setProgress(pct, $thumb.find('.file-thumb-progress'), pct + '%', stats); - } - if (!self.fileManager.getFile(fileId)) { - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - }); - } - self._setProgress(101, self.$progress, self.msgPaused); - return self.$element; - }, - cancel: function () { - var self = this, xhr = self.ajaxRequests, rm = self.resumableManager, len = xhr.length, i; - if (self.enableResumableUpload && rm.chunkIntervalId) { - clearInterval(rm.chunkIntervalId); - rm.reset(); - self._raise('fileuploadcancelled', [self.fileManager, rm]); - } else { - self._raise('fileuploadcancelled', [self.fileManager]); - } - if (self.ajaxQueueIntervalId) { - clearInterval(self.ajaxQueueIntervalId); - } - self._initAjax(); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.cancelling = true; - xhr[i].abort(); - } - } - self._getThumbs().each(function () { - var $thumb = $(this), fileId = $thumb.attr('data-fileid'), $prog = $thumb.find('.file-thumb-progress'); - $thumb.removeClass('file-uploading'); - self._setProgress(0, $prog); - $prog.hide(); - if (!self.fileManager.getFile(fileId)) { - $thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - self.unlock(); - }); - setTimeout(function () { - self._setProgressCancelled(); - }, self.processDelay); - return self.$element; - }, - clear: function () { - var self = this, cap; - if (!self._raise('fileclear')) { - return; - } - self.$btnUpload.removeAttr('disabled'); - self._getThumbs().find('video,audio,img').each(function () { - $h.cleanMemory($(this)); - }); - self._clearFileInput(); - self._resetUpload(); - self.clearFileStack(); - self._resetErrors(true); - if (self._hasInitialPreview()) { - self._showFileIcon(); - self._resetPreview(); - self._initPreviewActions(); - self.$container.removeClass('file-input-new'); - } else { - self._getThumbs().each(function () { - self._clearObjects($(this)); - }); - if (self.isAjaxUpload) { - self.previewCache.data = {}; - } - self.$preview.html(''); - cap = (!self.overwriteInitial && self.initialCaption.length > 0) ? self.initialCaption : ''; - self.$caption.attr('title', '').val(cap); - $h.addCss(self.$container, 'file-input-new'); - self._validateDefaultPreview(); - } - if (self.$container.find($h.FRAMES).length === 0) { - if (!self._initCaption()) { - self.$captionContainer.removeClass('icon-visible'); - } - } - self._hideFileIcon(); - self.$captionContainer.focus(); - self._setFileDropZoneTitle(); - self._raise('filecleared'); - return self.$element; - }, - reset: function () { - var self = this; - if (!self._raise('filereset')) { - return; - } - self.lastProgress = 0; - self._resetPreview(); - self.$container.find('.fileinput-filename').text(''); - $h.addCss(self.$container, 'file-input-new'); - if (self.getFrames().length || self.dropZoneEnabled) { - self.$container.removeClass('file-input-new'); - } - self.clearFileStack(); - self._setFileDropZoneTitle(); - return self.$element; - }, - disable: function () { - var self = this; - self.isDisabled = true; - self._raise('filedisabled'); - self.$element.attr('disabled', 'disabled'); - self.$container.find('.kv-fileinput-caption').addClass('file-caption-disabled'); - self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .attr('disabled', true); - $h.addCss(self.$container.find('.btn-file'), 'disabled'); - self._initDragDrop(); - return self.$element; - }, - enable: function () { - var self = this; - self.isDisabled = false; - self._raise('fileenabled'); - self.$element.removeAttr('disabled'); - self.$container.find('.kv-fileinput-caption').removeClass('file-caption-disabled'); - self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .removeAttr('disabled'); - self.$container.find('.btn-file').removeClass('disabled'); - self._initDragDrop(); - return self.$element; - }, - upload: function () { - var self = this, fm = self.fileManager, totLen = fm.count(), i, outData, len, - hasExtraData = !$.isEmptyObject(self._getExtraData()); - if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) { - return; - } - self.lastProgress = 0; - self._resetUpload(); - if (totLen === 0 && !hasExtraData) { - self._showFileError(self.msgUploadEmpty); - return; - } - self.cancelling = false; - self.$progress.show(); - self.lock(); - len = fm.count(); - if (totLen === 0 && hasExtraData) { - self._setProgress(2); - self._uploadExtraOnly(); - return; - } - if (self.enableResumableUpload) { - return self.resume(); - } - if (self.uploadAsync || self.enableResumableUpload) { - outData = self._getOutData(null); - self._raise('filebatchpreupload', [outData]); - self.fileBatchCompleted = false; - self.uploadCache = {content: [], config: [], tags: [], append: true}; - for (i = 0; i < len; i++) { - self.uploadCache.content[i] = null; - self.uploadCache.config[i] = null; - self.uploadCache.tags[i] = null; - } - self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS); - self._initSortable(); - self.cacheInitialPreview = self.getPreview(); - } - self._setProgress(2); - self.hasInitData = false; - if (self.uploadAsync) { - i = 0; - $.each(fm.stack, function (id) { - self._uploadSingle(i, id, true); - i++; - }); - return; - } - self._uploadBatch(); - return self.$element; - }, - destroy: function () { - var self = this, $form = self.$form, $cont = self.$container, $el = self.$element, ns = self.namespace; - $(document).off(ns); - $(window).off(ns); - if ($form && $form.length) { - $form.off(ns); - } - if (self.isAjaxUpload) { - self._clearFileInput(); - } - self._cleanup(); - self._initPreviewCache(); - $el.insertBefore($cont).off(ns).removeData(); - $cont.off().remove(); - return $el; - }, - refresh: function (options) { - var self = this, $el = self.$element; - if (typeof options !== 'object' || $h.isEmpty(options)) { - options = self.options; - } else { - options = $.extend(true, {}, self.options, options); - } - self._init(options, true); - self._listen(); - return $el; - }, - zoom: function (frameId) { - var self = this, $frame = self._getFrame(frameId), $modal = self.$modal; - if (!$frame) { - return; - } - $h.initModal($modal); - $modal.html(self._getModalContent()); - self._setZoomContent($frame); - $modal.modal('show'); - self._initZoomButtons(); - }, - getExif: function (frameId) { - var self = this, $frame = self._getFrame(frameId); - return $frame && $frame.data('exif') || null; - }, - getFrames: function (cssFilter) { - var self = this, $frames; - cssFilter = cssFilter || ''; - $frames = self.$preview.find($h.FRAMES + cssFilter); - if (self.reversePreviewOrder) { - $frames = $($frames.get().reverse()); - } - return $frames; - }, - getPreview: function () { - var self = this; - return { - content: self.initialPreview, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - } - }; - - $.fn.fileinput = function (option) { - if (!$h.hasFileAPISupport() && !$h.isIE(9)) { - return; - } - var args = Array.apply(null, arguments), retvals = []; - args.shift(); - this.each(function () { - var self = $(this), data = self.data('fileinput'), options = typeof option === 'object' && option, - theme = options.theme || self.data('theme'), l = {}, t = {}, - lang = options.language || self.data('language') || $.fn.fileinput.defaults.language || 'en', opt; - if (!data) { - if (theme) { - t = $.fn.fileinputThemes[theme] || {}; - } - if (lang !== 'en' && !$h.isEmpty($.fn.fileinputLocales[lang])) { - l = $.fn.fileinputLocales[lang] || {}; - } - opt = $.extend(true, {}, $.fn.fileinput.defaults, t, $.fn.fileinputLocales.zh, l, options, self.data()); - data = new FileInput(this, opt); - self.data('fileinput', data); - } - - if (typeof option === 'string') { - retvals.push(data[option].apply(data, args)); - } - }); - switch (retvals.length) { - case 0: - return this; - case 1: - return retvals[0]; - default: - return retvals; - } - }; - - //noinspection HtmlUnknownAttribute - $.fn.fileinput.defaults = { - language: 'en', - showCaption: true, - showBrowse: true, - showPreview: true, - showRemove: true, - showUpload: true, - showUploadStats: true, - showCancel: null, - showPause: null, - showClose: true, - showUploadedThumbs: true, - browseOnZoneClick: false, - autoReplace: false, - autoOrientImage: function () { // applicable for JPEG images only and non ios safari - var ua = window.navigator.userAgent, webkit = !!ua.match(/WebKit/i), - iOS = !!ua.match(/iP(od|ad|hone)/i), iOSSafari = iOS && webkit && !ua.match(/CriOS/i); - return !iOSSafari; - }, - autoOrientImageInitial: true, - required: false, - rtl: false, - hideThumbnailContent: false, - encodeUrl: true, - generateFileId: null, - previewClass: '', - captionClass: '', - frameClass: 'krajee-default', - mainClass: 'file-caption-main', - mainTemplate: null, - purifyHtml: true, - fileSizeGetter: null, - initialCaption: '', - initialPreview: [], - initialPreviewDelimiter: '*$$*', - initialPreviewAsData: false, - initialPreviewFileType: 'image', - initialPreviewConfig: [], - initialPreviewThumbTags: [], - previewThumbTags: {}, - initialPreviewShowDelete: true, - initialPreviewDownloadUrl: '', - removeFromPreviewOnError: false, - deleteUrl: '', - deleteExtraData: {}, - overwriteInitial: true, - sanitizeZoomCache: function (content) { - var $container = $(document.createElement('div')).append(content); - $container.find('input,select,.file-thumbnail-footer').remove(); - return $container.html(); - }, - previewZoomButtonIcons: { - prev: '', - next: '', - toggleheader: '', - fullscreen: '', - borderless: '', - close: '' - }, - previewZoomButtonClasses: { - prev: 'btn btn-navigate', - next: 'btn btn-navigate', - toggleheader: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - fullscreen: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - borderless: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - close: 'btn btn-sm btn-kv btn-default btn-outline-secondary' - }, - previewTemplates: {}, - previewContentTemplates: {}, - preferIconicPreview: false, - preferIconicZoomPreview: false, - allowedFileTypes: null, - allowedFileExtensions: null, - allowedPreviewTypes: undefined, - allowedPreviewMimeTypes: null, - allowedPreviewExtensions: null, - disabledPreviewTypes: undefined, - disabledPreviewExtensions: ['msi', 'exe', 'com', 'zip', 'rar', 'app', 'vb', 'scr'], - disabledPreviewMimeTypes: null, - defaultPreviewContent: null, - customLayoutTags: {}, - customPreviewTags: {}, - previewFileIcon: '', - previewFileIconClass: 'file-other-icon', - previewFileIconSettings: {}, - previewFileExtSettings: {}, - buttonLabelClass: 'hidden-xs', - browseIcon: ' ', - browseClass: 'btn btn-primary', - removeIcon: '', - removeClass: 'btn btn-default btn-secondary', - cancelIcon: '', - cancelClass: 'btn btn-default btn-secondary', - pauseIcon: '', - pauseClass: 'btn btn-default btn-secondary', - uploadIcon: '', - uploadClass: 'btn btn-default btn-secondary', - uploadUrl: null, - uploadUrlThumb: null, - uploadAsync: true, - uploadParamNames: { - chunkCount: 'chunkCount', - chunkIndex: 'chunkIndex', - chunkSize: 'chunkSize', - chunkSizeStart: 'chunkSizeStart', - chunksUploaded: 'chunksUploaded', - fileBlob: 'fileBlob', - fileId: 'fileId', - fileName: 'fileName', - fileRelativePath: 'fileRelativePath', - fileSize: 'fileSize', - retryCount: 'retryCount' - }, - maxAjaxThreads: 5, - processDelay: 100, - queueDelay: 10, // must be lesser than process delay - progressDelay: 0, // must be lesser than process delay - enableResumableUpload: false, - resumableUploadOptions: { - fallback: null, - testUrl: null, // used for checking status of chunks/ files previously / partially uploaded - chunkSize: 2 * 1024, // in KB - maxThreads: 4, - maxRetries: 3, - showErrorLog: true - }, - uploadExtraData: {}, - zoomModalHeight: 480, - minImageWidth: null, - minImageHeight: null, - maxImageWidth: null, - maxImageHeight: null, - resizeImage: false, - resizePreference: 'width', - resizeQuality: 0.92, - resizeDefaultImageType: 'image/jpeg', - resizeIfSizeMoreThan: 0, // in KB - minFileSize: 0, - maxFileSize: 0, - maxFilePreviewSize: 25600, // 25 MB - minFileCount: 0, - maxFileCount: 0, - validateInitialCount: false, - msgValidationErrorClass: 'text-danger', - msgValidationErrorIcon: ' ', - msgErrorClass: 'file-error-message', - progressThumbClass: 'progress-bar progress-bar-striped active', - progressClass: 'progress-bar bg-success progress-bar-success progress-bar-striped active', - progressInfoClass: 'progress-bar bg-info progress-bar-info progress-bar-striped active', - progressCompleteClass: 'progress-bar bg-success progress-bar-success', - progressPauseClass: 'progress-bar bg-primary progress-bar-primary progress-bar-striped active', - progressErrorClass: 'progress-bar bg-danger progress-bar-danger', - progressUploadThreshold: 99, - previewFileType: 'image', - elCaptionContainer: null, - elCaptionText: null, - elPreviewContainer: null, - elPreviewImage: null, - elPreviewStatus: null, - elErrorContainer: null, - errorCloseButton: $h.closeButton('kv-error-close'), - slugCallback: null, - dropZoneEnabled: true, - dropZoneTitleClass: 'file-drop-zone-title', - fileActionSettings: {}, - otherActionButtons: '', - textEncoding: 'UTF-8', - ajaxSettings: {}, - ajaxDeleteSettings: {}, - showAjaxErrorDetails: true, - mergeAjaxCallbacks: false, - mergeAjaxDeleteCallbacks: false, - retryErrorUploads: true, - reversePreviewOrder: false, - usePdfRenderer: function () { - //noinspection JSUnresolvedVariable - var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; - return !!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i) || isIE11; - }, - pdfRendererUrl: '', - pdfRendererTemplate: '' - }; - - // noinspection HtmlUnknownAttribute - $.fn.fileinputLocales.en = { - fileSingle: 'file', - filePlural: 'files', - browseLabel: 'Browse …', - removeLabel: 'Remove', - removeTitle: 'Clear all unprocessed files', - cancelLabel: 'Cancel', - cancelTitle: 'Abort ongoing upload', - pauseLabel: 'Pause', - pauseTitle: 'Pause ongoing upload', - uploadLabel: 'Upload', - uploadTitle: 'Upload selected files', - msgNo: 'No', - msgNoFilesSelected: 'No files selected', - msgCancelled: 'Cancelled', - msgPaused: 'Paused', - msgPlaceholder: 'Select {files}...', - msgZoomModalHeading: 'Detailed Preview', - msgFileRequired: 'You must select a file to upload.', - msgSizeTooSmall: 'File "{name}" ({size} KB) is too small and must be larger than {minSize} KB.', - msgSizeTooLarge: 'File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB.', - msgFilesTooLess: 'You must select at least {n} {files} to upload.', - msgFilesTooMany: 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.', - msgFileNotFound: 'File "{name}" not found!', - msgFileSecured: 'Security restrictions prevent reading the file "{name}".', - msgFileNotReadable: 'File "{name}" is not readable.', - msgFilePreviewAborted: 'File preview aborted for "{name}".', - msgFilePreviewError: 'An error occurred while reading the file "{name}".', - msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', - msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', - msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', - 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', - msgUploadResume: 'Resuming upload...', - msgUploadEmpty: 'No valid data available for upload.', - msgUploadError: 'Upload Error', - msgDeleteError: 'Delete Error', - msgProgressError: 'Error', - msgValidationError: 'Validation Error', - msgLoading: 'Loading file {index} of {files} …', - msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.', - msgSelected: '{n} {files} selected', - msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.', - 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.
    {errors}
    ', - msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!', - msgAjaxProgressError: '{operation} failed', - msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', - msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', - msgPendingTime: '{time} remaining', - msgCalculatingTime: 'calculating time remaining', - ajaxOperations: { - deleteThumb: 'file delete', - uploadThumb: 'file upload', - uploadBatch: 'batch file upload', - uploadExtra: 'form data upload' - }, - dropZoneTitle: 'Drag & drop files here …', - dropZoneClickTitle: '
    (or click to select {files})', - previewZoomButtonTitles: { - prev: 'View previous file', - next: 'View next file', - toggleheader: 'Toggle header', - fullscreen: 'Toggle full screen', - borderless: 'Toggle borderless mode', - close: 'Close detailed preview' - } - }; - - $.fn.fileinputLocales.zh = { - fileSingle: '文件', - filePlural: '个文件', - browseLabel: '选择 …', - removeLabel: '移除', - removeTitle: '清除选中文件', - cancelLabel: '取消', - cancelTitle: '取消进行中的上传', - pauseLabel: 'Pause', - pauseTitle: 'Pause ongoing upload', - uploadLabel: '上传', - uploadTitle: '上传选中文件', - msgNo: '没有', - msgNoFilesSelected: '未选择文件', - msgPaused: 'Paused', - msgCancelled: '取消', - msgPlaceholder: '选择 {files}...', - msgZoomModalHeading: '详细预览', - msgFileRequired: '必须选择一个文件上传.', - msgSizeTooSmall: '文件 "{name}" ({size} KB) 必须大于限定大小 {minSize} KB.', - msgSizeTooLarge: '文件 "{name}" ({size} KB) 超过了允许大小 {maxSize} KB.', - msgFilesTooLess: '你必须选择最少 {n} {files} 来上传. ', - msgFilesTooMany: '选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.', - msgFileNotFound: '文件 "{name}" 未找到!', - msgFileSecured: '安全限制,为了防止读取文件 "{name}".', - msgFileNotReadable: '文件 "{name}" 不可读.', - msgFilePreviewAborted: '取消 "{name}" 的预览.', - msgFilePreviewError: '读取 "{name}" 时出现了一个错误.', - msgInvalidFileName: '文件名 "{name}" 包含非法字符.', - msgInvalidFileType: '不正确的类型 "{name}". 只支持 "{types}" 类型的文件.', - msgInvalidFileExtension: '不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.', - msgFileTypes: { - 'image': 'image', - 'html': 'HTML', - 'text': 'text', - 'video': 'video', - 'audio': 'audio', - 'flash': 'flash', - 'pdf': 'PDF', - 'object': 'object' - }, - msgUploadAborted: '该文件上传被中止', - msgUploadThreshold: '处理中...', - msgUploadBegin: '正在初始化...', - msgUploadEnd: '完成', - msgUploadResume: 'Resuming upload...', - msgUploadEmpty: '无效的文件上传.', - msgUploadError: 'Upload Error', - msgDeleteError: 'Delete Error', - msgProgressError: '上传出错', - msgValidationError: '验证错误', - msgLoading: '加载第 {index} 文件 共 {files} …', - msgProgress: '加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.', - msgSelected: '{n} {files} 选中', - msgFoldersNotAllowed: '只支持拖拽文件! 跳过 {n} 拖拽的文件夹.', - msgImageWidthSmall: '图像文件的"{name}"的宽度必须是至少{size}像素.', - msgImageHeightSmall: '图像文件的"{name}"的高度必须至少为{size}像素.', - msgImageWidthLarge: '图像文件"{name}"的宽度不能超过{size}像素.', - msgImageHeightLarge: '图像文件"{name}"的高度不能超过{size}像素.', - msgImageResizeError: '无法获取的图像尺寸调整。', - msgImageResizeException: '调整图像大小时发生错误。
    {errors}
    ', - msgAjaxError: '{operation} 发生错误. 请重试!', - msgAjaxProgressError: '{operation} 失败', - msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', - msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', - msgPendingTime: '{time} remaining', - msgCalculatingTime: 'calculating time remaining', - ajaxOperations: { - deleteThumb: '删除文件', - uploadThumb: '上传文件', - uploadBatch: '批量上传', - uploadExtra: '表单数据上传' - }, - dropZoneTitle: '拖拽文件到这里 …
    支持多文件同时上传', - dropZoneClickTitle: '
    (或点击{files}按钮选择文件)', - fileActionSettings: { - removeTitle: '删除文件', - uploadTitle: '上传文件', - downloadTitle: '下载文件', - uploadRetryTitle: '重试', - zoomTitle: '查看详情', - dragTitle: '移动 / 重置', - indicatorNewTitle: '没有上传', - indicatorSuccessTitle: '上传', - indicatorErrorTitle: '上传错误', - indicatorPausedTitle: 'Upload Paused', - indicatorLoadingTitle: '上传 ...' - }, - previewZoomButtonTitles: { - prev: '预览上一个文件', - next: '预览下一个文件', - toggleheader: '缩放', - fullscreen: '全屏', - borderless: '无边界模式', - close: '关闭当前预览' - } - }; - - $.fn.fileinput.Constructor = FileInput; - - /** - * Convert automatically file inputs with class 'file' into a bootstrap fileinput control. - */ - $(document).ready(function () { - var $input = $('input.file[type=file]'); - if ($input.length) { - $input.fileinput(); - } - }); +/*! + * bootstrap-fileinput v5.0.4 + * http://plugins.krajee.com/file-input + * + * Author: Kartik Visweswaran + * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com + * + * Licensed under the BSD-3-Clause + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md + */ +(function (factory) { + 'use strict'; + //noinspection JSUnresolvedVariable + if (typeof define === 'function' && define.amd) { // jshint ignore:line + // AMD. Register as an anonymous module. + define(['jquery'], factory); // jshint ignore:line + } else { // noinspection JSUnresolvedVariable + if (typeof module === 'object' && module.exports) { // jshint ignore:line + // Node/CommonJS + // noinspection JSUnresolvedVariable + module.exports = factory(require('jquery')); // jshint ignore:line + } else { + // Browser globals + factory(window.jQuery); + } + } +}(function ($) { + 'use strict'; + + $.fn.fileinputLocales = {}; + $.fn.fileinputThemes = {}; + + String.prototype.setTokens = function (replacePairs) { + var str = this.toString(), key, re; + for (key in replacePairs) { + if (replacePairs.hasOwnProperty(key)) { + re = new RegExp('\{' + key + '\}', 'g'); + str = str.replace(re, replacePairs[key]); + } + } + return str; + }; + + var $h, FileInput; + + // fileinput helper object for all global variables and internal helper methods + //noinspection JSUnresolvedVariable + $h = { + FRAMES: '.kv-preview-thumb', + SORT_CSS: 'file-sortable', + OBJECT_PARAMS: '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n', + DEFAULT_PREVIEW: '
    \n' + + '{previewFileIcon}\n' + + '
    ', + MODAL_ID: 'kvFileinputModal', + MODAL_EVENTS: ['show', 'shown', 'hide', 'hidden', 'loaded'], + logMessages: { + ajaxError: '{status}: {error}. Error Details: {text}.', + badDroppedFiles: 'Error scanning dropped files!', + badExifParser: 'Error loading the piexif.js library. {details}', + badInputType: 'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.', + exifWarning: 'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded ' + + 'the "piexif.js" library correctly on your page before the "fileinput.js" script.', + invalidChunkSize: 'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.', + invalidThumb: 'Invalid thumb frame with id: "{id}".', + noResumableSupport: 'The browser does not support resumable or chunk uploads.', + noUploadUrl: 'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.', + retryStatus: 'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.' + }, + objUrl: window.URL || window.webkitURL, + now: function () { + return new Date(); + }, + round: function (num) { + num = parseFloat(num); + return isNaN(num) ? 0 : Math.floor(Math.round(num)); + }, + getFileRelativePath: function (file) { + /** @namespace file.relativePath */ + /** @namespace file.webkitRelativePath */ + return String(file.relativePath || file.webkitRelativePath || $h.getFileName(file) || null); + + }, + getFileId: function (file, generateFileId) { + var relativePath = $h.getFileRelativePath(file); + if (typeof generateFileId === 'function') { + return generateFileId(file); + } + if (!file) { + return null; + } + if (!relativePath) { + return null; + } + return (file.size + '_' + relativePath.replace(/\s/img, '_')); + }, + getElapsed: function (seconds) { + var delta = seconds, out = '', result = {}, structure = { + year: 31536000, + month: 2592000, + week: 604800, // uncomment row to ignore + day: 86400, // feel free to add your own row + hour: 3600, + minute: 60, + second: 1 + }; + Object.keys(structure).forEach(function (key) { + result[key] = Math.floor(delta / structure[key]); + delta -= result[key] * structure[key]; + }); + $.each(result, function (key, value) { + if (value > 0) { + out += (out ? ' ' : '') + value + key.substring(0, 1); + } + }); + return out; + }, + debounce: function (func, delay) { + var inDebounce; + return function () { + var args = arguments, context = this; + clearTimeout(inDebounce); + inDebounce = setTimeout(function () { + func.apply(context, args); + }, delay); + }; + }, + stopEvent: function (e) { + e.stopPropagation(); + e.preventDefault(); + }, + getFileName: function (file) { + /** @namespace file.fileName */ + return file ? (file.fileName || file.name || '') : ''; // some confusion in different versions of Firefox + }, + createObjectURL: function (data) { + if ($h.objUrl && $h.objUrl.createObjectURL && data) { + return $h.objUrl.createObjectURL(data); + } + return ''; + }, + revokeObjectURL: function (data) { + if ($h.objUrl && $h.objUrl.revokeObjectURL && data) { + $h.objUrl.revokeObjectURL(data); + } + }, + compare: function (input, str, exact) { + return input !== undefined && (exact ? input === str : input.match(str)); + }, + isIE: function (ver) { + var div, status; + // check for IE versions < 11 + if (navigator.appName !== 'Microsoft Internet Explorer') { + return false; + } + if (ver === 10) { + return new RegExp('msie\\s' + ver, 'i').test(navigator.userAgent); + } + div = document.createElement('div'); + div.innerHTML = ''; + status = div.getElementsByTagName('i').length; + document.body.appendChild(div); + div.parentNode.removeChild(div); + return status; + }, + canAssignFilesToInput: function () { + var input = document.createElement('input'); + try { + input.type = 'file'; + input.files = null; + return true; + } catch (err) { + return false; + } + }, + getDragDropFolders: function (items) { + var i, item, len = items ? items.length : 0, folders = 0; + if (len > 0 && items[0].webkitGetAsEntry()) { + for (i = 0; i < len; i++) { + item = items[i].webkitGetAsEntry(); + if (item && item.isDirectory) { + folders++; + } + } + } + return folders; + }, + initModal: function ($modal) { + var $body = $('body'); + if ($body.length) { + $modal.appendTo($body); + } + }, + isEmpty: function (value, trim) { + return value === undefined || value === null || value.length === 0 || (trim && $.trim(value) === ''); + }, + isArray: function (a) { + return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]'; + }, + ifSet: function (needle, haystack, def) { + def = def || ''; + return (haystack && typeof haystack === 'object' && needle in haystack) ? haystack[needle] : def; + }, + cleanArray: function (arr) { + if (!(arr instanceof Array)) { + arr = []; + } + return arr.filter(function (e) { + return (e !== undefined && e !== null); + }); + }, + spliceArray: function (arr, index, reverseOrder) { + var i, j = 0, out = [], newArr; + if (!(arr instanceof Array)) { + return []; + } + newArr = $.extend(true, [], arr); + if (reverseOrder) { + newArr.reverse(); + } + for (i = 0; i < newArr.length; i++) { + if (i !== index) { + out[j] = newArr[i]; + j++; + } + } + if (reverseOrder) { + out.reverse(); + } + return out; + }, + getNum: function (num, def) { + def = def || 0; + if (typeof num === 'number') { + return num; + } + if (typeof num === 'string') { + num = parseFloat(num); + } + return isNaN(num) ? def : num; + }, + hasFileAPISupport: function () { + return !!(window.File && window.FileReader); + }, + hasDragDropSupport: function () { + var div = document.createElement('div'); + /** @namespace div.draggable */ + /** @namespace div.ondragstart */ + /** @namespace div.ondrop */ + return !$h.isIE(9) && + (div.draggable !== undefined || (div.ondragstart !== undefined && div.ondrop !== undefined)); + }, + hasFileUploadSupport: function () { + return $h.hasFileAPISupport() && window.FormData; + }, + hasBlobSupport: function () { + try { + return !!window.Blob && Boolean(new Blob()); + } catch (e) { + return false; + } + }, + hasArrayBufferViewSupport: function () { + try { + return new Blob([new Uint8Array(100)]).size === 100; + } catch (e) { + return false; + } + }, + hasResumableUploadSupport: function () { + /** @namespace Blob.prototype.webkitSlice */ + /** @namespace Blob.prototype.mozSlice */ + return $h.hasFileUploadSupport() && $h.hasBlobSupport() && $h.hasArrayBufferViewSupport() && + (!!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || !!Blob.prototype.slice || false); + }, + dataURI2Blob: function (dataURI) { + //noinspection JSUnresolvedVariable + var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || + window.MSBlobBuilder, canBlob = $h.hasBlobSupport(), byteStr, arrayBuffer, intArray, i, mimeStr, bb, + canProceed = (canBlob || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array; + if (!canProceed) { + return null; + } + if (dataURI.split(',')[0].indexOf('base64') >= 0) { + byteStr = atob(dataURI.split(',')[1]); + } else { + byteStr = decodeURIComponent(dataURI.split(',')[1]); + } + arrayBuffer = new ArrayBuffer(byteStr.length); + intArray = new Uint8Array(arrayBuffer); + for (i = 0; i < byteStr.length; i += 1) { + intArray[i] = byteStr.charCodeAt(i); + } + mimeStr = dataURI.split(',')[0].split(':')[1].split(';')[0]; + if (canBlob) { + return new Blob([$h.hasArrayBufferViewSupport() ? intArray : arrayBuffer], {type: mimeStr}); + } + bb = new BlobBuilder(); + bb.append(arrayBuffer); + return bb.getBlob(mimeStr); + }, + arrayBuffer2String: function (buffer) { + //noinspection JSUnresolvedVariable + if (window.TextDecoder) { + // noinspection JSUnresolvedFunction + return new TextDecoder('utf-8').decode(buffer); + } + var array = Array.prototype.slice.apply(new Uint8Array(buffer)), out = '', i = 0, len, c, char2, char3; + len = array.length; + while (i < len) { + c = array[i++]; + switch (c >> 4) { // jshint ignore:line + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + // 0xxxxxxx + out += String.fromCharCode(c); + break; + case 12: + case 13: + // 110x xxxx 10xx xxxx + char2 = array[i++]; + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); // jshint ignore:line + break; + case 14: + // 1110 xxxx 10xx xxxx 10xx xxxx + char2 = array[i++]; + char3 = array[i++]; + out += String.fromCharCode(((c & 0x0F) << 12) | // jshint ignore:line + ((char2 & 0x3F) << 6) | // jshint ignore:line + ((char3 & 0x3F) << 0)); // jshint ignore:line + break; + } + } + return out; + }, + isHtml: function (str) { + var a = document.createElement('div'); + a.innerHTML = str; + for (var c = a.childNodes, i = c.length; i--;) { + if (c[i].nodeType === 1) { + return true; + } + } + return false; + }, + isSvg: function (str) { + return str.match(/^\s*<\?xml/i) && (str.match(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + }, + replaceTags: function (str, tags) { + var out = str; + if (!tags) { + return out; + } + $.each(tags, function (key, value) { + if (typeof value === 'function') { + value = value(); + } + out = out.split(key).join(value); + }); + return out; + }, + cleanMemory: function ($thumb) { + var data = $thumb.is('img') ? $thumb.attr('src') : $thumb.find('source').attr('src'); + $h.revokeObjectURL(data); + }, + findFileName: function (filePath) { + var sepIndex = filePath.lastIndexOf('/'); + if (sepIndex === -1) { + sepIndex = filePath.lastIndexOf('\\'); + } + return filePath.split(filePath.substring(sepIndex, sepIndex + 1)).pop(); + }, + checkFullScreen: function () { + //noinspection JSUnresolvedVariable + return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || + document.msFullscreenElement; + }, + toggleFullScreen: function (maximize) { + var doc = document, de = doc.documentElement; + if (de && maximize && !$h.checkFullScreen()) { + /** @namespace document.requestFullscreen */ + /** @namespace document.msRequestFullscreen */ + /** @namespace document.mozRequestFullScreen */ + /** @namespace document.webkitRequestFullscreen */ + /** @namespace Element.ALLOW_KEYBOARD_INPUT */ + if (de.requestFullscreen) { + de.requestFullscreen(); + } else { + if (de.msRequestFullscreen) { + de.msRequestFullscreen(); + } else { + if (de.mozRequestFullScreen) { + de.mozRequestFullScreen(); + } else { + if (de.webkitRequestFullscreen) { + de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); + } + } + } + } + } else { + /** @namespace document.exitFullscreen */ + /** @namespace document.msExitFullscreen */ + /** @namespace document.mozCancelFullScreen */ + /** @namespace document.webkitExitFullscreen */ + if (doc.exitFullscreen) { + doc.exitFullscreen(); + } else { + if (doc.msExitFullscreen) { + doc.msExitFullscreen(); + } else { + if (doc.mozCancelFullScreen) { + doc.mozCancelFullScreen(); + } else { + if (doc.webkitExitFullscreen) { + doc.webkitExitFullscreen(); + } + } + } + } + } + }, + moveArray: function (arr, oldIndex, newIndex, reverseOrder) { + var newArr = $.extend(true, [], arr); + if (reverseOrder) { + newArr.reverse(); + } + if (newIndex >= newArr.length) { + var k = newIndex - newArr.length; + while ((k--) + 1) { + newArr.push(undefined); + } + } + newArr.splice(newIndex, 0, newArr.splice(oldIndex, 1)[0]); + if (reverseOrder) { + newArr.reverse(); + } + return newArr; + }, + cleanZoomCache: function ($el) { + var $cache = $el.closest('.kv-zoom-cache-theme'); + if (!$cache.length) { + $cache = $el.closest('.kv-zoom-cache'); + } + $cache.remove(); + }, + closeButton: function (css) { + css = css ? 'close ' + css : 'close'; + return ''; + }, + getRotation: function (value) { + switch (value) { + case 2: + return 'rotateY(180deg)'; + case 3: + return 'rotate(180deg)'; + case 4: + return 'rotate(180deg) rotateY(180deg)'; + case 5: + return 'rotate(270deg) rotateY(180deg)'; + case 6: + return 'rotate(90deg)'; + case 7: + return 'rotate(90deg) rotateY(180deg)'; + case 8: + return 'rotate(270deg)'; + default: + return ''; + } + }, + setTransform: function (el, val) { + if (!el) { + return; + } + el.style.transform = val; + el.style.webkitTransform = val; + el.style['-moz-transform'] = val; + el.style['-ms-transform'] = val; + el.style['-o-transform'] = val; + } + }; + FileInput = function (element, options) { + var self = this; + self.$element = $(element); + self.$parent = self.$element.parent(); + if (!self._validate()) { + return; + } + self.isPreviewable = $h.hasFileAPISupport(); + self.isIE9 = $h.isIE(9); + self.isIE10 = $h.isIE(10); + if (self.isPreviewable || self.isIE9) { + self._init(options); + self._listen(); + } + self.$element.removeClass('file-loading'); + }; + //noinspection JSUnusedGlobalSymbols + FileInput.prototype = { + constructor: FileInput, + _cleanup: function () { + var self = this; + self.reader = null; + self.clearFileStack(); + self.fileBatchCompleted = true; + self.isError = false; + self.cancelling = false; + self.paused = false; + self.lastProgress = 0; + self._initAjax(); + }, + _initAjax: function () { + var self = this; + self.ajaxQueue = []; + self.ajaxRequests = []; + self.ajaxQueueIntervalId = null; + self.ajaxCurrentThreads = 0; + self.ajaxAborted = false; + }, + _init: function (options, refreshMode) { + var self = this, f, $el = self.$element, $cont, t, tmp; + self.options = options; + $.each(options, function (key, value) { + switch (key) { + case 'minFileCount': + case 'maxFileCount': + case 'minFileSize': + case 'maxFileSize': + case 'maxFilePreviewSize': + case 'resizeImageQuality': + case 'resizeIfSizeMoreThan': + case 'progressUploadThreshold': + case 'initialPreviewCount': + case 'zoomModalHeight': + case 'minImageHeight': + case 'maxImageHeight': + case 'minImageWidth': + case 'maxImageWidth': + self[key] = $h.getNum(value); + break; + default: + self[key] = value; + break; + } + }); + if (self.rtl) { // swap buttons for rtl + tmp = self.previewZoomButtonIcons.prev; + self.previewZoomButtonIcons.prev = self.previewZoomButtonIcons.next; + self.previewZoomButtonIcons.next = tmp; + } + // validate chunk threads to not exceed maxAjaxThreads + if (!isNaN(self.maxAjaxThreads) && self.maxAjaxThreads < self.resumableUploadOptions.maxThreads) { + self.resumableUploadOptions.maxThreads = self.maxAjaxThreads; + } + self._initFileManager(); + if (typeof self.autoOrientImage === 'function') { + self.autoOrientImage = self.autoOrientImage(); + } + if (typeof self.autoOrientImageInitial === 'function') { + self.autoOrientImageInitial = self.autoOrientImageInitial(); + } + if (!refreshMode) { + self._cleanup(); + } + self.$form = $el.closest('form'); + self._initTemplateDefaults(); + self.uploadFileAttr = !$h.isEmpty($el.attr('name')) ? $el.attr('name') : 'file_data'; + t = self._getLayoutTemplate('progress'); + self.progressTemplate = t.replace('{class}', self.progressClass); + self.progressInfoTemplate = t.replace('{class}', self.progressInfoClass); + self.progressPauseTemplate = t.replace('{class}', self.progressPauseClass); + self.progressCompleteTemplate = t.replace('{class}', self.progressCompleteClass); + self.progressErrorTemplate = t.replace('{class}', self.progressErrorClass); + self.isDisabled = $el.attr('disabled') || $el.attr('readonly'); + if (self.isDisabled) { + $el.attr('disabled', true); + } + self.isClickable = self.browseOnZoneClick && self.showPreview && + (self.dropZoneEnabled || !$h.isEmpty(self.defaultPreviewContent)); + self.isAjaxUpload = $h.hasFileUploadSupport() && !$h.isEmpty(self.uploadUrl); + self.dropZoneEnabled = $h.hasDragDropSupport() && self.dropZoneEnabled; + if (!self.isAjaxUpload) { + self.dropZoneEnabled = self.dropZoneEnabled && $h.canAssignFilesToInput(); + } + self.slug = typeof options.slugCallback === 'function' ? options.slugCallback : self._slugDefault; + self.mainTemplate = self.showCaption ? self._getLayoutTemplate('main1') : self._getLayoutTemplate('main2'); + self.captionTemplate = self._getLayoutTemplate('caption'); + self.previewGenericTemplate = self._getPreviewTemplate('generic'); + if (!self.imageCanvas && self.resizeImage && (self.maxImageWidth || self.maxImageHeight)) { + self.imageCanvas = document.createElement('canvas'); + self.imageCanvasContext = self.imageCanvas.getContext('2d'); + } + if ($h.isEmpty($el.attr('id'))) { + $el.attr('id', $h.uniqId()); + } + self.namespace = '.fileinput_' + $el.attr('id').replace(/-/g, '_'); + if (self.$container === undefined) { + self.$container = self._createContainer(); + } else { + self._refreshContainer(); + } + $cont = self.$container; + self.$dropZone = $cont.find('.file-drop-zone'); + self.$progress = $cont.find('.kv-upload-progress'); + self.$btnUpload = $cont.find('.fileinput-upload'); + self.$captionContainer = $h.getElement(options, 'elCaptionContainer', $cont.find('.file-caption')); + self.$caption = $h.getElement(options, 'elCaptionText', $cont.find('.file-caption-name')); + if (!$h.isEmpty(self.msgPlaceholder)) { + f = $el.attr('multiple') ? self.filePlural : self.fileSingle; + self.$caption.attr('placeholder', self.msgPlaceholder.replace('{files}', f)); + } + self.$captionIcon = self.$captionContainer.find('.file-caption-icon'); + self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview')); + self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails')); + self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status')); + self.$errorContainer = $h.getElement(options, 'elErrorContainer', + self.$previewContainer.find('.kv-fileinput-error')); + self._validateDisabled(); + if (!$h.isEmpty(self.msgErrorClass)) { + $h.addCss(self.$errorContainer, self.msgErrorClass); + } + if (!refreshMode) { + self.$errorContainer.hide(); + self.previewInitId = 'preview-' + $h.uniqId(); + self._initPreviewCache(); + self._initPreview(true); + self._initPreviewActions(); + if (self.$parent.hasClass('file-loading')) { + self.$container.insertBefore(self.$parent); + self.$parent.remove(); + } + } else { + if (!self._errorsExist()) { + self.$errorContainer.hide(); + } + } + self._setFileDropZoneTitle(); + if ($el.attr('disabled')) { + self.disable(); + } + self._initZoom(); + if (self.hideThumbnailContent) { + $h.addCss(self.$preview, 'hide-content'); + } + }, + _initFileManager: function () { + var self = this; + self.fileManager = { + stack: {}, + processed: [], + errors: [], + loadedImages: {}, + totalImages: 0, + totalFiles: null, + totalSize: null, + uploadedSize: 0, + stats: {}, + initStats: function (id) { + var data = {started: $h.now().getTime()}; + if (id) { + self.fileManager.stats[id] = data; + } else { + self.fileManager.stats = data; + } + }, + getUploadStats: function (id, loaded, total) { + var fm = self.fileManager, started = id ? fm.stats[id] && fm.stats[id].started || null : null; + if (!started) { + started = $h.now().getTime(); + } + var elapsed = ($h.now().getTime() - started) / 1000, + speeds = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'], + bps = elapsed ? loaded / elapsed : 0, bitrate = self._getSize(bps, speeds), + pendingBytes = total - loaded, + out = { + fileId: id, + started: started, + elapsed: elapsed, + loaded: loaded, + total: total, + bps: bps, + bitrate: bitrate, + pendingBytes: pendingBytes + }; + if (id) { + fm.stats[id] = out; + } else { + fm.stats = out; + } + return out; + }, + exists: function (id) { + return $.inArray(id, self.fileManager.getIdList()) !== -1; + }, + count: function () { + return self.fileManager.getIdList().length; + }, + total: function () { + var fm = self.fileManager; + if (!fm.totalFiles) { + fm.totalFiles = fm.count(); + } + return fm.totalFiles; + }, + getTotalSize: function () { + var fm = self.fileManager; + if (fm.totalSize) { + return fm.totalSize; + } + fm.totalSize = 0; + $.each(self.fileManager.stack, function (id, f) { + var size = parseFloat(f.size); + fm.totalSize += isNaN(size) ? 0 : size; + }); + return fm.totalSize; + }, + add: function (file, id) { + if (!id) { + id = self.fileManager.getId(file); + } + if (!id) { + return; + } + self.fileManager.stack[id] = { + file: file, + name: $h.getFileName(file), + relativePath: $h.getFileRelativePath(file), + size: file.size, + nameFmt: self._getFileName(file, ''), + sizeFmt: self._getSize(file.size) + }; + }, + remove: function ($thumb) { + var id = $thumb.attr('data-fileid'); + if (id) { + self.fileManager.removeFile(id); + } + }, + removeFile: function (id) { + delete self.fileManager.stack[id]; + delete self.fileManager.loadedImages[id]; + }, + move: function (idFrom, idTo) { + var result = {}, stack = self.fileManager.stack; + if (!idFrom && !idTo || idFrom === idTo) { + return; + } + $.each(stack, function (k, v) { + if (k !== idFrom) { + result[k] = v; + } + if (k === idTo) { + result[idFrom] = stack[idFrom]; + } + }); + self.fileManager.stack = result; + }, + list: function () { + var files = []; + $.each(self.fileManager.stack, function (k, v) { + if (v && v.file) { + files.push(v.file); + } + }); + return files; + }, + isPending: function (id) { + return $.inArray(id, self.fileManager.processed) === -1 && self.fileManager.exists(id); + }, + isProcessed: function () { + var processed = true, fm = self.fileManager; + $.each(fm.stack, function (id) { + if (fm.isPending(id)) { + processed = false; + } + }); + return processed; + }, + clear: function () { + var fm = self.fileManager; + fm.totalFiles = null; + fm.totalSize = null; + fm.uploadedSize = 0; + fm.stack = {}; + fm.errors = []; + fm.processed = []; + fm.stats = {}; + fm.clearImages(); + }, + clearImages: function () { + self.fileManager.loadedImages = {}; + self.fileManager.totalImages = 0; + }, + addImage: function (id, config) { + self.fileManager.loadedImages[id] = config; + }, + removeImage: function (id) { + delete self.fileManager.loadedImages[id]; + }, + getImageIdList: function () { + return Object.keys(self.fileManager.loadedImages); + }, + getImageCount: function () { + return self.fileManager.getImageIdList().length; + }, + getId: function (file) { + return self._getFileId(file); + }, + getIndex: function (id) { + return self.fileManager.getIdList().indexOf(id); + }, + getThumb: function (id) { + var $thumb = null; + self._getThumbs().each(function () { + if ($(this).attr('data-fileid') === id) { + $thumb = $(this); + } + }); + return $thumb; + }, + getThumbIndex: function ($thumb) { + var id = $thumb.attr('data-fileid'); + return self.fileManager.getIndex(id); + }, + getIdList: function () { + return Object.keys(self.fileManager.stack); + }, + getFile: function (id) { + return self.fileManager.stack[id] || null; + }, + getFileName: function (id, fmt) { + var file = self.fileManager.getFile(id); + if (!file) { + return ''; + } + return fmt ? (file.nameFmt || '') : file.name || ''; + }, + getFirstFile: function () { + var ids = self.fileManager.getIdList(), id = ids && ids.length ? ids[0] : null; + return self.fileManager.getFile(id); + }, + setFile: function (id, file) { + if (self.fileManager.getFile(id)) { + self.fileManager.stack[id].file = file; + } else { + self.fileManager.add(file, id); + } + }, + setProcessed: function (id) { + self.fileManager.processed.push(id); + }, + getProgress: function () { + var total = self.fileManager.total(), processed = self.fileManager.processed.length; + if (!total) { + return 0; + } + return Math.ceil(processed / total * 100); + + }, + setProgress: function (id, pct) { + var f = self.fileManager.getFile(id); + if (!isNaN(pct) && f) { + f.progress = pct; + } + } + }; + }, + _setUploadData: function (fd, config) { + var self = this; + $.each(config, function (key, value) { + var param = self.uploadParamNames[key] || key; + if ($h.isArray(value)) { + fd.append(param, value[0], value[1]); + } else { + fd.append(param, value); + } + }); + }, + _initResumableUpload: function () { + var self = this, opts = self.resumableUploadOptions, logs = $h.logMessages; + if (!self.enableResumableUpload) { + return; + } + if (opts.fallback !== false && typeof opts.fallback !== 'function') { + opts.fallback = function (s) { + s._log(logs.noResumableSupport); + s.enableResumableUpload = false; + }; + } + if (!$h.hasResumableUploadSupport() && opts.fallback !== false) { + opts.fallback(self); + return; + } + if (!self.uploadUrl && self.enableResumableUpload) { + self._log(logs.noUploadUrl); + self.enableResumableUpload = false; + return; + + } + opts.chunkSize = parseFloat(opts.chunkSize); + if (opts.chunkSize <= 0 || isNaN(opts.chunkSize)) { + self._log(logs.invalidChunkSize, {chunkSize: opts.chunkSize}); + self.enableResumableUpload = false; + return; + } + self.resumableManager = { + init: function (id, f, index) { + var rm = self.resumableManager, fm = self.fileManager; + rm.currThreads = 0; + rm.logs = []; + rm.stack = []; + rm.error = ''; + rm.chunkIntervalId = null; + rm.id = id; + rm.file = f.file; + rm.fileName = f.name; + rm.fileIndex = index; + rm.completed = false; + rm.testing = false; + rm.lastProgress = 0; + if (self.showPreview) { + rm.$thumb = fm.getThumb(id) || null; + rm.$progress = rm.$btnDelete = null; + if (rm.$thumb && rm.$thumb.length) { + rm.$progress = rm.$thumb.find('.file-thumb-progress'); + rm.$btnDelete = rm.$thumb.find('.kv-file-remove'); + } + } + rm.chunkSize = self.resumableUploadOptions.chunkSize * 1024; + rm.chunkCount = rm.getTotalChunks(); + }, + logAjaxError: function (jqXHR, textStatus, errorThrown) { + if (self.resumableUploadOptions.showErrorLog) { + self._log(logs.ajaxError, { + status: jqXHR.status, + error: errorThrown, + text: jqXHR.responseText || '' + }); + } + }, + reset: function () { + var rm = self.resumableManager; + rm.processed = {}; + }, + setProcessed: function (status) { + var rm = self.resumableManager, fm = self.fileManager, id = rm.id, msg, + $thumb = rm.$thumb, $prog = rm.$progress, hasThumb = $thumb && $thumb.length, + params = {id: hasThumb ? $thumb.attr('id') : '', index: fm.getIndex(id), fileId: id}; + rm.completed = true; + rm.lastProgress = 0; + fm.uploadedSize += rm.file.size; + if (hasThumb) { + $thumb.removeClass('file-uploading'); + } + if (status === 'success') { + if (self.showPreview) { + self._setProgress(101, $prog); + self._setThumbStatus($thumb, 'Success'); + self._initUploadSuccess(rm.processed[id].data, $thumb); + } + self.fileManager.removeFile(id); + delete rm.processed[id]; + self._raise('fileuploaded', [params.id, params.index, params.fileId]); + if (fm.isProcessed()) { + self._setProgress(101); + } + } else { + if (self.showPreview) { + self._setThumbStatus($thumb, 'Error'); + self._setPreviewError($thumb, true); + self._setProgress(101, $prog, self.msgProgressError); + self._setProgress(101, self.$progress, self.msgProgressError); + self.cancelling = true; + } + if (!self.$errorContainer.find('li[data-file-id="' + params.fileId + '"]').length) { + msg = self.msgResumableUploadRetriesExceeded.setTokens({ + file: rm.fileName, + max: self.resumableUploadOptions.maxRetries, + error: rm.error + }); + self._showFileError(msg, params); + } + } + if (fm.isProcessed()) { + rm.reset(); + } + }, + check: function () { + var rm = self.resumableManager, status = true; + $.each(rm.logs, function (index, value) { + if (!value) { + status = false; + return false; + } + }); + if (status) { + clearInterval(rm.chunkIntervalId); + rm.setProcessed('success'); + } + }, + processedResumables: function () { + var logs = self.resumableManager.logs, i, count = 0; + if (!logs || !logs.length) { + return 0; + } + for (i = 0; i < logs.length; i++) { + if (logs[i] === true) { + count++; + } + } + return count; + }, + getUploadedSize: function () { + var rm = self.resumableManager, size = rm.processedResumables() * rm.chunkSize; + return size > rm.file.size ? rm.file.size : size; + }, + getTotalChunks: function () { + var rm = self.resumableManager, chunkSize = parseFloat(rm.chunkSize); + if (!isNaN(chunkSize) && chunkSize > 0) { + return Math.ceil(rm.file.size / chunkSize); + } + return 0; + }, + getProgress: function () { + var rm = self.resumableManager, processed = rm.processedResumables(), total = rm.chunkCount; + if (total === 0) { + return 0; + } + return Math.ceil(processed / total * 100); + }, + checkAborted: function (intervalId) { + if (self.paused || self.cancelling) { + clearInterval(intervalId); + self.unlock(); + } + }, + upload: function () { + var rm = self.resumableManager, fm = self.fileManager, ids = fm.getIdList(), flag = 'new', + intervalId; + intervalId = setInterval(function () { + var id; + rm.checkAborted(intervalId); + if (flag === 'new') { + self.lock(); + flag = 'processing'; + id = ids.shift(); + fm.initStats(id); + if (fm.stack[id]) { + rm.init(id, fm.stack[id], fm.getIndex(id)); + rm.testUpload(); + rm.uploadResumable(); + } + } + if (!fm.isPending(id) && rm.completed) { + flag = 'new'; + } + if (fm.isProcessed()) { + var $initThumbs = self.$preview.find('.file-preview-initial'); + if ($initThumbs.length) { + $h.addCss($initThumbs, $h.SORT_CSS); + self._initSortable(); + } + clearInterval(intervalId); + self._clearFileInput(); + self.unlock(); + setTimeout(function () { + var data = self.previewCache.data; + if (data) { + self.initialPreview = data.content; + self.initialPreviewConfig = data.config; + self.initialPreviewThumbTags = data.tags; + } + self._raise('filebatchuploadcomplete', [ + self.initialPreview, + self.initialPreviewConfig, + self.initialPreviewThumbTags, + self._getExtraData() + ]); + }, self.processDelay); + } + }, self.processDelay); + }, + uploadResumable: function () { + var i, rm = self.resumableManager, total = rm.chunkCount; + for (i = 0; i < total; i++) { + rm.logs[i] = !!(rm.processed[rm.id] && rm.processed[rm.id][i]); + } + for (i = 0; i < total; i++) { + rm.pushAjax(i, 0); + } + rm.chunkIntervalId = setInterval(rm.loopAjax, self.queueDelay); + }, + testUpload: function () { + var rm = self.resumableManager, opts = self.resumableUploadOptions, fd, f, + fm = self.fileManager, id = rm.id, fnBefore, fnSuccess, fnError, fnComplete, outData; + if (!opts.testUrl) { + rm.testing = false; + return; + } + rm.testing = true; + fd = new FormData(); + f = fm.stack[id]; + self._setUploadData(fd, { + fileId: id, + fileName: f.fileName, + fileSize: f.size, + fileRelativePath: f.relativePath, + chunkSize: rm.chunkSize, + chunkCount: rm.chunkCount + }); + fnBefore = function (jqXHR) { + outData = self._getOutData(fd, jqXHR); + self._raise('filetestbeforesend', [id, fm, rm, outData]); + }; + fnSuccess = function (data, textStatus, jqXHR) { + outData = self._getOutData(fd, jqXHR, data); + var pNames = self.uploadParamNames, chunksUploaded = pNames.chunksUploaded || 'chunksUploaded', + params = [id, fm, rm, outData]; + if (!data[chunksUploaded] || !$h.isArray(data[chunksUploaded])) { + self._raise('filetesterror', params); + } else { + if (!rm.processed[id]) { + rm.processed[id] = {}; + } + $.each(data[chunksUploaded], function (key, index) { + rm.logs[index] = true; + rm.processed[id][index] = true; + }); + rm.processed[id].data = data; + self._raise('filetestsuccess', params); + } + rm.testing = false; + }; + fnError = function (jqXHR, textStatus, errorThrown) { + outData = self._getOutData(fd, jqXHR); + self._raise('filetestajaxerror', [id, fm, rm, outData]); + rm.logAjaxError(jqXHR, textStatus, errorThrown); + rm.testing = false; + }; + fnComplete = function () { + self._raise('filetestcomplete', [id, fm, rm, self._getOutData(fd)]); + rm.testing = false; + }; + self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex, opts.testUrl); + }, + pushAjax: function (index, retry) { + self.resumableManager.stack.push([index, retry]); + }, + sendAjax: function (index, retry) { + var fm = self.fileManager, rm = self.resumableManager, opts = self.resumableUploadOptions, f, + chunkSize = rm.chunkSize, id = rm.id, file = rm.file, $thumb = rm.$thumb, + $btnDelete = rm.$btnDelete; + if (rm.processed[id] && rm.processed[id][index]) { + return; + } + rm.currThreads++; + if (retry > opts.maxRetries) { + rm.setProcessed('error'); + return; + } + var fd, outData, fnBefore, fnSuccess, fnError, fnComplete, slice = file.slice ? 'slice' : + (file.mozSlice ? 'mozSlice' : (file.webkitSlice ? 'webkitSlice' : 'slice')), + blob = file[slice](chunkSize * index, chunkSize * (index + 1)); + fd = new FormData(); + f = fm.stack[id]; + self._setUploadData(fd, { + chunkCount: rm.chunkCount, + chunkIndex: index, + chunkSize: chunkSize, + chunkSizeStart: chunkSize * index, + fileBlob: [blob, rm.fileName], + fileId: id, + fileName: rm.fileName, + fileRelativePath: f.relativePath, + fileSize: file.size, + retryCount: retry + }); + if (rm.$progress && rm.$progress.length) { + rm.$progress.show(); + } + fnBefore = function (jqXHR) { + outData = self._getOutData(fd, jqXHR); + if (self.showPreview) { + if (!$thumb.hasClass('file-preview-success')) { + self._setThumbStatus($thumb, 'Loading'); + $h.addCss($thumb, 'file-uploading'); + } + $btnDelete.attr('disabled', true); + } + self._raise('filechunkbeforesend', [id, index, retry, fm, rm, outData]); + }; + fnSuccess = function (data, textStatus, jqXHR) { + outData = self._getOutData(fd, jqXHR, data); + var paramNames = self.uploadParamNames, chunkIndex = paramNames.chunkIndex || 'chunkIndex', + opts = self.resumableUploadOptions, params = [id, index, retry, fm, rm, outData]; + rm.currThreads--; + if (data.error) { + if (opts.showErrorLog) { + self._log(logs.retryStatus, { + retry: retry + 1, + filename: rm.fileName, + chunk: index + }); + } + rm.pushAjax(index, retry + 1); + rm.error = data.error; + self._raise('filechunkerror', params); + } else { + rm.logs[data[chunkIndex]] = true; + if (!rm.processed[id]) { + rm.processed[id] = {}; + } + rm.processed[id][data[chunkIndex]] = true; + rm.processed[id].data = data; + self._raise('filechunksuccess', params); + rm.check(); + } + }; + fnError = function (jqXHR, textStatus, errorThrown) { + outData = self._getOutData(fd, jqXHR); + rm.currThreads--; + rm.error = errorThrown; + rm.logAjaxError(jqXHR, textStatus, errorThrown); + self._raise('filechunkajaxerror', [id, index, retry, fm, rm, outData]); + rm.pushAjax(index, retry + 1); + }; + fnComplete = function () { + self._raise('filechunkcomplete', [id, index, retry, fm, rm, self._getOutData(fd)]); + }; + self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex); + }, + loopAjax: function () { + var rm = self.resumableManager; + if (rm.currThreads < self.resumableUploadOptions.maxThreads && !rm.testing) { + var arr = rm.stack.shift(), index; + if (typeof arr !== 'undefined') { + index = arr[0]; + if (!rm.processed[rm.id] || !rm.processed[rm.id][index]) { + rm.sendAjax(index, arr[1]); + } else { + if (rm.processedResumables() >= rm.getTotalChunks()) { + rm.setProcessed('success'); + clearInterval(rm.chunkIntervalId); + } + } + } + } + } + }; + self.resumableManager.reset(); + }, + _initTemplateDefaults: function () { + var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse, + tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionDownload, + tActionZoom, tActionDrag, tIndicator, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage, + tText, tOffice, tGdocs, tVideo, tAudio, tFlash, tObject, tPdf, tOther, tStyle, tZoomCache, vDefaultDim, + tStats; + tMain1 = '{preview}\n' + + '
    \n' + + '
    \n' + + ' {caption}\n' + + '
    \n' + + ' {remove}\n' + + ' {cancel}\n' + + ' {pause}\n' + + ' {upload}\n' + + ' {browse}\n' + + '
    \n' + + '
    '; + tMain2 = '{preview}\n
    \n
    \n' + + '{remove}\n{cancel}\n{upload}\n{browse}\n'; + tPreview = '
    \n' + + ' {close}' + + '
    \n' + + '
    \n' + + '
    \n' + + '
    ' + + '
    \n' + + '
    \n' + + '
    \n' + + '
    '; + tClose = $h.closeButton('fileinput-remove'); + tFileIcon = ''; + // noinspection HtmlUnknownAttribute + tCaption = '
    \n' + + ' \n' + + ' \n' + + '
    '; + //noinspection HtmlUnknownAttribute + tBtnDefault = ''; + //noinspection HtmlUnknownAttribute + tBtnLink = '{icon} {label}'; + //noinspection HtmlUnknownAttribute + tBtnBrowse = '
    {icon} {label}
    '; + tModalMain = ''; + tModal = '\n'; + tProgress = '
    \n' + + '
    \n' + + ' {status}\n' + + '
    \n' + + '
    {stats}'; + tStats = '
    ' + + '{pendingTime} ' + + '{uploadSpeed}' + + '
    '; + tSize = ' ({sizeText})'; + tFooter = ''; + tActions = '
    \n' + + ' \n' + + '
    \n' + + '{drag}\n' + + '
    '; + //noinspection HtmlUnknownAttribute + tActionDelete = '\n'; + tActionUpload = ''; + tActionDownload = '{downloadIcon}'; + tActionZoom = ''; + tActionDrag = '{dragIcon}'; + tIndicator = '
    {indicator}
    '; + tTagBef = '
    \n'; + tTagBef2 = tTagBef + ' title="{caption}">
    \n'; + tTagAft = '
    {footer}\n
    \n'; + tGeneric = '{content}\n'; + tStyle = ' {style}'; + tHtml = '
    {data}
    \n'; + tImage = '\n'; + tText = '\n'; + tOffice = ''; + tGdocs = ''; + tVideo = '\n'; + tAudio = '\n'; + tFlash = '\n'; + tPdf = '\n'; + tObject = '\n' + '\n' + + $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n\n'; + tOther = '
    \n' + $h.DEFAULT_PREVIEW + '\n
    \n'; + tZoomCache = ''; + vDefaultDim = {width: '100%', height: '100%', 'min-height': '480px'}; + if (self._isPdfRendered()) { + tPdf = self.pdfRendererTemplate.replace('{renderer}', self._encodeURI(self.pdfRendererUrl)); + } + self.defaults = { + layoutTemplates: { + main1: tMain1, + main2: tMain2, + preview: tPreview, + close: tClose, + fileIcon: tFileIcon, + caption: tCaption, + modalMain: tModalMain, + modal: tModal, + progress: tProgress, + stats: tStats, + size: tSize, + footer: tFooter, + indicator: tIndicator, + actions: tActions, + actionDelete: tActionDelete, + actionUpload: tActionUpload, + actionDownload: tActionDownload, + actionZoom: tActionZoom, + actionDrag: tActionDrag, + btnDefault: tBtnDefault, + btnLink: tBtnLink, + btnBrowse: tBtnBrowse, + zoomCache: tZoomCache + }, + previewMarkupTags: { + tagBefore1: tTagBef1, + tagBefore2: tTagBef2, + tagAfter: tTagAft + }, + previewContentTemplates: { + generic: tGeneric, + html: tHtml, + image: tImage, + text: tText, + office: tOffice, + gdocs: tGdocs, + video: tVideo, + audio: tAudio, + flash: tFlash, + object: tObject, + pdf: tPdf, + other: tOther + }, + allowedPreviewTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'pdf', 'object'], + previewTemplates: {}, + previewSettings: { + image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, + html: {width: '213px', height: '160px'}, + text: {width: '213px', height: '160px'}, + office: {width: '213px', height: '160px'}, + gdocs: {width: '213px', height: '160px'}, + video: {width: '213px', height: '160px'}, + audio: {width: '100%', height: '30px'}, + flash: {width: '213px', height: '160px'}, + object: {width: '213px', height: '160px'}, + pdf: {width: '100%', height: '160px'}, + other: {width: '213px', height: '160px'} + }, + previewSettingsSmall: { + image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, + html: {width: '100%', height: '160px'}, + text: {width: '100%', height: '160px'}, + office: {width: '100%', height: '160px'}, + gdocs: {width: '100%', height: '160px'}, + video: {width: '100%', height: 'auto'}, + audio: {width: '100%', height: '30px'}, + flash: {width: '100%', height: 'auto'}, + object: {width: '100%', height: 'auto'}, + pdf: {width: '100%', height: '160px'}, + other: {width: '100%', height: '160px'} + }, + previewZoomSettings: { + image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, + html: vDefaultDim, + text: vDefaultDim, + office: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, + gdocs: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, + video: {width: 'auto', height: '100%', 'max-width': '100%'}, + audio: {width: '100%', height: '30px'}, + flash: {width: 'auto', height: '480px'}, + object: {width: 'auto', height: '100%', 'max-width': '100%', 'min-height': '480px'}, + pdf: vDefaultDim, + other: {width: 'auto', height: '100%', 'min-height': '480px'} + }, + mimeTypeAliases: { + 'video/quicktime': 'video/mp4' + }, + fileTypeSettings: { + image: function (vType, vName) { + return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) || + $h.compare(vName, /\.(gif|png|jpe?g)$/i)); + }, + html: function (vType, vName) { + return $h.compare(vType, 'text/html') || $h.compare(vName, /\.(htm|html)$/i); + }, + office: function (vType, vName) { + return $h.compare(vType, /(word|excel|powerpoint|office)$/i) || + $h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?)$/i); + }, + gdocs: function (vType, vName) { + return $h.compare(vType, /(word|excel|powerpoint|office|iwork-pages|tiff?)$/i) || + $h.compare(vName, + /\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i); + }, + text: function (vType, vName) { + return $h.compare(vType, 'text.*') || $h.compare(vName, /\.(xml|javascript)$/i) || + $h.compare(vName, /\.(txt|md|csv|nfo|ini|json|php|js|css)$/i); + }, + video: function (vType, vName) { + return $h.compare(vType, 'video.*') && ($h.compare(vType, /(ogg|mp4|mp?g|mov|webm|3gp)$/i) || + $h.compare(vName, /\.(og?|mp4|webm|mp?g|mov|3gp)$/i)); + }, + audio: function (vType, vName) { + return $h.compare(vType, 'audio.*') && ($h.compare(vName, /(ogg|mp3|mp?g|wav)$/i) || + $h.compare(vName, /\.(og?|mp3|mp?g|wav)$/i)); + }, + flash: function (vType, vName) { + return $h.compare(vType, 'application/x-shockwave-flash', true) || $h.compare(vName, + /\.(swf)$/i); + }, + pdf: function (vType, vName) { + return $h.compare(vType, 'application/pdf', true) || $h.compare(vName, /\.(pdf)$/i); + }, + object: function () { + return true; + }, + other: function () { + return true; + } + }, + fileActionSettings: { + showRemove: true, + showUpload: true, + showDownload: true, + showZoom: true, + showDrag: true, + removeIcon: '', + removeClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + removeErrorClass: 'btn btn-sm btn-kv btn-danger', + removeTitle: 'Remove file', + uploadIcon: '', + uploadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + uploadTitle: 'Upload file', + uploadRetryIcon: '', + uploadRetryTitle: 'Retry upload', + downloadIcon: '', + downloadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + downloadTitle: 'Download file', + zoomIcon: '', + zoomClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + zoomTitle: 'View Details', + dragIcon: '', + dragClass: 'text-info', + dragTitle: 'Move / Rearrange', + dragSettings: {}, + indicatorNew: '', + indicatorSuccess: '', + indicatorError: '', + indicatorLoading: '', + indicatorPaused: '', + indicatorNewTitle: 'Not uploaded yet', + indicatorSuccessTitle: 'Uploaded', + indicatorErrorTitle: 'Upload Error', + indicatorLoadingTitle: 'Uploading ...', + indicatorPausedTitle: 'Upload Paused' + } + }; + $.each(self.defaults, function (key, setting) { + if (key === 'allowedPreviewTypes') { + if (self.allowedPreviewTypes === undefined) { + self.allowedPreviewTypes = setting; + } + return; + } + self[key] = $.extend(true, {}, setting, self[key]); + }); + self._initPreviewTemplates(); + }, + _initPreviewTemplates: function () { + var self = this, tags = self.previewMarkupTags, tagBef, tagAft = tags.tagAfter; + $.each(self.previewContentTemplates, function (key, value) { + if ($h.isEmpty(self.previewTemplates[key])) { + tagBef = tags.tagBefore2; + if (key === 'generic' || key === 'image' || key === 'html' || key === 'text') { + tagBef = tags.tagBefore1; + } + if (self._isPdfRendered() && key === 'pdf') { + tagBef = tagBef.replace('kv-file-content', 'kv-file-content kv-pdf-rendered'); + } + self.previewTemplates[key] = tagBef + value + tagAft; + } + }); + }, + _initPreviewCache: function () { + var self = this; + self.previewCache = { + data: {}, + init: function () { + var content = self.initialPreview; + if (content.length > 0 && !$h.isArray(content)) { + content = content.split(self.initialPreviewDelimiter); + } + self.previewCache.data = { + content: content, + config: self.initialPreviewConfig, + tags: self.initialPreviewThumbTags + }; + }, + count: function (skipNull) { + if (!self.previewCache.data || !self.previewCache.data.content) { + return 0; + } + if (skipNull) { + var chk = self.previewCache.data.content.filter(function (n) { + return n !== null; + }); + return chk.length; + } + return self.previewCache.data.content.length; + }, + get: function (i, isDisabled) { + var ind = 'init_' + i, data = self.previewCache.data, config = data.config[i], fileId, + content = data.content[i], previewId = self.previewInitId + '-' + ind, out, $tmp, cat, ftr, + fname, ftype, frameClass, asData = $h.ifSet('previewAsData', config, self.initialPreviewAsData), + a = config ? {title: config.title || null, alt: config.alt || null} : {title: null, alt: null}, + parseTemplate = function (cat, dat, fn, ft, id, ftr, ind, fc, t) { + fc = ' file-preview-initial ' + $h.SORT_CSS + (fc ? ' ' + fc : ''); + /** @namespace config.zoomData */ + fileId = config && config.fileId || 'file_' + id; + return self._generatePreviewTemplate(cat, dat, fn, ft, id, fileId, false, null, fc, + ftr, ind, t, a, config && config.zoomData || dat); + }; + if (!content || !content.length) { + return ''; + } + isDisabled = isDisabled === undefined ? true : isDisabled; + cat = $h.ifSet('type', config, self.initialPreviewFileType || 'generic'); + fname = $h.ifSet('filename', config, $h.ifSet('caption', config)); + ftype = $h.ifSet('filetype', config, cat); + ftr = self.previewCache.footer(i, isDisabled, (config && config.size || null)); + frameClass = $h.ifSet('frameClass', config); + if (asData) { + out = parseTemplate(cat, content, fname, ftype, previewId, ftr, ind, frameClass); + } else { + out = parseTemplate('generic', content, fname, ftype, previewId, ftr, ind, frameClass, cat) + .setTokens({'content': data.content[i]}); + } + if (data.tags.length && data.tags[i]) { + out = $h.replaceTags(out, data.tags[i]); + } + /** @namespace config.frameAttr */ + if (!$h.isEmpty(config) && !$h.isEmpty(config.frameAttr)) { + $tmp = $(document.createElement('div')).html(out); + $tmp.find('.file-preview-initial').attr(config.frameAttr); + out = $tmp.html(); + $tmp.remove(); + } + return out; + }, + clean: function (data) { + data.content = $h.cleanArray(data.content); + data.config = $h.cleanArray(data.config); + data.tags = $h.cleanArray(data.tags); + self.previewCache.data = data; + }, + add: function (content, config, tags, append) { + var data = self.previewCache.data, index = content.length - 1; + if (!content || !content.length) { + return index; + } + if (!$h.isArray(content)) { + content = content.split(self.initialPreviewDelimiter); + } + if (append) { + index = data.content.push(content[0]) - 1; + data.config[index] = config; + data.tags[index] = tags; + } else { + data.content = content; + data.config = config; + data.tags = tags; + } + self.previewCache.clean(data); + return index; + }, + set: function (content, config, tags, append) { + var data = self.previewCache.data, i, chk; + if (!content || !content.length) { + return; + } + if (!$h.isArray(content)) { + content = content.split(self.initialPreviewDelimiter); + } + chk = content.filter(function (n) { + return n !== null; + }); + if (!chk.length) { + return; + } + if (data.content === undefined) { + data.content = []; + } + if (data.config === undefined) { + data.config = []; + } + if (data.tags === undefined) { + data.tags = []; + } + if (append) { + for (i = 0; i < content.length; i++) { + if (content[i]) { + data.content.push(content[i]); + } + } + for (i = 0; i < config.length; i++) { + if (config[i]) { + data.config.push(config[i]); + } + } + for (i = 0; i < tags.length; i++) { + if (tags[i]) { + data.tags.push(tags[i]); + } + } + } else { + data.content = content; + data.config = config; + data.tags = tags; + } + self.previewCache.clean(data); + }, + unset: function (index) { + var chk = self.previewCache.count(), rev = self.reversePreviewOrder; + if (!chk) { + return; + } + if (chk === 1) { + self.previewCache.data.content = []; + self.previewCache.data.config = []; + self.previewCache.data.tags = []; + self.initialPreview = []; + self.initialPreviewConfig = []; + self.initialPreviewThumbTags = []; + return; + } + self.previewCache.data.content = $h.spliceArray(self.previewCache.data.content, index, rev); + self.previewCache.data.config = $h.spliceArray(self.previewCache.data.config, index, rev); + self.previewCache.data.tags = $h.spliceArray(self.previewCache.data.tags, index, rev); + var data = $.extend(true, {}, self.previewCache.data); + self.previewCache.clean(data); + }, + out: function () { + var html = '', caption, len = self.previewCache.count(), i, content; + if (len === 0) { + return {content: '', caption: ''}; + } + for (i = 0; i < len; i++) { + content = self.previewCache.get(i); + html = self.reversePreviewOrder ? (content + html) : (html + content); + } + caption = self._getMsgSelected(len); + return {content: html, caption: caption}; + }, + footer: function (i, isDisabled, size) { + var data = self.previewCache.data || {}; + if ($h.isEmpty(data.content)) { + return ''; + } + if ($h.isEmpty(data.config) || $h.isEmpty(data.config[i])) { + data.config[i] = {}; + } + isDisabled = isDisabled === undefined ? true : isDisabled; + var config = data.config[i], caption = $h.ifSet('caption', config), a, + width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false), + key = $h.ifSet('key', config, null), fileId = $h.ifSet('fileId', config, null), + fs = self.fileActionSettings, initPreviewShowDel = self.initialPreviewShowDelete || false, + downloadInitialUrl = !self.initialPreviewDownloadUrl ? '' : + self.initialPreviewDownloadUrl + '?key=' + key + (fileId ? '&fileId=' + fileId : ''), + dUrl = config.downloadUrl || downloadInitialUrl, + dFil = config.filename || config.caption || '', + initPreviewShowDwl = !!(dUrl), + sDel = $h.ifSet('showRemove', config, $h.ifSet('showRemove', fs, initPreviewShowDel)), + sDwl = $h.ifSet('showDownload', config, $h.ifSet('showDownload', fs, initPreviewShowDwl)), + sZm = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)), + sDrg = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)), + dis = (url === false) && isDisabled; + sDwl = sDwl && config.downloadUrl !== false && !!dUrl; + a = self._renderFileActions(config, false, sDwl, sDel, sZm, sDrg, dis, url, key, true, dUrl, dFil); + return self._getLayoutTemplate('footer').setTokens({ + 'progress': self._renderThumbProgress(), + 'actions': a, + 'caption': caption, + 'size': self._getSize(size), + 'width': width, + 'indicator': '' + }); + } + }; + self.previewCache.init(); + }, + _isPdfRendered: function () { + var self = this, useLib = self.usePdfRenderer, + flag = typeof useLib === 'function' ? useLib() : !!useLib; + return flag && self.pdfRendererUrl; + }, + _handler: function ($el, event, callback) { + var self = this, ns = self.namespace, ev = event.split(' ').join(ns + ' ') + ns; + if (!$el || !$el.length) { + return; + } + $el.off(ev).on(ev, callback); + }, + _encodeURI: function (vUrl) { + var self = this; + return self.encodeUrl ? encodeURI(vUrl) : vUrl; + }, + _log: function (msg, tokens) { + var self = this, id = self.$element.attr('id'); + if (id) { + msg = '"' + id + '": ' + msg; + } + msg = 'bootstrap-fileinput: ' + msg; + if (typeof tokens === 'object') { + msg.setTokens(tokens); + } + if (typeof window.console.log !== 'undefined') { + window.console.log(msg); + } else { + window.alert(msg); + } + }, + _validate: function () { + var self = this, status = self.$element.attr('type') === 'file'; + if (!status) { + self._log($h.logMessages.badInputType); + } + return status; + }, + _errorsExist: function () { + var self = this, $err, $errList = self.$errorContainer.find('li'); + if ($errList.length) { + return true; + } + $err = $(document.createElement('div')).html(self.$errorContainer.html()); + $err.find('.kv-error-close').remove(); + $err.find('ul').remove(); + return !!$.trim($err.text()).length; + }, + _errorHandler: function (evt, caption) { + var self = this, err = evt.target.error, showError = function (msg) { + self._showError(msg.replace('{name}', caption)); + }; + /** @namespace err.NOT_FOUND_ERR */ + /** @namespace err.SECURITY_ERR */ + /** @namespace err.NOT_READABLE_ERR */ + if (err.code === err.NOT_FOUND_ERR) { + showError(self.msgFileNotFound); + } else { + if (err.code === err.SECURITY_ERR) { + showError(self.msgFileSecured); + } else { + if (err.code === err.NOT_READABLE_ERR) { + showError(self.msgFileNotReadable); + } else { + if (err.code === err.ABORT_ERR) { + showError(self.msgFilePreviewAborted); + } else { + showError(self.msgFilePreviewError); + } + } + } + } + }, + _addError: function (msg) { + var self = this, $error = self.$errorContainer; + if (msg && $error.length) { + $error.html(self.errorCloseButton + msg); + self._handler($error.find('.kv-error-close'), 'click', function () { + setTimeout(function () { + if (self.showPreview && !self.getFrames().length) { + self.clear(); + } + $error.fadeOut('slow'); + }, self.processDelay); + }); + } + }, + _setValidationError: function (css) { + var self = this; + css = (css ? css + ' ' : '') + 'has-error'; + self.$container.removeClass(css).addClass('has-error'); + $h.addCss(self.$captionContainer, 'is-invalid'); + }, + _resetErrors: function (fade) { + var self = this, $error = self.$errorContainer; + self.isError = false; + self.$container.removeClass('has-error'); + self.$captionContainer.removeClass('is-invalid'); + $error.html(''); + if (fade) { + $error.fadeOut('slow'); + } else { + $error.hide(); + } + }, + _showFolderError: function (folders) { + var self = this, $error = self.$errorContainer, msg; + if (!folders) { + return; + } + if (!self.isAjaxUpload) { + self._clearFileInput(); + } + msg = self.msgFoldersNotAllowed.replace('{n}', folders); + self._addError(msg); + self._setValidationError(); + $error.fadeIn(800); + self._raise('filefoldererror', [folders, msg]); + }, + _showFileError: function (msg, params, event) { + var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', + fId = params && params.fileId || '', e = params && params.id ? + '
  • ' + msg + '
  • ' : '
  • ' + msg + '
  • '; + if ($error.find('ul').length === 0) { + self._addError('
      ' + e + '
    '); + } else { + $error.find('ul').append(e); + } + $error.fadeIn(800); + self._raise(ev, [params, msg]); + self._setValidationError('file-input-new'); + return true; + }, + _showError: function (msg, params, event) { + var self = this, $error = self.$errorContainer, ev = event || 'fileerror'; + params = params || {}; + params.reader = self.reader; + self._addError(msg); + $error.fadeIn(800); + self._raise(ev, [params, msg]); + if (!self.isAjaxUpload) { + self._clearFileInput(); + } + self._setValidationError('file-input-new'); + self.$btnUpload.attr('disabled', true); + return true; + }, + _noFilesError: function (params) { + var self = this, label = self.minFileCount > 1 ? self.filePlural : self.fileSingle, + msg = self.msgFilesTooLess.replace('{n}', self.minFileCount).replace('{files}', label), + $error = self.$errorContainer; + self._addError(msg); + self.isError = true; + self._updateFileDetails(0); + $error.fadeIn(800); + self._raise('fileerror', [params, msg]); + self._clearFileInput(); + self._setValidationError(); + }, + _parseError: function (operation, jqXHR, errorThrown, fileName) { + /** @namespace jqXHR.responseJSON */ + var self = this, errMsg = $.trim(errorThrown + ''), textPre, + text = jqXHR.responseJSON !== undefined && jqXHR.responseJSON.error !== undefined ? + jqXHR.responseJSON.error : jqXHR.responseText; + if (self.cancelling && self.msgUploadAborted) { + errMsg = self.msgUploadAborted; + } + if (self.showAjaxErrorDetails && text) { + text = $.trim(text.replace(/\n\s*\n/g, '\n')); + textPre = text.length ? '
    ' + text + '
    ' : ''; + errMsg += errMsg ? textPre : text; + } + if (!errMsg) { + errMsg = self.msgAjaxError.replace('{operation}', operation); + } + self.cancelling = false; + return fileName ? '' + fileName + ': ' + errMsg : errMsg; + }, + _parseFileType: function (type, name) { + var self = this, isValid, vType, cat, i, types = self.allowedPreviewTypes || []; + if (type === 'application/text-plain') { + return 'text'; + } + for (i = 0; i < types.length; i++) { + cat = types[i]; + isValid = self.fileTypeSettings[cat]; + vType = isValid(type, name) ? cat : ''; + if (!$h.isEmpty(vType)) { + return vType; + } + } + return 'other'; + }, + _getPreviewIcon: function (fname) { + var self = this, ext, out = null; + if (fname && fname.indexOf('.') > -1) { + ext = fname.split('.').pop(); + if (self.previewFileIconSettings) { + out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null; + } + if (self.previewFileExtSettings) { + $.each(self.previewFileExtSettings, function (key, func) { + if (self.previewFileIconSettings[key] && func(ext)) { + out = self.previewFileIconSettings[key]; + //noinspection UnnecessaryReturnStatementJS + return; + } + }); + } + } + return out; + }, + _parseFilePreviewIcon: function (content, fname) { + var self = this, icn = self._getPreviewIcon(fname) || self.previewFileIcon, out = content; + if (out.indexOf('{previewFileIcon}') > -1) { + out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn}); + } + return out; + }, + _raise: function (event, params) { + var self = this, e = $.Event(event); + if (params !== undefined) { + self.$element.trigger(e, params); + } else { + self.$element.trigger(e); + } + if (e.isDefaultPrevented() || e.result === false) { + return false; + } + switch (event) { + // ignore these events + case 'filebatchuploadcomplete': + case 'filebatchuploadsuccess': + case 'fileuploaded': + case 'fileclear': + case 'filecleared': + case 'filereset': + case 'fileerror': + case 'filefoldererror': + case 'fileuploaderror': + case 'filebatchuploaderror': + case 'filedeleteerror': + case 'filecustomerror': + case 'filesuccessremove': + break; + // receive data response via `filecustomerror` event` + default: + if (!self.ajaxAborted) { + self.ajaxAborted = e.result; + } + break; + } + return true; + }, + _listenFullScreen: function (isFullScreen) { + var self = this, $modal = self.$modal, $btnFull, $btnBord; + if (!$modal || !$modal.length) { + return; + } + $btnFull = $modal && $modal.find('.btn-fullscreen'); + $btnBord = $modal && $modal.find('.btn-borderless'); + if (!$btnFull.length || !$btnBord.length) { + return; + } + $btnFull.removeClass('active').attr('aria-pressed', 'false'); + $btnBord.removeClass('active').attr('aria-pressed', 'false'); + if (isFullScreen) { + $btnFull.addClass('active').attr('aria-pressed', 'true'); + } else { + $btnBord.addClass('active').attr('aria-pressed', 'true'); + } + if ($modal.hasClass('file-zoom-fullscreen')) { + self._maximizeZoomDialog(); + } else { + if (isFullScreen) { + self._maximizeZoomDialog(); + } else { + $btnBord.removeClass('active').attr('aria-pressed', 'false'); + } + } + }, + _listen: function () { + var self = this, $el = self.$element, $form = self.$form, $cont = self.$container, fullScreenEvents; + self._handler($el, 'click', function (e) { + if ($el.hasClass('file-no-browse')) { + if ($el.data('zoneClicked')) { + $el.data('zoneClicked', false); + } else { + e.preventDefault(); + } + } + }); + self._handler($el, 'change', $.proxy(self._change, self)); + if (self.showBrowse) { + self._handler(self.$btnFile, 'click', $.proxy(self._browse, self)); + } + self._handler($cont.find('.fileinput-remove:not([disabled])'), 'click', $.proxy(self.clear, self)); + self._handler($cont.find('.fileinput-cancel'), 'click', $.proxy(self.cancel, self)); + self._handler($cont.find('.fileinput-pause'), 'click', $.proxy(self.pause, self)); + self._initDragDrop(); + self._handler($form, 'reset', $.proxy(self.clear, self)); + if (!self.isAjaxUpload) { + self._handler($form, 'submit', $.proxy(self._submitForm, self)); + } + self._handler(self.$container.find('.fileinput-upload'), 'click', $.proxy(self._uploadClick, self)); + self._handler($(window), 'resize', function () { + self._listenFullScreen(screen.width === window.innerWidth && screen.height === window.innerHeight); + }); + fullScreenEvents = 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange'; + self._handler($(document), fullScreenEvents, function () { + self._listenFullScreen($h.checkFullScreen()); + }); + self._autoFitContent(); + self._initClickable(); + self._refreshPreview(); + }, + _autoFitContent: function () { + var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, + self = this, config = width < 400 ? (self.previewSettingsSmall || self.defaults.previewSettingsSmall) : + (self.previewSettings || self.defaults.previewSettings), sel; + $.each(config, function (cat, settings) { + sel = '.file-preview-frame .file-preview-' + cat; + self.$preview.find(sel + '.kv-preview-data,' + sel + ' .kv-preview-data').css(settings); + }); + }, + _scanDroppedItems: function (item, files, path) { + path = path || ''; + var self = this, i, dirReader, readDir, errorHandler = function (e) { + self._log($h.logMessages.badDroppedFiles); + self._log(e); + }; + if (item.isFile) { + item.file(function (file) { + files.push(file); + }, errorHandler); + } else { + if (item.isDirectory) { + dirReader = item.createReader(); + readDir = function () { + dirReader.readEntries(function (entries) { + if (entries && entries.length > 0) { + for (i = 0; i < entries.length; i++) { + self._scanDroppedItems(entries[i], files, path + item.name + '/'); + } + // recursively call readDir() again, since browser can only handle first 100 entries. + readDir(); + } + return null; + }, errorHandler); + }; + readDir(); + } + } + + }, + _initDragDrop: function () { + var self = this, $zone = self.$dropZone; + if (self.dropZoneEnabled && self.showPreview) { + self._handler($zone, 'dragenter dragover', $.proxy(self._zoneDragEnter, self)); + self._handler($zone, 'dragleave', $.proxy(self._zoneDragLeave, self)); + self._handler($zone, 'drop', $.proxy(self._zoneDrop, self)); + self._handler($(document), 'dragenter dragover drop', self._zoneDragDropInit); + } + }, + _zoneDragDropInit: function (e) { + e.stopPropagation(); + e.preventDefault(); + }, + _zoneDragEnter: function (e) { + var self = this, dataTransfer = e.originalEvent.dataTransfer, + hasFiles = $.inArray('Files', dataTransfer.types) > -1; + self._zoneDragDropInit(e); + if (self.isDisabled || !hasFiles) { + e.originalEvent.dataTransfer.effectAllowed = 'none'; + e.originalEvent.dataTransfer.dropEffect = 'none'; + return; + } + if (self._raise('fileDragEnter', {'sourceEvent': e, 'files': dataTransfer.types.Files})) { + $h.addCss(self.$dropZone, 'file-highlighted'); + } + }, + _zoneDragLeave: function (e) { + var self = this; + self._zoneDragDropInit(e); + if (self.isDisabled) { + return; + } + if (self._raise('fileDragLeave', {'sourceEvent': e})) { + self.$dropZone.removeClass('file-highlighted'); + } + + }, + _zoneDrop: function (e) { + /** @namespace e.originalEvent.dataTransfer */ + var self = this, i, $el = self.$element, dataTransfer = e.originalEvent.dataTransfer, + files = dataTransfer.files, items = dataTransfer.items, folders = $h.getDragDropFolders(items), + processFiles = function () { + if (!self.isAjaxUpload) { + self.changeTriggered = true; + $el.get(0).files = files; + setTimeout(function () { + self.changeTriggered = false; + $el.trigger('change' + self.namespace); + }, self.processDelay); + } else { + self._change(e, files); + } + self.$dropZone.removeClass('file-highlighted'); + }; + e.preventDefault(); + if (self.isDisabled || $h.isEmpty(files)) { + return; + } + if (!self._raise('fileDragDrop', {'sourceEvent': e, 'files': files})) { + return; + } + if (folders > 0) { + if (!self.isAjaxUpload) { + self._showFolderError(folders); + return; + } + files = []; + for (i = 0; i < items.length; i++) { + var item = items[i].webkitGetAsEntry(); + if (item) { + self._scanDroppedItems(item, files); + } + } + setTimeout(function () { + processFiles(); + }, 500); + } else { + processFiles(); + } + }, + _uploadClick: function (e) { + var self = this, $btn = self.$container.find('.fileinput-upload'), $form, + isEnabled = !$btn.hasClass('disabled') && $h.isEmpty($btn.attr('disabled')); + if (e && e.isDefaultPrevented()) { + return; + } + if (!self.isAjaxUpload) { + if (isEnabled && $btn.attr('type') !== 'submit') { + $form = $btn.closest('form'); + // downgrade to normal form submit if possible + if ($form.length) { + $form.trigger('submit'); + } + e.preventDefault(); + } + return; + } + e.preventDefault(); + if (isEnabled) { + self.upload(); + } + }, + _submitForm: function () { + var self = this; + return self._isFileSelectionValid() && !self._abort({}); + }, + _clearPreview: function () { + var self = this, $p = self.$preview, + $thumbs = self.showUploadedThumbs ? self.getFrames(':not(.file-preview-success)') : self.getFrames(); + $thumbs.each(function () { + var $thumb = $(this); + $thumb.remove(); + $h.cleanZoomCache($p.find('#zoom-' + $thumb.attr('id'))); + }); + if (!self.getFrames().length || !self.showPreview) { + self._resetUpload(); + } + self._validateDefaultPreview(); + }, + _initSortable: function () { + var self = this, $el = self.$preview, settings, selector = '.' + $h.SORT_CSS, + rev = self.reversePreviewOrder; + if (!window.KvSortable || $el.find(selector).length === 0) { + return; + } + //noinspection JSUnusedGlobalSymbols + settings = { + handle: '.drag-handle-init', + dataIdAttr: 'data-preview-id', + scroll: false, + draggable: selector, + onSort: function (e) { + var oldIndex = e.oldIndex, newIndex = e.newIndex, i = 0; + self.initialPreview = $h.moveArray(self.initialPreview, oldIndex, newIndex, rev); + self.initialPreviewConfig = $h.moveArray(self.initialPreviewConfig, oldIndex, newIndex, rev); + self.previewCache.init(); + self.getFrames('.file-preview-initial').each(function () { + $(this).attr('data-fileindex', 'init_' + i); + i++; + }); + self._raise('filesorted', { + previewId: $(e.item).attr('id'), + 'oldIndex': oldIndex, + 'newIndex': newIndex, + stack: self.initialPreviewConfig + }); + } + }; + if ($el.data('kvsortable')) { + $el.kvsortable('destroy'); + } + $.extend(true, settings, self.fileActionSettings.dragSettings); + $el.kvsortable(settings); + }, + _setPreviewContent: function (content) { + var self = this; + self.$preview.html(content); + self._autoFitContent(); + }, + _initPreviewImageOrientations: function () { + var self = this, i = 0; + if (!self.autoOrientImageInitial) { + return; + } + self.getFrames('.file-preview-initial').each(function () { + var $thumb = $(this), $img, $zoomImg, id, config = self.initialPreviewConfig[i]; + /** @namespace config.exif */ + if (config && config.exif && config.exif.Orientation) { + id = $thumb.attr('id'); + $img = $thumb.find('>.kv-file-content img'); + $zoomImg = self.$preview.find('#zoom-' + id + ' >.kv-file-content img'); + self.setImageOrientation($img, $zoomImg, config.exif.Orientation, $thumb); + } + i++; + }); + }, + _initPreview: function (isInit) { + var self = this, cap = self.initialCaption || '', out; + if (!self.previewCache.count(true)) { + self._clearPreview(); + if (isInit) { + self._setCaption(cap); + } else { + self._initCaption(); + } + return; + } + out = self.previewCache.out(); + cap = isInit && self.initialCaption ? self.initialCaption : out.caption; + self._setPreviewContent(out.content); + self._setInitThumbAttr(); + self._setCaption(cap); + self._initSortable(); + if (!$h.isEmpty(out.content)) { + self.$container.removeClass('file-input-new'); + } + self._initPreviewImageOrientations(); + }, + _getZoomButton: function (type) { + var self = this, label = self.previewZoomButtonIcons[type], css = self.previewZoomButtonClasses[type], + title = ' title="' + (self.previewZoomButtonTitles[type] || '') + '" ', + params = title + (type === 'close' ? ' data-dismiss="modal" aria-hidden="true"' : ''); + if (type === 'fullscreen' || type === 'borderless' || type === 'toggleheader') { + params += ' data-toggle="button" aria-pressed="false" autocomplete="off"'; + } + return ''; + }, + _getModalContent: function () { + var self = this; + return self._getLayoutTemplate('modal').setTokens({ + 'rtl': self.rtl ? ' kv-rtl' : '', + 'zoomFrameClass': self.frameClass, + 'heading': self.msgZoomModalHeading, + 'prev': self._getZoomButton('prev'), + 'next': self._getZoomButton('next'), + 'toggleheader': self._getZoomButton('toggleheader'), + 'fullscreen': self._getZoomButton('fullscreen'), + 'borderless': self._getZoomButton('borderless'), + 'close': self._getZoomButton('close') + }); + }, + _listenModalEvent: function (event) { + var self = this, $modal = self.$modal, getParams = function (e) { + return { + sourceEvent: e, + previewId: $modal.data('previewId'), + modal: $modal + }; + }; + $modal.on(event + '.bs.modal', function (e) { + var $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'); + self._raise('filezoom' + event, getParams(e)); + if (event === 'shown') { + $btnBord.removeClass('active').attr('aria-pressed', 'false'); + $btnFull.removeClass('active').attr('aria-pressed', 'false'); + if ($modal.hasClass('file-zoom-fullscreen')) { + self._maximizeZoomDialog(); + if ($h.checkFullScreen()) { + $btnFull.addClass('active').attr('aria-pressed', 'true'); + } else { + $btnBord.addClass('active').attr('aria-pressed', 'true'); + } + } + } + }); + }, + _initZoom: function () { + var self = this, $dialog, modalMain = self._getLayoutTemplate('modalMain'), modalId = '#' + $h.MODAL_ID; + if (!self.showPreview) { + return; + } + self.$modal = $(modalId); + if (!self.$modal || !self.$modal.length) { + $dialog = $(document.createElement('div')).html(modalMain).insertAfter(self.$container); + self.$modal = $(modalId).insertBefore($dialog); + $dialog.remove(); + } + $h.initModal(self.$modal); + self.$modal.html(self._getModalContent()); + $.each($h.MODAL_EVENTS, function (key, event) { + self._listenModalEvent(event); + }); + }, + _initZoomButtons: function () { + var self = this, previewId = self.$modal.data('previewId') || '', $first, $last, + thumbs = self.getFrames().toArray(), len = thumbs.length, $prev = self.$modal.find('.btn-prev'), + $next = self.$modal.find('.btn-next'); + if (thumbs.length < 2) { + $prev.hide(); + $next.hide(); + return; + } else { + $prev.show(); + $next.show(); + } + if (!len) { + return; + } + $first = $(thumbs[0]); + $last = $(thumbs[len - 1]); + $prev.removeAttr('disabled'); + $next.removeAttr('disabled'); + if ($first.length && $first.attr('id') === previewId) { + $prev.attr('disabled', true); + } + if ($last.length && $last.attr('id') === previewId) { + $next.attr('disabled', true); + } + }, + _maximizeZoomDialog: function () { + var self = this, $modal = self.$modal, $head = $modal.find('.modal-header:visible'), + $foot = $modal.find('.modal-footer:visible'), $body = $modal.find('.modal-body'), + h = $(window).height(), diff = 0; + $modal.addClass('file-zoom-fullscreen'); + if ($head && $head.length) { + h -= $head.outerHeight(true); + } + if ($foot && $foot.length) { + h -= $foot.outerHeight(true); + } + if ($body && $body.length) { + diff = $body.outerHeight(true) - $body.height(); + h -= diff; + } + $modal.find('.kv-zoom-body').height(h); + }, + _resizeZoomDialog: function (fullScreen) { + var self = this, $modal = self.$modal, $btnFull = $modal.find('.btn-fullscreen'), + $btnBord = $modal.find('.btn-borderless'); + if ($modal.hasClass('file-zoom-fullscreen')) { + $h.toggleFullScreen(false); + if (!fullScreen) { + if (!$btnFull.hasClass('active')) { + $modal.removeClass('file-zoom-fullscreen'); + self.$modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); + } else { + $btnFull.removeClass('active').attr('aria-pressed', 'false'); + } + } else { + if (!$btnFull.hasClass('active')) { + $modal.removeClass('file-zoom-fullscreen'); + self._resizeZoomDialog(true); + if ($btnBord.hasClass('active')) { + $btnBord.removeClass('active').attr('aria-pressed', 'false'); + } + } + } + } else { + if (!fullScreen) { + self._maximizeZoomDialog(); + return; + } + $h.toggleFullScreen(true); + } + $modal.focus(); + }, + _setZoomContent: function ($frame, animate) { + var self = this, $content, tmplt, body, title, $body, $dataEl, config, previewId = $frame.attr('id'), + $zoomPreview = self.$preview.find('#zoom-' + previewId), $modal = self.$modal, $tmp, + $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), cap, size, + $btnTogh = $modal.find('.btn-toggleheader'); + tmplt = $zoomPreview.attr('data-template') || 'generic'; + $content = $zoomPreview.find('.kv-file-content'); + body = $content.length ? $content.html() : ''; + cap = $frame.data('caption') || ''; + size = $frame.data('size') || ''; + title = cap + ' ' + size; + $modal.find('.kv-zoom-title').attr('title', $('
    ').html(title).text()).html(title); + $body = $modal.find('.kv-zoom-body'); + $modal.removeClass('kv-single-content'); + if (animate) { + $tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body); + $body.html(body).hide(); + $tmp.fadeOut('fast', function () { + $body.fadeIn('fast', function () { + $body.removeClass('file-thumb-loading'); + }); + $tmp.remove(); + }); + } else { + $body.html(body); + } + config = self.previewZoomSettings[tmplt]; + if (config) { + $dataEl = $body.find('.kv-preview-data'); + $h.addCss($dataEl, 'file-zoom-detail'); + $.each(config, function (key, value) { + $dataEl.css(key, value); + if (($dataEl.attr('width') && key === 'width') || ($dataEl.attr('height') && key === 'height')) { + $dataEl.removeAttr(key); + } + }); + } + $modal.data('previewId', previewId); + self._handler($modal.find('.btn-prev'), 'click', function () { + self._zoomSlideShow('prev', previewId); + }); + self._handler($modal.find('.btn-next'), 'click', function () { + self._zoomSlideShow('next', previewId); + }); + self._handler($btnFull, 'click', function () { + self._resizeZoomDialog(true); + }); + self._handler($btnBord, 'click', function () { + self._resizeZoomDialog(false); + }); + self._handler($btnTogh, 'click', function () { + var $header = $modal.find('.modal-header'), $floatBar = $modal.find('.modal-body .floating-buttons'), + ht, $actions = $header.find('.kv-zoom-actions'), resize = function (height) { + var $body = self.$modal.find('.kv-zoom-body'), h = self.zoomModalHeight; + if ($modal.hasClass('file-zoom-fullscreen')) { + h = $body.outerHeight(true); + if (!height) { + h = h - $header.outerHeight(true); + } + } + $body.css('height', height ? h + height : h); + }; + if ($header.is(':visible')) { + ht = $header.outerHeight(true); + $header.slideUp('slow', function () { + $actions.find('.btn').appendTo($floatBar); + resize(ht); + }); + } else { + $floatBar.find('.btn').appendTo($actions); + $header.slideDown('slow', function () { + resize(); + }); + } + $modal.focus(); + }); + self._handler($modal, 'keydown', function (e) { + var key = e.which || e.keyCode, $prev = $(this).find('.btn-prev'), $next = $(this).find('.btn-next'), + vId = $(this).data('previewId'), vPrevKey = self.rtl ? 39 : 37, vNextKey = self.rtl ? 37 : 39; + if (key === vPrevKey && $prev.length && !$prev.attr('disabled')) { + self._zoomSlideShow('prev', vId); + } + if (key === vNextKey && $next.length && !$next.attr('disabled')) { + self._zoomSlideShow('next', vId); + } + }); + }, + _zoomPreview: function ($btn) { + var self = this, $frame, $modal = self.$modal; + if (!$btn.length) { + throw 'Cannot zoom to detailed preview!'; + } + $h.initModal($modal); + $modal.html(self._getModalContent()); + $frame = $btn.closest($h.FRAMES); + self._setZoomContent($frame); + $modal.modal('show'); + self._initZoomButtons(); + }, + _zoomSlideShow: function (dir, previewId) { + var self = this, $btn = self.$modal.find('.kv-zoom-actions .btn-' + dir), $targFrame, i, + thumbs = self.getFrames().toArray(), len = thumbs.length, out; + if ($btn.attr('disabled')) { + return; + } + for (i = 0; i < len; i++) { + if ($(thumbs[i]).attr('id') === previewId) { + out = dir === 'prev' ? i - 1 : i + 1; + break; + } + } + if (out < 0 || out >= len || !thumbs[out]) { + return; + } + $targFrame = $(thumbs[out]); + if ($targFrame.length) { + self._setZoomContent($targFrame, true); + } + self._initZoomButtons(); + self._raise('filezoom' + dir, {'previewId': previewId, modal: self.$modal}); + }, + _initZoomButton: function () { + var self = this; + self.$preview.find('.kv-file-zoom').each(function () { + var $el = $(this); + self._handler($el, 'click', function () { + self._zoomPreview($el); + }); + }); + }, + _inputFileCount: function () { + return this.$element.get(0).files.length; + }, + _refreshPreview: function () { + var self = this, files; + if ((!self._inputFileCount() && !self.isAjaxUpload) || !self.showPreview || !self.isPreviewable) { + return; + } + if (self.isAjaxUpload) { + if (self.fileManager.count() > 0) { + files = $.extend(true, {}, self.fileManager.stack); + self.fileManager.clear(); + self._clearFileInput(); + } else { + files = self.$element.get(0).files; + } + } else { + files = self.$element.get(0).files; + } + if (files && files.length) { + self.readFiles(files); + self._setFileDropZoneTitle(); + } + }, + _clearObjects: function ($el) { + $el.find('video audio').each(function () { + this.pause(); + $(this).remove(); + }); + $el.find('img object div').each(function () { + $(this).remove(); + }); + }, + _clearFileInput: function () { + var self = this, $el = self.$element, $srcFrm, $tmpFrm, $tmpEl; + if (!self._inputFileCount()) { + return; + } + $srcFrm = $el.closest('form'); + $tmpFrm = $(document.createElement('form')); + $tmpEl = $(document.createElement('div')); + $el.before($tmpEl); + if ($srcFrm.length) { + $srcFrm.after($tmpFrm); + } else { + $tmpEl.after($tmpFrm); + } + $tmpFrm.append($el).trigger('reset'); + $tmpEl.before($el).remove(); + $tmpFrm.remove(); + }, + _resetUpload: function () { + var self = this; + self.uploadCache = {content: [], config: [], tags: [], append: true}; + self.$btnUpload.removeAttr('disabled'); + self._setProgress(0); + self.$progress.hide(); + self._resetErrors(false); + self._initAjax(); + self.fileManager.clearImages(); + self._resetCanvas(); + self.cacheInitialPreview = {}; + if (self.overwriteInitial) { + self.initialPreview = []; + self.initialPreviewConfig = []; + self.initialPreviewThumbTags = []; + self.previewCache.data = { + content: [], + config: [], + tags: [] + }; + } + }, + _resetCanvas: function () { + var self = this; + if (self.canvas && self.imageCanvasContext) { + self.imageCanvasContext.clearRect(0, 0, self.canvas.width, self.canvas.height); + } + }, + _hasInitialPreview: function () { + var self = this; + return !self.overwriteInitial && self.previewCache.count(true); + }, + _resetPreview: function () { + var self = this, out, cap; + if (self.previewCache.count(true)) { + out = self.previewCache.out(); + self._setPreviewContent(out.content); + self._setInitThumbAttr(); + cap = self.initialCaption ? self.initialCaption : out.caption; + self._setCaption(cap); + } else { + self._clearPreview(); + self._initCaption(); + } + if (self.showPreview) { + self._initZoom(); + self._initSortable(); + } + }, + _clearDefaultPreview: function () { + var self = this; + self.$preview.find('.file-default-preview').remove(); + }, + _validateDefaultPreview: function () { + var self = this; + if (!self.showPreview || $h.isEmpty(self.defaultPreviewContent)) { + return; + } + self._setPreviewContent('
    ' + self.defaultPreviewContent + '
    '); + self.$container.removeClass('file-input-new'); + self._initClickable(); + }, + _resetPreviewThumbs: function (isAjax) { + var self = this, out; + if (isAjax) { + self._clearPreview(); + self.clearFileStack(); + return; + } + if (self._hasInitialPreview()) { + out = self.previewCache.out(); + self._setPreviewContent(out.content); + self._setInitThumbAttr(); + self._setCaption(out.caption); + self._initPreviewActions(); + } else { + self._clearPreview(); + } + }, + _getLayoutTemplate: function (t) { + var self = this, template = self.layoutTemplates[t]; + if ($h.isEmpty(self.customLayoutTags)) { + return template; + } + return $h.replaceTags(template, self.customLayoutTags); + }, + _getPreviewTemplate: function (t) { + var self = this, template = self.previewTemplates[t]; + if ($h.isEmpty(self.customPreviewTags)) { + return template; + } + return $h.replaceTags(template, self.customPreviewTags); + }, + _getOutData: function (formdata, jqXHR, responseData, filesData) { + var self = this; + jqXHR = jqXHR || {}; + responseData = responseData || {}; + filesData = filesData || self.fileManager.list(); + return { + formdata: formdata, + files: filesData, + filenames: self.filenames, + filescount: self.getFilesCount(), + extra: self._getExtraData(), + response: responseData, + reader: self.reader, + jqXHR: jqXHR + }; + }, + _getMsgSelected: function (n) { + var self = this, strFiles = n === 1 ? self.fileSingle : self.filePlural; + return n > 0 ? self.msgSelected.replace('{n}', n).replace('{files}', strFiles) : self.msgNoFilesSelected; + }, + _getFrame: function (id) { + var self = this, $frame = $('#' + id); + if (!$frame.length) { + self._log($h.logMessages.invalidThumb, {id: id}); + return null; + } + return $frame; + }, + _getThumbs: function (css) { + css = css || ''; + return this.getFrames(':not(.file-preview-initial)' + css); + }, + _getExtraData: function (fileId, index) { + var self = this, data = self.uploadExtraData; + if (typeof self.uploadExtraData === 'function') { + data = self.uploadExtraData(fileId, index); + } + return data; + }, + _initXhr: function (xhrobj, fileId, fileCount) { + var self = this, fm = self.fileManager, func = function (event) { + var pct = 0, total = event.total, loaded = event.loaded || event.position, + stats = fm.getUploadStats(fileId, loaded, total); + /** @namespace event.lengthComputable */ + if (event.lengthComputable && !self.enableResumableUpload) { + pct = $h.round(loaded / total * 100); + } + if (fileId) { + self._setFileUploadStats(fileId, pct, fileCount, stats); + } else { + self._setProgress(pct, null, null, self._getStats(stats)); + } + self._raise('fileajaxprogress', [stats]); + }; + if (xhrobj.upload) { + if (self.progressDelay) { + func = $h.debounce(func, self.progressDelay); + } + xhrobj.upload.addEventListener('progress', func, false); + } + return xhrobj; + }, + _initAjaxSettings: function () { + var self = this; + self._ajaxSettings = $.extend(true, {}, self.ajaxSettings); + self._ajaxDeleteSettings = $.extend(true, {}, self.ajaxDeleteSettings); + }, + _mergeAjaxCallback: function (funcName, srcFunc, type) { + var self = this, settings = self._ajaxSettings, flag = self.mergeAjaxCallbacks, targFunc; + if (type === 'delete') { + settings = self._ajaxDeleteSettings; + flag = self.mergeAjaxDeleteCallbacks; + } + targFunc = settings[funcName]; + if (flag && typeof targFunc === 'function') { + if (flag === 'before') { + settings[funcName] = function () { + targFunc.apply(this, arguments); + srcFunc.apply(this, arguments); + }; + } else { + settings[funcName] = function () { + srcFunc.apply(this, arguments); + targFunc.apply(this, arguments); + }; + } + } else { + settings[funcName] = srcFunc; + } + }, + _ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, formdata, fileId, index, vUrl) { + var self = this, settings, defaults, data, processQueue; + if (!self._raise('filepreajax', [formdata, fileId, index])) { + return; + } + formdata.append('initialPreview', JSON.stringify(self.initialPreview)); + formdata.append('initialPreviewConfig', JSON.stringify(self.initialPreviewConfig)); + formdata.append('initialPreviewThumbTags', JSON.stringify(self.initialPreviewThumbTags)); + self._initAjaxSettings(); + self._mergeAjaxCallback('beforeSend', fnBefore); + self._mergeAjaxCallback('success', fnSuccess); + self._mergeAjaxCallback('complete', fnComplete); + self._mergeAjaxCallback('error', fnError); + vUrl = vUrl || self.uploadUrlThumb || self.uploadUrl; + if (typeof vUrl === 'function') { + vUrl = vUrl(); + } + data = self._getExtraData(fileId, index) || {}; + if (typeof data === 'object') { + $.each(data, function (key, value) { + formdata.append(key, value); + }); + } + defaults = { + xhr: function () { + var xhrobj = $.ajaxSettings.xhr(); + return self._initXhr(xhrobj, fileId, self.fileManager.count()); + }, + url: self._encodeURI(vUrl), + type: 'POST', + dataType: 'json', + data: formdata, + cache: false, + processData: false, + contentType: false + }; + settings = $.extend(true, {}, defaults, self._ajaxSettings); + self.ajaxQueue.push(settings); + processQueue = function () { + var config, xhr; + if (self.ajaxCurrentThreads < self.maxAjaxThreads) { + config = self.ajaxQueue.shift(); + if (typeof config !== 'undefined') { + self.ajaxCurrentThreads++; + xhr = $.ajax(config).done(function () { + clearInterval(self.ajaxQueueIntervalId); + self.ajaxCurrentThreads--; + }); + self.ajaxRequests.push(xhr); + } + } + }; + self.ajaxQueueIntervalId = setInterval(processQueue, self.queueDelay); + + }, + _mergeArray: function (prop, content) { + var self = this, arr1 = $h.cleanArray(self[prop]), arr2 = $h.cleanArray(content); + self[prop] = arr1.concat(arr2); + }, + _initUploadSuccess: function (out, $thumb, allFiles) { + var self = this, append, data, index, $div, $newCache, content, config, tags, i; + if (!self.showPreview || typeof out !== 'object' || $.isEmptyObject(out)) { + return; + } + if (out.initialPreview !== undefined && out.initialPreview.length > 0) { + self.hasInitData = true; + content = out.initialPreview || []; + config = out.initialPreviewConfig || []; + tags = out.initialPreviewThumbTags || []; + append = out.append === undefined || out.append; + if (content.length > 0 && !$h.isArray(content)) { + content = content.split(self.initialPreviewDelimiter); + } + if (content.length) { + self._mergeArray('initialPreview', content); + self._mergeArray('initialPreviewConfig', config); + self._mergeArray('initialPreviewThumbTags', tags); + } + if ($thumb !== undefined) { + if (!allFiles) { + index = self.previewCache.add(content[0], config[0], tags[0], append); + data = self.previewCache.get(index, false); + $div = $(document.createElement('div')).html(data).hide().insertAfter($thumb); + $newCache = $div.find('.kv-zoom-cache'); + if ($newCache && $newCache.length) { + $newCache.insertAfter($thumb); + } + $thumb.fadeOut('slow', function () { + var $newThumb = $div.find('.file-preview-frame'); + if ($newThumb && $newThumb.length) { + $newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block'); + } + self._initPreviewActions(); + self._clearFileInput(); + $h.cleanZoomCache(self.$preview.find('#zoom-' + $thumb.attr('id'))); + $thumb.remove(); + $div.remove(); + self._initSortable(); + }); + } else { + i = $thumb.attr('data-fileindex'); + self.uploadCache.content[i] = content[0]; + self.uploadCache.config[i] = config[0] || []; + self.uploadCache.tags[i] = tags[0] || []; + self.uploadCache.append = append; + } + } else { + self.previewCache.set(content, config, tags, append); + self._initPreview(); + self._initPreviewActions(); + } + } + }, + _initSuccessThumbs: function () { + var self = this; + if (!self.showPreview) { + return; + } + self._getThumbs($h.FRAMES + '.file-preview-success').each(function () { + var $thumb = $(this), $preview = self.$preview, $remove = $thumb.find('.kv-file-remove'); + $remove.removeAttr('disabled'); + self._handler($remove, 'click', function () { + var id = $thumb.attr('id'), + out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]); + $h.cleanMemory($thumb); + if (out === false) { + return; + } + $thumb.fadeOut('slow', function () { + $h.cleanZoomCache($preview.find('#zoom-' + id)); + $thumb.remove(); + if (!self.getFrames().length) { + self.reset(); + } + }); + }); + }); + }, + _updateInitialPreview: function () { + var self = this, u = self.uploadCache, i, j, len = 0, data = self.cacheInitialPreview; + if (data && data.content) { + len = data.content.length; + } + if (self.showPreview) { + self.previewCache.set(u.content, u.config, u.tags, u.append); + if (len) { + for (i = 0; i < u.content.length; i++) { + j = i + len; + data.content[j] = u.content[i]; + //noinspection JSUnresolvedVariable + if (data.config.length) { + data.config[j] = u.config[i]; + } + if (data.tags.length) { + data.tags[j] = u.tags[i]; + } + } + self.initialPreview = $h.cleanArray(data.content); + self.initialPreviewConfig = $h.cleanArray(data.config); + self.initialPreviewThumbTags = $h.cleanArray(data.tags); + } else { + self.initialPreview = u.content; + self.initialPreviewConfig = u.config; + self.initialPreviewThumbTags = u.tags; + } + self.cacheInitialPreview = {}; + if (self.hasInitData) { + self._initPreview(); + self._initPreviewActions(); + } + } + }, + _uploadSingle: function (i, id, isBatch) { + var self = this, fm = self.fileManager, count = fm.count(), formdata = new FormData(), outData, + previewId = self.previewInitId + '-' + i, $thumb, chkComplete, $btnUpload, $btnDelete, + hasPostData = count > 0 || !$.isEmptyObject(self.uploadExtraData), uploadFailed, $prog, fnBefore, + errMsg, fnSuccess, fnComplete, fnError, updateUploadLog, op = self.ajaxOperations.uploadThumb, + fileObj = fm.getFile(id), params = {id: previewId, index: i, fileId: id}, + fileName = self.fileManager.getFileName(id, true); + if (self.enableResumableUpload) { // not enabled for resumable uploads + return; + } + if (self.showPreview) { + $thumb = self.fileManager.getThumb(id); + $prog = $thumb.find('.file-thumb-progress'); + $btnUpload = $thumb.find('.kv-file-upload'); + $btnDelete = $thumb.find('.kv-file-remove'); + $prog.show(); + } + if (count === 0 || !hasPostData || (self.showPreview && $btnUpload && $btnUpload.hasClass('disabled')) || + self._abort(params)) { + return; + } + updateUploadLog = function () { + if (!uploadFailed) { + fm.removeFile(id); + } else { + fm.errors.push(id); + } + fm.setProcessed(id); + if (fm.isProcessed()) { + self.fileBatchCompleted = true; + } + }; + chkComplete = function () { + var $initThumbs; + if (!self.fileBatchCompleted) { + return; + } + setTimeout(function () { + var triggerReset = fm.count() === 0, errCount = fm.errors.length; + self._updateInitialPreview(); + self.unlock(triggerReset); + if (triggerReset) { + self._clearFileInput(); + } + $initThumbs = self.$preview.find('.file-preview-initial'); + if (self.uploadAsync && $initThumbs.length) { + $h.addCss($initThumbs, $h.SORT_CSS); + self._initSortable(); + } + self._raise('filebatchuploadcomplete', [fm.stack, self._getExtraData()]); + if (!self.retryErrorUploads || errCount === 0) { + fm.clear(); + } + self._setProgress(101); + self.ajaxAborted = false; + }, self.processDelay); + }; + fnBefore = function (jqXHR) { + outData = self._getOutData(formdata, jqXHR); + fm.initStats(id); + self.fileBatchCompleted = false; + if (!isBatch) { + self.ajaxAborted = false; + } + if (self.showPreview) { + if (!$thumb.hasClass('file-preview-success')) { + self._setThumbStatus($thumb, 'Loading'); + $h.addCss($thumb, 'file-uploading'); + } + $btnUpload.attr('disabled', true); + $btnDelete.attr('disabled', true); + } + if (!isBatch) { + self.lock(); + } + if (fm.errors.indexOf(id) !== -1) { + delete fm.errors[id]; + } + self._raise('filepreupload', [outData, previewId, i]); + $.extend(true, params, outData); + if (self._abort(params)) { + jqXHR.abort(); + if (!isBatch) { + self._setThumbStatus($thumb, 'New'); + $thumb.removeClass('file-uploading'); + $btnUpload.removeAttr('disabled'); + $btnDelete.removeAttr('disabled'); + self.unlock(); + } + self._setProgressCancelled(); + } + }; + fnSuccess = function (data, textStatus, jqXHR) { + var pid = self.showPreview && $thumb.attr('id') ? $thumb.attr('id') : previewId; + outData = self._getOutData(formdata, jqXHR, data); + $.extend(true, params, outData); + setTimeout(function () { + if ($h.isEmpty(data) || $h.isEmpty(data.error)) { + if (self.showPreview) { + self._setThumbStatus($thumb, 'Success'); + $btnUpload.hide(); + self._initUploadSuccess(data, $thumb, isBatch); + self._setProgress(101, $prog); + } + self._raise('fileuploaded', [outData, pid, i]); + if (!isBatch) { + self.fileManager.remove($thumb); + } else { + updateUploadLog(); + } + } else { + uploadFailed = true; + errMsg = self._parseError(op, jqXHR, self.msgUploadError, self.fileManager.getFileName(id)); + self._showFileError(errMsg, params); + self._setPreviewError($thumb, true); + if (!self.retryErrorUploads) { + $btnUpload.hide(); + } + if (isBatch) { + updateUploadLog(); + } + self._setProgress(101, $('#' + pid).find('.file-thumb-progress'), self.msgUploadError); + } + }, self.processDelay); + }; + fnComplete = function () { + setTimeout(function () { + if (self.showPreview) { + $btnUpload.removeAttr('disabled'); + $btnDelete.removeAttr('disabled'); + $thumb.removeClass('file-uploading'); + } + if (!isBatch) { + self.unlock(false); + self._clearFileInput(); + } else { + chkComplete(); + } + self._initSuccessThumbs(); + }, self.processDelay); + }; + fnError = function (jqXHR, textStatus, errorThrown) { + errMsg = self._parseError(op, jqXHR, errorThrown, self.fileManager.getFileName(id)); + uploadFailed = true; + setTimeout(function () { + if (isBatch) { + updateUploadLog(); + } + self.fileManager.setProgress(id, 100); + self._setPreviewError($thumb, true); + if (!self.retryErrorUploads) { + $btnUpload.hide(); + } + $.extend(true, params, self._getOutData(formdata, jqXHR)); + self._setProgress(101, $prog, self.msgAjaxProgressError.replace('{operation}', op)); + self._setProgress(101, $thumb.find('.file-thumb-progress'), self.msgUploadError); + self._showFileError(errMsg, params); + }, self.processDelay); + }; + formdata.append(self.uploadFileAttr, fileObj.file, fileName); + self._setUploadData(formdata, {fileId: id}); + self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata, id, i); + }, + _uploadBatch: function () { + var self = this, fm = self.fileManager, total = fm.total(), params = {}, fnBefore, fnSuccess, fnError, + fnComplete, hasPostData = total > 0 || !$.isEmptyObject(self.uploadExtraData), errMsg, + setAllUploaded, formdata = new FormData(), op = self.ajaxOperations.uploadBatch; + if (total === 0 || !hasPostData || self._abort(params)) { + return; + } + setAllUploaded = function () { + self.fileManager.clear(); + self._clearFileInput(); + }; + fnBefore = function (jqXHR) { + self.lock(); + fm.initStats(); + var outData = self._getOutData(formdata, jqXHR); + self.ajaxAborted = false; + if (self.showPreview) { + self._getThumbs().each(function () { + var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), + $btnDelete = $thumb.find('.kv-file-remove'); + if (!$thumb.hasClass('file-preview-success')) { + self._setThumbStatus($thumb, 'Loading'); + $h.addCss($thumb, 'file-uploading'); + } + $btnUpload.attr('disabled', true); + $btnDelete.attr('disabled', true); + }); + } + self._raise('filebatchpreupload', [outData]); + if (self._abort(outData)) { + jqXHR.abort(); + self._getThumbs().each(function () { + var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), + $btnDelete = $thumb.find('.kv-file-remove'); + if ($thumb.hasClass('file-preview-loading')) { + self._setThumbStatus($thumb, 'New'); + $thumb.removeClass('file-uploading'); + } + $btnUpload.removeAttr('disabled'); + $btnDelete.removeAttr('disabled'); + }); + self._setProgressCancelled(); + } + }; + fnSuccess = function (data, textStatus, jqXHR) { + /** @namespace data.errorkeys */ + var outData = self._getOutData(formdata, jqXHR, data), key = 0, + $thumbs = self._getThumbs(':not(.file-preview-success)'), + keys = $h.isEmpty(data) || $h.isEmpty(data.errorkeys) ? [] : data.errorkeys; + + if ($h.isEmpty(data) || $h.isEmpty(data.error)) { + self._raise('filebatchuploadsuccess', [outData]); + setAllUploaded(); + if (self.showPreview) { + $thumbs.each(function () { + var $thumb = $(this); + self._setThumbStatus($thumb, 'Success'); + $thumb.removeClass('file-uploading'); + $thumb.find('.kv-file-upload').hide().removeAttr('disabled'); + }); + self._initUploadSuccess(data); + } else { + self.reset(); + } + self._setProgress(101); + } else { + if (self.showPreview) { + $thumbs.each(function () { + var $thumb = $(this); + $thumb.removeClass('file-uploading'); + $thumb.find('.kv-file-upload').removeAttr('disabled'); + $thumb.find('.kv-file-remove').removeAttr('disabled'); + if (keys.length === 0 || $.inArray(key, keys) !== -1) { + self._setPreviewError($thumb, true); + if (!self.retryErrorUploads) { + $thumb.find('.kv-file-upload').hide(); + self.fileManager.remove($thumb); + } + } else { + $thumb.find('.kv-file-upload').hide(); + self._setThumbStatus($thumb, 'Success'); + self.fileManager.remove($thumb); + } + if (!$thumb.hasClass('file-preview-error') || self.retryErrorUploads) { + key++; + } + }); + self._initUploadSuccess(data); + } + errMsg = self._parseError(op, jqXHR, self.msgUploadError); + self._showFileError(errMsg, outData, 'filebatchuploaderror'); + self._setProgress(101, self.$progress, self.msgUploadError); + } + }; + fnComplete = function () { + self.unlock(); + self._initSuccessThumbs(); + self._clearFileInput(); + self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); + }; + fnError = function (jqXHR, textStatus, errorThrown) { + var outData = self._getOutData(formdata, jqXHR); + errMsg = self._parseError(op, jqXHR, errorThrown); + self._showFileError(errMsg, outData, 'filebatchuploaderror'); + self.uploadFileCount = total - 1; + if (!self.showPreview) { + return; + } + self._getThumbs().each(function () { + var $thumb = $(this); + $thumb.removeClass('file-uploading'); + if (self.fileManager.getFile($thumb.attr('data-fileid'))) { + self._setPreviewError($thumb); + } + }); + self._getThumbs().removeClass('file-uploading'); + self._getThumbs(' .kv-file-upload').removeAttr('disabled'); + self._getThumbs(' .kv-file-delete').removeAttr('disabled'); + self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); + }; + var ctr = 0; + $.each(self.fileManager.stack, function (key, data) { + if (!$h.isEmpty(data.file)) { + formdata.append(self.uploadFileAttr, data.file, (data.nameFmt || ('untitled_' + ctr))); + } + ctr++; + }); + self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); + }, + _uploadExtraOnly: function () { + var self = this, params = {}, fnBefore, fnSuccess, fnComplete, fnError, formdata = new FormData(), errMsg, + op = self.ajaxOperations.uploadExtra; + if (self._abort(params)) { + return; + } + fnBefore = function (jqXHR) { + self.lock(); + var outData = self._getOutData(formdata, jqXHR); + self._raise('filebatchpreupload', [outData]); + self._setProgress(50); + params.data = outData; + params.xhr = jqXHR; + if (self._abort(params)) { + jqXHR.abort(); + self._setProgressCancelled(); + } + }; + fnSuccess = function (data, textStatus, jqXHR) { + var outData = self._getOutData(formdata, jqXHR, data); + if ($h.isEmpty(data) || $h.isEmpty(data.error)) { + self._raise('filebatchuploadsuccess', [outData]); + self._clearFileInput(); + self._initUploadSuccess(data); + self._setProgress(101); + } else { + errMsg = self._parseError(op, jqXHR, self.msgUploadError); + self._showFileError(errMsg, outData, 'filebatchuploaderror'); + } + }; + fnComplete = function () { + self.unlock(); + self._clearFileInput(); + self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); + }; + fnError = function (jqXHR, textStatus, errorThrown) { + var outData = self._getOutData(formdata, jqXHR); + errMsg = self._parseError(op, jqXHR, errorThrown); + params.data = outData; + self._showFileError(errMsg, outData, 'filebatchuploaderror'); + self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); + }; + self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); + }, + _deleteFileIndex: function ($frame) { + var self = this, ind = $frame.attr('data-fileindex'), rev = self.reversePreviewOrder; + if (ind.substring(0, 5) === 'init_') { + ind = parseInt(ind.replace('init_', '')); + self.initialPreview = $h.spliceArray(self.initialPreview, ind, rev); + self.initialPreviewConfig = $h.spliceArray(self.initialPreviewConfig, ind, rev); + self.initialPreviewThumbTags = $h.spliceArray(self.initialPreviewThumbTags, ind, rev); + self.getFrames().each(function () { + var $nFrame = $(this), nInd = $nFrame.attr('data-fileindex'); + if (nInd.substring(0, 5) === 'init_') { + nInd = parseInt(nInd.replace('init_', '')); + if (nInd > ind) { + nInd--; + $nFrame.attr('data-fileindex', 'init_' + nInd); + } + } + }); + if (self.uploadAsync || self.enableResumableUpload) { + self.cacheInitialPreview = self.getPreview(); + } + } + }, + _initFileActions: function () { + var self = this, $preview = self.$preview; + if (!self.showPreview) { + return; + } + self._initZoomButton(); + self.getFrames(' .kv-file-remove').each(function () { + var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'), + ind = $frame.attr('data-fileindex'), n, cap, status; + self._handler($el, 'click', function () { + status = self._raise('filepreremove', [id, ind]); + if (status === false || !self._validateMinCount()) { + return false; + } + hasError = $frame.hasClass('file-preview-error'); + $h.cleanMemory($frame); + $frame.fadeOut('slow', function () { + $h.cleanZoomCache($preview.find('#zoom-' + id)); + self.fileManager.remove($frame); + self._clearObjects($frame); + $frame.remove(); + if (id && hasError) { + self.$errorContainer.find('li[data-thumb-id="' + id + '"]').fadeOut('fast', function () { + $(this).remove(); + if (!self._errorsExist()) { + self._resetErrors(); + } + }); + } + self._clearFileInput(); + var chk = self.previewCache.count(true), len = self.fileManager.count(), + file, hasThumb = self.showPreview && self.getFrames().length; + if (len === 0 && chk === 0 && !hasThumb) { + self.reset(); + } else { + n = chk + len; + if (n > 1) { + cap = self._getMsgSelected(n); + } else { + file = self.fileManager.getFirstFile(); + cap = file ? file.nameFmt : '_'; + } + self._setCaption(cap); + } + self._raise('fileremoved', [id, ind]); + }); + }); + }); + self.getFrames(' .kv-file-upload').each(function () { + var $el = $(this); + self._handler($el, 'click', function () { + var $frame = $el.closest($h.FRAMES), id = $frame.attr('data-fileid'); + self.$progress.hide(); + if ($frame.hasClass('file-preview-error') && !self.retryErrorUploads) { + return; + } + self._uploadSingle(self.fileManager.getIndex(id), id, false); + }); + }); + }, + _initPreviewActions: function () { + var self = this, $preview = self.$preview, deleteExtraData = self.deleteExtraData || {}, + btnRemove = $h.FRAMES + ' .kv-file-remove', settings = self.fileActionSettings, + origClass = settings.removeClass, errClass = settings.removeErrorClass, + resetProgress = function () { + var hasFiles = self.isAjaxUpload ? self.previewCache.count(true) : self._inputFileCount(); + if (!self.getFrames().length && !hasFiles) { + self._setCaption(''); + self.reset(); + self.initialCaption = ''; + } + }; + self._initZoomButton(); + $preview.find(btnRemove).each(function () { + var $el = $(this), vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'), errMsg, fnBefore, + fnSuccess, fnError, op = self.ajaxOperations.deleteThumb; + if ($h.isEmpty(vUrl) || vKey === undefined) { + return; + } + if (typeof vUrl === 'function') { + vUrl = vUrl(); + } + var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data, settings, params, config, + fileName, extraData, index = $frame.attr('data-fileindex'); + index = parseInt(index.replace('init_', '')); + 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; + fileName = config.filename || config.caption || ''; + if (typeof extraData === 'function') { + extraData = extraData(); + } + params = {id: $el.attr('id'), key: vKey, extra: extraData}; + fnBefore = function (jqXHR) { + self.ajaxAborted = false; + self._raise('filepredelete', [vKey, jqXHR, extraData]); + if (self._abort()) { + jqXHR.abort(); + } else { + $el.removeClass(errClass); + $h.addCss($frame, 'file-uploading'); + $h.addCss($el, 'disabled ' + origClass); + } + }; + fnSuccess = function (data, textStatus, jqXHR) { + var n, cap; + if (!$h.isEmpty(data) && !$h.isEmpty(data.error)) { + params.jqXHR = jqXHR; + params.response = data; + errMsg = self._parseError(op, jqXHR, self.msgDeleteError, fileName); + self._showFileError(errMsg, params, 'filedeleteerror'); + $frame.removeClass('file-uploading'); + $el.removeClass('disabled ' + origClass).addClass(errClass); + resetProgress(); + return; + } + $frame.removeClass('file-uploading').addClass('file-deleted'); + $frame.fadeOut('slow', function () { + index = parseInt(($frame.attr('data-fileindex')).replace('init_', '')); + self.previewCache.unset(index); + self._deleteFileIndex($frame); + n = self.previewCache.count(true); + cap = n > 0 ? self._getMsgSelected(n) : ''; + self._setCaption(cap); + self._raise('filedeleted', [vKey, jqXHR, extraData]); + $h.cleanZoomCache($preview.find('#zoom-' + $frame.attr('id'))); + self._clearObjects($frame); + $frame.remove(); + resetProgress(); + }); + }; + fnError = function (jqXHR, textStatus, errorThrown) { + var errMsg = self._parseError(op, jqXHR, errorThrown, fileName); + params.jqXHR = jqXHR; + params.response = {}; + self._showFileError(errMsg, params, 'filedeleteerror'); + $frame.removeClass('file-uploading'); + $el.removeClass('disabled ' + origClass).addClass(errClass); + resetProgress(); + }; + self._initAjaxSettings(); + self._mergeAjaxCallback('beforeSend', fnBefore, 'delete'); + self._mergeAjaxCallback('success', fnSuccess, 'delete'); + self._mergeAjaxCallback('error', fnError, 'delete'); + settings = $.extend(true, {}, { + url: self._encodeURI(vUrl), + type: 'POST', + dataType: 'json', + data: $.extend(true, {}, {key: vKey}, extraData) + }, self._ajaxDeleteSettings); + self._handler($el, 'click', function () { + if (!self._validateMinCount()) { + return false; + } + self.ajaxAborted = false; + self._raise('filebeforedelete', [vKey, extraData]); + //noinspection JSUnresolvedVariable,JSHint + if (self.ajaxAborted instanceof Promise) { + self.ajaxAborted.then(function (result) { + if (!result) { + $.ajax(settings); + } + }); + } else { + if (!self.ajaxAborted) { + $.ajax(settings); + } + } + }); + }); + }, + _hideFileIcon: function () { + var self = this; + if (self.overwriteInitial) { + self.$captionContainer.removeClass('icon-visible'); + } + }, + _showFileIcon: function () { + var self = this; + $h.addCss(self.$captionContainer, 'icon-visible'); + }, + _getSize: function (bytes, sizes) { + var self = this, size = parseFloat(bytes), i, func = self.fileSizeGetter, out; + if (!$.isNumeric(bytes) || !$.isNumeric(size)) { + return ''; + } + if (typeof func === 'function') { + out = func(size); + } else { + if (size === 0) { + out = '0.00 B'; + } else { + i = Math.floor(Math.log(size) / Math.log(1024)); + if (!sizes) { + sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + } + out = (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]; + } + } + 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, + fileId, + isError, + size, + frameClass, + foot, + ind, + templ, + attrs, + zoomData + ) { + var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '', + screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, + config, newCat = self.preferIconicPreview ? 'other' : cat, title = caption, alt = caption, + footer = foot || self._renderFileFooter(cat, caption, size, 'auto', isError), + hasIconSetting = self._getPreviewIcon(fname), typeCss = 'type-default', + forcePrevIcon = hasIconSetting && self.preferIconicPreview, + forceZoomIcon = hasIconSetting && self.preferIconicZoomPreview, getContent; + config = screenW < 400 ? (self.previewSettingsSmall[newCat] || self.defaults.previewSettingsSmall[newCat]) : + (self.previewSettings[newCat] || self.defaults.previewSettings[newCat]); + if (config) { + $.each(config, function (key, val) { + styleAttribs += key + ':' + val + ';'; + }); + } + getContent = function (c, d, zoom, frameCss) { + var id = zoom ? 'zoom-' + previewId : previewId, tmplt = self._getPreviewTemplate(c), + css = (frameClass || '') + ' ' + frameCss; + if (self.frameClass) { + css = self.frameClass + ' ' + css; + } + if (zoom) { + css = css.replace(' ' + $h.SORT_CSS, ''); + } + tmplt = self._parseFilePreviewIcon(tmplt, fname); + if (c === 'text') { + d = $h.htmlEncode(d); + } + if (cat === 'object' && !ftype) { + $.each(self.defaults.fileTypeSettings, function (key, func) { + if (key === 'object' || key === 'other') { + return; + } + if (func(fname, ftype)) { + typeCss = 'type-' + key; + } + }); + } + if (!$h.isEmpty(attrs)) { + if (attrs.title !== undefined && attrs.title !== null) { + title = attrs.title; + } + if (attrs.alt !== undefined && attrs.alt !== null) { + title = attrs.alt; + } + } + return tmplt.setTokens({ + 'previewId': id, + 'caption': caption, + 'title': title, + 'alt': alt, + 'frameClass': css, + 'type': self._getFileType(ftype), + 'fileindex': ind, + 'fileid': fileId || '', + 'typeCss': typeCss, + 'footer': footer, + 'data': d, + 'template': templ || cat, + 'style': styleAttribs ? 'style="' + styleAttribs + '"' : '' + }); + }; + ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1); + if (self.fileActionSettings.showZoom) { + zoomContent = getContent((forceZoomIcon ? 'other' : cat), zoomData ? zoomData : data, true, + 'kv-zoom-thumb'); + } + zoomContent = '\n' + self._getLayoutTemplate('zoomCache').replace('{zoomContent}', zoomContent); + if (typeof self.sanitizeZoomCache === 'function') { + zoomContent = self.sanitizeZoomCache(zoomContent); + } + prevContent = getContent((forcePrevIcon ? 'other' : cat), data, false, 'kv-preview-thumb'); + return prevContent + zoomContent; + }, + _addToPreview: function ($preview, content) { + var self = this; + return self.reversePreviewOrder ? $preview.prepend(content) : $preview.append(content); + }, + _previewDefault: function (file, previewId, isDisabled) { + var self = this, $preview = self.$preview; + if (!self.showPreview) { + return; + } + var fname = $h.getFileName(file), ftype = file ? file.type : '', content, size = file.size || 0, + caption = self._getFileName(file, ''), isError = isDisabled === true && !self.isAjaxUpload, + data = $h.createObjectURL(file), fileId = self.fileManager.getId(file); + self._clearDefaultPreview(); + content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, fileId, isError, size); + self._addToPreview($preview, content); + self._setThumbAttr(previewId, caption, size); + if (isDisabled === true && self.isAjaxUpload) { + self._setThumbStatus($('#' + previewId), 'Error'); + } + }, + canPreview: function (file) { + var self = this; + if (!file || !self.showPreview || !self.$preview || !self.$preview.length) { + return false; + } + var name = file.name || '', type = file.type || '', size = (file.size || 0) / 1000, + cat = self._parseFileType(type, name), allowedTypes, allowedMimes, allowedExts, skipPreview, + types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes, + exts = self.allowedPreviewExtensions || [], dTypes = self.disabledPreviewTypes, + dMimes = self.disabledPreviewMimeTypes, dExts = self.disabledPreviewExtensions || [], + maxSize = self.maxFilePreviewSize && parseFloat(self.maxFilePreviewSize) || 0, + expAllExt = new RegExp('\\.(' + exts.join('|') + ')$', 'i'), + expDisExt = new RegExp('\\.(' + dExts.join('|') + ')$', 'i'); + allowedTypes = !types || types.indexOf(cat) !== -1; + allowedMimes = !mimes || mimes.indexOf(type) !== -1; + allowedExts = !exts.length || $h.compare(name, expAllExt); + skipPreview = (dTypes && dTypes.indexOf(cat) !== -1) || (dMimes && dMimes.indexOf(type) !== -1) || + (dExts.length && $h.compare(name, expDisExt)) || (maxSize && !isNaN(maxSize) && size > maxSize); + return !skipPreview && (allowedTypes || allowedMimes || allowedExts); + }, + _previewFile: function (i, file, theFile, previewId, data, fileInfo) { + if (!this.showPreview) { + return; + } + var self = this, fname = $h.getFileName(file), ftype = fileInfo.type, caption = fileInfo.name, + cat = self._parseFileType(ftype, fname), content, $preview = self.$preview, fsize = file.size || 0, + iData = (cat === 'text' || cat === 'html' || cat === 'image') ? theFile.target.result : data, + fileId = self.fileManager.getId(file); + /** @namespace window.DOMPurify */ + if (cat === 'html' && self.purifyHtml && window.DOMPurify) { + iData = window.DOMPurify.sanitize(iData); + } + content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, fileId, false, fsize); + self._clearDefaultPreview(); + self._addToPreview($preview, content); + var $thumb = $preview.find('#' + previewId), $img = $thumb.find('img'), id = $thumb.attr('data-fileid'); + self._validateImageOrientation($img, file, previewId, id, caption, ftype, fsize, iData); + self._setThumbAttr(previewId, caption, fsize); + self._initSortable(); + }, + _setThumbAttr: function (id, caption, size) { + var self = this, $frame = $('#' + id); + if ($frame.length) { + size = size && size > 0 ? self._getSize(size) : ''; + $frame.data({'caption': caption, 'size': size}); + } + }, + _setInitThumbAttr: function () { + var self = this, data = self.previewCache.data, len = self.previewCache.count(true), config, + caption, size, previewId; + if (len === 0) { + return; + } + for (var i = 0; i < len; i++) { + config = data.config[i]; + previewId = self.previewInitId + '-' + 'init_' + i; + caption = $h.ifSet('caption', config, $h.ifSet('filename', config)); + size = $h.ifSet('size', config); + self._setThumbAttr(previewId, caption, size); + } + }, + _slugDefault: function (text) { + // noinspection RegExpRedundantEscape + return $h.isEmpty(text) ? '' : String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_'); + }, + _updateFileDetails: function (numFiles) { + var self = this, $el = self.$element, label, n, log, nFiles, file, + name = ($h.isIE(9) && $h.findFileName($el.val())) || ($el[0].files[0] && $el[0].files[0].name); + if (!name && self.fileManager.count() > 0) { + file = self.fileManager.getFirstFile(); + label = file.nameFmt; + } else { + label = name ? self.slug(name) : '_'; + } + n = self.isAjaxUpload ? self.fileManager.count() : numFiles; + nFiles = self.previewCache.count(true) + n; + log = n === 1 ? label : self._getMsgSelected(nFiles); + if (self.isError) { + self.$previewContainer.removeClass('file-thumb-loading'); + self.$previewStatus.html(''); + self.$captionContainer.removeClass('icon-visible'); + } else { + self._showFileIcon(); + } + self._setCaption(log, self.isError); + self.$container.removeClass('file-input-new file-input-ajax-new'); + if (arguments.length === 1) { + self._raise('fileselect', [numFiles, label]); + } + if (self.previewCache.count(true)) { + self._initPreviewActions(); + } + }, + _setThumbStatus: function ($thumb, status) { + var self = this; + if (!self.showPreview) { + return; + } + var icon = 'indicator' + status, msg = icon + 'Title', + css = 'file-preview-' + status.toLowerCase(), + $indicator = $thumb.find('.file-upload-indicator'), + config = self.fileActionSettings; + $thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading'); + if (status === 'Success') { + $thumb.find('.file-drag-handle').remove(); + } + $indicator.html(config[icon]); + $indicator.attr('title', config[msg]); + $thumb.addClass(css); + if (status === 'Error' && !self.retryErrorUploads) { + $thumb.find('.kv-file-upload').attr('disabled', true); + } + }, + _setProgressCancelled: function () { + var self = this; + self._setProgress(101, self.$progress, self.msgCancelled); + }, + _setProgress: function (p, $el, error, stats) { + var self = this; + $el = $el || self.$progress; + if (!$el.length) { + return; + } + var pct = Math.min(p, 100), out, pctLimit = self.progressUploadThreshold, + t = p <= 100 ? self.progressTemplate : self.progressCompleteTemplate, + template = pct < 100 ? self.progressTemplate : + (error ? (self.paused ? self.progressPauseTemplate : self.progressErrorTemplate) : t); + if (p >= 100) { + stats = ''; + } + if (!$h.isEmpty(template)) { + if (pctLimit && pct > pctLimit && p <= 100) { + out = template.setTokens({'percent': pctLimit, 'status': self.msgUploadThreshold}); + } else { + out = template.setTokens({'percent': pct, 'status': (p > 100 ? self.msgUploadEnd : pct + '%')}); + } + stats = stats || ''; + out = out.setTokens({stats: stats}); + $el.html(out); + if (error) { + $el.find('[role="progressbar"]').html(error); + } + } + }, + _setFileDropZoneTitle: function () { + var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles; + if (self.isClickable) { + strFiles = $h.isEmpty(self.$element.attr('multiple')) ? self.fileSingle : self.filePlural; + title += self.dropZoneClickTitle.replace('{files}', strFiles); + } + $zone.find('.' + self.dropZoneTitleClass).remove(); + if (!self.showPreview || $zone.length === 0 || self.fileManager.count() > 0 || !self.dropZoneEnabled || + (!self.isAjaxUpload && self.$element.files)) { + return; + } + if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) { + $zone.prepend('
    ' + title + '
    '); + } + self.$container.removeClass('file-input-new'); + $h.addCss(self.$container, 'file-input-ajax-new'); + }, + _getStats: function (stats) { + var self = this, pendingTime, t; + if (!self.showUploadStats || !stats || !stats.bitrate) { + return ''; + } + t = self._getLayoutTemplate('stats'); + pendingTime = (!stats.elapsed || !stats.bps) ? self.msgCalculatingTime : + self.msgPendingTime.setTokens({time: $h.getElapsed(Math.ceil(stats.pendingBytes / stats.bps))}); + + return t.setTokens({ + uploadSpeed: stats.bitrate, + pendingTime: pendingTime + }); + }, + _setResumableProgress: function (pct, stats, $thumb) { + var self = this, rm = self.resumableManager, obj = $thumb ? rm : self, + $prog = $thumb ? $thumb.find('.file-thumb-progress') : null; + if (obj.lastProgress === 0) { + obj.lastProgress = pct; + } + if (pct < obj.lastProgress) { + pct = obj.lastProgress; + } + self._setProgress(pct, $prog, null, self._getStats(stats)); + obj.lastProgress = pct; + }, + _setFileUploadStats: function (id, pct, total, stats) { + var self = this, $prog = self.$progress; + if (!self.showPreview && (!$prog || !$prog.length)) { + return; + } + var fm = self.fileManager, $thumb = fm.getThumb(id), pctTot, rm = self.resumableManager, + totUpSize = 0, totSize = fm.getTotalSize(), totStats = $.extend(true, {}, stats); + if (self.enableResumableUpload) { + var loaded = stats.loaded, currUplSize = rm.getUploadedSize(), currTotSize = rm.file.size, totLoaded; + loaded += currUplSize; + totLoaded = fm.uploadedSize + loaded; + pct = $h.round(100 * loaded / currTotSize); + stats.pendingBytes = currTotSize - currUplSize; + self._setResumableProgress(pct, stats, $thumb); + pctTot = Math.floor(100 * totLoaded / totSize); + totStats.pendingBytes = totSize - totLoaded; + self._setResumableProgress(pctTot, totStats); + } else { + fm.setProgress(id, pct); + $prog = $thumb && $thumb.length ? $thumb.find('.file-thumb-progress') : null; + self._setProgress(pct, $prog, null, self._getStats(stats)); + $.each(fm.stats, function (id, cfg) { + totUpSize += cfg.loaded; + }); + totStats.pendingBytes = totSize - totUpSize; + pctTot = $h.round(totUpSize / totSize * 100); + self._setProgress(pctTot, null, null, self._getStats(totStats)); + } + }, + _validateMinCount: function () { + var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); + if (self.validateInitialCount && self.minFileCount > 0 && self._getFileCount(len - 1) < self.minFileCount) { + self._noFilesError({}); + return false; + } + return true; + }, + _getFileCount: function (fileCount) { + var self = this, addCount = 0; + if (self.validateInitialCount && !self.overwriteInitial) { + addCount = self.previewCache.count(true); + fileCount += addCount; + } + return fileCount; + }, + _getFileId: function (file) { + return $h.getFileId(file, this.generateFileId); + }, + _getFileName: function (file, defaultValue) { + var self = this, fileName = $h.getFileName(file); + return fileName ? self.slug(fileName) : defaultValue; + }, + _getFileNames: function (skipNull) { + var self = this; + return self.filenames.filter(function (n) { + return (skipNull ? n !== undefined : n !== undefined && n !== null); + }); + }, + _setPreviewError: function ($thumb, keepFile) { + var self = this, removeFrame = self.removeFromPreviewOnError && !self.retryErrorUploads; + if (!keepFile || removeFrame) { + self.fileManager.remove($thumb); + } + if (!self.showPreview) { + return; + } + if (removeFrame) { + $thumb.remove(); + return; + } else { + self._setThumbStatus($thumb, 'Error'); + } + self._refreshUploadButton($thumb); + }, + _refreshUploadButton: function ($thumb) { + var self = this, $btn = $thumb.find('.kv-file-upload'), cfg = self.fileActionSettings, + icon = cfg.uploadIcon, title = cfg.uploadTitle; + if (!$btn.length) { + return; + } + if (self.retryErrorUploads) { + icon = cfg.uploadRetryIcon; + title = cfg.uploadRetryTitle; + } + $btn.attr('title', title).html(icon); + }, + _checkDimensions: function (i, chk, $img, $thumb, fname, type, params) { + var self = this, msg, dim, tag = chk === 'Small' ? 'min' : 'max', limit = self[tag + 'Image' + type], + $imgEl, isValid; + if ($h.isEmpty(limit) || !$img.length) { + return; + } + $imgEl = $img[0]; + dim = (type === 'Width') ? $imgEl.naturalWidth || $imgEl.width : $imgEl.naturalHeight || $imgEl.height; + isValid = chk === 'Small' ? dim >= limit : dim <= limit; + if (isValid) { + return; + } + msg = self['msgImage' + type + chk].setTokens({'name': fname, 'size': limit}); + self._showFileError(msg, params); + self._setPreviewError($thumb); + }, + _getExifObj: function (data) { + var self = this, exifObj = null, error = $h.logMessages.exifWarning; + if (data.slice(0, 23) !== 'data:image/jpeg;base64,' && data.slice(0, 22) !== 'data:image/jpg;base64,') { + exifObj = null; + return; + } + try { + exifObj = window.piexif ? window.piexif.load(data) : null; + } catch (err) { + exifObj = null; + error = err && err.message || ''; + } + if (!exifObj) { + self._log($h.logMessages.badExifParser, {details: error}); + } + return exifObj; + }, + setImageOrientation: function ($img, $zoomImg, value, $thumb) { + var self = this, invalidImg = !$img || !$img.length, invalidZoomImg = !$zoomImg || !$zoomImg.length, $mark, + isHidden = false, $div, zoomOnly = invalidImg && $thumb && $thumb.attr('data-template') === 'image', ev; + if (invalidImg && invalidZoomImg) { + return; + } + ev = 'load.fileinputimageorient'; + if (zoomOnly) { + $img = $zoomImg; + $zoomImg = null; + $img.css(self.previewSettings.image); + $div = $(document.createElement('div')).appendTo($thumb.find('.kv-file-content')); + $mark = $(document.createElement('span')).insertBefore($img); + $img.css('visibility', 'hidden').removeClass('file-zoom-detail').appendTo($div); + } else { + isHidden = !$img.is(':visible'); + } + $img.off(ev).on(ev, function () { + if (isHidden) { + self.$preview.removeClass('hide-content'); + $thumb.find('.kv-file-content').css('visibility', 'hidden'); + } + var img = $img.get(0), zoomImg = $zoomImg && $zoomImg.length ? $zoomImg.get(0) : null, + h = img.offsetHeight, w = img.offsetWidth, r = $h.getRotation(value); + if (isHidden) { + $thumb.find('.kv-file-content').css('visibility', 'visible'); + self.$preview.addClass('hide-content'); + } + $img.data('orientation', value); + if (zoomImg) { + $zoomImg.data('orientation', value); + } + if (value < 5) { + $h.setTransform(img, r); + $h.setTransform(zoomImg, r); + return; + } + var offsetAngle = Math.atan(w / h), origFactor = Math.sqrt(Math.pow(h, 2) + Math.pow(w, 2)), + scale = !origFactor ? 1 : (h / Math.cos(Math.PI / 2 + offsetAngle)) / origFactor, + s = ' scale(' + Math.abs(scale) + ')'; + $h.setTransform(img, r + s); + $h.setTransform(zoomImg, r + s); + if (zoomOnly) { + $img.css('visibility', 'visible').insertAfter($mark).addClass('file-zoom-detail'); + $mark.remove(); + $div.remove(); + } + }); + }, + _validateImageOrientation: function ($img, file, previewId, fileId, caption, ftype, fsize, iData) { + var self = this, exifObj, value, autoOrientImage = self.autoOrientImage; + exifObj = autoOrientImage ? self._getExifObj(iData) : null; + value = exifObj ? exifObj['0th'][piexif.ImageIFD.Orientation] : null; // jshint ignore:line + if (!value) { + self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); + return; + } + self.setImageOrientation($img, $('#zoom-' + previewId + ' img'), value, $('#' + previewId)); + self._raise('fileimageoriented', {'$img': $img, 'file': file}); + self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); + }, + _validateImage: function (previewId, fileId, fname, ftype, fsize, iData, exifObj) { + var self = this, $preview = self.$preview, params, w1, w2, $thumb = $preview.find('#' + previewId), + i = $thumb.attr('data-fileindex'), $img = $thumb.find('img'); + fname = fname || 'Untitled'; + $img.one('load', function () { + w1 = $thumb.width(); + w2 = $preview.width(); + if (w1 > w2) { + $img.css('width', '100%'); + } + params = {ind: i, id: previewId, fileId: fileId}; + self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Width', params); + self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Height', params); + if (!self.resizeImage) { + self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Width', params); + self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Height', params); + } + self._raise('fileimageloaded', [previewId]); + self.fileManager.addImage(fileId, { + ind: i, + img: $img, + thumb: $thumb, + pid: previewId, + typ: ftype, + siz: fsize, + validated: false, + imgData: iData, + exifObj: exifObj + }); + $thumb.data('exif', exifObj); + self._validateAllImages(); + }).one('error', function () { + self._raise('fileimageloaderror', [previewId]); + }).each(function () { + if (this.complete) { + $(this).trigger('load'); + } else { + if (this.error) { + $(this).trigger('error'); + } + } + }); + }, + _validateAllImages: function () { + var self = this, counter = {val: 0}, numImgs = self.fileManager.getImageCount(), fsize, + minSize = self.resizeIfSizeMoreThan; + if (numImgs !== self.fileManager.totalImages) { + return; + } + self._raise('fileimagesloaded'); + if (!self.resizeImage) { + return; + } + $.each(self.fileManager.loadedImages, function (id, config) { + if (!config.validated) { + fsize = config.siz; + if (fsize && fsize > minSize * 1000) { + self._getResizedImage(id, config, counter, numImgs); + } + config.validated = true; + } + }); + }, + _getResizedImage: function (id, config, counter, numImgs) { + var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight, blob, + ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height, + isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas, dataURI, + context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind, + $thumb = config.thumb, throwError, msg, exifObj = config.exifObj, exifStr, file, params, evParams; + throwError = function (msg, params, ev) { + if (self.isAjaxUpload) { + self._showFileError(msg, params, ev); + } else { + self._showError(msg, params, ev); + } + self._setPreviewError($thumb); + }; + file = self.fileManager.getFile(id); + params = {id: pid, 'index': ind, fileId: id}; + evParams = [id, pid, ind]; + if (!file || !isValidImage || (width <= maxWidth && height <= maxHeight)) { + if (isValidImage && file) { + self._raise('fileimageresized', evParams); + } + counter.val++; + if (counter.val === numImgs) { + self._raise('fileimagesresized'); + } + if (!isValidImage) { + throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); + return; + } + } + type = type || self.resizeDefaultImageType; + chkWidth = width > maxWidth; + chkHeight = height > maxHeight; + if (self.resizePreference === 'width') { + ratio = chkWidth ? maxWidth / width : (chkHeight ? maxHeight / height : 1); + } else { + ratio = chkHeight ? maxHeight / height : (chkWidth ? maxWidth / width : 1); + } + self._resetCanvas(); + width *= ratio; + height *= ratio; + canvas.width = width; + canvas.height = height; + try { + context.drawImage(img, 0, 0, width, height); + dataURI = canvas.toDataURL(type, self.resizeQuality); + if (exifObj) { + exifStr = window.piexif.dump(exifObj); + dataURI = window.piexif.insert(exifStr, dataURI); + } + blob = $h.dataURI2Blob(dataURI); + self.fileManager.setFile(id, blob); + self._raise('fileimageresized', evParams); + counter.val++; + if (counter.val === numImgs) { + self._raise('fileimagesresized', [undefined, undefined]); + } + if (!(blob instanceof Blob)) { + throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); + } + } + catch (err) { + counter.val++; + if (counter.val === numImgs) { + self._raise('fileimagesresized', [undefined, undefined]); + } + msg = self.msgImageResizeException.replace('{errors}', err.message); + throwError(msg, params, 'fileimageresizeexception'); + } + }, + _initBrowse: function ($container) { + var self = this, $el = self.$element; + if (self.showBrowse) { + self.$btnFile = $container.find('.btn-file').append($el); + } else { + $el.appendTo($container).attr('tabindex', -1); + $h.addCss($el, 'file-no-browse'); + } + }, + _initClickable: function () { + var self = this, $zone, $tmpZone; + if (!self.isClickable) { + return; + } + $zone = self.$dropZone; + if (!self.isAjaxUpload) { + $tmpZone = self.$preview.find('.file-default-preview'); + if ($tmpZone.length) { + $zone = $tmpZone; + } + } + + $h.addCss($zone, 'clickable'); + $zone.attr('tabindex', -1); + self._handler($zone, 'click', function (e) { + var $tar = $(e.target); + if (!$(self.elErrorContainer + ':visible').length && + (!$tar.parents('.file-preview-thumbnails').length || $tar.parents( + '.file-default-preview').length)) { + self.$element.data('zoneClicked', true).trigger('click'); + $zone.blur(); + } + }); + }, + _initCaption: function () { + var self = this, cap = self.initialCaption || ''; + if (self.overwriteInitial || $h.isEmpty(cap)) { + self.$caption.val(''); + return false; + } + self._setCaption(cap); + return true; + }, + _setCaption: function (content, isError) { + var self = this, title, out, icon, n, cap, file; + if (!self.$caption.length) { + return; + } + self.$captionContainer.removeClass('icon-visible'); + if (isError) { + title = $('
    ' + self.msgValidationError + '
    ').text(); + n = self.fileManager.count(); + if (n) { + file = self.fileManager.getFirstFile(); + cap = n === 1 && file ? file.nameFmt : self._getMsgSelected(n); + } else { + cap = self._getMsgSelected(self.msgNo); + } + out = $h.isEmpty(content) ? cap : content; + icon = '' + self.msgValidationErrorIcon + ''; + } else { + if ($h.isEmpty(content)) { + return; + } + title = $('
    ' + content + '
    ').text(); + out = title; + icon = self._getLayoutTemplate('fileIcon'); + } + self.$captionContainer.addClass('icon-visible'); + self.$caption.attr('title', title).val(out); + self.$captionIcon.html(icon); + }, + _createContainer: function () { + var self = this, attribs = {'class': 'file-input file-input-new' + (self.rtl ? ' kv-rtl' : '')}, + $container = $(document.createElement('div')).attr(attribs).html(self._renderMain()); + $container.insertBefore(self.$element); + self._initBrowse($container); + if (self.theme) { + $container.addClass('theme-' + self.theme); + } + return $container; + }, + _refreshContainer: function () { + var self = this, $container = self.$container, $el = self.$element; + $el.insertAfter($container); + $container.html(self._renderMain()); + self._initBrowse($container); + self._validateDisabled(); + }, + _validateDisabled: function () { + var self = this; + self.$caption.attr({readonly: self.isDisabled}); + }, + _renderMain: function () { + var self = this, + dropCss = self.dropZoneEnabled ? ' file-drop-zone' : 'file-drop-disabled', + close = !self.showClose ? '' : self._getLayoutTemplate('close'), + preview = !self.showPreview ? '' : self._getLayoutTemplate('preview') + .setTokens({'class': self.previewClass, 'dropClass': dropCss}), + css = self.isDisabled ? self.captionClass + ' file-caption-disabled' : self.captionClass, + caption = self.captionTemplate.setTokens({'class': css + ' kv-fileinput-caption'}); + return self.mainTemplate.setTokens({ + 'class': self.mainClass + (!self.showBrowse && self.showCaption ? ' no-browse' : ''), + 'preview': preview, + 'close': close, + 'caption': caption, + 'upload': self._renderButton('upload'), + 'remove': self._renderButton('remove'), + 'cancel': self._renderButton('cancel'), + 'pause': self._renderButton('pause'), + 'browse': self._renderButton('browse') + }); + + }, + _renderButton: function (type) { + var self = this, tmplt = self._getLayoutTemplate('btnDefault'), css = self[type + 'Class'], + title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'], + status = self.isDisabled ? ' disabled' : '', btnType = 'button'; + switch (type) { + case 'remove': + if (!self.showRemove) { + return ''; + } + break; + case 'cancel': + if (!self.showCancel) { + return ''; + } + css += ' kv-hidden'; + break; + case 'pause': + if (!self.showPause) { + return ''; + } + css += ' kv-hidden'; + break; + case 'upload': + if (!self.showUpload) { + return ''; + } + if (self.isAjaxUpload && !self.isDisabled) { + tmplt = self._getLayoutTemplate('btnLink').replace('{href}', self.uploadUrl); + } else { + btnType = 'submit'; + } + break; + case 'browse': + if (!self.showBrowse) { + return ''; + } + tmplt = self._getLayoutTemplate('btnBrowse'); + break; + default: + return ''; + } + + css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button'; + if (!$h.isEmpty(label)) { + label = ' ' + label + ''; + } + return tmplt.setTokens({ + 'type': btnType, 'css': css, 'title': title, 'status': status, 'icon': icon, 'label': label + }); + }, + _renderThumbProgress: function () { + var self = this; + return '
    ' + + self.progressInfoTemplate.setTokens({percent: 101, status: self.msgUploadBegin, stats: ''}) + + '
    '; + }, + _renderFileFooter: function (cat, caption, size, width, isError) { + var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag, + upl = config.showUpload, zoom = config.showZoom, out, params, + template = self._getLayoutTemplate('footer'), tInd = self._getLayoutTemplate('indicator'), + ind = isError ? config.indicatorError : config.indicatorNew, + title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle, + indicator = tInd.setTokens({'indicator': ind, 'indicatorTitle': title}); + size = self._getSize(size); + params = {type: cat, caption: caption, size: size, width: width, progress: '', indicator: indicator}; + if (self.isAjaxUpload) { + params.progress = self._renderThumbProgress(); + params.actions = self._renderFileActions(params, upl, false, rem, zoom, drg, false, false, false); + } else { + params.actions = self._renderFileActions(params, false, false, false, zoom, drg, false, false, false); + } + out = template.setTokens(params); + out = $h.replaceTags(out, self.previewThumbTags); + return out; + }, + _renderFileActions: function ( + cfg, + showUpl, + showDwn, + showDel, + showZoom, + showDrag, + disabled, + url, + key, + isInit, + dUrl, + dFile + ) { + var self = this; + if (!cfg.type && isInit) { + cfg.type = 'image'; + } + if (self.enableResumableUpload) { + showUpl = false; + } else { + if (typeof showUpl === 'function') { + showUpl = showUpl(cfg); + } + } + if (typeof showDwn === 'function') { + showDwn = showDwn(cfg); + } + if (typeof showDel === 'function') { + showDel = showDel(cfg); + } + if (typeof showZoom === 'function') { + showZoom = showZoom(cfg); + } + if (typeof showDrag === 'function') { + showDrag = showDrag(cfg); + } + if (!showUpl && !showDwn && !showDel && !showZoom && !showDrag) { + return ''; + } + var vUrl = url === false ? '' : ' data-url="' + url + '"', btnZoom = '', btnDrag = '', css, + vKey = key === false ? '' : ' data-key="' + key + '"', btnDelete = '', btnUpload = '', btnDownload = '', + template = self._getLayoutTemplate('actions'), config = self.fileActionSettings, + otherButtons = self.otherActionButtons.setTokens({'dataKey': vKey, 'key': key}), + removeClass = disabled ? config.removeClass + ' disabled' : config.removeClass; + if (showDel) { + btnDelete = self._getLayoutTemplate('actionDelete').setTokens({ + 'removeClass': removeClass, + 'removeIcon': config.removeIcon, + 'removeTitle': config.removeTitle, + 'dataUrl': vUrl, + 'dataKey': vKey, + 'key': key + }); + } + if (showUpl) { + btnUpload = self._getLayoutTemplate('actionUpload').setTokens({ + 'uploadClass': config.uploadClass, + 'uploadIcon': config.uploadIcon, + 'uploadTitle': config.uploadTitle + }); + } + if (showDwn) { + btnDownload = self._getLayoutTemplate('actionDownload').setTokens({ + 'downloadClass': config.downloadClass, + 'downloadIcon': config.downloadIcon, + 'downloadTitle': config.downloadTitle, + 'downloadUrl': dUrl || self.initialPreviewDownloadUrl + }); + btnDownload = btnDownload.setTokens({'filename': dFile, 'key': key}); + } + if (showZoom) { + btnZoom = self._getLayoutTemplate('actionZoom').setTokens({ + 'zoomClass': config.zoomClass, + 'zoomIcon': config.zoomIcon, + 'zoomTitle': config.zoomTitle + }); + } + if (showDrag && isInit) { + css = 'drag-handle-init ' + config.dragClass; + btnDrag = self._getLayoutTemplate('actionDrag').setTokens({ + 'dragClass': css, + 'dragTitle': config.dragTitle, + 'dragIcon': config.dragIcon + }); + } + return template.setTokens({ + 'delete': btnDelete, + 'upload': btnUpload, + 'download': btnDownload, + 'zoom': btnZoom, + 'drag': btnDrag, + 'other': otherButtons + }); + }, + _browse: function (e) { + var self = this; + if (e && e.isDefaultPrevented() || !self._raise('filebrowse')) { + return; + } + if (self.isError && !self.isAjaxUpload) { + self.clear(); + } + self.$captionContainer.focus(); + }, + _change: function (e) { + var self = this; + if (self.changeTriggered) { + return; + } + var $el = self.$element, isDragDrop = arguments.length > 1, isAjaxUpload = self.isAjaxUpload, + tfiles, files = isDragDrop ? arguments[1] : $el.get(0).files, total, + maxCount = !isAjaxUpload && $h.isEmpty($el.attr('multiple')) ? 1 : self.maxFileCount, + len, ctr = self.fileManager.count(), isSingleUpload = $h.isEmpty($el.attr('multiple')), + flagSingle = (isSingleUpload && ctr > 0), + throwError = function (mesg, file, previewId, index) { + var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), {id: previewId, index: index}), + p2 = {id: previewId, index: index, file: file, files: files}; + return isAjaxUpload ? self._showFileError(mesg, p1) : self._showError(mesg, p2); + }, + maxCountCheck = function (n, m) { + var msg = self.msgFilesTooMany.replace('{m}', m).replace('{n}', n); + self.isError = throwError(msg, null, null, null); + self.$captionContainer.removeClass('icon-visible'); + self._setCaption('', true); + self.$container.removeClass('file-input-new file-input-ajax-new'); + }; + self.reader = null; + self._resetUpload(); + self._hideFileIcon(); + if (self.dropZoneEnabled) { + self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove(); + } + if (!isAjaxUpload) { + if (e.target && e.target.files === undefined) { + files = e.target.value ? [{name: e.target.value.replace(/^.+\\/, '')}] : []; + } else { + files = e.target.files || {}; + } + } + tfiles = files; + if ($h.isEmpty(tfiles) || tfiles.length === 0) { + if (!isAjaxUpload) { + self.clear(); + } + self._raise('fileselectnone'); + return; + } + self._resetErrors(); + len = tfiles.length; + total = self._getFileCount(isAjaxUpload ? (self.fileManager.count() + len) : len); + if (maxCount > 0 && total > maxCount) { + if (!self.autoReplace || len > maxCount) { + maxCountCheck((self.autoReplace && len > maxCount ? len : total), maxCount); + return; + } + if (total > maxCount) { + self._resetPreviewThumbs(isAjaxUpload); + } + } else { + if (!isAjaxUpload || flagSingle) { + self._resetPreviewThumbs(false); + if (flagSingle) { + self.clearFileStack(); + } + } else { + if (isAjaxUpload && ctr === 0 && (!self.previewCache.count(true) || self.overwriteInitial)) { + self._resetPreviewThumbs(true); + } + } + } + self.readFiles(tfiles); + }, + _abort: function (params) { + var self = this, data; + if (self.ajaxAborted && typeof self.ajaxAborted === 'object' && self.ajaxAborted.message !== undefined) { + data = $.extend(true, {}, self._getOutData(null), params); + data.abortData = self.ajaxAborted.data || {}; + data.abortMessage = self.ajaxAborted.message; + self._setProgress(101, self.$progress, self.msgCancelled); + self._showFileError(self.ajaxAborted.message, data, 'filecustomerror'); + self.cancel(); + return true; + } + return !!self.ajaxAborted; + }, + _resetFileStack: function () { + var self = this, i = 0; + self._getThumbs().each(function () { + var $thumb = $(this), ind = $thumb.attr('data-fileindex'), pid = $thumb.attr('id'); + if (ind === '-1' || ind === -1) { + return; + } + if (!self.fileManager.getFile($thumb.attr('data-fileid'))) { + $thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i}); + i++; + } else { + $thumb.attr({'id': 'uploaded-' + $h.uniqId(), 'data-fileindex': '-1'}); + } + self.$preview.find('#zoom-' + pid).attr({ + 'id': 'zoom-' + $thumb.attr('id'), + 'data-fileindex': $thumb.attr('data-fileindex') + }); + }); + }, + _isFileSelectionValid: function (cnt) { + var self = this; + cnt = cnt || 0; + if (self.required && !self.getFilesCount()) { + self.$errorContainer.html(''); + self._showFileError(self.msgFileRequired); + return false; + } + if (self.minFileCount > 0 && self._getFileCount(cnt) < self.minFileCount) { + self._noFilesError({}); + return false; + } + return true; + }, + clearFileStack: function () { + var self = this; + self.fileManager.clear(); + self._initResumableUpload(); + if (self.enableResumableUpload) { + if (self.showPause === null) { + self.showPause = true; + } + if (self.showCancel === null) { + self.showCancel = false; + } + } else { + self.showPause = false; + if (self.showCancel === null) { + self.showCancel = true; + } + } + return self.$element; + }, + getFileStack: function () { + return this.fileManager.stack; + }, + getFileList: function () { + return this.fileManager.list(); + }, + getFilesCount: function () { + var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); + return self._getFileCount(len); + }, + readFiles: function (files) { + this.reader = new FileReader(); + var self = this, $el = self.$element, reader = self.reader, + $container = self.$previewContainer, $status = self.$previewStatus, msgLoading = self.msgLoading, + msgProgress = self.msgProgress, previewInitId = self.previewInitId, numFiles = files.length, + settings = self.fileTypeSettings, ctr = self.fileManager.count(), readFile, + fileTypes = self.allowedFileTypes, typLen = fileTypes ? fileTypes.length : 0, + fileExt = self.allowedFileExtensions, strExt = $h.isEmpty(fileExt) ? '' : fileExt.join(', '), + throwError = function (msg, file, previewId, index, fileId) { + var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), + {id: previewId, index: index, fileId: fileId}), $thumb = $('#' + previewId), + p2 = {id: previewId, index: index, fileId: fileId, file: file, files: files}; + self._previewDefault(file, previewId, true); + if (self.isAjaxUpload) { + setTimeout(function () { + readFile(index + 1); + }, self.processDelay); + } else { + numFiles = 0; + } + self._initFileActions(); + $thumb.remove(); + self.isError = self.isAjaxUpload ? self._showFileError(msg, p1) : self._showError(msg, p2); + self._updateFileDetails(numFiles); + }; + self.fileManager.clearImages(); + $.each(files, function (key, file) { + var func = self.fileTypeSettings.image; + if (func && func(file.type)) { + self.fileManager.totalImages++; + } + }); + readFile = function (i) { + if ($h.isEmpty($el.attr('multiple'))) { + numFiles = 1; + } + if (i >= numFiles) { + if (self.isAjaxUpload && self.fileManager.count() > 0) { + self._raise('filebatchselected', [self.fileManager.stack]); + } else { + self._raise('filebatchselected', [files]); + } + $container.removeClass('file-thumb-loading'); + $status.html(''); + return; + } + var node = ctr + i, previewId = previewInitId + '-' + node, file = files[i], fSizeKB, j, msg, $thumb, + fnText = settings.text, fnImage = settings.image, fnHtml = settings.html, typ, chk, typ1, typ2, + caption = self._getFileName(file, ''), fileSize = (file && file.size || 0) / 1000, + fileExtExpr = '', previewData = $h.createObjectURL(file), fileCount = 0, + strTypes = '', fileId, + func, knownTypes = 0, isText, isHtml, isImage, txtFlag, processFileLoaded = function () { + var msg = msgProgress.setTokens({ + 'index': i + 1, + 'files': numFiles, + 'percent': 50, + 'name': caption + }); + setTimeout(function () { + $status.html(msg); + self._updateFileDetails(numFiles); + readFile(i + 1); + }, self.processDelay); + self._raise('fileloaded', [file, previewId, i, reader]); + }; + if (!file) { + return; + } + fileId = self.fileManager.getId(file); + if (typLen > 0) { + for (j = 0; j < typLen; j++) { + typ1 = fileTypes[j]; + typ2 = self.msgFileTypes[typ1] || typ1; + strTypes += j === 0 ? typ2 : ', ' + typ2; + } + } + if (caption === false) { + readFile(i + 1); + return; + } + if (caption.length === 0) { + msg = self.msgInvalidFileName.replace('{name}', $h.htmlEncode($h.getFileName(file), '[unknown]')); + throwError(msg, file, previewId, i, fileId); + return; + } + if (!$h.isEmpty(fileExt)) { + fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i'); + } + fSizeKB = fileSize.toFixed(2); + if (self.maxFileSize > 0 && fileSize > self.maxFileSize) { + msg = self.msgSizeTooLarge.setTokens({ + 'name': caption, + 'size': fSizeKB, + 'maxSize': self.maxFileSize + }); + throwError(msg, file, previewId, i, fileId); + return; + } + if (self.minFileSize !== null && fileSize <= $h.getNum(self.minFileSize)) { + msg = self.msgSizeTooSmall.setTokens({ + 'name': caption, + 'size': fSizeKB, + 'minSize': self.minFileSize + }); + throwError(msg, file, previewId, i, fileId); + return; + } + if (!$h.isEmpty(fileTypes) && $h.isArray(fileTypes)) { + for (j = 0; j < fileTypes.length; j += 1) { + typ = fileTypes[j]; + func = settings[typ]; + fileCount += !func || (typeof func !== 'function') ? 0 : (func(file.type, + $h.getFileName(file)) ? 1 : 0); + } + if (fileCount === 0) { + msg = self.msgInvalidFileType.setTokens({name: caption, types: strTypes}); + throwError(msg, file, previewId, i, fileId); + return; + } + } + if (fileCount === 0 && !$h.isEmpty(fileExt) && $h.isArray(fileExt) && !$h.isEmpty(fileExtExpr)) { + chk = $h.compare(caption, fileExtExpr); + fileCount += $h.isEmpty(chk) ? 0 : chk.length; + if (fileCount === 0) { + msg = self.msgInvalidFileExtension.setTokens({name: caption, extensions: strExt}); + throwError(msg, file, previewId, i, fileId); + return; + } + } + if (self.isAjaxUpload && self.fileManager.exists(fileId)) { + msg = self.msgDuplicateFile.setTokens({name: caption, size: fSizeKB}); + throwError(msg, file, previewId, i, fileId); + $thumb = $('#' + previewId); + if ($thumb && $thumb.length) { + $thumb.remove(); + } + return; + } + if (!self.canPreview(file)) { + if (self.isAjaxUpload) { + self.fileManager.add(file); + } + if (self.showPreview) { + $container.addClass('file-thumb-loading'); + self._previewDefault(file, previewId); + self._initFileActions(); + } + setTimeout(function () { + self._updateFileDetails(numFiles); + readFile(i + 1); + self._raise('fileloaded', [file, previewId, i]); + }, 10); + return; + } + isText = fnText(file.type, caption); + isHtml = fnHtml(file.type, caption); + isImage = fnImage(file.type, caption); + $status.html(msgLoading.replace('{index}', i + 1).replace('{files}', numFiles)); + $container.addClass('file-thumb-loading'); + reader.onerror = function (evt) { + self._errorHandler(evt, caption); + }; + reader.onload = function (theFile) { + var hex, fileInfo, uint, byte, bytes = [], contents, mime, readTextImage = function (textFlag) { + var newReader = new FileReader(); + newReader.onerror = function (theFileNew) { + self._errorHandler(theFileNew, caption); + }; + newReader.onload = function (theFileNew) { + self._previewFile(i, file, theFileNew, previewId, previewData, fileInfo); + self._initFileActions(); + processFileLoaded(); + }; + if (textFlag) { + newReader.readAsText(file, self.textEncoding); + } else { + newReader.readAsDataURL(file); + } + }; + fileInfo = {'name': caption, 'type': file.type}; + $.each(settings, function (k, f) { + if (k !== 'object' && k !== 'other' && typeof f === 'function' && f(file.type, caption)) { + knownTypes++; + } + }); + if (knownTypes === 0) {// auto detect mime types from content if no known file types detected + uint = new Uint8Array(theFile.target.result); + for (j = 0; j < uint.length; j++) { + byte = uint[j].toString(16); + bytes.push(byte); + } + hex = bytes.join('').toLowerCase().substring(0, 8); + mime = $h.getMimeType(hex, '', ''); + if ($h.isEmpty(mime)) { // look for ascii text content + contents = $h.arrayBuffer2String(reader.result); + mime = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type); + } + fileInfo = {'name': caption, 'type': mime}; + isText = fnText(mime, ''); + isHtml = fnHtml(mime, ''); + isImage = fnImage(mime, ''); + txtFlag = isText || isHtml; + if (txtFlag || isImage) { + readTextImage(txtFlag); + return; + } + } + self._previewFile(i, file, theFile, previewId, previewData, fileInfo); + self._initFileActions(); + processFileLoaded(); + }; + reader.onprogress = function (data) { + if (data.lengthComputable) { + var fact = (data.loaded / data.total) * 100, progress = Math.ceil(fact); + msg = msgProgress.setTokens({ + 'index': i + 1, + 'files': numFiles, + 'percent': progress, + 'name': caption + }); + setTimeout(function () { + $status.html(msg); + }, self.processDelay); + } + }; + + if (isText || isHtml) { + reader.readAsText(file, self.textEncoding); + } else { + if (isImage) { + reader.readAsDataURL(file); + } else { + reader.readAsArrayBuffer(file); + } + } + self.fileManager.add(file); + }; + + readFile(0); + self._updateFileDetails(numFiles, false); + }, + lock: function () { + var self = this, $container = self.$container; + self._resetErrors(); + self.disable(); + $container.addClass('is-locked'); + if (self.showCancel) { + $container.find('.fileinput-cancel').show(); + } + if (self.showPause) { + $container.find('.fileinput-pause').show(); + } + self._raise('filelock', [self.fileManager.stack, self._getExtraData()]); + return self.$element; + }, + unlock: function (reset) { + var self = this, $container = self.$container; + if (reset === undefined) { + reset = true; + } + self.enable(); + $container.removeClass('is-locked'); + if (self.showCancel) { + $container.find('.fileinput-cancel').hide(); + } + if (self.showPause) { + $container.find('.fileinput-pause').hide(); + } + if (reset) { + self._resetFileStack(); + } + self._raise('fileunlock', [self.fileManager.stack, self._getExtraData()]); + return self.$element; + }, + resume: function () { + var self = this, flag = false, $pr = self.$progress, rm = self.resumableManager; + if (!self.enableResumableUpload) { + return self.$element; + } + if (self.paused) { + $pr.html(self.progressPauseTemplate.setTokens({ + percent: 101, + status: self.msgUploadResume, + stats: '' + })); + } else { + flag = true; + } + self.paused = false; + if (flag) { + $pr.html(self.progressInfoTemplate.setTokens({ + percent: 101, + status: self.msgUploadBegin, + stats: '' + })); + } + setTimeout(function () { + rm.upload(); + }, self.processDelay); + return self.$element; + }, + pause: function () { + var self = this, rm = self.resumableManager, xhr = self.ajaxRequests, len = xhr.length, i, + pct = rm.getProgress(), actions = self.fileActionSettings; + if (!self.enableResumableUpload) { + return self.$element; + } + if (rm.chunkIntervalId) { + clearInterval(rm.chunkIntervalId); + } + if (self.ajaxQueueIntervalId) { + clearInterval(self.ajaxQueueIntervalId); + } + self._raise('fileuploadpaused', [self.fileManager, rm]); + if (len > 0) { + for (i = 0; i < len; i += 1) { + self.paused = true; + xhr[i].abort(); + } + } + if (self.showPreview) { + self._getThumbs().each(function () { + var $thumb = $(this), fileId = $thumb.attr('data-fileid'), t = self._getLayoutTemplate('stats'), + stats, $indicator = $thumb.find('.file-upload-indicator'); + $thumb.removeClass('file-uploading'); + if ($indicator.attr('title') === actions.indicatorLoadingTitle) { + self._setThumbStatus($thumb, 'Paused'); + stats = t.setTokens({pendingTime: self.msgPaused, uploadSpeed: ''}); + self.paused = true; + self._setProgress(pct, $thumb.find('.file-thumb-progress'), pct + '%', stats); + } + if (!self.fileManager.getFile(fileId)) { + $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); + } + }); + } + self._setProgress(101, self.$progress, self.msgPaused); + return self.$element; + }, + cancel: function () { + var self = this, xhr = self.ajaxRequests, rm = self.resumableManager, len = xhr.length, i; + if (self.enableResumableUpload && rm.chunkIntervalId) { + clearInterval(rm.chunkIntervalId); + rm.reset(); + self._raise('fileuploadcancelled', [self.fileManager, rm]); + } else { + self._raise('fileuploadcancelled', [self.fileManager]); + } + if (self.ajaxQueueIntervalId) { + clearInterval(self.ajaxQueueIntervalId); + } + self._initAjax(); + if (len > 0) { + for (i = 0; i < len; i += 1) { + self.cancelling = true; + xhr[i].abort(); + } + } + self._getThumbs().each(function () { + var $thumb = $(this), fileId = $thumb.attr('data-fileid'), $prog = $thumb.find('.file-thumb-progress'); + $thumb.removeClass('file-uploading'); + self._setProgress(0, $prog); + $prog.hide(); + if (!self.fileManager.getFile(fileId)) { + $thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled'); + $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); + } + self.unlock(); + }); + setTimeout(function () { + self._setProgressCancelled(); + }, self.processDelay); + return self.$element; + }, + clear: function () { + var self = this, cap; + if (!self._raise('fileclear')) { + return; + } + self.$btnUpload.removeAttr('disabled'); + self._getThumbs().find('video,audio,img').each(function () { + $h.cleanMemory($(this)); + }); + self._clearFileInput(); + self._resetUpload(); + self.clearFileStack(); + self._resetErrors(true); + if (self._hasInitialPreview()) { + self._showFileIcon(); + self._resetPreview(); + self._initPreviewActions(); + self.$container.removeClass('file-input-new'); + } else { + self._getThumbs().each(function () { + self._clearObjects($(this)); + }); + if (self.isAjaxUpload) { + self.previewCache.data = {}; + } + self.$preview.html(''); + cap = (!self.overwriteInitial && self.initialCaption.length > 0) ? self.initialCaption : ''; + self.$caption.attr('title', '').val(cap); + $h.addCss(self.$container, 'file-input-new'); + self._validateDefaultPreview(); + } + if (self.$container.find($h.FRAMES).length === 0) { + if (!self._initCaption()) { + self.$captionContainer.removeClass('icon-visible'); + } + } + self._hideFileIcon(); + self.$captionContainer.focus(); + self._setFileDropZoneTitle(); + self._raise('filecleared'); + return self.$element; + }, + reset: function () { + var self = this; + if (!self._raise('filereset')) { + return; + } + self.lastProgress = 0; + self._resetPreview(); + self.$container.find('.fileinput-filename').text(''); + $h.addCss(self.$container, 'file-input-new'); + if (self.getFrames().length || self.dropZoneEnabled) { + self.$container.removeClass('file-input-new'); + } + self.clearFileStack(); + self._setFileDropZoneTitle(); + return self.$element; + }, + disable: function () { + var self = this; + self.isDisabled = true; + self._raise('filedisabled'); + self.$element.attr('disabled', 'disabled'); + self.$container.find('.kv-fileinput-caption').addClass('file-caption-disabled'); + self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') + .attr('disabled', true); + $h.addCss(self.$container.find('.btn-file'), 'disabled'); + self._initDragDrop(); + return self.$element; + }, + enable: function () { + var self = this; + self.isDisabled = false; + self._raise('fileenabled'); + self.$element.removeAttr('disabled'); + self.$container.find('.kv-fileinput-caption').removeClass('file-caption-disabled'); + self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') + .removeAttr('disabled'); + self.$container.find('.btn-file').removeClass('disabled'); + self._initDragDrop(); + return self.$element; + }, + upload: function () { + var self = this, fm = self.fileManager, totLen = fm.count(), i, outData, len, + hasExtraData = !$.isEmptyObject(self._getExtraData()); + if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) { + return; + } + self.lastProgress = 0; + self._resetUpload(); + if (totLen === 0 && !hasExtraData) { + self._showFileError(self.msgUploadEmpty); + return; + } + self.cancelling = false; + self.$progress.show(); + self.lock(); + len = fm.count(); + if (totLen === 0 && hasExtraData) { + self._setProgress(2); + self._uploadExtraOnly(); + return; + } + if (self.enableResumableUpload) { + return self.resume(); + } + if (self.uploadAsync || self.enableResumableUpload) { + outData = self._getOutData(null); + self._raise('filebatchpreupload', [outData]); + self.fileBatchCompleted = false; + self.uploadCache = {content: [], config: [], tags: [], append: true}; + for (i = 0; i < len; i++) { + self.uploadCache.content[i] = null; + self.uploadCache.config[i] = null; + self.uploadCache.tags[i] = null; + } + self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS); + self._initSortable(); + self.cacheInitialPreview = self.getPreview(); + } + self._setProgress(2); + self.hasInitData = false; + if (self.uploadAsync) { + i = 0; + $.each(fm.stack, function (id) { + self._uploadSingle(i, id, true); + i++; + }); + return; + } + self._uploadBatch(); + return self.$element; + }, + destroy: function () { + var self = this, $form = self.$form, $cont = self.$container, $el = self.$element, ns = self.namespace; + $(document).off(ns); + $(window).off(ns); + if ($form && $form.length) { + $form.off(ns); + } + if (self.isAjaxUpload) { + self._clearFileInput(); + } + self._cleanup(); + self._initPreviewCache(); + $el.insertBefore($cont).off(ns).removeData(); + $cont.off().remove(); + return $el; + }, + refresh: function (options) { + var self = this, $el = self.$element; + if (typeof options !== 'object' || $h.isEmpty(options)) { + options = self.options; + } else { + options = $.extend(true, {}, self.options, options); + } + self._init(options, true); + self._listen(); + return $el; + }, + zoom: function (frameId) { + var self = this, $frame = self._getFrame(frameId), $modal = self.$modal; + if (!$frame) { + return; + } + $h.initModal($modal); + $modal.html(self._getModalContent()); + self._setZoomContent($frame); + $modal.modal('show'); + self._initZoomButtons(); + }, + getExif: function (frameId) { + var self = this, $frame = self._getFrame(frameId); + return $frame && $frame.data('exif') || null; + }, + getFrames: function (cssFilter) { + var self = this, $frames; + cssFilter = cssFilter || ''; + $frames = self.$preview.find($h.FRAMES + cssFilter); + if (self.reversePreviewOrder) { + $frames = $($frames.get().reverse()); + } + return $frames; + }, + getPreview: function () { + var self = this; + return { + content: self.initialPreview, + config: self.initialPreviewConfig, + tags: self.initialPreviewThumbTags + }; + } + }; + + $.fn.fileinput = function (option) { + if (!$h.hasFileAPISupport() && !$h.isIE(9)) { + return; + } + var args = Array.apply(null, arguments), retvals = []; + args.shift(); + this.each(function () { + var self = $(this), data = self.data('fileinput'), options = typeof option === 'object' && option, + theme = options.theme || self.data('theme'), l = {}, t = {}, + lang = options.language || self.data('language') || $.fn.fileinput.defaults.language || 'en', opt; + if (!data) { + if (theme) { + t = $.fn.fileinputThemes[theme] || {}; + } + if (lang !== 'en' && !$h.isEmpty($.fn.fileinputLocales[lang])) { + l = $.fn.fileinputLocales[lang] || {}; + } + opt = $.extend(true, {}, $.fn.fileinput.defaults, t, $.fn.fileinputLocales.zh, l, options, self.data()); + data = new FileInput(this, opt); + self.data('fileinput', data); + } + + if (typeof option === 'string') { + retvals.push(data[option].apply(data, args)); + } + }); + switch (retvals.length) { + case 0: + return this; + case 1: + return retvals[0]; + default: + return retvals; + } + }; + + //noinspection HtmlUnknownAttribute + $.fn.fileinput.defaults = { + language: 'en', + showCaption: true, + showBrowse: true, + showPreview: true, + showRemove: true, + showUpload: true, + showUploadStats: true, + showCancel: null, + showPause: null, + showClose: true, + showUploadedThumbs: true, + browseOnZoneClick: false, + autoReplace: false, + autoOrientImage: function () { // applicable for JPEG images only and non ios safari + var ua = window.navigator.userAgent, webkit = !!ua.match(/WebKit/i), + iOS = !!ua.match(/iP(od|ad|hone)/i), iOSSafari = iOS && webkit && !ua.match(/CriOS/i); + return !iOSSafari; + }, + autoOrientImageInitial: true, + required: false, + rtl: false, + hideThumbnailContent: false, + encodeUrl: true, + generateFileId: null, + previewClass: '', + captionClass: '', + frameClass: 'krajee-default', + mainClass: 'file-caption-main', + mainTemplate: null, + purifyHtml: true, + fileSizeGetter: null, + initialCaption: '', + initialPreview: [], + initialPreviewDelimiter: '*$$*', + initialPreviewAsData: false, + initialPreviewFileType: 'image', + initialPreviewConfig: [], + initialPreviewThumbTags: [], + previewThumbTags: {}, + initialPreviewShowDelete: true, + initialPreviewDownloadUrl: '', + removeFromPreviewOnError: false, + deleteUrl: '', + deleteExtraData: {}, + overwriteInitial: true, + sanitizeZoomCache: function (content) { + var $container = $(document.createElement('div')).append(content); + $container.find('input,select,.file-thumbnail-footer').remove(); + return $container.html(); + }, + previewZoomButtonIcons: { + prev: '', + next: '', + toggleheader: '', + fullscreen: '', + borderless: '', + close: '' + }, + previewZoomButtonClasses: { + prev: 'btn btn-navigate', + next: 'btn btn-navigate', + toggleheader: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + fullscreen: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + borderless: 'btn btn-sm btn-kv btn-default btn-outline-secondary', + close: 'btn btn-sm btn-kv btn-default btn-outline-secondary' + }, + previewTemplates: {}, + previewContentTemplates: {}, + preferIconicPreview: false, + preferIconicZoomPreview: false, + allowedFileTypes: null, + allowedFileExtensions: null, + allowedPreviewTypes: undefined, + allowedPreviewMimeTypes: null, + allowedPreviewExtensions: null, + disabledPreviewTypes: undefined, + disabledPreviewExtensions: ['msi', 'exe', 'com', 'zip', 'rar', 'app', 'vb', 'scr'], + disabledPreviewMimeTypes: null, + defaultPreviewContent: null, + customLayoutTags: {}, + customPreviewTags: {}, + previewFileIcon: '', + previewFileIconClass: 'file-other-icon', + previewFileIconSettings: {}, + previewFileExtSettings: {}, + buttonLabelClass: 'hidden-xs', + browseIcon: ' ', + browseClass: 'btn btn-primary', + removeIcon: '', + removeClass: 'btn btn-default btn-secondary', + cancelIcon: '', + cancelClass: 'btn btn-default btn-secondary', + pauseIcon: '', + pauseClass: 'btn btn-default btn-secondary', + uploadIcon: '', + uploadClass: 'btn btn-default btn-secondary', + uploadUrl: null, + uploadUrlThumb: null, + uploadAsync: true, + uploadParamNames: { + chunkCount: 'chunkCount', + chunkIndex: 'chunkIndex', + chunkSize: 'chunkSize', + chunkSizeStart: 'chunkSizeStart', + chunksUploaded: 'chunksUploaded', + fileBlob: 'fileBlob', + fileId: 'fileId', + fileName: 'fileName', + fileRelativePath: 'fileRelativePath', + fileSize: 'fileSize', + retryCount: 'retryCount' + }, + maxAjaxThreads: 5, + processDelay: 100, + queueDelay: 10, // must be lesser than process delay + progressDelay: 0, // must be lesser than process delay + enableResumableUpload: false, + resumableUploadOptions: { + fallback: null, + testUrl: null, // used for checking status of chunks/ files previously / partially uploaded + chunkSize: 2 * 1024, // in KB + maxThreads: 4, + maxRetries: 3, + showErrorLog: true + }, + uploadExtraData: {}, + zoomModalHeight: 480, + minImageWidth: null, + minImageHeight: null, + maxImageWidth: null, + maxImageHeight: null, + resizeImage: false, + resizePreference: 'width', + resizeQuality: 0.92, + resizeDefaultImageType: 'image/jpeg', + resizeIfSizeMoreThan: 0, // in KB + minFileSize: 0, + maxFileSize: 0, + maxFilePreviewSize: 25600, // 25 MB + minFileCount: 0, + maxFileCount: 0, + validateInitialCount: false, + msgValidationErrorClass: 'text-danger', + msgValidationErrorIcon: ' ', + msgErrorClass: 'file-error-message', + progressThumbClass: 'progress-bar progress-bar-striped active', + progressClass: 'progress-bar bg-success progress-bar-success progress-bar-striped active', + progressInfoClass: 'progress-bar bg-info progress-bar-info progress-bar-striped active', + progressCompleteClass: 'progress-bar bg-success progress-bar-success', + progressPauseClass: 'progress-bar bg-primary progress-bar-primary progress-bar-striped active', + progressErrorClass: 'progress-bar bg-danger progress-bar-danger', + progressUploadThreshold: 99, + previewFileType: 'image', + elCaptionContainer: null, + elCaptionText: null, + elPreviewContainer: null, + elPreviewImage: null, + elPreviewStatus: null, + elErrorContainer: null, + errorCloseButton: $h.closeButton('kv-error-close'), + slugCallback: null, + dropZoneEnabled: true, + dropZoneTitleClass: 'file-drop-zone-title', + fileActionSettings: {}, + otherActionButtons: '', + textEncoding: 'UTF-8', + ajaxSettings: {}, + ajaxDeleteSettings: {}, + showAjaxErrorDetails: true, + mergeAjaxCallbacks: false, + mergeAjaxDeleteCallbacks: false, + retryErrorUploads: true, + reversePreviewOrder: false, + usePdfRenderer: function () { + //noinspection JSUnresolvedVariable + var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; + return !!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i) || isIE11; + }, + pdfRendererUrl: '', + pdfRendererTemplate: '' + }; + + // noinspection HtmlUnknownAttribute + $.fn.fileinputLocales.en = { + fileSingle: 'file', + filePlural: 'files', + browseLabel: 'Browse …', + removeLabel: 'Remove', + removeTitle: 'Clear all unprocessed files', + cancelLabel: 'Cancel', + cancelTitle: 'Abort ongoing upload', + pauseLabel: 'Pause', + pauseTitle: 'Pause ongoing upload', + uploadLabel: 'Upload', + uploadTitle: 'Upload selected files', + msgNo: 'No', + msgNoFilesSelected: 'No files selected', + msgCancelled: 'Cancelled', + msgPaused: 'Paused', + msgPlaceholder: 'Select {files}...', + msgZoomModalHeading: 'Detailed Preview', + msgFileRequired: 'You must select a file to upload.', + msgSizeTooSmall: 'File "{name}" ({size} KB) is too small and must be larger than {minSize} KB.', + msgSizeTooLarge: 'File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB.', + msgFilesTooLess: 'You must select at least {n} {files} to upload.', + msgFilesTooMany: 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.', + msgFileNotFound: 'File "{name}" not found!', + msgFileSecured: 'Security restrictions prevent reading the file "{name}".', + msgFileNotReadable: 'File "{name}" is not readable.', + msgFilePreviewAborted: 'File preview aborted for "{name}".', + msgFilePreviewError: 'An error occurred while reading the file "{name}".', + msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', + msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', + msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', + 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', + msgUploadResume: 'Resuming upload...', + msgUploadEmpty: 'No valid data available for upload.', + msgUploadError: 'Upload Error', + msgDeleteError: 'Delete Error', + msgProgressError: 'Error', + msgValidationError: 'Validation Error', + msgLoading: 'Loading file {index} of {files} …', + msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.', + msgSelected: '{n} {files} selected', + msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.', + 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.
    {errors}
    ', + msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!', + msgAjaxProgressError: '{operation} failed', + msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', + msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', + msgPendingTime: '{time} remaining', + msgCalculatingTime: 'calculating time remaining', + ajaxOperations: { + deleteThumb: 'file delete', + uploadThumb: 'file upload', + uploadBatch: 'batch file upload', + uploadExtra: 'form data upload' + }, + dropZoneTitle: 'Drag & drop files here …', + dropZoneClickTitle: '
    (or click to select {files})', + previewZoomButtonTitles: { + prev: 'View previous file', + next: 'View next file', + toggleheader: 'Toggle header', + fullscreen: 'Toggle full screen', + borderless: 'Toggle borderless mode', + close: 'Close detailed preview' + } + }; + + $.fn.fileinputLocales.zh = { + fileSingle: '文件', + filePlural: '个文件', + browseLabel: '选择 …', + removeLabel: '移除', + removeTitle: '清除选中文件', + cancelLabel: '取消', + cancelTitle: '取消进行中的上传', + pauseLabel: 'Pause', + pauseTitle: 'Pause ongoing upload', + uploadLabel: '上传', + uploadTitle: '上传选中文件', + msgNo: '没有', + msgNoFilesSelected: '未选择文件', + msgPaused: 'Paused', + msgCancelled: '取消', + msgPlaceholder: '选择 {files}...', + msgZoomModalHeading: '详细预览', + msgFileRequired: '必须选择一个文件上传.', + msgSizeTooSmall: '文件 "{name}" ({size} KB) 必须大于限定大小 {minSize} KB.', + msgSizeTooLarge: '文件 "{name}" ({size} KB) 超过了允许大小 {maxSize} KB.', + msgFilesTooLess: '你必须选择最少 {n} {files} 来上传. ', + msgFilesTooMany: '选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.', + msgFileNotFound: '文件 "{name}" 未找到!', + msgFileSecured: '安全限制,为了防止读取文件 "{name}".', + msgFileNotReadable: '文件 "{name}" 不可读.', + msgFilePreviewAborted: '取消 "{name}" 的预览.', + msgFilePreviewError: '读取 "{name}" 时出现了一个错误.', + msgInvalidFileName: '文件名 "{name}" 包含非法字符.', + msgInvalidFileType: '不正确的类型 "{name}". 只支持 "{types}" 类型的文件.', + msgInvalidFileExtension: '不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.', + msgFileTypes: { + 'image': 'image', + 'html': 'HTML', + 'text': 'text', + 'video': 'video', + 'audio': 'audio', + 'flash': 'flash', + 'pdf': 'PDF', + 'object': 'object' + }, + msgUploadAborted: '该文件上传被中止', + msgUploadThreshold: '处理中...', + msgUploadBegin: '正在初始化...', + msgUploadEnd: '完成', + msgUploadResume: 'Resuming upload...', + msgUploadEmpty: '无效的文件上传.', + msgUploadError: 'Upload Error', + msgDeleteError: 'Delete Error', + msgProgressError: '上传出错', + msgValidationError: '验证错误', + msgLoading: '加载第 {index} 文件 共 {files} …', + msgProgress: '加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.', + msgSelected: '{n} {files} 选中', + msgFoldersNotAllowed: '只支持拖拽文件! 跳过 {n} 拖拽的文件夹.', + msgImageWidthSmall: '图像文件的"{name}"的宽度必须是至少{size}像素.', + msgImageHeightSmall: '图像文件的"{name}"的高度必须至少为{size}像素.', + msgImageWidthLarge: '图像文件"{name}"的宽度不能超过{size}像素.', + msgImageHeightLarge: '图像文件"{name}"的高度不能超过{size}像素.', + msgImageResizeError: '无法获取的图像尺寸调整。', + msgImageResizeException: '调整图像大小时发生错误。
    {errors}
    ', + msgAjaxError: '{operation} 发生错误. 请重试!', + msgAjaxProgressError: '{operation} 失败', + msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', + msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', + msgPendingTime: '{time} remaining', + msgCalculatingTime: 'calculating time remaining', + ajaxOperations: { + deleteThumb: '删除文件', + uploadThumb: '上传文件', + uploadBatch: '批量上传', + uploadExtra: '表单数据上传' + }, + dropZoneTitle: '拖拽文件到这里 …
    支持多文件同时上传', + dropZoneClickTitle: '
    (或点击{files}按钮选择文件)', + fileActionSettings: { + removeTitle: '删除文件', + uploadTitle: '上传文件', + downloadTitle: '下载文件', + uploadRetryTitle: '重试', + zoomTitle: '查看详情', + dragTitle: '移动 / 重置', + indicatorNewTitle: '没有上传', + indicatorSuccessTitle: '上传', + indicatorErrorTitle: '上传错误', + indicatorPausedTitle: 'Upload Paused', + indicatorLoadingTitle: '上传 ...' + }, + previewZoomButtonTitles: { + prev: '预览上一个文件', + next: '预览下一个文件', + toggleheader: '缩放', + fullscreen: '全屏', + borderless: '无边界模式', + close: '关闭当前预览' + } + }; + + $.fn.fileinput.Constructor = FileInput; + + /** + * Convert automatically file inputs with class 'file' into a bootstrap fileinput control. + */ + $(document).ready(function () { + var $input = $('input.file[type=file]'); + if ($input.length) { + $input.fileinput(); + } + }); })); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css index add4f839c..2b2042cc1 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css @@ -1,12 +1,12 @@ -/*! - * bootstrap-fileinput v5.0.4 - * http://plugins.krajee.com/file-input - * - * Krajee default styling for bootstrap-fileinput. - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md +/*! + * bootstrap-fileinput v5.0.4 + * http://plugins.krajee.com/file-input + * + * Krajee default styling for bootstrap-fileinput. + * + * Author: Kartik Visweswaran + * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com + * + * Licensed under the BSD-3-Clause + * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md */.btn-file input[type=file],.file-caption-icon,.file-no-browse,.file-preview .fileinput-remove,.file-zoom-dialog .btn-navigate,.file-zoom-dialog .floating-buttons,.krajee-default .file-thumb-progress{position:absolute}.file-loading input[type=file],input[type=file].file-loading{width:0;height:0}.file-no-browse{left:50%;bottom:20%;width:1px;height:1px;font-size:0;opacity:0;border:none;background:0 0;outline:0;box-shadow:none}.file-caption-icon,.file-input-ajax-new .fileinput-remove-button,.file-input-ajax-new .fileinput-upload-button,.file-input-ajax-new .no-browse .input-group-btn,.file-input-new .close,.file-input-new .file-preview,.file-input-new .fileinput-remove-button,.file-input-new .fileinput-upload-button,.file-input-new .glyphicon-file,.file-input-new .no-browse .input-group-btn,.file-zoom-dialog .modal-header:after,.file-zoom-dialog .modal-header:before,.hide-content .kv-file-content,.is-locked .fileinput-remove-button,.is-locked .fileinput-upload-button,.kv-hidden{display:none}.file-caption-icon .kv-caption-icon{line-height:inherit}.btn-file,.file-caption,.file-input,.file-loading:before,.file-preview,.file-zoom-dialog .modal-dialog,.krajee-default .file-thumbnail-footer,.krajee-default.file-preview-frame{position:relative}.file-error-message pre,.file-error-message ul,.krajee-default .file-actions,.krajee-default .file-other-error{text-align:left}.file-error-message pre,.file-error-message ul{margin:0}.krajee-default .file-drag-handle,.krajee-default .file-upload-indicator{float:left;margin-top:10px;width:16px;height:16px}.krajee-default .file-thumb-progress .progress,.krajee-default .file-thumb-progress .progress-bar{height:20px;font-family:Verdana,Helvetica,sans-serif;font-size:9px}.krajee-default .file-thumb-progress .progress,.kv-upload-progress .progress{background-color:#ccc}.krajee-default .file-caption-info,.krajee-default .file-size-info{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:160px;height:15px;margin:auto}.file-zoom-content>.file-object.type-flash,.file-zoom-content>.file-object.type-image,.file-zoom-content>.file-object.type-video{max-width:100%;max-height:100%;width:auto}.file-zoom-content>.file-object.type-flash,.file-zoom-content>.file-object.type-video{height:100%}.file-zoom-content>.file-object.type-default,.file-zoom-content>.file-object.type-html,.file-zoom-content>.file-object.type-pdf,.file-zoom-content>.file-object.type-text{width:100%}.file-loading:before{content:" Loading...";display:inline-block;padding-left:20px;line-height:16px;font-size:13px;font-variant:small-caps;color:#999;background:url(loading.gif) top left no-repeat}.file-object{margin:0 0 -5px;padding:0}.btn-file{overflow:hidden}.btn-file input[type=file]{top:0;left:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:none;cursor:inherit;display:block}.btn-file ::-ms-browse{font-size:10000px;width:100%;height:100%}.file-caption .file-caption-name{width:100%;margin:0;padding:0;box-shadow:none;border:none;background:0 0;outline:0}.file-caption.icon-visible .file-caption-icon{display:inline-block}.file-caption.icon-visible .file-caption-name{padding-left:15px}.file-caption-icon{left:8px}.file-error-message{color:#a94442;background-color:#f2dede;margin:5px;border:1px solid #ebccd1;border-radius:4px;padding:15px}.file-error-message pre{margin:5px 0}.file-caption-disabled{background-color:#eee;cursor:not-allowed;opacity:1}.file-preview{border-radius:5px;border:1px solid #ddd;padding:8px;width:100%;margin-bottom:5px}.file-preview .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.file-preview .fileinput-remove{top:1px;right:1px;line-height:10px}.file-preview .clickable{cursor:pointer}.file-preview-image{font:40px Impact,Charcoal,sans-serif;color:green}.krajee-default.file-preview-frame{margin:8px;border:1px solid rgba(0,0,0,.2);box-shadow:0 0 10px 0 rgba(0,0,0,.2);padding:6px;float:left;text-align:center}.krajee-default.file-preview-frame .kv-file-content{width:213px;height:160px}.krajee-default .file-preview-other-frame{display:flex;align-items:center;justify-content:center}.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:400px}.krajee-default.file-preview-frame[data-template=audio] .kv-file-content{width:240px;height:55px}.krajee-default.file-preview-frame .file-thumbnail-footer{height:70px}.krajee-default.file-preview-frame:not(.file-preview-error):hover{border:1px solid rgba(0,0,0,.3);box-shadow:0 0 10px 0 rgba(0,0,0,.4)}.krajee-default .file-preview-text{display:block;color:#428bca;border:1px solid #ddd;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;outline:0;padding:8px;resize:none}.krajee-default .file-preview-html{border:1px solid #ddd;padding:8px;overflow:auto}.krajee-default .file-other-icon{font-size:6em;line-height:1}.krajee-default .file-footer-buttons{float:right}.krajee-default .file-footer-caption{display:block;text-align:center;padding-top:4px;font-size:11px;color:#777;margin-bottom:30px}.file-upload-stats{font-size:10px;text-align:center;width:100%}.kv-upload-progress .file-upload-stats{font-size:12px;margin:-10px 0 5px}.krajee-default .file-preview-error{opacity:.65;box-shadow:none}.krajee-default .file-thumb-progress{height:11px;top:37px;left:0;right:0}.krajee-default.kvsortable-ghost{background:#e1edf7;border:2px solid #a1abff}.krajee-default .file-preview-other:hover{opacity:.8}.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover{color:#000}.kv-upload-progress .progress{height:20px;margin:10px 0;overflow:hidden}.kv-upload-progress .progress-bar{height:20px;font-family:Verdana,Helvetica,sans-serif}.file-zoom-dialog .file-other-icon{font-size:22em;font-size:50vmin}.file-zoom-dialog .modal-dialog{width:auto}.file-zoom-dialog .modal-header{display:flex;align-items:center;justify-content:space-between}.file-zoom-dialog .btn-navigate{padding:0;margin:0;background:0 0;text-decoration:none;outline:0;opacity:.7;top:45%;font-size:4em;color:#1c94c4}.file-zoom-dialog .btn-navigate:not([disabled]):hover{outline:0;box-shadow:none;opacity:.6}.file-zoom-dialog .floating-buttons{top:5px;right:10px}.file-zoom-dialog .btn-navigate[disabled]{opacity:.3}.file-zoom-dialog .btn-prev{left:1px}.file-zoom-dialog .btn-next{right:1px}.file-zoom-dialog .kv-zoom-title{font-weight:300;color:#999;max-width:50%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.file-input-ajax-new .no-browse .form-control,.file-input-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px}.file-caption-main{width:100%}.file-thumb-loading{background:url(loading.gif) center center no-repeat content-box!important}.file-drop-zone{border:1px dashed #aaa;border-radius:4px;text-align:center;vertical-align:middle;margin:12px 15px 12px 12px;padding:5px}.file-drop-zone.clickable:hover{border:2px dashed #999}.file-drop-zone.clickable:focus{border:2px solid #5acde2}.file-drop-zone .file-preview-thumbnails{cursor:default}.file-drop-zone-title{color:#aaa;font-size:1.6em;padding:85px 10px;cursor:default}.file-highlighted{border:2px dashed #999!important;background-color:#eee}.file-uploading{background:url(loading-sm.gif) center bottom 10px no-repeat;opacity:.65}.file-zoom-fullscreen .modal-dialog{min-width:100%;margin:0}.file-zoom-fullscreen .modal-content{border-radius:0;box-shadow:none;min-height:100vh}.file-zoom-fullscreen .modal-body{overflow-y:auto}.floating-buttons{z-index:3000}.floating-buttons .btn-kv{margin-left:3px;z-index:3000}.kv-zoom-actions .btn-kv{margin-left:3px}.file-zoom-content{height:480px;text-align:center}.file-zoom-content .file-preview-image,.file-zoom-content .file-preview-video{max-height:100%}.file-zoom-content>.file-object.type-image{height:auto;min-height:inherit}.file-zoom-content>.file-object.type-audio{width:auto;height:30px}@media (min-width:576px){.file-zoom-dialog .modal-dialog{max-width:500px}}@media (min-width:992px){.file-zoom-dialog .modal-lg{max-width:800px}}@media (max-width:767px){.file-preview-thumbnails{display:flex;justify-content:center;align-items:center;flex-direction:column}.file-zoom-dialog .modal-header{flex-direction:column}}@media (max-width:350px){.krajee-default.file-preview-frame:not([data-template=audio]) .kv-file-content{width:160px}}@media (max-width:420px){.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:100%}}.file-loading[dir=rtl]:before{background:url(loading.gif) top right no-repeat;padding-left:0;padding-right:20px}.file-sortable .file-drag-handle{cursor:move;opacity:1}.file-sortable .file-drag-handle:hover{opacity:.7}.clickable .file-drop-zone-title{cursor:pointer}.file-preview-initial.sortable-chosen{background-color:#d9edf7} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js index 2a2206afa..c627c6cc2 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js @@ -1,10 +1,10 @@ -/*! - bootstrap-fileinput v5.0.4 - http://plugins.krajee.com/file-input - - Author: Kartik Visweswaran - Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com - - Licensed under the BSD-3-Clause - https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md +/*! + bootstrap-fileinput v5.0.4 + http://plugins.krajee.com/file-input + + Author: Kartik Visweswaran + Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com + + Licensed under the BSD-3-Clause + https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md */(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else{if(typeof module==='object'&&module.exports){module.exports=factory(require('jquery'));}else{factory(window.jQuery);}}}(function($){'use strict';$.fn.fileinputLocales={};$.fn.fileinputThemes={};String.prototype.setTokens=function(replacePairs){var str=this.toString(),key,re;for(key in replacePairs){if(replacePairs.hasOwnProperty(key)){re=new RegExp('\{'+key+'\}','g');str=str.replace(re,replacePairs[key]);}}return str;};var $h,FileInput;$h={FRAMES:'.kv-preview-thumb',SORT_CSS:'file-sortable',OBJECT_PARAMS:'\n'+'\n'+'\n'+'\n'+'\n'+'\n',DEFAULT_PREVIEW:'
    \n'+'{previewFileIcon}\n'+'
    ',MODAL_ID:'kvFileinputModal',MODAL_EVENTS:['show','shown','hide','hidden','loaded'],logMessages:{ajaxError:'{status}: {error}. Error Details: {text}.',badDroppedFiles:'Error scanning dropped files!',badExifParser:'Error loading the piexif.js library. {details}',badInputType:'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.',exifWarning:'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded '+'the "piexif.js" library correctly on your page before the "fileinput.js" script.',invalidChunkSize:'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.',invalidThumb:'Invalid thumb frame with id: "{id}".',noResumableSupport:'The browser does not support resumable or chunk uploads.',noUploadUrl:'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.',retryStatus:'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.'},objUrl:window.URL||window.webkitURL,now:function(){return new Date();},round:function(num){num=parseFloat(num);return isNaN(num)?0:Math.floor(Math.round(num));},getFileRelativePath:function(file){return String(file.relativePath||file.webkitRelativePath||$h.getFileName(file)||null);},getFileId:function(file,generateFileId){var relativePath=$h.getFileRelativePath(file);if(typeof generateFileId==='function'){return generateFileId(file);}if(!file){return null;}if(!relativePath){return null;}return(file.size+'_'+relativePath.replace(/\s/img,'_'));},getElapsed:function(seconds){var delta=seconds,out='',result={},structure={year:31536000,month:2592000,week:604800,day:86400,hour:3600,minute:60,second:1};Object.keys(structure).forEach(function(key){result[key]=Math.floor(delta/structure[key]);delta-=result[key]*structure[key];});$.each(result,function(key,value){if(value>0){out+=(out?' ':'')+value+key.substring(0,1);}});return out;},debounce:function(func,delay){var inDebounce;return function(){var args=arguments,context=this;clearTimeout(inDebounce);inDebounce=setTimeout(function(){func.apply(context,args);},delay);};},stopEvent:function(e){e.stopPropagation();e.preventDefault();},getFileName:function(file){return file?(file.fileName||file.name||''):'';},createObjectURL:function(data){if($h.objUrl&&$h.objUrl.createObjectURL&&data){return $h.objUrl.createObjectURL(data);}return'';},revokeObjectURL:function(data){if($h.objUrl&&$h.objUrl.revokeObjectURL&&data){$h.objUrl.revokeObjectURL(data);}},compare:function(input,str,exact){return input!==undefined&&(exact?input===str:input.match(str));},isIE:function(ver){var div,status;if(navigator.appName!=='Microsoft Internet Explorer'){return false;}if(ver===10){return new RegExp('msie\\s'+ver,'i').test(navigator.userAgent);}div=document.createElement('div');div.innerHTML='';status=div.getElementsByTagName('i').length;document.body.appendChild(div);div.parentNode.removeChild(div);return status;},canAssignFilesToInput:function(){var input=document.createElement('input');try{input.type='file';input.files=null;return true;}catch(err){return false;}},getDragDropFolders:function(items){var i,item,len=items?items.length:0,folders=0;if(len>0&&items[0].webkitGetAsEntry()){for(i=0;i=0){byteStr=atob(dataURI.split(',')[1]);}else{byteStr=decodeURIComponent(dataURI.split(',')[1]);}arrayBuffer=new ArrayBuffer(byteStr.length);intArray=new Uint8Array(arrayBuffer);for(i=0;i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=String.fromCharCode(c);break;case 12:case 13:char2=array[i++];out+=String.fromCharCode(((c&0x1F)<<6)|(char2&0x3F));break;case 14:char2=array[i++];char3=array[i++];out+=String.fromCharCode(((c&0x0F)<<12)|((char2&0x3F)<<6)|((char3&0x3F)<<0));break;}}return out;},isHtml:function(str){var a=document.createElement('div');a.innerHTML=str;for(var c=a.childNodes,i=c.length;i--;){if(c[i].nodeType===1){return true;}}return false;},isSvg:function(str){return str.match(/^\s*<\?xml/i)&&(str.match(//g,'>').replace(/"/g,'"').replace(/'/g,''');},replaceTags:function(str,tags){var out=str;if(!tags){return out;}$.each(tags,function(key,value){if(typeof value==='function'){value=value();}out=out.split(key).join(value);});return out;},cleanMemory:function($thumb){var data=$thumb.is('img')?$thumb.attr('src'):$thumb.find('source').attr('src');$h.revokeObjectURL(data);},findFileName:function(filePath){var sepIndex=filePath.lastIndexOf('/');if(sepIndex===-1){sepIndex=filePath.lastIndexOf('\\');}return filePath.split(filePath.substring(sepIndex,sepIndex+1)).pop();},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;},toggleFullScreen:function(maximize){var doc=document,de=doc.documentElement;if(de&&maximize&&!$h.checkFullScreen()){if(de.requestFullscreen){de.requestFullscreen();}else{if(de.msRequestFullscreen){de.msRequestFullscreen();}else{if(de.mozRequestFullScreen){de.mozRequestFullScreen();}else{if(de.webkitRequestFullscreen){de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);}}}}}else{if(doc.exitFullscreen){doc.exitFullscreen();}else{if(doc.msExitFullscreen){doc.msExitFullscreen();}else{if(doc.mozCancelFullScreen){doc.mozCancelFullScreen();}else{if(doc.webkitExitFullscreen){doc.webkitExitFullscreen();}}}}}},moveArray:function(arr,oldIndex,newIndex,reverseOrder){var newArr=$.extend(true,[],arr);if(reverseOrder){newArr.reverse();}if(newIndex>=newArr.length){var k=newIndex-newArr.length;while((k--)+1){newArr.push(undefined);}}newArr.splice(newIndex,0,newArr.splice(oldIndex,1)[0]);if(reverseOrder){newArr.reverse();}return newArr;},cleanZoomCache:function($el){var $cache=$el.closest('.kv-zoom-cache-theme');if(!$cache.length){$cache=$el.closest('.kv-zoom-cache');}$cache.remove();},closeButton:function(css){css=css?'close '+css:'close';return'';},getRotation:function(value){switch(value){case 2:return'rotateY(180deg)';case 3:return'rotate(180deg)';case 4:return'rotate(180deg) rotateY(180deg)';case 5:return'rotate(270deg) rotateY(180deg)';case 6:return'rotate(90deg)';case 7:return'rotate(90deg) rotateY(180deg)';case 8:return'rotate(270deg)';default:return'';}},setTransform:function(el,val){if(!el){return;}el.style.transform=val;el.style.webkitTransform=val;el.style['-moz-transform']=val;el.style['-ms-transform']=val;el.style['-o-transform']=val;}};FileInput=function(element,options){var self=this;self.$element=$(element);self.$parent=self.$element.parent();if(!self._validate()){return;}self.isPreviewable=$h.hasFileAPISupport();self.isIE9=$h.isIE(9);self.isIE10=$h.isIE(10);if(self.isPreviewable||self.isIE9){self._init(options);self._listen();}self.$element.removeClass('file-loading');};FileInput.prototype={constructor:FileInput,_cleanup:function(){var self=this;self.reader=null;self.clearFileStack();self.fileBatchCompleted=true;self.isError=false;self.cancelling=false;self.paused=false;self.lastProgress=0;self._initAjax();},_initAjax:function(){var self=this;self.ajaxQueue=[];self.ajaxRequests=[];self.ajaxQueueIntervalId=null;self.ajaxCurrentThreads=0;self.ajaxAborted=false;},_init:function(options,refreshMode){var self=this,f,$el=self.$element,$cont,t,tmp;self.options=options;$.each(options,function(key,value){switch(key){case'minFileCount':case'maxFileCount':case'minFileSize':case'maxFileSize':case'maxFilePreviewSize':case'resizeImageQuality':case'resizeIfSizeMoreThan':case'progressUploadThreshold':case'initialPreviewCount':case'zoomModalHeight':case'minImageHeight':case'maxImageHeight':case'minImageWidth':case'maxImageWidth':self[key]=$h.getNum(value);break;default:self[key]=value;break;}});if(self.rtl){tmp=self.previewZoomButtonIcons.prev;self.previewZoomButtonIcons.prev=self.previewZoomButtonIcons.next;self.previewZoomButtonIcons.next=tmp;}if(!isNaN(self.maxAjaxThreads)&&self.maxAjaxThreadsrm.file.size?rm.file.size:size;},getTotalChunks:function(){var rm=self.resumableManager,chunkSize=parseFloat(rm.chunkSize);if(!isNaN(chunkSize)&&chunkSize>0){return Math.ceil(rm.file.size/chunkSize);}return 0;},getProgress:function(){var rm=self.resumableManager,processed=rm.processedResumables(),total=rm.chunkCount;if(total===0){return 0;}return Math.ceil(processed/total*100);},checkAborted:function(intervalId){if(self.paused||self.cancelling){clearInterval(intervalId);self.unlock();}},upload:function(){var rm=self.resumableManager,fm=self.fileManager,ids=fm.getIdList(),flag='new',intervalId;intervalId=setInterval(function(){var id;rm.checkAborted(intervalId);if(flag==='new'){self.lock();flag='processing';id=ids.shift();fm.initStats(id);if(fm.stack[id]){rm.init(id,fm.stack[id],fm.getIndex(id));rm.testUpload();rm.uploadResumable();}}if(!fm.isPending(id)&&rm.completed){flag='new';}if(fm.isProcessed()){var $initThumbs=self.$preview.find('.file-preview-initial');if($initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable();}clearInterval(intervalId);self._clearFileInput();self.unlock();setTimeout(function(){var data=self.previewCache.data;if(data){self.initialPreview=data.content;self.initialPreviewConfig=data.config;self.initialPreviewThumbTags=data.tags;}self._raise('filebatchuploadcomplete',[self.initialPreview,self.initialPreviewConfig,self.initialPreviewThumbTags,self._getExtraData()]);},self.processDelay);}},self.processDelay);},uploadResumable:function(){var i,rm=self.resumableManager,total=rm.chunkCount;for(i=0;iopts.maxRetries){rm.setProcessed('error');return;}var fd,outData,fnBefore,fnSuccess,fnError,fnComplete,slice=file.slice?'slice':(file.mozSlice?'mozSlice':(file.webkitSlice?'webkitSlice':'slice')),blob=file[slice](chunkSize*index,chunkSize*(index+1));fd=new FormData();f=fm.stack[id];self._setUploadData(fd,{chunkCount:rm.chunkCount,chunkIndex:index,chunkSize:chunkSize,chunkSizeStart:chunkSize*index,fileBlob:[blob,rm.fileName],fileId:id,fileName:rm.fileName,fileRelativePath:f.relativePath,fileSize:file.size,retryCount:retry});if(rm.$progress&&rm.$progress.length){rm.$progress.show();}fnBefore=function(jqXHR){outData=self._getOutData(fd,jqXHR);if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading');}$btnDelete.attr('disabled',true);}self._raise('filechunkbeforesend',[id,index,retry,fm,rm,outData]);};fnSuccess=function(data,textStatus,jqXHR){outData=self._getOutData(fd,jqXHR,data);var paramNames=self.uploadParamNames,chunkIndex=paramNames.chunkIndex||'chunkIndex',opts=self.resumableUploadOptions,params=[id,index,retry,fm,rm,outData];rm.currThreads--;if(data.error){if(opts.showErrorLog){self._log(logs.retryStatus,{retry:retry+1,filename:rm.fileName,chunk:index});}rm.pushAjax(index,retry+1);rm.error=data.error;self._raise('filechunkerror',params);}else{rm.logs[data[chunkIndex]]=true;if(!rm.processed[id]){rm.processed[id]={};}rm.processed[id][data[chunkIndex]]=true;rm.processed[id].data=data;self._raise('filechunksuccess',params);rm.check();}};fnError=function(jqXHR,textStatus,errorThrown){outData=self._getOutData(fd,jqXHR);rm.currThreads--;rm.error=errorThrown;rm.logAjaxError(jqXHR,textStatus,errorThrown);self._raise('filechunkajaxerror',[id,index,retry,fm,rm,outData]);rm.pushAjax(index,retry+1);};fnComplete=function(){self._raise('filechunkcomplete',[id,index,retry,fm,rm,self._getOutData(fd)]);};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,fd,id,rm.fileIndex);},loopAjax:function(){var rm=self.resumableManager;if(rm.currThreads=rm.getTotalChunks()){rm.setProcessed('success');clearInterval(rm.chunkIntervalId);}}}}}};self.resumableManager.reset();},_initTemplateDefaults:function(){var self=this,tMain1,tMain2,tPreview,tFileIcon,tClose,tCaption,tBtnDefault,tBtnLink,tBtnBrowse,tModalMain,tModal,tProgress,tSize,tFooter,tActions,tActionDelete,tActionUpload,tActionDownload,tActionZoom,tActionDrag,tIndicator,tTagBef,tTagBef1,tTagBef2,tTagAft,tGeneric,tHtml,tImage,tText,tOffice,tGdocs,tVideo,tAudio,tFlash,tObject,tPdf,tOther,tStyle,tZoomCache,vDefaultDim,tStats;tMain1='{preview}\n'+'
    \n'+'
    \n'+' {caption}\n'+'
    \n'+' {remove}\n'+' {cancel}\n'+' {pause}\n'+' {upload}\n'+' {browse}\n'+'
    \n'+'
    ';tMain2='{preview}\n
    \n
    \n'+'{remove}\n{cancel}\n{upload}\n{browse}\n';tPreview='
    \n'+' {close}'+'
    \n'+'
    \n'+'
    \n'+'
    '+'
    \n'+'
    \n'+'
    \n'+'
    ';tClose=$h.closeButton('fileinput-remove');tFileIcon='';tCaption='
    \n'+' \n'+' \n'+'
    ';tBtnDefault='';tBtnLink='{icon} {label}';tBtnBrowse='
    {icon} {label}
    ';tModalMain='';tModal='\n';tProgress='
    \n'+'
    \n'+' {status}\n'+'
    \n'+'
    {stats}';tStats='
    '+'{pendingTime} '+'{uploadSpeed}'+'
    ';tSize=' ({sizeText})';tFooter='';tActions='
    \n'+' \n'+'
    \n'+'{drag}\n'+'
    ';tActionDelete='\n';tActionUpload='';tActionDownload='{downloadIcon}';tActionZoom='';tActionDrag='{dragIcon}';tIndicator='
    {indicator}
    ';tTagBef='
    \n';tTagBef2=tTagBef+' title="{caption}">
    \n';tTagAft='
    {footer}\n
    \n';tGeneric='{content}\n';tStyle=' {style}';tHtml='
    {data}
    \n';tImage='\n';tText='\n';tOffice='';tGdocs='';tVideo='\n';tAudio='\n';tFlash='\n';tPdf='\n';tObject='\n'+'\n'+$h.OBJECT_PARAMS+' '+$h.DEFAULT_PREVIEW+'\n\n';tOther='
    \n'+$h.DEFAULT_PREVIEW+'\n
    \n';tZoomCache='';vDefaultDim={width:'100%',height:'100%','min-height':'480px'};if(self._isPdfRendered()){tPdf=self.pdfRendererTemplate.replace('{renderer}',self._encodeURI(self.pdfRendererUrl));}self.defaults={layoutTemplates:{main1:tMain1,main2:tMain2,preview:tPreview,close:tClose,fileIcon:tFileIcon,caption:tCaption,modalMain:tModalMain,modal:tModal,progress:tProgress,stats:tStats,size:tSize,footer:tFooter,indicator:tIndicator,actions:tActions,actionDelete:tActionDelete,actionUpload:tActionUpload,actionDownload:tActionDownload,actionZoom:tActionZoom,actionDrag:tActionDrag,btnDefault:tBtnDefault,btnLink:tBtnLink,btnBrowse:tBtnBrowse,zoomCache:tZoomCache},previewMarkupTags:{tagBefore1:tTagBef1,tagBefore2:tTagBef2,tagAfter:tTagAft},previewContentTemplates:{generic:tGeneric,html:tHtml,image:tImage,text:tText,office:tOffice,gdocs:tGdocs,video:tVideo,audio:tAudio,flash:tFlash,object:tObject,pdf:tPdf,other:tOther},allowedPreviewTypes:['image','html','text','video','audio','flash','pdf','object'],previewTemplates:{},previewSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'213px',height:'160px'},text:{width:'213px',height:'160px'},office:{width:'213px',height:'160px'},gdocs:{width:'213px',height:'160px'},video:{width:'213px',height:'160px'},audio:{width:'100%',height:'30px'},flash:{width:'213px',height:'160px'},object:{width:'213px',height:'160px'},pdf:{width:'100%',height:'160px'},other:{width:'213px',height:'160px'}},previewSettingsSmall:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'100%',height:'160px'},text:{width:'100%',height:'160px'},office:{width:'100%',height:'160px'},gdocs:{width:'100%',height:'160px'},video:{width:'100%',height:'auto'},audio:{width:'100%',height:'30px'},flash:{width:'100%',height:'auto'},object:{width:'100%',height:'auto'},pdf:{width:'100%',height:'160px'},other:{width:'100%',height:'160px'}},previewZoomSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:vDefaultDim,text:vDefaultDim,office:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},gdocs:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},video:{width:'auto',height:'100%','max-width':'100%'},audio:{width:'100%',height:'30px'},flash:{width:'auto',height:'480px'},object:{width:'auto',height:'100%','max-width':'100%','min-height':'480px'},pdf:vDefaultDim,other:{width:'auto',height:'100%','min-height':'480px'}},mimeTypeAliases:{'video/quicktime':'video/mp4'},fileTypeSettings:{image:function(vType,vName){return($h.compare(vType,'image.*')&&!$h.compare(vType,/(tiff?|wmf)$/i)||$h.compare(vName,/\.(gif|png|jpe?g)$/i));},html:function(vType,vName){return $h.compare(vType,'text/html')||$h.compare(vName,/\.(htm|html)$/i);},office:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?)$/i);},gdocs:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i);},text:function(vType,vName){return $h.compare(vType,'text.*')||$h.compare(vName,/\.(xml|javascript)$/i)||$h.compare(vName,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i);},video:function(vType,vName){return $h.compare(vType,'video.*')&&($h.compare(vType,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||$h.compare(vName,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i));},audio:function(vType,vName){return $h.compare(vType,'audio.*')&&($h.compare(vName,/(ogg|mp3|mp?g|wav)$/i)||$h.compare(vName,/\.(og?|mp3|mp?g|wav)$/i));},flash:function(vType,vName){return $h.compare(vType,'application/x-shockwave-flash',true)||$h.compare(vName,/\.(swf)$/i);},pdf:function(vType,vName){return $h.compare(vType,'application/pdf',true)||$h.compare(vName,/\.(pdf)$/i);},object:function(){return true;},other:function(){return true;}},fileActionSettings:{showRemove:true,showUpload:true,showDownload:true,showZoom:true,showDrag:true,removeIcon:'',removeClass:'btn btn-sm btn-kv btn-default btn-outline-secondary',removeErrorClass:'btn btn-sm btn-kv btn-danger',removeTitle:'Remove file',uploadIcon:'',uploadClass:'btn btn-sm btn-kv btn-default btn-outline-secondary',uploadTitle:'Upload file',uploadRetryIcon:'',uploadRetryTitle:'Retry upload',downloadIcon:'',downloadClass:'btn btn-sm btn-kv btn-default btn-outline-secondary',downloadTitle:'Download file',zoomIcon:'',zoomClass:'btn btn-sm btn-kv btn-default btn-outline-secondary',zoomTitle:'View Details',dragIcon:'',dragClass:'text-info',dragTitle:'Move / Rearrange',dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorPaused:'',indicatorNewTitle:'Not uploaded yet',indicatorSuccessTitle:'Uploaded',indicatorErrorTitle:'Upload Error',indicatorLoadingTitle:'Uploading ...',indicatorPausedTitle:'Upload Paused'}};$.each(self.defaults,function(key,setting){if(key==='allowedPreviewTypes'){if(self.allowedPreviewTypes===undefined){self.allowedPreviewTypes=setting;}return;}self[key]=$.extend(true,{},setting,self[key]);});self._initPreviewTemplates();},_initPreviewTemplates:function(){var self=this,tags=self.previewMarkupTags,tagBef,tagAft=tags.tagAfter;$.each(self.previewContentTemplates,function(key,value){if($h.isEmpty(self.previewTemplates[key])){tagBef=tags.tagBefore2;if(key==='generic'||key==='image'||key==='html'||key==='text'){tagBef=tags.tagBefore1;}if(self._isPdfRendered()&&key==='pdf'){tagBef=tagBef.replace('kv-file-content','kv-file-content kv-pdf-rendered');}self.previewTemplates[key]=tagBef+value+tagAft;}});},_initPreviewCache:function(){var self=this;self.previewCache={data:{},init:function(){var content=self.initialPreview;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter);}self.previewCache.data={content:content,config:self.initialPreviewConfig,tags:self.initialPreviewThumbTags};},count:function(skipNull){if(!self.previewCache.data||!self.previewCache.data.content){return 0;}if(skipNull){var chk=self.previewCache.data.content.filter(function(n){return n!==null;});return chk.length;}return self.previewCache.data.content.length;},get:function(i,isDisabled){var ind='init_'+i,data=self.previewCache.data,config=data.config[i],fileId,content=data.content[i],previewId=self.previewInitId+'-'+ind,out,$tmp,cat,ftr,fname,ftype,frameClass,asData=$h.ifSet('previewAsData',config,self.initialPreviewAsData),a=config?{title:config.title||null,alt:config.alt||null}:{title:null,alt:null},parseTemplate=function(cat,dat,fn,ft,id,ftr,ind,fc,t){fc=' file-preview-initial '+$h.SORT_CSS+(fc?' '+fc:'');fileId=config&&config.fileId||'file_'+id;return self._generatePreviewTemplate(cat,dat,fn,ft,id,fileId,false,null,fc,ftr,ind,t,a,config&&config.zoomData||dat);};if(!content||!content.length){return'';}isDisabled=isDisabled===undefined?true:isDisabled;cat=$h.ifSet('type',config,self.initialPreviewFileType||'generic');fname=$h.ifSet('filename',config,$h.ifSet('caption',config));ftype=$h.ifSet('filetype',config,cat);ftr=self.previewCache.footer(i,isDisabled,(config&&config.size||null));frameClass=$h.ifSet('frameClass',config);if(asData){out=parseTemplate(cat,content,fname,ftype,previewId,ftr,ind,frameClass);}else{out=parseTemplate('generic',content,fname,ftype,previewId,ftr,ind,frameClass,cat).setTokens({'content':data.content[i]});}if(data.tags.length&&data.tags[i]){out=$h.replaceTags(out,data.tags[i]);}if(!$h.isEmpty(config)&&!$h.isEmpty(config.frameAttr)){$tmp=$(document.createElement('div')).html(out);$tmp.find('.file-preview-initial').attr(config.frameAttr);out=$tmp.html();$tmp.remove();}return out;},clean:function(data){data.content=$h.cleanArray(data.content);data.config=$h.cleanArray(data.config);data.tags=$h.cleanArray(data.tags);self.previewCache.data=data;},add:function(content,config,tags,append){var data=self.previewCache.data,index=content.length-1;if(!content||!content.length){return index;}if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter);}if(append){index=data.content.push(content[0])-1;data.config[index]=config;data.tags[index]=tags;}else{data.content=content;data.config=config;data.tags=tags;}self.previewCache.clean(data);return index;},set:function(content,config,tags,append){var data=self.previewCache.data,i,chk;if(!content||!content.length){return;}if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter);}chk=content.filter(function(n){return n!==null;});if(!chk.length){return;}if(data.content===undefined){data.content=[];}if(data.config===undefined){data.config=[];}if(data.tags===undefined){data.tags=[];}if(append){for(i=0;i'+msg+'':'
  • '+msg+'
  • ';if($error.find('ul').length===0){self._addError('
      '+e+'
    ');}else{$error.find('ul').append(e);}$error.fadeIn(800);self._raise(ev,[params,msg]);self._setValidationError('file-input-new');return true;},_showError:function(msg,params,event){var self=this,$error=self.$errorContainer,ev=event||'fileerror';params=params||{};params.reader=self.reader;self._addError(msg);$error.fadeIn(800);self._raise(ev,[params,msg]);if(!self.isAjaxUpload){self._clearFileInput();}self._setValidationError('file-input-new');self.$btnUpload.attr('disabled',true);return true;},_noFilesError:function(params){var self=this,label=self.minFileCount>1?self.filePlural:self.fileSingle,msg=self.msgFilesTooLess.replace('{n}',self.minFileCount).replace('{files}',label),$error=self.$errorContainer;self._addError(msg);self.isError=true;self._updateFileDetails(0);$error.fadeIn(800);self._raise('fileerror',[params,msg]);self._clearFileInput();self._setValidationError();},_parseError:function(operation,jqXHR,errorThrown,fileName){var self=this,errMsg=$.trim(errorThrown+''),textPre,text=jqXHR.responseJSON!==undefined&&jqXHR.responseJSON.error!==undefined?jqXHR.responseJSON.error:jqXHR.responseText;if(self.cancelling&&self.msgUploadAborted){errMsg=self.msgUploadAborted;}if(self.showAjaxErrorDetails&&text){text=$.trim(text.replace(/\n\s*\n/g,'\n'));textPre=text.length?'
    '+text+'
    ':'';errMsg+=errMsg?textPre:text;}if(!errMsg){errMsg=self.msgAjaxError.replace('{operation}',operation);}self.cancelling=false;return fileName?''+fileName+': '+errMsg:errMsg;},_parseFileType:function(type,name){var self=this,isValid,vType,cat,i,types=self.allowedPreviewTypes||[];if(type==='application/text-plain'){return'text';}for(i=0;i-1){ext=fname.split('.').pop();if(self.previewFileIconSettings){out=self.previewFileIconSettings[ext]||self.previewFileIconSettings[ext.toLowerCase()]||null;}if(self.previewFileExtSettings){$.each(self.previewFileExtSettings,function(key,func){if(self.previewFileIconSettings[key]&&func(ext)){out=self.previewFileIconSettings[key];return;}});}}return out;},_parseFilePreviewIcon:function(content,fname){var self=this,icn=self._getPreviewIcon(fname)||self.previewFileIcon,out=content;if(out.indexOf('{previewFileIcon}')>-1){out=out.setTokens({'previewFileIconClass':self.previewFileIconClass,'previewFileIcon':icn});}return out;},_raise:function(event,params){var self=this,e=$.Event(event);if(params!==undefined){self.$element.trigger(e,params);}else{self.$element.trigger(e);}if(e.isDefaultPrevented()||e.result===false){return false;}switch(event){case'filebatchuploadcomplete':case'filebatchuploadsuccess':case'fileuploaded':case'fileclear':case'filecleared':case'filereset':case'fileerror':case'filefoldererror':case'fileuploaderror':case'filebatchuploaderror':case'filedeleteerror':case'filecustomerror':case'filesuccessremove':break;default:if(!self.ajaxAborted){self.ajaxAborted=e.result;}break;}return true;},_listenFullScreen:function(isFullScreen){var self=this,$modal=self.$modal,$btnFull,$btnBord;if(!$modal||!$modal.length){return;}$btnFull=$modal&&$modal.find('.btn-fullscreen');$btnBord=$modal&&$modal.find('.btn-borderless');if(!$btnFull.length||!$btnBord.length){return;}$btnFull.removeClass('active').attr('aria-pressed','false');$btnBord.removeClass('active').attr('aria-pressed','false');if(isFullScreen){$btnFull.addClass('active').attr('aria-pressed','true');}else{$btnBord.addClass('active').attr('aria-pressed','true');}if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog();}else{if(isFullScreen){self._maximizeZoomDialog();}else{$btnBord.removeClass('active').attr('aria-pressed','false');}}},_listen:function(){var self=this,$el=self.$element,$form=self.$form,$cont=self.$container,fullScreenEvents;self._handler($el,'click',function(e){if($el.hasClass('file-no-browse')){if($el.data('zoneClicked')){$el.data('zoneClicked',false);}else{e.preventDefault();}}});self._handler($el,'change',$.proxy(self._change,self));if(self.showBrowse){self._handler(self.$btnFile,'click',$.proxy(self._browse,self));}self._handler($cont.find('.fileinput-remove:not([disabled])'),'click',$.proxy(self.clear,self));self._handler($cont.find('.fileinput-cancel'),'click',$.proxy(self.cancel,self));self._handler($cont.find('.fileinput-pause'),'click',$.proxy(self.pause,self));self._initDragDrop();self._handler($form,'reset',$.proxy(self.clear,self));if(!self.isAjaxUpload){self._handler($form,'submit',$.proxy(self._submitForm,self));}self._handler(self.$container.find('.fileinput-upload'),'click',$.proxy(self._uploadClick,self));self._handler($(window),'resize',function(){self._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight);});fullScreenEvents='webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange';self._handler($(document),fullScreenEvents,function(){self._listenFullScreen($h.checkFullScreen());});self._autoFitContent();self._initClickable();self._refreshPreview();},_autoFitContent:function(){var width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,self=this,config=width<400?(self.previewSettingsSmall||self.defaults.previewSettingsSmall):(self.previewSettings||self.defaults.previewSettings),sel;$.each(config,function(cat,settings){sel='.file-preview-frame .file-preview-'+cat;self.$preview.find(sel+'.kv-preview-data,'+sel+' .kv-preview-data').css(settings);});},_scanDroppedItems:function(item,files,path){path=path||'';var self=this,i,dirReader,readDir,errorHandler=function(e){self._log($h.logMessages.badDroppedFiles);self._log(e);};if(item.isFile){item.file(function(file){files.push(file);},errorHandler);}else{if(item.isDirectory){dirReader=item.createReader();readDir=function(){dirReader.readEntries(function(entries){if(entries&&entries.length>0){for(i=0;i-1;self._zoneDragDropInit(e);if(self.isDisabled||!hasFiles){e.originalEvent.dataTransfer.effectAllowed='none';e.originalEvent.dataTransfer.dropEffect='none';return;}if(self._raise('fileDragEnter',{'sourceEvent':e,'files':dataTransfer.types.Files})){$h.addCss(self.$dropZone,'file-highlighted');}},_zoneDragLeave:function(e){var self=this;self._zoneDragDropInit(e);if(self.isDisabled){return;}if(self._raise('fileDragLeave',{'sourceEvent':e})){self.$dropZone.removeClass('file-highlighted');}},_zoneDrop:function(e){var self=this,i,$el=self.$element,dataTransfer=e.originalEvent.dataTransfer,files=dataTransfer.files,items=dataTransfer.items,folders=$h.getDragDropFolders(items),processFiles=function(){if(!self.isAjaxUpload){self.changeTriggered=true;$el.get(0).files=files;setTimeout(function(){self.changeTriggered=false;$el.trigger('change'+self.namespace);},self.processDelay);}else{self._change(e,files);}self.$dropZone.removeClass('file-highlighted');};e.preventDefault();if(self.isDisabled||$h.isEmpty(files)){return;}if(!self._raise('fileDragDrop',{'sourceEvent':e,'files':files})){return;}if(folders>0){if(!self.isAjaxUpload){self._showFolderError(folders);return;}files=[];for(i=0;i.kv-file-content img');$zoomImg=self.$preview.find('#zoom-'+id+' >.kv-file-content img');self.setImageOrientation($img,$zoomImg,config.exif.Orientation,$thumb);}i++;});},_initPreview:function(isInit){var self=this,cap=self.initialCaption||'',out;if(!self.previewCache.count(true)){self._clearPreview();if(isInit){self._setCaption(cap);}else{self._initCaption();}return;}out=self.previewCache.out();cap=isInit&&self.initialCaption?self.initialCaption:out.caption;self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(cap);self._initSortable();if(!$h.isEmpty(out.content)){self.$container.removeClass('file-input-new');}self._initPreviewImageOrientations();},_getZoomButton:function(type){var self=this,label=self.previewZoomButtonIcons[type],css=self.previewZoomButtonClasses[type],title=' title="'+(self.previewZoomButtonTitles[type]||'')+'" ',params=title+(type==='close'?' data-dismiss="modal" aria-hidden="true"':'');if(type==='fullscreen'||type==='borderless'||type==='toggleheader'){params+=' data-toggle="button" aria-pressed="false" autocomplete="off"';}return'';},_getModalContent:function(){var self=this;return self._getLayoutTemplate('modal').setTokens({'rtl':self.rtl?' kv-rtl':'','zoomFrameClass':self.frameClass,'heading':self.msgZoomModalHeading,'prev':self._getZoomButton('prev'),'next':self._getZoomButton('next'),'toggleheader':self._getZoomButton('toggleheader'),'fullscreen':self._getZoomButton('fullscreen'),'borderless':self._getZoomButton('borderless'),'close':self._getZoomButton('close')});},_listenModalEvent:function(event){var self=this,$modal=self.$modal,getParams=function(e){return{sourceEvent:e,previewId:$modal.data('previewId'),modal:$modal};};$modal.on(event+'.bs.modal',function(e){var $btnFull=$modal.find('.btn-fullscreen'),$btnBord=$modal.find('.btn-borderless');self._raise('filezoom'+event,getParams(e));if(event==='shown'){$btnBord.removeClass('active').attr('aria-pressed','false');$btnFull.removeClass('active').attr('aria-pressed','false');if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog();if($h.checkFullScreen()){$btnFull.addClass('active').attr('aria-pressed','true');}else{$btnBord.addClass('active').attr('aria-pressed','true');}}}});},_initZoom:function(){var self=this,$dialog,modalMain=self._getLayoutTemplate('modalMain'),modalId='#'+$h.MODAL_ID;if(!self.showPreview){return;}self.$modal=$(modalId);if(!self.$modal||!self.$modal.length){$dialog=$(document.createElement('div')).html(modalMain).insertAfter(self.$container);self.$modal=$(modalId).insertBefore($dialog);$dialog.remove();}$h.initModal(self.$modal);self.$modal.html(self._getModalContent());$.each($h.MODAL_EVENTS,function(key,event){self._listenModalEvent(event);});},_initZoomButtons:function(){var self=this,previewId=self.$modal.data('previewId')||'',$first,$last,thumbs=self.getFrames().toArray(),len=thumbs.length,$prev=self.$modal.find('.btn-prev'),$next=self.$modal.find('.btn-next');if(thumbs.length<2){$prev.hide();$next.hide();return;}else{$prev.show();$next.show();}if(!len){return;}$first=$(thumbs[0]);$last=$(thumbs[len-1]);$prev.removeAttr('disabled');$next.removeAttr('disabled');if($first.length&&$first.attr('id')===previewId){$prev.attr('disabled',true);}if($last.length&&$last.attr('id')===previewId){$next.attr('disabled',true);}},_maximizeZoomDialog:function(){var self=this,$modal=self.$modal,$head=$modal.find('.modal-header:visible'),$foot=$modal.find('.modal-footer:visible'),$body=$modal.find('.modal-body'),h=$(window).height(),diff=0;$modal.addClass('file-zoom-fullscreen');if($head&&$head.length){h-=$head.outerHeight(true);}if($foot&&$foot.length){h-=$foot.outerHeight(true);}if($body&&$body.length){diff=$body.outerHeight(true)-$body.height();h-=diff;}$modal.find('.kv-zoom-body').height(h);},_resizeZoomDialog:function(fullScreen){var self=this,$modal=self.$modal,$btnFull=$modal.find('.btn-fullscreen'),$btnBord=$modal.find('.btn-borderless');if($modal.hasClass('file-zoom-fullscreen')){$h.toggleFullScreen(false);if(!fullScreen){if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self.$modal.find('.kv-zoom-body').css('height',self.zoomModalHeight);}else{$btnFull.removeClass('active').attr('aria-pressed','false');}}else{if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self._resizeZoomDialog(true);if($btnBord.hasClass('active')){$btnBord.removeClass('active').attr('aria-pressed','false');}}}}else{if(!fullScreen){self._maximizeZoomDialog();return;}$h.toggleFullScreen(true);}$modal.focus();},_setZoomContent:function($frame,animate){var self=this,$content,tmplt,body,title,$body,$dataEl,config,previewId=$frame.attr('id'),$zoomPreview=self.$preview.find('#zoom-'+previewId),$modal=self.$modal,$tmp,$btnFull=$modal.find('.btn-fullscreen'),$btnBord=$modal.find('.btn-borderless'),cap,size,$btnTogh=$modal.find('.btn-toggleheader');tmplt=$zoomPreview.attr('data-template')||'generic';$content=$zoomPreview.find('.kv-file-content');body=$content.length?$content.html():'';cap=$frame.data('caption')||'';size=$frame.data('size')||'';title=cap+' '+size;$modal.find('.kv-zoom-title').attr('title',$('
    ').html(title).text()).html(title);$body=$modal.find('.kv-zoom-body');$modal.removeClass('kv-single-content');if(animate){$tmp=$body.addClass('file-thumb-loading').clone().insertAfter($body);$body.html(body).hide();$tmp.fadeOut('fast',function(){$body.fadeIn('fast',function(){$body.removeClass('file-thumb-loading');});$tmp.remove();});}else{$body.html(body);}config=self.previewZoomSettings[tmplt];if(config){$dataEl=$body.find('.kv-preview-data');$h.addCss($dataEl,'file-zoom-detail');$.each(config,function(key,value){$dataEl.css(key,value);if(($dataEl.attr('width')&&key==='width')||($dataEl.attr('height')&&key==='height')){$dataEl.removeAttr(key);}});}$modal.data('previewId',previewId);self._handler($modal.find('.btn-prev'),'click',function(){self._zoomSlideShow('prev',previewId);});self._handler($modal.find('.btn-next'),'click',function(){self._zoomSlideShow('next',previewId);});self._handler($btnFull,'click',function(){self._resizeZoomDialog(true);});self._handler($btnBord,'click',function(){self._resizeZoomDialog(false);});self._handler($btnTogh,'click',function(){var $header=$modal.find('.modal-header'),$floatBar=$modal.find('.modal-body .floating-buttons'),ht,$actions=$header.find('.kv-zoom-actions'),resize=function(height){var $body=self.$modal.find('.kv-zoom-body'),h=self.zoomModalHeight;if($modal.hasClass('file-zoom-fullscreen')){h=$body.outerHeight(true);if(!height){h=h-$header.outerHeight(true);}}$body.css('height',height?h+height:h);};if($header.is(':visible')){ht=$header.outerHeight(true);$header.slideUp('slow',function(){$actions.find('.btn').appendTo($floatBar);resize(ht);});}else{$floatBar.find('.btn').appendTo($actions);$header.slideDown('slow',function(){resize();});}$modal.focus();});self._handler($modal,'keydown',function(e){var key=e.which||e.keyCode,$prev=$(this).find('.btn-prev'),$next=$(this).find('.btn-next'),vId=$(this).data('previewId'),vPrevKey=self.rtl?39:37,vNextKey=self.rtl?37:39;if(key===vPrevKey&&$prev.length&&!$prev.attr('disabled')){self._zoomSlideShow('prev',vId);}if(key===vNextKey&&$next.length&&!$next.attr('disabled')){self._zoomSlideShow('next',vId);}});},_zoomPreview:function($btn){var self=this,$frame,$modal=self.$modal;if(!$btn.length){throw'Cannot zoom to detailed preview!';}$h.initModal($modal);$modal.html(self._getModalContent());$frame=$btn.closest($h.FRAMES);self._setZoomContent($frame);$modal.modal('show');self._initZoomButtons();},_zoomSlideShow:function(dir,previewId){var self=this,$btn=self.$modal.find('.kv-zoom-actions .btn-'+dir),$targFrame,i,thumbs=self.getFrames().toArray(),len=thumbs.length,out;if($btn.attr('disabled')){return;}for(i=0;i=len||!thumbs[out]){return;}$targFrame=$(thumbs[out]);if($targFrame.length){self._setZoomContent($targFrame,true);}self._initZoomButtons();self._raise('filezoom'+dir,{'previewId':previewId,modal:self.$modal});},_initZoomButton:function(){var self=this;self.$preview.find('.kv-file-zoom').each(function(){var $el=$(this);self._handler($el,'click',function(){self._zoomPreview($el);});});},_inputFileCount:function(){return this.$element.get(0).files.length;},_refreshPreview:function(){var self=this,files;if((!self._inputFileCount()&&!self.isAjaxUpload)||!self.showPreview||!self.isPreviewable){return;}if(self.isAjaxUpload){if(self.fileManager.count()>0){files=$.extend(true,{},self.fileManager.stack);self.fileManager.clear();self._clearFileInput();}else{files=self.$element.get(0).files;}}else{files=self.$element.get(0).files;}if(files&&files.length){self.readFiles(files);self._setFileDropZoneTitle();}},_clearObjects:function($el){$el.find('video audio').each(function(){this.pause();$(this).remove();});$el.find('img object div').each(function(){$(this).remove();});},_clearFileInput:function(){var self=this,$el=self.$element,$srcFrm,$tmpFrm,$tmpEl;if(!self._inputFileCount()){return;}$srcFrm=$el.closest('form');$tmpFrm=$(document.createElement('form'));$tmpEl=$(document.createElement('div'));$el.before($tmpEl);if($srcFrm.length){$srcFrm.after($tmpFrm);}else{$tmpEl.after($tmpFrm);}$tmpFrm.append($el).trigger('reset');$tmpEl.before($el).remove();$tmpFrm.remove();},_resetUpload:function(){var self=this;self.uploadCache={content:[],config:[],tags:[],append:true};self.$btnUpload.removeAttr('disabled');self._setProgress(0);self.$progress.hide();self._resetErrors(false);self._initAjax();self.fileManager.clearImages();self._resetCanvas();self.cacheInitialPreview={};if(self.overwriteInitial){self.initialPreview=[];self.initialPreviewConfig=[];self.initialPreviewThumbTags=[];self.previewCache.data={content:[],config:[],tags:[]};}},_resetCanvas:function(){var self=this;if(self.canvas&&self.imageCanvasContext){self.imageCanvasContext.clearRect(0,0,self.canvas.width,self.canvas.height);}},_hasInitialPreview:function(){var self=this;return!self.overwriteInitial&&self.previewCache.count(true);},_resetPreview:function(){var self=this,out,cap;if(self.previewCache.count(true)){out=self.previewCache.out();self._setPreviewContent(out.content);self._setInitThumbAttr();cap=self.initialCaption?self.initialCaption:out.caption;self._setCaption(cap);}else{self._clearPreview();self._initCaption();}if(self.showPreview){self._initZoom();self._initSortable();}},_clearDefaultPreview:function(){var self=this;self.$preview.find('.file-default-preview').remove();},_validateDefaultPreview:function(){var self=this;if(!self.showPreview||$h.isEmpty(self.defaultPreviewContent)){return;}self._setPreviewContent('
    '+self.defaultPreviewContent+'
    ');self.$container.removeClass('file-input-new');self._initClickable();},_resetPreviewThumbs:function(isAjax){var self=this,out;if(isAjax){self._clearPreview();self.clearFileStack();return;}if(self._hasInitialPreview()){out=self.previewCache.out();self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(out.caption);self._initPreviewActions();}else{self._clearPreview();}},_getLayoutTemplate:function(t){var self=this,template=self.layoutTemplates[t];if($h.isEmpty(self.customLayoutTags)){return template;}return $h.replaceTags(template,self.customLayoutTags);},_getPreviewTemplate:function(t){var self=this,template=self.previewTemplates[t];if($h.isEmpty(self.customPreviewTags)){return template;}return $h.replaceTags(template,self.customPreviewTags);},_getOutData:function(formdata,jqXHR,responseData,filesData){var self=this;jqXHR=jqXHR||{};responseData=responseData||{};filesData=filesData||self.fileManager.list();return{formdata:formdata,files:filesData,filenames:self.filenames,filescount:self.getFilesCount(),extra:self._getExtraData(),response:responseData,reader:self.reader,jqXHR:jqXHR};},_getMsgSelected:function(n){var self=this,strFiles=n===1?self.fileSingle:self.filePlural;return n>0?self.msgSelected.replace('{n}',n).replace('{files}',strFiles):self.msgNoFilesSelected;},_getFrame:function(id){var self=this,$frame=$('#'+id);if(!$frame.length){self._log($h.logMessages.invalidThumb,{id:id});return null;}return $frame;},_getThumbs:function(css){css=css||'';return this.getFrames(':not(.file-preview-initial)'+css);},_getExtraData:function(fileId,index){var self=this,data=self.uploadExtraData;if(typeof self.uploadExtraData==='function'){data=self.uploadExtraData(fileId,index);}return data;},_initXhr:function(xhrobj,fileId,fileCount){var self=this,fm=self.fileManager,func=function(event){var pct=0,total=event.total,loaded=event.loaded||event.position,stats=fm.getUploadStats(fileId,loaded,total);if(event.lengthComputable&&!self.enableResumableUpload){pct=$h.round(loaded/total*100);}if(fileId){self._setFileUploadStats(fileId,pct,fileCount,stats);}else{self._setProgress(pct,null,null,self._getStats(stats));}self._raise('fileajaxprogress',[stats]);};if(xhrobj.upload){if(self.progressDelay){func=$h.debounce(func,self.progressDelay);}xhrobj.upload.addEventListener('progress',func,false);}return xhrobj;},_initAjaxSettings:function(){var self=this;self._ajaxSettings=$.extend(true,{},self.ajaxSettings);self._ajaxDeleteSettings=$.extend(true,{},self.ajaxDeleteSettings);},_mergeAjaxCallback:function(funcName,srcFunc,type){var self=this,settings=self._ajaxSettings,flag=self.mergeAjaxCallbacks,targFunc;if(type==='delete'){settings=self._ajaxDeleteSettings;flag=self.mergeAjaxDeleteCallbacks;}targFunc=settings[funcName];if(flag&&typeof targFunc==='function'){if(flag==='before'){settings[funcName]=function(){targFunc.apply(this,arguments);srcFunc.apply(this,arguments);};}else{settings[funcName]=function(){srcFunc.apply(this,arguments);targFunc.apply(this,arguments);};}}else{settings[funcName]=srcFunc;}},_ajaxSubmit:function(fnBefore,fnSuccess,fnComplete,fnError,formdata,fileId,index,vUrl){var self=this,settings,defaults,data,processQueue;if(!self._raise('filepreajax',[formdata,fileId,index])){return;}formdata.append('initialPreview',JSON.stringify(self.initialPreview));formdata.append('initialPreviewConfig',JSON.stringify(self.initialPreviewConfig));formdata.append('initialPreviewThumbTags',JSON.stringify(self.initialPreviewThumbTags));self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore);self._mergeAjaxCallback('success',fnSuccess);self._mergeAjaxCallback('complete',fnComplete);self._mergeAjaxCallback('error',fnError);vUrl=vUrl||self.uploadUrlThumb||self.uploadUrl;if(typeof vUrl==='function'){vUrl=vUrl();}data=self._getExtraData(fileId,index)||{};if(typeof data==='object'){$.each(data,function(key,value){formdata.append(key,value);});}defaults={xhr:function(){var xhrobj=$.ajaxSettings.xhr();return self._initXhr(xhrobj,fileId,self.fileManager.count());},url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:formdata,cache:false,processData:false,contentType:false};settings=$.extend(true,{},defaults,self._ajaxSettings);self.ajaxQueue.push(settings);processQueue=function(){var config,xhr;if(self.ajaxCurrentThreads0){self.hasInitData=true;content=out.initialPreview||[];config=out.initialPreviewConfig||[];tags=out.initialPreviewThumbTags||[];append=out.append===undefined||out.append;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter);}if(content.length){self._mergeArray('initialPreview',content);self._mergeArray('initialPreviewConfig',config);self._mergeArray('initialPreviewThumbTags',tags);}if($thumb!==undefined){if(!allFiles){index=self.previewCache.add(content[0],config[0],tags[0],append);data=self.previewCache.get(index,false);$div=$(document.createElement('div')).html(data).hide().insertAfter($thumb);$newCache=$div.find('.kv-zoom-cache');if($newCache&&$newCache.length){$newCache.insertAfter($thumb);}$thumb.fadeOut('slow',function(){var $newThumb=$div.find('.file-preview-frame');if($newThumb&&$newThumb.length){$newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block');}self._initPreviewActions();self._clearFileInput();$h.cleanZoomCache(self.$preview.find('#zoom-'+$thumb.attr('id')));$thumb.remove();$div.remove();self._initSortable();});}else{i=$thumb.attr('data-fileindex');self.uploadCache.content[i]=content[0];self.uploadCache.config[i]=config[0]||[];self.uploadCache.tags[i]=tags[0]||[];self.uploadCache.append=append;}}else{self.previewCache.set(content,config,tags,append);self._initPreview();self._initPreviewActions();}}},_initSuccessThumbs:function(){var self=this;if(!self.showPreview){return;}self._getThumbs($h.FRAMES+'.file-preview-success').each(function(){var $thumb=$(this),$preview=self.$preview,$remove=$thumb.find('.kv-file-remove');$remove.removeAttr('disabled');self._handler($remove,'click',function(){var id=$thumb.attr('id'),out=self._raise('filesuccessremove',[id,$thumb.attr('data-fileindex')]);$h.cleanMemory($thumb);if(out===false){return;}$thumb.fadeOut('slow',function(){$h.cleanZoomCache($preview.find('#zoom-'+id));$thumb.remove();if(!self.getFrames().length){self.reset();}});});});},_updateInitialPreview:function(){var self=this,u=self.uploadCache,i,j,len=0,data=self.cacheInitialPreview;if(data&&data.content){len=data.content.length;}if(self.showPreview){self.previewCache.set(u.content,u.config,u.tags,u.append);if(len){for(i=0;i0||!$.isEmptyObject(self.uploadExtraData),uploadFailed,$prog,fnBefore,errMsg,fnSuccess,fnComplete,fnError,updateUploadLog,op=self.ajaxOperations.uploadThumb,fileObj=fm.getFile(id),params={id:previewId,index:i,fileId:id},fileName=self.fileManager.getFileName(id,true);if(self.enableResumableUpload){return;}if(self.showPreview){$thumb=self.fileManager.getThumb(id);$prog=$thumb.find('.file-thumb-progress');$btnUpload=$thumb.find('.kv-file-upload');$btnDelete=$thumb.find('.kv-file-remove');$prog.show();}if(count===0||!hasPostData||(self.showPreview&&$btnUpload&&$btnUpload.hasClass('disabled'))||self._abort(params)){return;}updateUploadLog=function(){if(!uploadFailed){fm.removeFile(id);}else{fm.errors.push(id);}fm.setProcessed(id);if(fm.isProcessed()){self.fileBatchCompleted=true;}};chkComplete=function(){var $initThumbs;if(!self.fileBatchCompleted){return;}setTimeout(function(){var triggerReset=fm.count()===0,errCount=fm.errors.length;self._updateInitialPreview();self.unlock(triggerReset);if(triggerReset){self._clearFileInput();}$initThumbs=self.$preview.find('.file-preview-initial');if(self.uploadAsync&&$initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable();}self._raise('filebatchuploadcomplete',[fm.stack,self._getExtraData()]);if(!self.retryErrorUploads||errCount===0){fm.clear();}self._setProgress(101);self.ajaxAborted=false;},self.processDelay);};fnBefore=function(jqXHR){outData=self._getOutData(formdata,jqXHR);fm.initStats(id);self.fileBatchCompleted=false;if(!isBatch){self.ajaxAborted=false;}if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading');}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true);}if(!isBatch){self.lock();}if(fm.errors.indexOf(id)!==-1){delete fm.errors[id];}self._raise('filepreupload',[outData,previewId,i]);$.extend(true,params,outData);if(self._abort(params)){jqXHR.abort();if(!isBatch){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading');$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled');self.unlock();}self._setProgressCancelled();}};fnSuccess=function(data,textStatus,jqXHR){var pid=self.showPreview&&$thumb.attr('id')?$thumb.attr('id'):previewId;outData=self._getOutData(formdata,jqXHR,data);$.extend(true,params,outData);setTimeout(function(){if($h.isEmpty(data)||$h.isEmpty(data.error)){if(self.showPreview){self._setThumbStatus($thumb,'Success');$btnUpload.hide();self._initUploadSuccess(data,$thumb,isBatch);self._setProgress(101,$prog);}self._raise('fileuploaded',[outData,pid,i]);if(!isBatch){self.fileManager.remove($thumb);}else{updateUploadLog();}}else{uploadFailed=true;errMsg=self._parseError(op,jqXHR,self.msgUploadError,self.fileManager.getFileName(id));self._showFileError(errMsg,params);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide();}if(isBatch){updateUploadLog();}self._setProgress(101,$('#'+pid).find('.file-thumb-progress'),self.msgUploadError);}},self.processDelay);};fnComplete=function(){setTimeout(function(){if(self.showPreview){$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled');$thumb.removeClass('file-uploading');}if(!isBatch){self.unlock(false);self._clearFileInput();}else{chkComplete();}self._initSuccessThumbs();},self.processDelay);};fnError=function(jqXHR,textStatus,errorThrown){errMsg=self._parseError(op,jqXHR,errorThrown,self.fileManager.getFileName(id));uploadFailed=true;setTimeout(function(){if(isBatch){updateUploadLog();}self.fileManager.setProgress(id,100);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide();}$.extend(true,params,self._getOutData(formdata,jqXHR));self._setProgress(101,$prog,self.msgAjaxProgressError.replace('{operation}',op));self._setProgress(101,$thumb.find('.file-thumb-progress'),self.msgUploadError);self._showFileError(errMsg,params);},self.processDelay);};formdata.append(self.uploadFileAttr,fileObj.file,fileName);self._setUploadData(formdata,{fileId:id});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata,id,i);},_uploadBatch:function(){var self=this,fm=self.fileManager,total=fm.total(),params={},fnBefore,fnSuccess,fnError,fnComplete,hasPostData=total>0||!$.isEmptyObject(self.uploadExtraData),errMsg,setAllUploaded,formdata=new FormData(),op=self.ajaxOperations.uploadBatch;if(total===0||!hasPostData||self._abort(params)){return;}setAllUploaded=function(){self.fileManager.clear();self._clearFileInput();};fnBefore=function(jqXHR){self.lock();fm.initStats();var outData=self._getOutData(formdata,jqXHR);self.ajaxAborted=false;if(self.showPreview){self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading');}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true);});}self._raise('filebatchpreupload',[outData]);if(self._abort(outData)){jqXHR.abort();self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if($thumb.hasClass('file-preview-loading')){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading');}$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled');});self._setProgressCancelled();}};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data),key=0,$thumbs=self._getThumbs(':not(.file-preview-success)'),keys=$h.isEmpty(data)||$h.isEmpty(data.errorkeys)?[]:data.errorkeys;if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);setAllUploaded();if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);self._setThumbStatus($thumb,'Success');$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').hide().removeAttr('disabled');});self._initUploadSuccess(data);}else{self.reset();}self._setProgress(101);}else{if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').removeAttr('disabled');$thumb.find('.kv-file-remove').removeAttr('disabled');if(keys.length===0||$.inArray(key,keys)!==-1){self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$thumb.find('.kv-file-upload').hide();self.fileManager.remove($thumb);}}else{$thumb.find('.kv-file-upload').hide();self._setThumbStatus($thumb,'Success');self.fileManager.remove($thumb);}if(!$thumb.hasClass('file-preview-error')||self.retryErrorUploads){key++;}});self._initUploadSuccess(data);}errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgUploadError);}};fnComplete=function(){self.unlock();self._initSuccessThumbs();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()]);};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);self._showFileError(errMsg,outData,'filebatchuploaderror');self.uploadFileCount=total-1;if(!self.showPreview){return;}self._getThumbs().each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');if(self.fileManager.getFile($thumb.attr('data-fileid'))){self._setPreviewError($thumb);}});self._getThumbs().removeClass('file-uploading');self._getThumbs(' .kv-file-upload').removeAttr('disabled');self._getThumbs(' .kv-file-delete').removeAttr('disabled');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op));};var ctr=0;$.each(self.fileManager.stack,function(key,data){if(!$h.isEmpty(data.file)){formdata.append(self.uploadFileAttr,data.file,(data.nameFmt||('untitled_'+ctr)));}ctr++;});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata);},_uploadExtraOnly:function(){var self=this,params={},fnBefore,fnSuccess,fnComplete,fnError,formdata=new FormData(),errMsg,op=self.ajaxOperations.uploadExtra;if(self._abort(params)){return;}fnBefore=function(jqXHR){self.lock();var outData=self._getOutData(formdata,jqXHR);self._raise('filebatchpreupload',[outData]);self._setProgress(50);params.data=outData;params.xhr=jqXHR;if(self._abort(params)){jqXHR.abort();self._setProgressCancelled();}};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data);if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);self._clearFileInput();self._initUploadSuccess(data);self._setProgress(101);}else{errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror');}};fnComplete=function(){self.unlock();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()]);};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);params.data=outData;self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op));};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata);},_deleteFileIndex:function($frame){var self=this,ind=$frame.attr('data-fileindex'),rev=self.reversePreviewOrder;if(ind.substring(0,5)==='init_'){ind=parseInt(ind.replace('init_',''));self.initialPreview=$h.spliceArray(self.initialPreview,ind,rev);self.initialPreviewConfig=$h.spliceArray(self.initialPreviewConfig,ind,rev);self.initialPreviewThumbTags=$h.spliceArray(self.initialPreviewThumbTags,ind,rev);self.getFrames().each(function(){var $nFrame=$(this),nInd=$nFrame.attr('data-fileindex');if(nInd.substring(0,5)==='init_'){nInd=parseInt(nInd.replace('init_',''));if(nInd>ind){nInd--;$nFrame.attr('data-fileindex','init_'+nInd);}}});if(self.uploadAsync||self.enableResumableUpload){self.cacheInitialPreview=self.getPreview();}}},_initFileActions:function(){var self=this,$preview=self.$preview;if(!self.showPreview){return;}self._initZoomButton();self.getFrames(' .kv-file-remove').each(function(){var $el=$(this),$frame=$el.closest($h.FRAMES),hasError,id=$frame.attr('id'),ind=$frame.attr('data-fileindex'),n,cap,status;self._handler($el,'click',function(){status=self._raise('filepreremove',[id,ind]);if(status===false||!self._validateMinCount()){return false;}hasError=$frame.hasClass('file-preview-error');$h.cleanMemory($frame);$frame.fadeOut('slow',function(){$h.cleanZoomCache($preview.find('#zoom-'+id));self.fileManager.remove($frame);self._clearObjects($frame);$frame.remove();if(id&&hasError){self.$errorContainer.find('li[data-thumb-id="'+id+'"]').fadeOut('fast',function(){$(this).remove();if(!self._errorsExist()){self._resetErrors();}});}self._clearFileInput();var chk=self.previewCache.count(true),len=self.fileManager.count(),file,hasThumb=self.showPreview&&self.getFrames().length;if(len===0&&chk===0&&!hasThumb){self.reset();}else{n=chk+len;if(n>1){cap=self._getMsgSelected(n);}else{file=self.fileManager.getFirstFile();cap=file?file.nameFmt:'_';}self._setCaption(cap);}self._raise('fileremoved',[id,ind]);});});});self.getFrames(' .kv-file-upload').each(function(){var $el=$(this);self._handler($el,'click',function(){var $frame=$el.closest($h.FRAMES),id=$frame.attr('data-fileid');self.$progress.hide();if($frame.hasClass('file-preview-error')&&!self.retryErrorUploads){return;}self._uploadSingle(self.fileManager.getIndex(id),id,false);});});},_initPreviewActions:function(){var self=this,$preview=self.$preview,deleteExtraData=self.deleteExtraData||{},btnRemove=$h.FRAMES+' .kv-file-remove',settings=self.fileActionSettings,origClass=settings.removeClass,errClass=settings.removeErrorClass,resetProgress=function(){var hasFiles=self.isAjaxUpload?self.previewCache.count(true):self._inputFileCount();if(!self.getFrames().length&&!hasFiles){self._setCaption('');self.reset();self.initialCaption='';}};self._initZoomButton();$preview.find(btnRemove).each(function(){var $el=$(this),vUrl=$el.data('url')||self.deleteUrl,vKey=$el.data('key'),errMsg,fnBefore,fnSuccess,fnError,op=self.ajaxOperations.deleteThumb;if($h.isEmpty(vUrl)||vKey===undefined){return;}if(typeof vUrl==='function'){vUrl=vUrl();}var $frame=$el.closest($h.FRAMES),cache=self.previewCache.data,settings,params,config,fileName,extraData,index=$frame.attr('data-fileindex');index=parseInt(index.replace('init_',''));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;fileName=config.filename||config.caption||'';if(typeof extraData==='function'){extraData=extraData();}params={id:$el.attr('id'),key:vKey,extra:extraData};fnBefore=function(jqXHR){self.ajaxAborted=false;self._raise('filepredelete',[vKey,jqXHR,extraData]);if(self._abort()){jqXHR.abort();}else{$el.removeClass(errClass);$h.addCss($frame,'file-uploading');$h.addCss($el,'disabled '+origClass);}};fnSuccess=function(data,textStatus,jqXHR){var n,cap;if(!$h.isEmpty(data)&&!$h.isEmpty(data.error)){params.jqXHR=jqXHR;params.response=data;errMsg=self._parseError(op,jqXHR,self.msgDeleteError,fileName);self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress();return;}$frame.removeClass('file-uploading').addClass('file-deleted');$frame.fadeOut('slow',function(){index=parseInt(($frame.attr('data-fileindex')).replace('init_',''));self.previewCache.unset(index);self._deleteFileIndex($frame);n=self.previewCache.count(true);cap=n>0?self._getMsgSelected(n):'';self._setCaption(cap);self._raise('filedeleted',[vKey,jqXHR,extraData]);$h.cleanZoomCache($preview.find('#zoom-'+$frame.attr('id')));self._clearObjects($frame);$frame.remove();resetProgress();});};fnError=function(jqXHR,textStatus,errorThrown){var errMsg=self._parseError(op,jqXHR,errorThrown,fileName);params.jqXHR=jqXHR;params.response={};self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress();};self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore,'delete');self._mergeAjaxCallback('success',fnSuccess,'delete');self._mergeAjaxCallback('error',fnError,'delete');settings=$.extend(true,{},{url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:$.extend(true,{},{key:vKey},extraData)},self._ajaxDeleteSettings);self._handler($el,'click',function(){if(!self._validateMinCount()){return false;}self.ajaxAborted=false;self._raise('filebeforedelete',[vKey,extraData]);if(self.ajaxAborted instanceof Promise){self.ajaxAborted.then(function(result){if(!result){$.ajax(settings);}});}else{if(!self.ajaxAborted){$.ajax(settings);}}});});},_hideFileIcon:function(){var self=this;if(self.overwriteInitial){self.$captionContainer.removeClass('icon-visible');}},_showFileIcon:function(){var self=this;$h.addCss(self.$captionContainer,'icon-visible');},_getSize:function(bytes,sizes){var self=this,size=parseFloat(bytes),i,func=self.fileSizeGetter,out;if(!$.isNumeric(bytes)||!$.isNumeric(size)){return'';}if(typeof func==='function'){out=func(size);}else{if(size===0){out='0.00 B';}else{i=Math.floor(Math.log(size)/Math.log(1024));if(!sizes){sizes=['B','KB','MB','GB','TB','PB','EB','ZB','YB'];}out=(size/Math.pow(1024,i)).toFixed(2)*1+' '+sizes[i];}}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,fileId,isError,size,frameClass,foot,ind,templ,attrs,zoomData){var self=this,caption=self.slug(fname),prevContent,zoomContent='',styleAttribs='',screenW=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,config,newCat=self.preferIconicPreview?'other':cat,title=caption,alt=caption,footer=foot||self._renderFileFooter(cat,caption,size,'auto',isError),hasIconSetting=self._getPreviewIcon(fname),typeCss='type-default',forcePrevIcon=hasIconSetting&&self.preferIconicPreview,forceZoomIcon=hasIconSetting&&self.preferIconicZoomPreview,getContent;config=screenW<400?(self.previewSettingsSmall[newCat]||self.defaults.previewSettingsSmall[newCat]):(self.previewSettings[newCat]||self.defaults.previewSettings[newCat]);if(config){$.each(config,function(key,val){styleAttribs+=key+':'+val+';';});}getContent=function(c,d,zoom,frameCss){var id=zoom?'zoom-'+previewId:previewId,tmplt=self._getPreviewTemplate(c),css=(frameClass||'')+' '+frameCss;if(self.frameClass){css=self.frameClass+' '+css;}if(zoom){css=css.replace(' '+$h.SORT_CSS,'');}tmplt=self._parseFilePreviewIcon(tmplt,fname);if(c==='text'){d=$h.htmlEncode(d);}if(cat==='object'&&!ftype){$.each(self.defaults.fileTypeSettings,function(key,func){if(key==='object'||key==='other'){return;}if(func(fname,ftype)){typeCss='type-'+key;}});}if(!$h.isEmpty(attrs)){if(attrs.title!==undefined&&attrs.title!==null){title=attrs.title;}if(attrs.alt!==undefined&&attrs.alt!==null){title=attrs.alt;}}return tmplt.setTokens({'previewId':id,'caption':caption,'title':title,'alt':alt,'frameClass':css,'type':self._getFileType(ftype),'fileindex':ind,'fileid':fileId||'','typeCss':typeCss,'footer':footer,'data':d,'template':templ||cat,'style':styleAttribs?'style="'+styleAttribs+'"':''});};ind=ind||previewId.slice(previewId.lastIndexOf('-')+1);if(self.fileActionSettings.showZoom){zoomContent=getContent((forceZoomIcon?'other':cat),zoomData?zoomData:data,true,'kv-zoom-thumb');}zoomContent='\n'+self._getLayoutTemplate('zoomCache').replace('{zoomContent}',zoomContent);if(typeof self.sanitizeZoomCache==='function'){zoomContent=self.sanitizeZoomCache(zoomContent);}prevContent=getContent((forcePrevIcon?'other':cat),data,false,'kv-preview-thumb');return prevContent+zoomContent;},_addToPreview:function($preview,content){var self=this;return self.reversePreviewOrder?$preview.prepend(content):$preview.append(content);},_previewDefault:function(file,previewId,isDisabled){var self=this,$preview=self.$preview;if(!self.showPreview){return;}var fname=$h.getFileName(file),ftype=file?file.type:'',content,size=file.size||0,caption=self._getFileName(file,''),isError=isDisabled===true&&!self.isAjaxUpload,data=$h.createObjectURL(file),fileId=self.fileManager.getId(file);self._clearDefaultPreview();content=self._generatePreviewTemplate('other',data,fname,ftype,previewId,fileId,isError,size);self._addToPreview($preview,content);self._setThumbAttr(previewId,caption,size);if(isDisabled===true&&self.isAjaxUpload){self._setThumbStatus($('#'+previewId),'Error');}},canPreview:function(file){var self=this;if(!file||!self.showPreview||!self.$preview||!self.$preview.length){return false;}var name=file.name||'',type=file.type||'',size=(file.size||0)/1000,cat=self._parseFileType(type,name),allowedTypes,allowedMimes,allowedExts,skipPreview,types=self.allowedPreviewTypes,mimes=self.allowedPreviewMimeTypes,exts=self.allowedPreviewExtensions||[],dTypes=self.disabledPreviewTypes,dMimes=self.disabledPreviewMimeTypes,dExts=self.disabledPreviewExtensions||[],maxSize=self.maxFilePreviewSize&&parseFloat(self.maxFilePreviewSize)||0,expAllExt=new RegExp('\\.('+exts.join('|')+')$','i'),expDisExt=new RegExp('\\.('+dExts.join('|')+')$','i');allowedTypes=!types||types.indexOf(cat)!==-1;allowedMimes=!mimes||mimes.indexOf(type)!==-1;allowedExts=!exts.length||$h.compare(name,expAllExt);skipPreview=(dTypes&&dTypes.indexOf(cat)!==-1)||(dMimes&&dMimes.indexOf(type)!==-1)||(dExts.length&&$h.compare(name,expDisExt))||(maxSize&&!isNaN(maxSize)&&size>maxSize);return!skipPreview&&(allowedTypes||allowedMimes||allowedExts);},_previewFile:function(i,file,theFile,previewId,data,fileInfo){if(!this.showPreview){return;}var self=this,fname=$h.getFileName(file),ftype=fileInfo.type,caption=fileInfo.name,cat=self._parseFileType(ftype,fname),content,$preview=self.$preview,fsize=file.size||0,iData=(cat==='text'||cat==='html'||cat==='image')?theFile.target.result:data,fileId=self.fileManager.getId(file);if(cat==='html'&&self.purifyHtml&&window.DOMPurify){iData=window.DOMPurify.sanitize(iData);}content=self._generatePreviewTemplate(cat,iData,fname,ftype,previewId,fileId,false,fsize);self._clearDefaultPreview();self._addToPreview($preview,content);var $thumb=$preview.find('#'+previewId),$img=$thumb.find('img'),id=$thumb.attr('data-fileid');self._validateImageOrientation($img,file,previewId,id,caption,ftype,fsize,iData);self._setThumbAttr(previewId,caption,fsize);self._initSortable();},_setThumbAttr:function(id,caption,size){var self=this,$frame=$('#'+id);if($frame.length){size=size&&size>0?self._getSize(size):'';$frame.data({'caption':caption,'size':size});}},_setInitThumbAttr:function(){var self=this,data=self.previewCache.data,len=self.previewCache.count(true),config,caption,size,previewId;if(len===0){return;}for(var i=0;i&"']/g,'_');},_updateFileDetails:function(numFiles){var self=this,$el=self.$element,label,n,log,nFiles,file,name=($h.isIE(9)&&$h.findFileName($el.val()))||($el[0].files[0]&&$el[0].files[0].name);if(!name&&self.fileManager.count()>0){file=self.fileManager.getFirstFile();label=file.nameFmt;}else{label=name?self.slug(name):'_';}n=self.isAjaxUpload?self.fileManager.count():numFiles;nFiles=self.previewCache.count(true)+n;log=n===1?label:self._getMsgSelected(nFiles);if(self.isError){self.$previewContainer.removeClass('file-thumb-loading');self.$previewStatus.html('');self.$captionContainer.removeClass('icon-visible');}else{self._showFileIcon();}self._setCaption(log,self.isError);self.$container.removeClass('file-input-new file-input-ajax-new');if(arguments.length===1){self._raise('fileselect',[numFiles,label]);}if(self.previewCache.count(true)){self._initPreviewActions();}},_setThumbStatus:function($thumb,status){var self=this;if(!self.showPreview){return;}var icon='indicator'+status,msg=icon+'Title',css='file-preview-'+status.toLowerCase(),$indicator=$thumb.find('.file-upload-indicator'),config=self.fileActionSettings;$thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading');if(status==='Success'){$thumb.find('.file-drag-handle').remove();}$indicator.html(config[icon]);$indicator.attr('title',config[msg]);$thumb.addClass(css);if(status==='Error'&&!self.retryErrorUploads){$thumb.find('.kv-file-upload').attr('disabled',true);}},_setProgressCancelled:function(){var self=this;self._setProgress(101,self.$progress,self.msgCancelled);},_setProgress:function(p,$el,error,stats){var self=this;$el=$el||self.$progress;if(!$el.length){return;}var pct=Math.min(p,100),out,pctLimit=self.progressUploadThreshold,t=p<=100?self.progressTemplate:self.progressCompleteTemplate,template=pct<100?self.progressTemplate:(error?(self.paused?self.progressPauseTemplate:self.progressErrorTemplate):t);if(p>=100){stats='';}if(!$h.isEmpty(template)){if(pctLimit&&pct>pctLimit&&p<=100){out=template.setTokens({'percent':pctLimit,'status':self.msgUploadThreshold});}else{out=template.setTokens({'percent':pct,'status':(p>100?self.msgUploadEnd:pct+'%')});}stats=stats||'';out=out.setTokens({stats:stats});$el.html(out);if(error){$el.find('[role="progressbar"]').html(error);}}},_setFileDropZoneTitle:function(){var self=this,$zone=self.$container.find('.file-drop-zone'),title=self.dropZoneTitle,strFiles;if(self.isClickable){strFiles=$h.isEmpty(self.$element.attr('multiple'))?self.fileSingle:self.filePlural;title+=self.dropZoneClickTitle.replace('{files}',strFiles);}$zone.find('.'+self.dropZoneTitleClass).remove();if(!self.showPreview||$zone.length===0||self.fileManager.count()>0||!self.dropZoneEnabled||(!self.isAjaxUpload&&self.$element.files)){return;}if($zone.find($h.FRAMES).length===0&&$h.isEmpty(self.defaultPreviewContent)){$zone.prepend('
    '+title+'
    ');}self.$container.removeClass('file-input-new');$h.addCss(self.$container,'file-input-ajax-new');},_getStats:function(stats){var self=this,pendingTime,t;if(!self.showUploadStats||!stats||!stats.bitrate){return'';}t=self._getLayoutTemplate('stats');pendingTime=(!stats.elapsed||!stats.bps)?self.msgCalculatingTime:self.msgPendingTime.setTokens({time:$h.getElapsed(Math.ceil(stats.pendingBytes/stats.bps))});return t.setTokens({uploadSpeed:stats.bitrate,pendingTime:pendingTime});},_setResumableProgress:function(pct,stats,$thumb){var self=this,rm=self.resumableManager,obj=$thumb?rm:self,$prog=$thumb?$thumb.find('.file-thumb-progress'):null;if(obj.lastProgress===0){obj.lastProgress=pct;}if(pct0&&self._getFileCount(len-1)=limit:dim<=limit;if(isValid){return;}msg=self['msgImage'+type+chk].setTokens({'name':fname,'size':limit});self._showFileError(msg,params);self._setPreviewError($thumb);},_getExifObj:function(data){var self=this,exifObj=null,error=$h.logMessages.exifWarning;if(data.slice(0,23)!=='data:image/jpeg;base64,'&&data.slice(0,22)!=='data:image/jpg;base64,'){exifObj=null;return;}try{exifObj=window.piexif?window.piexif.load(data):null;}catch(err){exifObj=null;error=err&&err.message||'';}if(!exifObj){self._log($h.logMessages.badExifParser,{details:error});}return exifObj;},setImageOrientation:function($img,$zoomImg,value,$thumb){var self=this,invalidImg=!$img||!$img.length,invalidZoomImg=!$zoomImg||!$zoomImg.length,$mark,isHidden=false,$div,zoomOnly=invalidImg&&$thumb&&$thumb.attr('data-template')==='image',ev;if(invalidImg&&invalidZoomImg){return;}ev='load.fileinputimageorient';if(zoomOnly){$img=$zoomImg;$zoomImg=null;$img.css(self.previewSettings.image);$div=$(document.createElement('div')).appendTo($thumb.find('.kv-file-content'));$mark=$(document.createElement('span')).insertBefore($img);$img.css('visibility','hidden').removeClass('file-zoom-detail').appendTo($div);}else{isHidden=!$img.is(':visible');}$img.off(ev).on(ev,function(){if(isHidden){self.$preview.removeClass('hide-content');$thumb.find('.kv-file-content').css('visibility','hidden');}var img=$img.get(0),zoomImg=$zoomImg&&$zoomImg.length?$zoomImg.get(0):null,h=img.offsetHeight,w=img.offsetWidth,r=$h.getRotation(value);if(isHidden){$thumb.find('.kv-file-content').css('visibility','visible');self.$preview.addClass('hide-content');}$img.data('orientation',value);if(zoomImg){$zoomImg.data('orientation',value);}if(value<5){$h.setTransform(img,r);$h.setTransform(zoomImg,r);return;}var offsetAngle=Math.atan(w/h),origFactor=Math.sqrt(Math.pow(h,2)+Math.pow(w,2)),scale=!origFactor?1:(h/Math.cos(Math.PI/2+offsetAngle))/origFactor,s=' scale('+Math.abs(scale)+')';$h.setTransform(img,r+s);$h.setTransform(zoomImg,r+s);if(zoomOnly){$img.css('visibility','visible').insertAfter($mark).addClass('file-zoom-detail');$mark.remove();$div.remove();}});},_validateImageOrientation:function($img,file,previewId,fileId,caption,ftype,fsize,iData){var self=this,exifObj,value,autoOrientImage=self.autoOrientImage;exifObj=autoOrientImage?self._getExifObj(iData):null;value=exifObj?exifObj['0th'][piexif.ImageIFD.Orientation]:null;if(!value){self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);return;}self.setImageOrientation($img,$('#zoom-'+previewId+' img'),value,$('#'+previewId));self._raise('fileimageoriented',{'$img':$img,'file':file});self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);},_validateImage:function(previewId,fileId,fname,ftype,fsize,iData,exifObj){var self=this,$preview=self.$preview,params,w1,w2,$thumb=$preview.find('#'+previewId),i=$thumb.attr('data-fileindex'),$img=$thumb.find('img');fname=fname||'Untitled';$img.one('load',function(){w1=$thumb.width();w2=$preview.width();if(w1>w2){$img.css('width','100%');}params={ind:i,id:previewId,fileId:fileId};self._checkDimensions(i,'Small',$img,$thumb,fname,'Width',params);self._checkDimensions(i,'Small',$img,$thumb,fname,'Height',params);if(!self.resizeImage){self._checkDimensions(i,'Large',$img,$thumb,fname,'Width',params);self._checkDimensions(i,'Large',$img,$thumb,fname,'Height',params);}self._raise('fileimageloaded',[previewId]);self.fileManager.addImage(fileId,{ind:i,img:$img,thumb:$thumb,pid:previewId,typ:ftype,siz:fsize,validated:false,imgData:iData,exifObj:exifObj});$thumb.data('exif',exifObj);self._validateAllImages();}).one('error',function(){self._raise('fileimageloaderror',[previewId]);}).each(function(){if(this.complete){$(this).trigger('load');}else{if(this.error){$(this).trigger('error');}}});},_validateAllImages:function(){var self=this,counter={val:0},numImgs=self.fileManager.getImageCount(),fsize,minSize=self.resizeIfSizeMoreThan;if(numImgs!==self.fileManager.totalImages){return;}self._raise('fileimagesloaded');if(!self.resizeImage){return;}$.each(self.fileManager.loadedImages,function(id,config){if(!config.validated){fsize=config.siz;if(fsize&&fsize>minSize*1000){self._getResizedImage(id,config,counter,numImgs);}config.validated=true;}});},_getResizedImage:function(id,config,counter,numImgs){var self=this,img=$(config.img)[0],width=img.naturalWidth,height=img.naturalHeight,blob,ratio=1,maxWidth=self.maxImageWidth||width,maxHeight=self.maxImageHeight||height,isValidImage=!!(width&&height),chkWidth,chkHeight,canvas=self.imageCanvas,dataURI,context=self.imageCanvasContext,type=config.typ,pid=config.pid,ind=config.ind,$thumb=config.thumb,throwError,msg,exifObj=config.exifObj,exifStr,file,params,evParams;throwError=function(msg,params,ev){if(self.isAjaxUpload){self._showFileError(msg,params,ev);}else{self._showError(msg,params,ev);}self._setPreviewError($thumb);};file=self.fileManager.getFile(id);params={id:pid,'index':ind,fileId:id};evParams=[id,pid,ind];if(!file||!isValidImage||(width<=maxWidth&&height<=maxHeight)){if(isValidImage&&file){self._raise('fileimageresized',evParams);}counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized');}if(!isValidImage){throwError(self.msgImageResizeError,params,'fileimageresizeerror');return;}}type=type||self.resizeDefaultImageType;chkWidth=width>maxWidth;chkHeight=height>maxHeight;if(self.resizePreference==='width'){ratio=chkWidth?maxWidth/width:(chkHeight?maxHeight/height:1);}else{ratio=chkHeight?maxHeight/height:(chkWidth?maxWidth/width:1);}self._resetCanvas();width*=ratio;height*=ratio;canvas.width=width;canvas.height=height;try{context.drawImage(img,0,0,width,height);dataURI=canvas.toDataURL(type,self.resizeQuality);if(exifObj){exifStr=window.piexif.dump(exifObj);dataURI=window.piexif.insert(exifStr,dataURI);}blob=$h.dataURI2Blob(dataURI);self.fileManager.setFile(id,blob);self._raise('fileimageresized',evParams);counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined]);}if(!(blob instanceof Blob)){throwError(self.msgImageResizeError,params,'fileimageresizeerror');}}catch(err){counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined]);}msg=self.msgImageResizeException.replace('{errors}',err.message);throwError(msg,params,'fileimageresizeexception');}},_initBrowse:function($container){var self=this,$el=self.$element;if(self.showBrowse){self.$btnFile=$container.find('.btn-file').append($el);}else{$el.appendTo($container).attr('tabindex',-1);$h.addCss($el,'file-no-browse');}},_initClickable:function(){var self=this,$zone,$tmpZone;if(!self.isClickable){return;}$zone=self.$dropZone;if(!self.isAjaxUpload){$tmpZone=self.$preview.find('.file-default-preview');if($tmpZone.length){$zone=$tmpZone;}}$h.addCss($zone,'clickable');$zone.attr('tabindex',-1);self._handler($zone,'click',function(e){var $tar=$(e.target);if(!$(self.elErrorContainer+':visible').length&&(!$tar.parents('.file-preview-thumbnails').length||$tar.parents('.file-default-preview').length)){self.$element.data('zoneClicked',true).trigger('click');$zone.blur();}});},_initCaption:function(){var self=this,cap=self.initialCaption||'';if(self.overwriteInitial||$h.isEmpty(cap)){self.$caption.val('');return false;}self._setCaption(cap);return true;},_setCaption:function(content,isError){var self=this,title,out,icon,n,cap,file;if(!self.$caption.length){return;}self.$captionContainer.removeClass('icon-visible');if(isError){title=$('
    '+self.msgValidationError+'
    ').text();n=self.fileManager.count();if(n){file=self.fileManager.getFirstFile();cap=n===1&&file?file.nameFmt:self._getMsgSelected(n);}else{cap=self._getMsgSelected(self.msgNo);}out=$h.isEmpty(content)?cap:content;icon=''+self.msgValidationErrorIcon+'';}else{if($h.isEmpty(content)){return;}title=$('
    '+content+'
    ').text();out=title;icon=self._getLayoutTemplate('fileIcon');}self.$captionContainer.addClass('icon-visible');self.$caption.attr('title',title).val(out);self.$captionIcon.html(icon);},_createContainer:function(){var self=this,attribs={'class':'file-input file-input-new'+(self.rtl?' kv-rtl':'')},$container=$(document.createElement('div')).attr(attribs).html(self._renderMain());$container.insertBefore(self.$element);self._initBrowse($container);if(self.theme){$container.addClass('theme-'+self.theme);}return $container;},_refreshContainer:function(){var self=this,$container=self.$container,$el=self.$element;$el.insertAfter($container);$container.html(self._renderMain());self._initBrowse($container);self._validateDisabled();},_validateDisabled:function(){var self=this;self.$caption.attr({readonly:self.isDisabled});},_renderMain:function(){var self=this,dropCss=self.dropZoneEnabled?' file-drop-zone':'file-drop-disabled',close=!self.showClose?'':self._getLayoutTemplate('close'),preview=!self.showPreview?'':self._getLayoutTemplate('preview').setTokens({'class':self.previewClass,'dropClass':dropCss}),css=self.isDisabled?self.captionClass+' file-caption-disabled':self.captionClass,caption=self.captionTemplate.setTokens({'class':css+' kv-fileinput-caption'});return self.mainTemplate.setTokens({'class':self.mainClass+(!self.showBrowse&&self.showCaption?' no-browse':''),'preview':preview,'close':close,'caption':caption,'upload':self._renderButton('upload'),'remove':self._renderButton('remove'),'cancel':self._renderButton('cancel'),'pause':self._renderButton('pause'),'browse':self._renderButton('browse')});},_renderButton:function(type){var self=this,tmplt=self._getLayoutTemplate('btnDefault'),css=self[type+'Class'],title=self[type+'Title'],icon=self[type+'Icon'],label=self[type+'Label'],status=self.isDisabled?' disabled':'',btnType='button';switch(type){case'remove':if(!self.showRemove){return'';}break;case'cancel':if(!self.showCancel){return'';}css+=' kv-hidden';break;case'pause':if(!self.showPause){return'';}css+=' kv-hidden';break;case'upload':if(!self.showUpload){return'';}if(self.isAjaxUpload&&!self.isDisabled){tmplt=self._getLayoutTemplate('btnLink').replace('{href}',self.uploadUrl);}else{btnType='submit';}break;case'browse':if(!self.showBrowse){return'';}tmplt=self._getLayoutTemplate('btnBrowse');break;default:return'';}css+=type==='browse'?' btn-file':' fileinput-'+type+' fileinput-'+type+'-button';if(!$h.isEmpty(label)){label=' '+label+'';}return tmplt.setTokens({'type':btnType,'css':css,'title':title,'status':status,'icon':icon,'label':label});},_renderThumbProgress:function(){var self=this;return'
    '+self.progressInfoTemplate.setTokens({percent:101,status:self.msgUploadBegin,stats:''})+'
    ';},_renderFileFooter:function(cat,caption,size,width,isError){var self=this,config=self.fileActionSettings,rem=config.showRemove,drg=config.showDrag,upl=config.showUpload,zoom=config.showZoom,out,params,template=self._getLayoutTemplate('footer'),tInd=self._getLayoutTemplate('indicator'),ind=isError?config.indicatorError:config.indicatorNew,title=isError?config.indicatorErrorTitle:config.indicatorNewTitle,indicator=tInd.setTokens({'indicator':ind,'indicatorTitle':title});size=self._getSize(size);params={type:cat,caption:caption,size:size,width:width,progress:'',indicator:indicator};if(self.isAjaxUpload){params.progress=self._renderThumbProgress();params.actions=self._renderFileActions(params,upl,false,rem,zoom,drg,false,false,false);}else{params.actions=self._renderFileActions(params,false,false,false,zoom,drg,false,false,false);}out=template.setTokens(params);out=$h.replaceTags(out,self.previewThumbTags);return out;},_renderFileActions:function(cfg,showUpl,showDwn,showDel,showZoom,showDrag,disabled,url,key,isInit,dUrl,dFile){var self=this;if(!cfg.type&&isInit){cfg.type='image';}if(self.enableResumableUpload){showUpl=false;}else{if(typeof showUpl==='function'){showUpl=showUpl(cfg);}}if(typeof showDwn==='function'){showDwn=showDwn(cfg);}if(typeof showDel==='function'){showDel=showDel(cfg);}if(typeof showZoom==='function'){showZoom=showZoom(cfg);}if(typeof showDrag==='function'){showDrag=showDrag(cfg);}if(!showUpl&&!showDwn&&!showDel&&!showZoom&&!showDrag){return'';}var vUrl=url===false?'':' data-url="'+url+'"',btnZoom='',btnDrag='',css,vKey=key===false?'':' data-key="'+key+'"',btnDelete='',btnUpload='',btnDownload='',template=self._getLayoutTemplate('actions'),config=self.fileActionSettings,otherButtons=self.otherActionButtons.setTokens({'dataKey':vKey,'key':key}),removeClass=disabled?config.removeClass+' disabled':config.removeClass;if(showDel){btnDelete=self._getLayoutTemplate('actionDelete').setTokens({'removeClass':removeClass,'removeIcon':config.removeIcon,'removeTitle':config.removeTitle,'dataUrl':vUrl,'dataKey':vKey,'key':key});}if(showUpl){btnUpload=self._getLayoutTemplate('actionUpload').setTokens({'uploadClass':config.uploadClass,'uploadIcon':config.uploadIcon,'uploadTitle':config.uploadTitle});}if(showDwn){btnDownload=self._getLayoutTemplate('actionDownload').setTokens({'downloadClass':config.downloadClass,'downloadIcon':config.downloadIcon,'downloadTitle':config.downloadTitle,'downloadUrl':dUrl||self.initialPreviewDownloadUrl});btnDownload=btnDownload.setTokens({'filename':dFile,'key':key});}if(showZoom){btnZoom=self._getLayoutTemplate('actionZoom').setTokens({'zoomClass':config.zoomClass,'zoomIcon':config.zoomIcon,'zoomTitle':config.zoomTitle});}if(showDrag&&isInit){css='drag-handle-init '+config.dragClass;btnDrag=self._getLayoutTemplate('actionDrag').setTokens({'dragClass':css,'dragTitle':config.dragTitle,'dragIcon':config.dragIcon});}return template.setTokens({'delete':btnDelete,'upload':btnUpload,'download':btnDownload,'zoom':btnZoom,'drag':btnDrag,'other':otherButtons});},_browse:function(e){var self=this;if(e&&e.isDefaultPrevented()||!self._raise('filebrowse')){return;}if(self.isError&&!self.isAjaxUpload){self.clear();}self.$captionContainer.focus();},_change:function(e){var self=this;if(self.changeTriggered){return;}var $el=self.$element,isDragDrop=arguments.length>1,isAjaxUpload=self.isAjaxUpload,tfiles,files=isDragDrop?arguments[1]:$el.get(0).files,total,maxCount=!isAjaxUpload&&$h.isEmpty($el.attr('multiple'))?1:self.maxFileCount,len,ctr=self.fileManager.count(),isSingleUpload=$h.isEmpty($el.attr('multiple')),flagSingle=(isSingleUpload&&ctr>0),throwError=function(mesg,file,previewId,index){var p1=$.extend(true,{},self._getOutData(null,{},{},files),{id:previewId,index:index}),p2={id:previewId,index:index,file:file,files:files};return isAjaxUpload?self._showFileError(mesg,p1):self._showError(mesg,p2);},maxCountCheck=function(n,m){var msg=self.msgFilesTooMany.replace('{m}',m).replace('{n}',n);self.isError=throwError(msg,null,null,null);self.$captionContainer.removeClass('icon-visible');self._setCaption('',true);self.$container.removeClass('file-input-new file-input-ajax-new');};self.reader=null;self._resetUpload();self._hideFileIcon();if(self.dropZoneEnabled){self.$container.find('.file-drop-zone .'+self.dropZoneTitleClass).remove();}if(!isAjaxUpload){if(e.target&&e.target.files===undefined){files=e.target.value?[{name:e.target.value.replace(/^.+\\/,'')}]:[];}else{files=e.target.files||{};}}tfiles=files;if($h.isEmpty(tfiles)||tfiles.length===0){if(!isAjaxUpload){self.clear();}self._raise('fileselectnone');return;}self._resetErrors();len=tfiles.length;total=self._getFileCount(isAjaxUpload?(self.fileManager.count()+len):len);if(maxCount>0&&total>maxCount){if(!self.autoReplace||len>maxCount){maxCountCheck((self.autoReplace&&len>maxCount?len:total),maxCount);return;}if(total>maxCount){self._resetPreviewThumbs(isAjaxUpload);}}else{if(!isAjaxUpload||flagSingle){self._resetPreviewThumbs(false);if(flagSingle){self.clearFileStack();}}else{if(isAjaxUpload&&ctr===0&&(!self.previewCache.count(true)||self.overwriteInitial)){self._resetPreviewThumbs(true);}}}self.readFiles(tfiles);},_abort:function(params){var self=this,data;if(self.ajaxAborted&&typeof self.ajaxAborted==='object'&&self.ajaxAborted.message!==undefined){data=$.extend(true,{},self._getOutData(null),params);data.abortData=self.ajaxAborted.data||{};data.abortMessage=self.ajaxAborted.message;self._setProgress(101,self.$progress,self.msgCancelled);self._showFileError(self.ajaxAborted.message,data,'filecustomerror');self.cancel();return true;}return!!self.ajaxAborted;},_resetFileStack:function(){var self=this,i=0;self._getThumbs().each(function(){var $thumb=$(this),ind=$thumb.attr('data-fileindex'),pid=$thumb.attr('id');if(ind==='-1'||ind===-1){return;}if(!self.fileManager.getFile($thumb.attr('data-fileid'))){$thumb.attr({'id':self.previewInitId+'-'+i,'data-fileindex':i});i++;}else{$thumb.attr({'id':'uploaded-'+$h.uniqId(),'data-fileindex':'-1'});}self.$preview.find('#zoom-'+pid).attr({'id':'zoom-'+$thumb.attr('id'),'data-fileindex':$thumb.attr('data-fileindex')});});},_isFileSelectionValid:function(cnt){var self=this;cnt=cnt||0;if(self.required&&!self.getFilesCount()){self.$errorContainer.html('');self._showFileError(self.msgFileRequired);return false;}if(self.minFileCount>0&&self._getFileCount(cnt)=numFiles){if(self.isAjaxUpload&&self.fileManager.count()>0){self._raise('filebatchselected',[self.fileManager.stack]);}else{self._raise('filebatchselected',[files]);}$container.removeClass('file-thumb-loading');$status.html('');return;}var node=ctr+i,previewId=previewInitId+'-'+node,file=files[i],fSizeKB,j,msg,$thumb,fnText=settings.text,fnImage=settings.image,fnHtml=settings.html,typ,chk,typ1,typ2,caption=self._getFileName(file,''),fileSize=(file&&file.size||0)/1000,fileExtExpr='',previewData=$h.createObjectURL(file),fileCount=0,strTypes='',fileId,func,knownTypes=0,isText,isHtml,isImage,txtFlag,processFileLoaded=function(){var msg=msgProgress.setTokens({'index':i+1,'files':numFiles,'percent':50,'name':caption});setTimeout(function(){$status.html(msg);self._updateFileDetails(numFiles);readFile(i+1);},self.processDelay);self._raise('fileloaded',[file,previewId,i,reader]);};if(!file){return;}fileId=self.fileManager.getId(file);if(typLen>0){for(j=0;j0&&fileSize>self.maxFileSize){msg=self.msgSizeTooLarge.setTokens({'name':caption,'size':fSizeKB,'maxSize':self.maxFileSize});throwError(msg,file,previewId,i,fileId);return;}if(self.minFileSize!==null&&fileSize<=$h.getNum(self.minFileSize)){msg=self.msgSizeTooSmall.setTokens({'name':caption,'size':fSizeKB,'minSize':self.minFileSize});throwError(msg,file,previewId,i,fileId);return;}if(!$h.isEmpty(fileTypes)&&$h.isArray(fileTypes)){for(j=0;j0){for(i=0;i0){for(i=0;i0)?self.initialCaption:'';self.$caption.attr('title','').val(cap);$h.addCss(self.$container,'file-input-new');self._validateDefaultPreview();}if(self.$container.find($h.FRAMES).length===0){if(!self._initCaption()){self.$captionContainer.removeClass('icon-visible');}}self._hideFileIcon();self.$captionContainer.focus();self._setFileDropZoneTitle();self._raise('filecleared');return self.$element;},reset:function(){var self=this;if(!self._raise('filereset')){return;}self.lastProgress=0;self._resetPreview();self.$container.find('.fileinput-filename').text('');$h.addCss(self.$container,'file-input-new');if(self.getFrames().length||self.dropZoneEnabled){self.$container.removeClass('file-input-new');}self.clearFileStack();self._setFileDropZoneTitle();return self.$element;},disable:function(){var self=this;self.isDisabled=true;self._raise('filedisabled');self.$element.attr('disabled','disabled');self.$container.find('.kv-fileinput-caption').addClass('file-caption-disabled');self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').attr('disabled',true);$h.addCss(self.$container.find('.btn-file'),'disabled');self._initDragDrop();return self.$element;},enable:function(){var self=this;self.isDisabled=false;self._raise('fileenabled');self.$element.removeAttr('disabled');self.$container.find('.kv-fileinput-caption').removeClass('file-caption-disabled');self.$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').removeAttr('disabled');self.$container.find('.btn-file').removeClass('disabled');self._initDragDrop();return self.$element;},upload:function(){var self=this,fm=self.fileManager,totLen=fm.count(),i,outData,len,hasExtraData=!$.isEmptyObject(self._getExtraData());if(!self.isAjaxUpload||self.isDisabled||!self._isFileSelectionValid(totLen)){return;}self.lastProgress=0;self._resetUpload();if(totLen===0&&!hasExtraData){self._showFileError(self.msgUploadEmpty);return;}self.cancelling=false;self.$progress.show();self.lock();len=fm.count();if(totLen===0&&hasExtraData){self._setProgress(2);self._uploadExtraOnly();return;}if(self.enableResumableUpload){return self.resume();}if(self.uploadAsync||self.enableResumableUpload){outData=self._getOutData(null);self._raise('filebatchpreupload',[outData]);self.fileBatchCompleted=false;self.uploadCache={content:[],config:[],tags:[],append:true};for(i=0;i',next:'',toggleheader:'',fullscreen:'',borderless:'',close:''},previewZoomButtonClasses:{prev:'btn btn-navigate',next:'btn btn-navigate',toggleheader:'btn btn-sm btn-kv btn-default btn-outline-secondary',fullscreen:'btn btn-sm btn-kv btn-default btn-outline-secondary',borderless:'btn btn-sm btn-kv btn-default btn-outline-secondary',close:'btn btn-sm btn-kv btn-default btn-outline-secondary'},previewTemplates:{},previewContentTemplates:{},preferIconicPreview:false,preferIconicZoomPreview:false,allowedFileTypes:null,allowedFileExtensions:null,allowedPreviewTypes:undefined,allowedPreviewMimeTypes:null,allowedPreviewExtensions:null,disabledPreviewTypes:undefined,disabledPreviewExtensions:['msi','exe','com','zip','rar','app','vb','scr'],disabledPreviewMimeTypes:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewFileIcon:'',previewFileIconClass:'file-other-icon',previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:'hidden-xs',browseIcon:' ',browseClass:'btn btn-primary',removeIcon:'',removeClass:'btn btn-default btn-secondary',cancelIcon:'',cancelClass:'btn btn-default btn-secondary',pauseIcon:'',pauseClass:'btn btn-default btn-secondary',uploadIcon:'',uploadClass:'btn btn-default btn-secondary',uploadUrl:null,uploadUrlThumb:null,uploadAsync:true,uploadParamNames:{chunkCount:'chunkCount',chunkIndex:'chunkIndex',chunkSize:'chunkSize',chunkSizeStart:'chunkSizeStart',chunksUploaded:'chunksUploaded',fileBlob:'fileBlob',fileId:'fileId',fileName:'fileName',fileRelativePath:'fileRelativePath',fileSize:'fileSize',retryCount:'retryCount'},maxAjaxThreads:5,processDelay:100,queueDelay:10,progressDelay:0,enableResumableUpload:false,resumableUploadOptions:{fallback:null,testUrl:null,chunkSize:2*1024,maxThreads:4,maxRetries:3,showErrorLog:true},uploadExtraData:{},zoomModalHeight:480,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:false,resizePreference:'width',resizeQuality:0.92,resizeDefaultImageType:'image/jpeg',resizeIfSizeMoreThan:0,minFileSize:0,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,validateInitialCount:false,msgValidationErrorClass:'text-danger',msgValidationErrorIcon:' ',msgErrorClass:'file-error-message',progressThumbClass:'progress-bar progress-bar-striped active',progressClass:'progress-bar bg-success progress-bar-success progress-bar-striped active',progressInfoClass:'progress-bar bg-info progress-bar-info progress-bar-striped active',progressCompleteClass:'progress-bar bg-success progress-bar-success',progressPauseClass:'progress-bar bg-primary progress-bar-primary progress-bar-striped active',progressErrorClass:'progress-bar bg-danger progress-bar-danger',progressUploadThreshold:99,previewFileType:'image',elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:$h.closeButton('kv-error-close'),slugCallback:null,dropZoneEnabled:true,dropZoneTitleClass:'file-drop-zone-title',fileActionSettings:{},otherActionButtons:'',textEncoding:'UTF-8',ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:true,mergeAjaxCallbacks:false,mergeAjaxDeleteCallbacks:false,retryErrorUploads:true,reversePreviewOrder:false,usePdfRenderer:function(){var isIE11=!!window.MSInputMethodContext&&!!document.documentMode;return!!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)||isIE11;},pdfRendererUrl:'',pdfRendererTemplate:''};$.fn.fileinputLocales.en={fileSingle:'file',filePlural:'files',browseLabel:'Browse …',removeLabel:'Remove',removeTitle:'Clear all unprocessed files',cancelLabel:'Cancel',cancelTitle:'Abort ongoing upload',pauseLabel:'Pause',pauseTitle:'Pause ongoing upload',uploadLabel:'Upload',uploadTitle:'Upload selected files',msgNo:'No',msgNoFilesSelected:'No files selected',msgCancelled:'Cancelled',msgPaused:'Paused',msgPlaceholder:'Select {files}...',msgZoomModalHeading:'Detailed Preview',msgFileRequired:'You must select a file to upload.',msgSizeTooSmall:'File "{name}" ({size} KB) is too small and must be larger than {minSize} KB.',msgSizeTooLarge:'File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB.',msgFilesTooLess:'You must select at least {n} {files} to upload.',msgFilesTooMany:'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.',msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',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',msgUploadResume:'Resuming upload...',msgUploadEmpty:'No valid data available for upload.',msgUploadError:'Upload Error',msgDeleteError:'Delete Error',msgProgressError:'Error',msgValidationError:'Validation Error',msgLoading:'Loading file {index} of {files} …',msgProgress:'Loading file {index} of {files} - {name} - {percent}% completed.',msgSelected:'{n} {files} selected',msgFoldersNotAllowed:'Drag & drop files only! {n} folder(s) dropped were skipped.',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.
    {errors}
    ',msgAjaxError:'Something went wrong with the {operation} operation. Please try again later!',msgAjaxProgressError:'{operation} failed',msgDuplicateFile:'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.',msgResumableUploadRetriesExceeded:'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ',msgPendingTime:'{time} remaining',msgCalculatingTime:'calculating time remaining',ajaxOperations:{deleteThumb:'file delete',uploadThumb:'file upload',uploadBatch:'batch file upload',uploadExtra:'form data upload'},dropZoneTitle:'Drag & drop files here …',dropZoneClickTitle:'
    (or click to select {files})',previewZoomButtonTitles:{prev:'View previous file',next:'View next file',toggleheader:'Toggle header',fullscreen:'Toggle full screen',borderless:'Toggle borderless mode',close:'Close detailed preview'}};$.fn.fileinputLocales.zh={fileSingle:'文件',filePlural:'个文件',browseLabel:'选择 …',removeLabel:'移除',removeTitle:'清除选中文件',cancelLabel:'取消',cancelTitle:'取消进行中的上传',pauseLabel:'Pause',pauseTitle:'Pause ongoing upload',uploadLabel:'上传',uploadTitle:'上传选中文件',msgNo:'没有',msgNoFilesSelected:'未选择文件',msgPaused:'Paused',msgCancelled:'取消',msgPlaceholder:'选择 {files}...',msgZoomModalHeading:'详细预览',msgFileRequired:'必须选择一个文件上传.',msgSizeTooSmall:'文件 "{name}" ({size} KB) 必须大于限定大小 {minSize} KB.',msgSizeTooLarge:'文件 "{name}" ({size} KB) 超过了允许大小 {maxSize} KB.',msgFilesTooLess:'你必须选择最少 {n} {files} 来上传. ',msgFilesTooMany:'选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.',msgFileNotFound:'文件 "{name}" 未找到!',msgFileSecured:'安全限制,为了防止读取文件 "{name}".',msgFileNotReadable:'文件 "{name}" 不可读.',msgFilePreviewAborted:'取消 "{name}" 的预览.',msgFilePreviewError:'读取 "{name}" 时出现了一个错误.',msgInvalidFileName:'文件名 "{name}" 包含非法字符.',msgInvalidFileType:'不正确的类型 "{name}". 只支持 "{types}" 类型的文件.',msgInvalidFileExtension:'不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.',msgFileTypes:{'image':'image','html':'HTML','text':'text','video':'video','audio':'audio','flash':'flash','pdf':'PDF','object':'object'},msgUploadAborted:'该文件上传被中止',msgUploadThreshold:'处理中...',msgUploadBegin:'正在初始化...',msgUploadEnd:'完成',msgUploadResume:'Resuming upload...',msgUploadEmpty:'无效的文件上传.',msgUploadError:'Upload Error',msgDeleteError:'Delete Error',msgProgressError:'上传出错',msgValidationError:'验证错误',msgLoading:'加载第 {index} 文件 共 {files} …',msgProgress:'加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.',msgSelected:'{n} {files} 选中',msgFoldersNotAllowed:'只支持拖拽文件! 跳过 {n} 拖拽的文件夹.',msgImageWidthSmall:'图像文件的"{name}"的宽度必须是至少{size}像素.',msgImageHeightSmall:'图像文件的"{name}"的高度必须至少为{size}像素.',msgImageWidthLarge:'图像文件"{name}"的宽度不能超过{size}像素.',msgImageHeightLarge:'图像文件"{name}"的高度不能超过{size}像素.',msgImageResizeError:'无法获取的图像尺寸调整。',msgImageResizeException:'调整图像大小时发生错误。
    {errors}
    ',msgAjaxError:'{operation} 发生错误. 请重试!',msgAjaxProgressError:'{operation} 失败',msgDuplicateFile:'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.',msgResumableUploadRetriesExceeded:'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ',msgPendingTime:'{time} remaining',msgCalculatingTime:'calculating time remaining',ajaxOperations:{deleteThumb:'删除文件',uploadThumb:'上传文件',uploadBatch:'批量上传',uploadExtra:'表单数据上传'},dropZoneTitle:'拖拽文件到这里 …
    支持多文件同时上传',dropZoneClickTitle:'
    (或点击{files}按钮选择文件)',fileActionSettings:{removeTitle:'删除文件',uploadTitle:'上传文件',downloadTitle:'下载文件',uploadRetryTitle:'重试',zoomTitle:'查看详情',dragTitle:'移动 / 重置',indicatorNewTitle:'没有上传',indicatorSuccessTitle:'上传',indicatorErrorTitle:'上传错误',indicatorPausedTitle:'Upload Paused',indicatorLoadingTitle:'上传 ...'},previewZoomButtonTitles:{prev:'预览上一个文件',next:'预览下一个文件',toggleheader:'缩放',fullscreen:'全屏',borderless:'无边界模式',close:'关闭当前预览'}};$.fn.fileinput.Constructor=FileInput;$(document).ready(function(){var $input=$('input.file[type=file]');if($input.length){$input.fileinput();}});})); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif similarity index 100% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif similarity index 100% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css index 66b8cc688..b07486c31 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css @@ -1,10 +1,10 @@ -/*! - * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2019 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - +/*! + * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) + * + * Copyright 2012-2019 SnapAppointments, LLC + * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) + */ + select.bs-select-hidden, .bootstrap-select > select.bs-select-hidden, select.selectpicker { diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js similarity index 97% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js index c3ab3bfa4..2a4b26e25 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js @@ -1,3139 +1,3139 @@ -/*! - * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2019 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - -(function (root, factory) { - if (root === undefined && window !== undefined) root = window; - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module unless amdModuleId is set - define(["jquery"], function (a0) { - return (factory(a0)); - }); - } else if (typeof module === 'object' && module.exports) { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - factory(root["jQuery"]); - } -}(this, function (jQuery) { - -(function ($) { - 'use strict'; - - var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; - - var uriAttrs = [ - 'background', - 'cite', - 'href', - 'itemtype', - 'longdesc', - 'poster', - 'src', - 'xlink:href' - ]; - - var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; - - var DefaultWhitelist = { - // Global attributes allowed on any supplied element below. - '*': ['class', 'dir', 'id', 'lang', 'role', 'tabindex', 'style', ARIA_ATTRIBUTE_PATTERN], - a: ['target', 'href', 'title', 'rel'], - area: [], - b: [], - br: [], - col: [], - code: [], - div: [], - em: [], - hr: [], - h1: [], - h2: [], - h3: [], - h4: [], - h5: [], - h6: [], - i: [], - img: ['src', 'alt', 'title', 'width', 'height'], - li: [], - ol: [], - p: [], - pre: [], - s: [], - small: [], - span: [], - sub: [], - sup: [], - strong: [], - u: [], - ul: [] - } - - /** - * A pattern that recognizes a commonly useful subset of URLs that are safe. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; - - /** - * A pattern that matches safe data URLs. Only matches image, video and audio types. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; - - function allowedAttribute (attr, allowedAttributeList) { - var attrName = attr.nodeName.toLowerCase() - - if ($.inArray(attrName, allowedAttributeList) !== -1) { - if ($.inArray(attrName, uriAttrs) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) - } - - return true - } - - var regExp = $(allowedAttributeList).filter(function (index, value) { - return value instanceof RegExp - }) - - // Check if a regular expression validates the attribute. - for (var i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { - return true - } - } - - return false - } - - function sanitizeHtml (unsafeElements, whiteList, sanitizeFn) { - if (sanitizeFn && typeof sanitizeFn === 'function') { - return sanitizeFn(unsafeElements); - } - - var whitelistKeys = Object.keys(whiteList); - - for (var i = 0, len = unsafeElements.length; i < len; i++) { - var elements = unsafeElements[i].querySelectorAll('*'); - - for (var j = 0, len2 = elements.length; j < len2; j++) { - var el = elements[j]; - var elName = el.nodeName.toLowerCase(); - - if (whitelistKeys.indexOf(elName) === -1) { - el.parentNode.removeChild(el); - - continue; - } - - var attributeList = [].slice.call(el.attributes); - var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); - - for (var k = 0, len3 = attributeList.length; k < len3; k++) { - var attr = attributeList[k]; - - if (!allowedAttribute(attr, whitelistedAttributes)) { - el.removeAttribute(attr.nodeName); - } - } - } - } - } - - // Polyfill for browsers with no classList support - // Remove in v2 - if (!('classList' in document.createElement('_'))) { - (function (view) { - if (!('Element' in view)) return; - - var classListProp = 'classList', - protoProp = 'prototype', - elemCtrProto = view.Element[protoProp], - objCtr = Object, - classListGetter = function () { - var $elem = $(this); - - return { - add: function (classes) { - classes = Array.prototype.slice.call(arguments).join(' '); - return $elem.addClass(classes); - }, - remove: function (classes) { - classes = Array.prototype.slice.call(arguments).join(' '); - return $elem.removeClass(classes); - }, - toggle: function (classes, force) { - return $elem.toggleClass(classes, force); - }, - contains: function (classes) { - return $elem.hasClass(classes); - } - } - }; - - if (objCtr.defineProperty) { - var classListPropDesc = { - get: classListGetter, - enumerable: true, - configurable: true - }; - try { - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } catch (ex) { // IE 8 doesn't support enumerable:true - // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36 - // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected - if (ex.number === undefined || ex.number === -0x7FF5EC54) { - classListPropDesc.enumerable = false; - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } - } - } else if (objCtr[protoProp].__defineGetter__) { - elemCtrProto.__defineGetter__(classListProp, classListGetter); - } - }(window)); - } - - var testElement = document.createElement('_'); - - testElement.classList.add('c1', 'c2'); - - if (!testElement.classList.contains('c2')) { - var _add = DOMTokenList.prototype.add, - _remove = DOMTokenList.prototype.remove; - - DOMTokenList.prototype.add = function () { - Array.prototype.forEach.call(arguments, _add.bind(this)); - } - - DOMTokenList.prototype.remove = function () { - Array.prototype.forEach.call(arguments, _remove.bind(this)); - } - } - - testElement.classList.toggle('c3', false); - - // Polyfill for IE 10 and Firefox <24, where classList.toggle does not - // support the second argument. - if (testElement.classList.contains('c3')) { - var _toggle = DOMTokenList.prototype.toggle; - - DOMTokenList.prototype.toggle = function (token, force) { - if (1 in arguments && !this.contains(token) === !force) { - return force; - } else { - return _toggle.call(this, token); - } - }; - } - - testElement = null; - - // shallow array comparison - function isEqual (array1, array2) { - return array1.length === array2.length && array1.every(function (element, index) { - return element === array2[index]; - }); - }; - - // - if (!String.prototype.startsWith) { - (function () { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var defineProperty = (function () { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch (error) { - } - return result; - }()); - var toString = {}.toString; - var startsWith = function (search) { - if (this == null) { - throw new TypeError(); - } - var string = String(this); - if (search && toString.call(search) == '[object RegExp]') { - throw new TypeError(); - } - var stringLength = string.length; - var searchString = String(search); - var searchLength = searchString.length; - var position = arguments.length > 1 ? arguments[1] : undefined; - // `ToInteger` - var pos = position ? Number(position) : 0; - if (pos != pos) { // better `isNaN` - pos = 0; - } - var start = Math.min(Math.max(pos, 0), stringLength); - // Avoid the `indexOf` call if no match is possible - if (searchLength + start > stringLength) { - return false; - } - var index = -1; - while (++index < searchLength) { - if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { - return false; - } - } - return true; - }; - if (defineProperty) { - defineProperty(String.prototype, 'startsWith', { - 'value': startsWith, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.startsWith = startsWith; - } - }()); - } - - if (!Object.keys) { - Object.keys = function ( - o, // object - k, // key - r // result array - ) { - // initialize object and result - r = []; - // iterate over object keys - for (k in o) { - // fill result array with non-prototypical keys - r.hasOwnProperty.call(o, k) && r.push(k); - } - // return result - return r; - }; - } - - if (HTMLSelectElement && !HTMLSelectElement.prototype.hasOwnProperty('selectedOptions')) { - Object.defineProperty(HTMLSelectElement.prototype, 'selectedOptions', { - get: function () { - return this.querySelectorAll(':checked'); - } - }); - } - - function getSelectedOptions (select, ignoreDisabled) { - var selectedOptions = select.selectedOptions, - options = [], - opt; - - if (ignoreDisabled) { - for (var i = 0, len = selectedOptions.length; i < len; i++) { - opt = selectedOptions[i]; - - if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { - options.push(opt); - } - } - - return options; - } - - return selectedOptions; - } - - // much faster than $.val() - function getSelectValues (select, selectedOptions) { - var value = [], - options = selectedOptions || select.selectedOptions, - opt; - - for (var i = 0, len = options.length; i < len; i++) { - opt = options[i]; - - if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { - value.push(opt.value || opt.text); - } - } - - if (!select.multiple) { - return !value.length ? null : value[0]; - } - - return value; - } - - // set data-selected on select element if the value has been programmatically selected - // prior to initialization of bootstrap-select - // * consider removing or replacing an alternative method * - var valHooks = { - useDefault: false, - _set: $.valHooks.select.set - }; - - $.valHooks.select.set = function (elem, value) { - if (value && !valHooks.useDefault) $(elem).data('selected', true); - - return valHooks._set.apply(this, arguments); - }; - - var changedArguments = null; - - var EventIsSupported = (function () { - try { - new Event('change'); - return true; - } catch (e) { - return false; - } - })(); - - $.fn.triggerNative = function (eventName) { - var el = this[0], - event; - - if (el.dispatchEvent) { // for modern browsers & IE9+ - if (EventIsSupported) { - // For modern browsers - event = new Event(eventName, { - bubbles: true - }); - } else { - // For IE since it doesn't support Event constructor - event = document.createEvent('Event'); - event.initEvent(eventName, true, false); - } - - el.dispatchEvent(event); - } else if (el.fireEvent) { // for IE8 - event = document.createEventObject(); - event.eventType = eventName; - el.fireEvent('on' + eventName, event); - } else { - // fall back to jQuery.trigger - this.trigger(eventName); - } - }; - // - - function stringSearch (li, searchString, method, normalize) { - var stringTypes = [ - 'display', - 'subtext', - 'tokens' - ], - searchSuccess = false; - - for (var i = 0; i < stringTypes.length; i++) { - var stringType = stringTypes[i], - string = li[stringType]; - - if (string) { - string = string.toString(); - - // Strip HTML tags. This isn't perfect, but it's much faster than any other method - if (stringType === 'display') { - string = string.replace(/<[^>]+>/g, ''); - } - - if (normalize) string = normalizeToBase(string); - string = string.toUpperCase(); - - if (method === 'contains') { - searchSuccess = string.indexOf(searchString) >= 0; - } else { - searchSuccess = string.startsWith(searchString); - } - - if (searchSuccess) break; - } - } - - return searchSuccess; - } - - function toInteger (value) { - return parseInt(value, 10) || 0; - } - - // Borrowed from Lodash (_.deburr) - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to compose unicode character classes. */ - var rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboMarksExtendedRange = '\\u1ab0-\\u1aff', - rsComboMarksSupplementRange = '\\u1dc0-\\u1dff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange; - - /** Used to compose unicode capture groups. */ - var rsCombo = '[' + rsComboRange + ']'; - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - function deburrLetter (key) { - return deburredLetters[key]; - }; - - function normalizeToBase (string) { - string = string.toString(); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - // List of HTML entities for escaping. - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - - // Functions for escaping and unescaping strings to/from HTML interpolation. - var createEscaper = function (map) { - var escaper = function (match) { - return map[match]; - }; - // Regexes for identifying a key that needs to be escaped. - var source = '(?:' + Object.keys(map).join('|') + ')'; - var testRegexp = RegExp(source); - var replaceRegexp = RegExp(source, 'g'); - return function (string) { - string = string == null ? '' : '' + string; - return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; - }; - }; - - var htmlEscape = createEscaper(escapeMap); - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var keyCodeMap = { - 32: ' ', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 59: ';', - 65: 'A', - 66: 'B', - 67: 'C', - 68: 'D', - 69: 'E', - 70: 'F', - 71: 'G', - 72: 'H', - 73: 'I', - 74: 'J', - 75: 'K', - 76: 'L', - 77: 'M', - 78: 'N', - 79: 'O', - 80: 'P', - 81: 'Q', - 82: 'R', - 83: 'S', - 84: 'T', - 85: 'U', - 86: 'V', - 87: 'W', - 88: 'X', - 89: 'Y', - 90: 'Z', - 96: '0', - 97: '1', - 98: '2', - 99: '3', - 100: '4', - 101: '5', - 102: '6', - 103: '7', - 104: '8', - 105: '9' - }; - - var keyCodes = { - ESCAPE: 27, // KeyboardEvent.which value for Escape (Esc) key - ENTER: 13, // KeyboardEvent.which value for Enter key - SPACE: 32, // KeyboardEvent.which value for space key - TAB: 9, // KeyboardEvent.which value for tab key - ARROW_UP: 38, // KeyboardEvent.which value for up arrow key - ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key - } - - var version = { - success: false, - major: '3' - }; - - try { - version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); - version.major = version.full[0]; - version.success = true; - } catch (err) { - // do nothing - } - - var selectId = 0; - - var EVENT_KEY = '.bs.select'; - - var classNames = { - DISABLED: 'disabled', - DIVIDER: 'divider', - SHOW: 'open', - DROPUP: 'dropup', - MENU: 'dropdown-menu', - MENURIGHT: 'dropdown-menu-right', - MENULEFT: 'dropdown-menu-left', - // to-do: replace with more advanced template/customization options - BUTTONCLASS: 'btn-default', - POPOVERHEADER: 'popover-title', - ICONBASE: 'glyphicon', - TICKICON: 'glyphicon-ok' - } - - var Selector = { - MENU: '.' + classNames.MENU - } - - var elementTemplates = { - span: document.createElement('span'), - i: document.createElement('i'), - subtext: document.createElement('small'), - a: document.createElement('a'), - li: document.createElement('li'), - whitespace: document.createTextNode('\u00A0'), - fragment: document.createDocumentFragment() - } - - elementTemplates.a.setAttribute('role', 'option'); - elementTemplates.subtext.className = 'text-muted'; - - elementTemplates.text = elementTemplates.span.cloneNode(false); - elementTemplates.text.className = 'text'; - - elementTemplates.checkMark = elementTemplates.span.cloneNode(false); - - var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN); - var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE); - - var generateOption = { - li: function (content, classes, optgroup) { - var li = elementTemplates.li.cloneNode(false); - - if (content) { - if (content.nodeType === 1 || content.nodeType === 11) { - li.appendChild(content); - } else { - li.innerHTML = content; - } - } - - if (typeof classes !== 'undefined' && classes !== '') li.className = classes; - if (typeof optgroup !== 'undefined' && optgroup !== null) li.classList.add('optgroup-' + optgroup); - - return li; - }, - - a: function (text, classes, inline) { - var a = elementTemplates.a.cloneNode(true); - - if (text) { - if (text.nodeType === 11) { - a.appendChild(text); - } else { - a.insertAdjacentHTML('beforeend', text); - } - } - - if (typeof classes !== 'undefined' && classes !== '') a.className = classes; - if (version.major === '4') a.classList.add('dropdown-item'); - if (inline) a.setAttribute('style', inline); - - return a; - }, - - text: function (options, useFragment) { - var textElement = elementTemplates.text.cloneNode(false), - subtextElement, - iconElement; - - if (options.content) { - textElement.innerHTML = options.content; - } else { - textElement.textContent = options.text; - - if (options.icon) { - var whitespace = elementTemplates.whitespace.cloneNode(false); - - // need to use for icons in the button to prevent a breaking change - // note: switch to span in next major release - iconElement = (useFragment === true ? elementTemplates.i : elementTemplates.span).cloneNode(false); - iconElement.className = options.iconBase + ' ' + options.icon; - - elementTemplates.fragment.appendChild(iconElement); - elementTemplates.fragment.appendChild(whitespace); - } - - if (options.subtext) { - subtextElement = elementTemplates.subtext.cloneNode(false); - subtextElement.textContent = options.subtext; - textElement.appendChild(subtextElement); - } - } - - if (useFragment === true) { - while (textElement.childNodes.length > 0) { - elementTemplates.fragment.appendChild(textElement.childNodes[0]); - } - } else { - elementTemplates.fragment.appendChild(textElement); - } - - return elementTemplates.fragment; - }, - - label: function (options) { - var textElement = elementTemplates.text.cloneNode(false), - subtextElement, - iconElement; - - textElement.innerHTML = options.label; - - if (options.icon) { - var whitespace = elementTemplates.whitespace.cloneNode(false); - - iconElement = elementTemplates.span.cloneNode(false); - iconElement.className = options.iconBase + ' ' + options.icon; - - elementTemplates.fragment.appendChild(iconElement); - elementTemplates.fragment.appendChild(whitespace); - } - - if (options.subtext) { - subtextElement = elementTemplates.subtext.cloneNode(false); - subtextElement.textContent = options.subtext; - textElement.appendChild(subtextElement); - } - - elementTemplates.fragment.appendChild(textElement); - - return elementTemplates.fragment; - } - } - - var Selectpicker = function (element, options) { - var that = this; - - // bootstrap-select has been initialized - revert valHooks.select.set back to its original function - if (!valHooks.useDefault) { - $.valHooks.select.set = valHooks._set; - valHooks.useDefault = true; - } - - this.$element = $(element); - this.$newElement = null; - this.$button = null; - this.$menu = null; - this.options = options; - this.selectpicker = { - main: {}, - search: {}, - current: {}, // current changes if a search is in progress - view: {}, - keydown: { - keyHistory: '', - resetKeyHistory: { - start: function () { - return setTimeout(function () { - that.selectpicker.keydown.keyHistory = ''; - }, 800); - } - } - } - }; - // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a - // data-attribute) - if (this.options.title === null) { - this.options.title = this.$element.attr('title'); - } - - // Format window padding - var winPad = this.options.windowPadding; - if (typeof winPad === 'number') { - this.options.windowPadding = [winPad, winPad, winPad, winPad]; - } - - // Expose public methods - this.val = Selectpicker.prototype.val; - this.render = Selectpicker.prototype.render; - this.refresh = Selectpicker.prototype.refresh; - this.setStyle = Selectpicker.prototype.setStyle; - this.selectAll = Selectpicker.prototype.selectAll; - this.deselectAll = Selectpicker.prototype.deselectAll; - this.destroy = Selectpicker.prototype.destroy; - this.remove = Selectpicker.prototype.remove; - this.show = Selectpicker.prototype.show; - this.hide = Selectpicker.prototype.hide; - - this.init(); - }; - - Selectpicker.VERSION = '1.13.10'; - - // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. - Selectpicker.DEFAULTS = { - noneSelectedText: 'Nothing selected', - noneResultsText: 'No results matched {0}', - countSelectedText: function (numSelected, numTotal) { - return (numSelected == 1) ? '{0} item selected' : '{0} items selected'; - }, - maxOptionsText: function (numAll, numGroup) { - return [ - (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', - (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' - ]; - }, - selectAllText: 'Select All', - deselectAllText: 'Deselect All', - doneButton: false, - doneButtonText: 'Close', - multipleSeparator: ', ', - styleBase: 'btn', - style: classNames.BUTTONCLASS, - size: 'auto', - title: null, - selectedTextFormat: 'values', - width: false, - container: false, - hideDisabled: false, - showSubtext: false, - showIcon: true, - showContent: true, - dropupAuto: true, - header: false, - liveSearch: false, - liveSearchPlaceholder: null, - liveSearchNormalize: false, - liveSearchStyle: 'contains', - actionsBox: false, - iconBase: classNames.ICONBASE, - tickIcon: classNames.TICKICON, - showTick: false, - template: { - caret: '' - }, - maxOptions: false, - mobile: false, - selectOnTab: false, - dropdownAlignRight: false, - windowPadding: 0, - virtualScroll: 600, - display: false, - sanitize: true, - sanitizeFn: null, - whiteList: DefaultWhitelist - }; - - Selectpicker.prototype = { - - constructor: Selectpicker, - - init: function () { - var that = this, - id = this.$element.attr('id'); - - selectId++; - this.selectId = 'bs-select-' + selectId; - - this.$element[0].classList.add('bs-select-hidden'); - - this.multiple = this.$element.prop('multiple'); - this.autofocus = this.$element.prop('autofocus'); - - if (this.$element[0].classList.contains('show-tick')) { - this.options.showTick = true; - } - - this.$newElement = this.createDropdown(); - this.$element - .after(this.$newElement) - .prependTo(this.$newElement); - - this.$button = this.$newElement.children('button'); - this.$menu = this.$newElement.children(Selector.MENU); - this.$menuInner = this.$menu.children('.inner'); - this.$searchbox = this.$menu.find('input'); - - this.$element[0].classList.remove('bs-select-hidden'); - - if (this.options.dropdownAlignRight === true) this.$menu[0].classList.add(classNames.MENURIGHT); - - if (typeof id !== 'undefined') { - this.$button.attr('data-id', id); - } - - this.checkDisabled(); - this.clickListener(); - - if (this.options.liveSearch) { - this.liveSearchListener(); - this.focusedParent = this.$searchbox[0]; - } else { - this.focusedParent = this.$menuInner[0]; - } - - this.setStyle(); - this.render(); - this.setWidth(); - if (this.options.container) { - this.selectPosition(); - } else { - this.$element.on('hide' + EVENT_KEY, function () { - if (that.isVirtual()) { - // empty menu on close - var menuInner = that.$menuInner[0], - emptyMenu = menuInner.firstChild.cloneNode(false); - - // replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = '' - menuInner.replaceChild(emptyMenu, menuInner.firstChild); - menuInner.scrollTop = 0; - } - }); - } - this.$menu.data('this', this); - this.$newElement.data('this', this); - if (this.options.mobile) this.mobile(); - - this.$newElement.on({ - 'hide.bs.dropdown': function (e) { - that.$element.trigger('hide' + EVENT_KEY, e); - }, - 'hidden.bs.dropdown': function (e) { - that.$element.trigger('hidden' + EVENT_KEY, e); - }, - 'show.bs.dropdown': function (e) { - that.$element.trigger('show' + EVENT_KEY, e); - }, - 'shown.bs.dropdown': function (e) { - that.$element.trigger('shown' + EVENT_KEY, e); - } - }); - - if (that.$element[0].hasAttribute('required')) { - this.$element.on('invalid' + EVENT_KEY, function () { - that.$button[0].classList.add('bs-invalid'); - - that.$element - .on('shown' + EVENT_KEY + '.invalid', function () { - that.$element - .val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened - .off('shown' + EVENT_KEY + '.invalid'); - }) - .on('rendered' + EVENT_KEY, function () { - // if select is no longer invalid, remove the bs-invalid class - if (this.validity.valid) that.$button[0].classList.remove('bs-invalid'); - that.$element.off('rendered' + EVENT_KEY); - }); - - that.$button.on('blur' + EVENT_KEY, function () { - that.$element.trigger('focus').trigger('blur'); - that.$button.off('blur' + EVENT_KEY); - }); - }); - } - - setTimeout(function () { - that.createLi(); - that.$element.trigger('loaded' + EVENT_KEY); - }); - }, - - createDropdown: function () { - // Options - // If we are multiple or showTick option is set, then add the show-tick class - var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '', - multiselectable = this.multiple ? ' aria-multiselectable="true"' : '', - inputGroup = '', - autofocus = this.autofocus ? ' autofocus' : ''; - - if (version.major < 4 && this.$element.parent().hasClass('input-group')) { - inputGroup = ' input-group-btn'; - } - - // Elements - var drop, - header = '', - searchbox = '', - actionsbox = '', - donebutton = ''; - - if (this.options.header) { - header = - '
    ' + - '' + - this.options.header + - '
    '; - } - - if (this.options.liveSearch) { - searchbox = - ''; - } - - if (this.multiple && this.options.actionsBox) { - actionsbox = - '
    ' + - '
    ' + - '' + - '' + - '
    ' + - '
    '; - } - - if (this.multiple && this.options.doneButton) { - donebutton = - '
    ' + - '
    ' + - '' + - '
    ' + - '
    '; - } - - drop = - ''; - - return $(drop); - }, - - setPositionData: function () { - this.selectpicker.view.canHighlight = []; - this.selectpicker.view.size = 0; - - for (var i = 0; i < this.selectpicker.current.data.length; i++) { - var li = this.selectpicker.current.data[i], - canHighlight = true; - - if (li.type === 'divider') { - canHighlight = false; - li.height = this.sizeInfo.dividerHeight; - } else if (li.type === 'optgroup-label') { - canHighlight = false; - li.height = this.sizeInfo.dropdownHeaderHeight; - } else { - li.height = this.sizeInfo.liHeight; - } - - if (li.disabled) canHighlight = false; - - this.selectpicker.view.canHighlight.push(canHighlight); - - if (canHighlight) { - this.selectpicker.view.size++; - li.posinset = this.selectpicker.view.size; - } - - li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height; - } - }, - - isVirtual: function () { - return (this.options.virtualScroll !== false) && (this.selectpicker.main.elements.length >= this.options.virtualScroll) || this.options.virtualScroll === true; - }, - - createView: function (isSearching, setSize, refresh) { - var that = this, - scrollTop = 0, - active = [], - selected, - prevActive; - - this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main; - - this.setPositionData(); - - if (setSize) { - if (refresh) { - scrollTop = this.$menuInner[0].scrollTop; - } else if (!that.multiple) { - var element = that.$element[0], - selectedIndex = (element.options[element.selectedIndex] || {}).liIndex; - - if (typeof selectedIndex === 'number' && that.options.size !== false) { - var selectedData = that.selectpicker.main.data[selectedIndex], - position = selectedData && selectedData.position; - - if (position) { - scrollTop = position - ((that.sizeInfo.menuInnerHeight + that.sizeInfo.liHeight) / 2); - } - } - } - } - - scroll(scrollTop, true); - - this.$menuInner.off('scroll.createView').on('scroll.createView', function (e, updateValue) { - if (!that.noScroll) scroll(this.scrollTop, updateValue); - that.noScroll = false; - }); - - function scroll (scrollTop, init) { - var size = that.selectpicker.current.elements.length, - chunks = [], - chunkSize, - chunkCount, - firstChunk, - lastChunk, - currentChunk, - prevPositions, - positionIsDifferent, - previousElements, - menuIsDifferent = true, - isVirtual = that.isVirtual(); - - that.selectpicker.view.scrollTop = scrollTop; - - if (isVirtual === true) { - // if an option that is encountered that is wider than the current menu width, update the menu width accordingly - if (that.sizeInfo.hasScrollBar && that.$menu[0].offsetWidth > that.sizeInfo.totalMenuWidth) { - that.sizeInfo.menuWidth = that.$menu[0].offsetWidth; - that.sizeInfo.totalMenuWidth = that.sizeInfo.menuWidth + that.sizeInfo.scrollBarWidth; - that.$menu.css('min-width', that.sizeInfo.menuWidth); - } - } - - chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk - chunkCount = Math.round(size / chunkSize) || 1; // number of chunks - - for (var i = 0; i < chunkCount; i++) { - var endOfChunk = (i + 1) * chunkSize; - - if (i === chunkCount - 1) { - endOfChunk = size; - } - - chunks[i] = [ - (i) * chunkSize + (!i ? 0 : 1), - endOfChunk - ]; - - if (!size) break; - - if (currentChunk === undefined && scrollTop <= that.selectpicker.current.data[endOfChunk - 1].position - that.sizeInfo.menuInnerHeight) { - currentChunk = i; - } - } - - if (currentChunk === undefined) currentChunk = 0; - - prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1]; - - // always display previous, current, and next chunks - firstChunk = Math.max(0, currentChunk - 1); - lastChunk = Math.min(chunkCount - 1, currentChunk + 1); - - that.selectpicker.view.position0 = isVirtual === false ? 0 : (Math.max(0, chunks[firstChunk][0]) || 0); - that.selectpicker.view.position1 = isVirtual === false ? size : (Math.min(size, chunks[lastChunk][1]) || 0); - - positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1; - - if (that.activeIndex !== undefined) { - prevActive = that.selectpicker.main.elements[that.prevActiveIndex]; - active = that.selectpicker.main.elements[that.activeIndex]; - selected = that.selectpicker.main.elements[that.selectedIndex]; - - if (init) { - if (that.activeIndex !== that.selectedIndex) { - that.defocusItem(active); - } - that.activeIndex = undefined; - } - - if (that.activeIndex && that.activeIndex !== that.selectedIndex) { - that.defocusItem(selected); - } - } - - if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex) { - that.defocusItem(prevActive); - } - - if (init || positionIsDifferent) { - previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : []; - - if (isVirtual === false) { - that.selectpicker.view.visibleElements = that.selectpicker.current.elements; - } else { - that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1); - } - - that.setOptionStatus(); - - // if searching, check to make sure the list has actually been updated before updating DOM - // this prevents unnecessary repaints - if (isSearching || (isVirtual === false && init)) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements); - - // if virtual scroll is disabled and not searching, - // menu should never need to be updated more than once - if ((init || isVirtual === true) && menuIsDifferent) { - var menuInner = that.$menuInner[0], - menuFragment = document.createDocumentFragment(), - emptyMenu = menuInner.firstChild.cloneNode(false), - marginTop, - marginBottom, - elements = that.selectpicker.view.visibleElements, - toSanitize = []; - - // replace the existing UL with an empty one - this is faster than $.empty() - menuInner.replaceChild(emptyMenu, menuInner.firstChild); - - for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) { - var element = elements[i], - elText, - elementData; - - if (that.options.sanitize) { - elText = element.lastChild; - - if (elText) { - elementData = that.selectpicker.current.data[i + that.selectpicker.view.position0]; - - if (elementData && elementData.content && !elementData.sanitized) { - toSanitize.push(elText); - elementData.sanitized = true; - } - } - } - - menuFragment.appendChild(element); - } - - if (that.options.sanitize && toSanitize.length) { - sanitizeHtml(toSanitize, that.options.whiteList, that.options.sanitizeFn); - } - - if (isVirtual === true) { - marginTop = (that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position); - marginBottom = (that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position); - - menuInner.firstChild.style.marginTop = marginTop + 'px'; - menuInner.firstChild.style.marginBottom = marginBottom + 'px'; - } else { - menuInner.firstChild.style.marginTop = 0; - menuInner.firstChild.style.marginBottom = 0; - } - - menuInner.firstChild.appendChild(menuFragment); - } - } - - that.prevActiveIndex = that.activeIndex; - - if (!that.options.liveSearch) { - that.$menuInner.trigger('focus'); - } else if (isSearching && init) { - var index = 0, - newActive; - - if (!that.selectpicker.view.canHighlight[index]) { - index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true); - } - - newActive = that.selectpicker.view.visibleElements[index]; - - that.defocusItem(that.selectpicker.view.currentActive); - - that.activeIndex = (that.selectpicker.current.data[index] || {}).index; - - that.focusItem(newActive); - } - } - - $(window) - .off('resize' + EVENT_KEY + '.' + this.selectId + '.createView') - .on('resize' + EVENT_KEY + '.' + this.selectId + '.createView', function () { - var isActive = that.$newElement.hasClass(classNames.SHOW); - - if (isActive) scroll(that.$menuInner[0].scrollTop); - }); - }, - - focusItem: function (li, liData, noStyle) { - if (li) { - liData = liData || this.selectpicker.main.data[this.activeIndex]; - var a = li.firstChild; - - if (a) { - a.setAttribute('aria-setsize', this.selectpicker.view.size); - a.setAttribute('aria-posinset', liData.posinset); - - if (noStyle !== true) { - this.focusedParent.setAttribute('aria-activedescendant', a.id); - li.classList.add('active'); - a.classList.add('active'); - } - } - } - }, - - defocusItem: function (li) { - if (li) { - li.classList.remove('active'); - if (li.firstChild) li.firstChild.classList.remove('active'); - } - }, - - setPlaceholder: function () { - var updateIndex = false; - - if (this.options.title && !this.multiple) { - if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option'); - - // this option doesn't create a new
  • element, but does add a new option at the start, - // so startIndex should increase to prevent having to check every option for the bs-title-option class - updateIndex = true; - - var element = this.$element[0], - isSelected = false, - titleNotAppended = !this.selectpicker.view.titleOption.parentNode; - - if (titleNotAppended) { - // Use native JS to prepend option (faster) - this.selectpicker.view.titleOption.className = 'bs-title-option'; - this.selectpicker.view.titleOption.value = ''; - - // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. - // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, - // if so, the select will have the data-selected attribute - var $opt = $(element.options[element.selectedIndex]); - isSelected = $opt.attr('selected') === undefined && this.$element.data('selected') === undefined; - } - - if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) { - element.insertBefore(this.selectpicker.view.titleOption, element.firstChild); - } - - // Set selected *after* appending to select, - // otherwise the option doesn't get selected in IE - // set using selectedIndex, as setting the selected attr to true here doesn't work in IE11 - if (isSelected) element.selectedIndex = 0; - } - - return updateIndex; - }, - - createLi: function () { - var that = this, - iconBase = this.options.iconBase, - optionSelector = ':not([hidden]):not([data-hidden="true"])', - mainElements = [], - mainData = [], - widestOptionLength = 0, - optID = 0, - startIndex = this.setPlaceholder() ? 1 : 0; // append the titleOption if necessary and skip the first option in the loop - - if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; - - if ((that.options.showTick || that.multiple) && !elementTemplates.checkMark.parentNode) { - elementTemplates.checkMark.className = iconBase + ' ' + that.options.tickIcon + ' check-mark'; - elementTemplates.a.appendChild(elementTemplates.checkMark); - } - - var selectOptions = this.$element[0].querySelectorAll('select > *' + optionSelector); - - function addDivider (config) { - var previousData = mainData[mainData.length - 1]; - - // ensure optgroup doesn't create back-to-back dividers - if ( - previousData && - previousData.type === 'divider' && - (previousData.optID || config.optID) - ) { - return; - } - - config = config || {}; - config.type = 'divider'; - - mainElements.push( - generateOption.li( - false, - classNames.DIVIDER, - (config.optID ? config.optID + 'div' : undefined) - ) - ); - - mainData.push(config); - } - - function addOption (option, config) { - config = config || {}; - - config.divider = option.getAttribute('data-divider') === 'true'; - - if (config.divider) { - addDivider({ - optID: config.optID - }); - } else { - var liIndex = mainData.length, - cssText = option.style.cssText, - inlineStyle = cssText ? htmlEscape(cssText) : '', - optionClass = (option.className || '') + (config.optgroupClass || ''); - - if (config.optID) optionClass = 'opt ' + optionClass; - - config.text = option.textContent; - - config.content = option.getAttribute('data-content'); - config.tokens = option.getAttribute('data-tokens'); - config.subtext = option.getAttribute('data-subtext'); - config.icon = option.getAttribute('data-icon'); - config.iconBase = iconBase; - - var textElement = generateOption.text(config); - var liElement = generateOption.li( - generateOption.a( - textElement, - optionClass, - inlineStyle - ), - '', - config.optID - ); - - if (liElement.firstChild) { - liElement.firstChild.id = that.selectId + '-' + liIndex; - } - - mainElements.push(liElement); - - option.liIndex = liIndex; - - config.display = config.content || config.text; - config.type = 'option'; - config.index = liIndex; - config.option = option; - config.disabled = config.disabled || option.disabled; - - mainData.push(config); - - var combinedLength = 0; - - // count the number of characters in the option - not perfect, but should work in most cases - if (config.display) combinedLength += config.display.length; - if (config.subtext) combinedLength += config.subtext.length; - // if there is an icon, ensure this option's width is checked - if (config.icon) combinedLength += 1; - - if (combinedLength > widestOptionLength) { - widestOptionLength = combinedLength; - - // guess which option is the widest - // use this when calculating menu width - // not perfect, but it's fast, and the width will be updating accordingly when scrolling - that.selectpicker.view.widestOption = mainElements[mainElements.length - 1]; - } - } - } - - function addOptgroup (index, selectOptions) { - var optgroup = selectOptions[index], - previous = selectOptions[index - 1], - next = selectOptions[index + 1], - options = optgroup.querySelectorAll('option' + optionSelector); - - if (!options.length) return; - - var config = { - label: htmlEscape(optgroup.label), - subtext: optgroup.getAttribute('data-subtext'), - icon: optgroup.getAttribute('data-icon'), - iconBase: iconBase - }, - optgroupClass = ' ' + (optgroup.className || ''), - headerIndex, - lastIndex; - - optID++; - - if (previous) { - addDivider({ optID: optID }); - } - - var labelElement = generateOption.label(config); - - mainElements.push( - generateOption.li(labelElement, 'dropdown-header' + optgroupClass, optID) - ); - - mainData.push({ - display: config.label, - subtext: config.subtext, - type: 'optgroup-label', - optID: optID - }); - - for (var j = 0, len = options.length; j < len; j++) { - var option = options[j]; - - if (j === 0) { - headerIndex = mainData.length - 1; - lastIndex = headerIndex + len; - } - - addOption(option, { - headerIndex: headerIndex, - lastIndex: lastIndex, - optID: optID, - optgroupClass: optgroupClass, - disabled: optgroup.disabled - }); - } - - if (next) { - addDivider({ optID: optID }); - } - } - - for (var len = selectOptions.length; startIndex < len; startIndex++) { - var item = selectOptions[startIndex]; - - if (item.tagName !== 'OPTGROUP') { - addOption(item, {}); - } else { - addOptgroup(startIndex, selectOptions); - } - } - - this.selectpicker.main.elements = mainElements; - this.selectpicker.main.data = mainData; - - this.selectpicker.current = this.selectpicker.main; - }, - - findLis: function () { - return this.$menuInner.find('.inner > li'); - }, - - render: function () { - // ensure titleOption is appended and selected (if necessary) before getting selectedOptions - this.setPlaceholder(); - - var that = this, - element = this.$element[0], - selectedOptions = getSelectedOptions(element, this.options.hideDisabled), - selectedCount = selectedOptions.length, - button = this.$button[0], - buttonInner = button.querySelector('.filter-option-inner-inner'), - multipleSeparator = document.createTextNode(this.options.multipleSeparator), - titleFragment = elementTemplates.fragment.cloneNode(false), - showCount, - countMax, - hasContent = false; - - button.classList.toggle('bs-placeholder', that.multiple ? !selectedCount : !getSelectValues(element, selectedOptions)); - - this.tabIndex(); - - if (this.options.selectedTextFormat === 'static') { - titleFragment = generateOption.text({ text: this.options.title }, true); - } else { - showCount = this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1 && selectedCount > 1; - - // determine if the number of selected options will be shown (showCount === true) - if (showCount) { - countMax = this.options.selectedTextFormat.split('>'); - showCount = (countMax.length > 1 && selectedCount > countMax[1]) || (countMax.length === 1 && selectedCount >= 2); - } - - // only loop through all selected options if the count won't be shown - if (showCount === false) { - for (var selectedIndex = 0; selectedIndex < selectedCount; selectedIndex++) { - if (selectedIndex < 50) { - var option = selectedOptions[selectedIndex], - titleOptions = {}, - thisData = { - content: option.getAttribute('data-content'), - subtext: option.getAttribute('data-subtext'), - icon: option.getAttribute('data-icon') - }; - - if (this.multiple && selectedIndex > 0) { - titleFragment.appendChild(multipleSeparator.cloneNode(false)); - } - - if (option.title) { - titleOptions.text = option.title; - } else if (thisData.content && that.options.showContent) { - titleOptions.content = thisData.content.toString(); - hasContent = true; - } else { - if (that.options.showIcon) { - titleOptions.icon = thisData.icon; - titleOptions.iconBase = this.options.iconBase; - } - if (that.options.showSubtext && !that.multiple && thisData.subtext) titleOptions.subtext = ' ' + thisData.subtext; - titleOptions.text = option.textContent.trim(); - } - - titleFragment.appendChild(generateOption.text(titleOptions, true)); - } else { - break; - } - } - - // add ellipsis - if (selectedCount > 49) { - titleFragment.appendChild(document.createTextNode('...')); - } - } else { - var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])'; - if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; - - // If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc. - var totalCount = this.$element[0].querySelectorAll('select > option' + optionSelector + ', optgroup' + optionSelector + ' option' + optionSelector).length, - tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedCount, totalCount) : this.options.countSelectedText; - - titleFragment = generateOption.text({ - text: tr8nText.replace('{0}', selectedCount.toString()).replace('{1}', totalCount.toString()) - }, true); - } - } - - if (this.options.title == undefined) { - // use .attr to ensure undefined is returned if title attribute is not set - this.options.title = this.$element.attr('title'); - } - - // If the select doesn't have a title, then use the default, or if nothing is set at all, use noneSelectedText - if (!titleFragment.childNodes.length) { - titleFragment = generateOption.text({ - text: typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText - }, true); - } - - // strip all HTML tags and trim the result, then unescape any escaped tags - button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim(); - - if (this.options.sanitize && hasContent) { - sanitizeHtml([titleFragment], that.options.whiteList, that.options.sanitizeFn); - } - - buttonInner.innerHTML = ''; - buttonInner.appendChild(titleFragment); - - if (version.major < 4 && this.$newElement[0].classList.contains('bs3-has-addon')) { - var filterExpand = button.querySelector('.filter-expand'), - clone = buttonInner.cloneNode(true); - - clone.className = 'filter-expand'; - - if (filterExpand) { - button.replaceChild(clone, filterExpand); - } else { - button.appendChild(clone); - } - } - - this.$element.trigger('rendered' + EVENT_KEY); - }, - - /** - * @param [style] - * @param [status] - */ - setStyle: function (newStyle, status) { - var button = this.$button[0], - newElement = this.$newElement[0], - style = this.options.style.trim(), - buttonClass; - - if (this.$element.attr('class')) { - this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); - } - - if (version.major < 4) { - newElement.classList.add('bs3'); - - if (newElement.parentNode.classList.contains('input-group') && - (newElement.previousElementSibling || newElement.nextElementSibling) && - (newElement.previousElementSibling || newElement.nextElementSibling).classList.contains('input-group-addon') - ) { - newElement.classList.add('bs3-has-addon'); - } - } - - if (newStyle) { - buttonClass = newStyle.trim(); - } else { - buttonClass = style; - } - - if (status == 'add') { - if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); - } else if (status == 'remove') { - if (buttonClass) button.classList.remove.apply(button.classList, buttonClass.split(' ')); - } else { - if (style) button.classList.remove.apply(button.classList, style.split(' ')); - if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); - } - }, - - liHeight: function (refresh) { - if (!refresh && (this.options.size === false || this.sizeInfo)) return; - - if (!this.sizeInfo) this.sizeInfo = {}; - - var newElement = document.createElement('div'), - menu = document.createElement('div'), - menuInner = document.createElement('div'), - menuInnerInner = document.createElement('ul'), - divider = document.createElement('li'), - dropdownHeader = document.createElement('li'), - li = document.createElement('li'), - a = document.createElement('a'), - text = document.createElement('span'), - header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null, - search = this.options.liveSearch ? document.createElement('div') : null, - actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, - doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null, - firstOption = this.$element.find('option')[0]; - - this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth; - - text.className = 'text'; - a.className = 'dropdown-item ' + (firstOption ? firstOption.className : ''); - newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW; - newElement.style.width = this.sizeInfo.selectWidth + 'px'; - if (this.options.width === 'auto') menu.style.minWidth = 0; - menu.className = classNames.MENU + ' ' + classNames.SHOW; - menuInner.className = 'inner ' + classNames.SHOW; - menuInnerInner.className = classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : ''); - divider.className = classNames.DIVIDER; - dropdownHeader.className = 'dropdown-header'; - - text.appendChild(document.createTextNode('\u200b')); - a.appendChild(text); - li.appendChild(a); - dropdownHeader.appendChild(text.cloneNode(true)); - - if (this.selectpicker.view.widestOption) { - menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true)); - } - - menuInnerInner.appendChild(li); - menuInnerInner.appendChild(divider); - menuInnerInner.appendChild(dropdownHeader); - if (header) menu.appendChild(header); - if (search) { - var input = document.createElement('input'); - search.className = 'bs-searchbox'; - input.className = 'form-control'; - search.appendChild(input); - menu.appendChild(search); - } - if (actions) menu.appendChild(actions); - menuInner.appendChild(menuInnerInner); - menu.appendChild(menuInner); - if (doneButton) menu.appendChild(doneButton); - newElement.appendChild(menu); - - document.body.appendChild(newElement); - - var liHeight = li.offsetHeight, - dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0, - headerHeight = header ? header.offsetHeight : 0, - searchHeight = search ? search.offsetHeight : 0, - actionsHeight = actions ? actions.offsetHeight : 0, - doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, - dividerHeight = $(divider).outerHeight(true), - // fall back to jQuery if getComputedStyle is not supported - menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false, - menuWidth = menu.offsetWidth, - $menu = menuStyle ? null : $(menu), - menuPadding = { - vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + - toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + - toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + - toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), - horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + - toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + - toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + - toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) - }, - menuExtras = { - vert: menuPadding.vert + - toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + - toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, - horiz: menuPadding.horiz + - toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + - toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 - }, - scrollBarWidth; - - menuInner.style.overflowY = 'scroll'; - - scrollBarWidth = menu.offsetWidth - menuWidth; - - document.body.removeChild(newElement); - - this.sizeInfo.liHeight = liHeight; - this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight; - this.sizeInfo.headerHeight = headerHeight; - this.sizeInfo.searchHeight = searchHeight; - this.sizeInfo.actionsHeight = actionsHeight; - this.sizeInfo.doneButtonHeight = doneButtonHeight; - this.sizeInfo.dividerHeight = dividerHeight; - this.sizeInfo.menuPadding = menuPadding; - this.sizeInfo.menuExtras = menuExtras; - this.sizeInfo.menuWidth = menuWidth; - this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth; - this.sizeInfo.scrollBarWidth = scrollBarWidth; - this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight; - - this.setPositionData(); - }, - - getSelectPosition: function () { - var that = this, - $window = $(window), - pos = that.$newElement.offset(), - $container = $(that.options.container), - containerPos; - - if (that.options.container && $container.length && !$container.is('body')) { - containerPos = $container.offset(); - containerPos.top += parseInt($container.css('borderTopWidth')); - containerPos.left += parseInt($container.css('borderLeftWidth')); - } else { - containerPos = { top: 0, left: 0 }; - } - - var winPad = that.options.windowPadding; - - this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); - this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo.selectHeight - containerPos.top - winPad[2]; - this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); - this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo.selectWidth - containerPos.left - winPad[1]; - this.sizeInfo.selectOffsetTop -= winPad[0]; - this.sizeInfo.selectOffsetLeft -= winPad[3]; - }, - - setMenuSize: function (isAuto) { - this.getSelectPosition(); - - var selectWidth = this.sizeInfo.selectWidth, - liHeight = this.sizeInfo.liHeight, - headerHeight = this.sizeInfo.headerHeight, - searchHeight = this.sizeInfo.searchHeight, - actionsHeight = this.sizeInfo.actionsHeight, - doneButtonHeight = this.sizeInfo.doneButtonHeight, - divHeight = this.sizeInfo.dividerHeight, - menuPadding = this.sizeInfo.menuPadding, - menuInnerHeight, - menuHeight, - divLength = 0, - minHeight, - _minHeight, - maxHeight, - menuInnerMinHeight, - estimate; - - if (this.options.dropupAuto) { - // Get the estimated height of the menu without scrollbars. - // This is useful for smaller menus, where there might be plenty of room - // below the button without setting dropup, but we can't know - // the exact height of the menu until createView is called later - estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert; - this.$newElement.toggleClass(classNames.DROPUP, this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot); - } - - if (this.options.size === 'auto') { - _minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0; - menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert; - minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; - menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0); - - if (this.$newElement.hasClass(classNames.DROPUP)) { - menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert; - } - - maxHeight = menuHeight; - menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert; - } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { - for (var i = 0; i < this.options.size; i++) { - if (this.selectpicker.current.data[i].type === 'divider') divLength++; - } - - menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; - menuInnerHeight = menuHeight - menuPadding.vert; - maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; - minHeight = menuInnerMinHeight = ''; - } - - if (this.options.dropdownAlignRight === 'auto') { - this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < (this.sizeInfo.totalMenuWidth - selectWidth)); - } - - this.$menu.css({ - 'max-height': maxHeight + 'px', - 'overflow': 'hidden', - 'min-height': minHeight + 'px' - }); - - this.$menuInner.css({ - 'max-height': menuInnerHeight + 'px', - 'overflow-y': 'auto', - 'min-height': menuInnerMinHeight + 'px' - }); - - // ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView - this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1); - - if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) { - this.sizeInfo.hasScrollBar = true; - this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth; - - this.$menu.css('min-width', this.sizeInfo.totalMenuWidth); - } - - if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update(); - }, - - setSize: function (refresh) { - this.liHeight(refresh); - - if (this.options.header) this.$menu.css('padding-top', 0); - if (this.options.size === false) return; - - var that = this, - $window = $(window); - - this.setMenuSize(); - - if (this.options.liveSearch) { - this.$searchbox - .off('input.setMenuSize propertychange.setMenuSize') - .on('input.setMenuSize propertychange.setMenuSize', function () { - return that.setMenuSize(); - }); - } - - if (this.options.size === 'auto') { - $window - .off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize') - .on('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize', function () { - return that.setMenuSize(); - }); - } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { - $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize'); - } - - that.createView(false, true, refresh); - }, - - setWidth: function () { - var that = this; - - if (this.options.width === 'auto') { - requestAnimationFrame(function () { - that.$menu.css('min-width', '0'); - - that.$element.on('loaded' + EVENT_KEY, function () { - that.liHeight(); - that.setMenuSize(); - - // Get correct width if element is hidden - var $selectClone = that.$newElement.clone().appendTo('body'), - btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth(); - - $selectClone.remove(); - - // Set width to whatever's larger, button title or longest option - that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth); - that.$newElement.css('width', that.sizeInfo.selectWidth + 'px'); - }); - }); - } else if (this.options.width === 'fit') { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', '').addClass('fit-width'); - } else if (this.options.width) { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', this.options.width); - } else { - // Remove inline min-width/width so width can be changed - this.$menu.css('min-width', ''); - this.$newElement.css('width', ''); - } - // Remove fit-width class if width is changed programmatically - if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { - this.$newElement[0].classList.remove('fit-width'); - } - }, - - selectPosition: function () { - this.$bsContainer = $('
    '); - - var that = this, - $container = $(this.options.container), - pos, - containerPos, - actualHeight, - getPlacement = function ($element) { - var containerPosition = {}, - // fall back to dropdown's default display setting if display is not manually set - display = that.options.display || ( - // Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default - $.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display - : false - ); - - that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP)); - pos = $element.offset(); - - if (!$container.is('body')) { - containerPos = $container.offset(); - containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop(); - containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft(); - } else { - containerPos = { top: 0, left: 0 }; - } - - actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight; - - // Bootstrap 4+ uses Popper for menu positioning - if (version.major < 4 || display === 'static') { - containerPosition.top = pos.top - containerPos.top + actualHeight; - containerPosition.left = pos.left - containerPos.left; - } - - containerPosition.width = $element[0].offsetWidth; - - that.$bsContainer.css(containerPosition); - }; - - this.$button.on('click.bs.dropdown.data-api', function () { - if (that.isDisabled()) { - return; - } - - getPlacement(that.$newElement); - - that.$bsContainer - .appendTo(that.options.container) - .toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW)) - .append(that.$menu); - }); - - $(window) - .off('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId) - .on('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId, function () { - var isActive = that.$newElement.hasClass(classNames.SHOW); - - if (isActive) getPlacement(that.$newElement); - }); - - this.$element.on('hide' + EVENT_KEY, function () { - that.$menu.data('height', that.$menu.height()); - that.$bsContainer.detach(); - }); - }, - - setOptionStatus: function (selectedOnly) { - var that = this; - - that.noScroll = false; - - if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) { - for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) { - var liData = that.selectpicker.current.data[i + that.selectpicker.view.position0], - option = liData.option; - - if (option) { - if (selectedOnly !== true) { - that.setDisabled( - liData.index, - liData.disabled - ); - } - - that.setSelected( - liData.index, - option.selected - ); - } - } - } - }, - - /** - * @param {number} index - the index of the option that is being changed - * @param {boolean} selected - true if the option is being selected, false if being deselected - */ - setSelected: function (index, selected) { - var li = this.selectpicker.main.elements[index], - liData = this.selectpicker.main.data[index], - activeIndexIsSet = this.activeIndex !== undefined, - thisIsActive = this.activeIndex === index, - prevActive, - a, - // if current option is already active - // OR - // if the current option is being selected, it's NOT multiple, and - // activeIndex is undefined: - // - when the menu is first being opened, OR - // - after a search has been performed, OR - // - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex) - keepActive = thisIsActive || (selected && !this.multiple && !activeIndexIsSet); - - liData.selected = selected; - - a = li.firstChild; - - if (selected) { - this.selectedIndex = index; - } - - li.classList.toggle('selected', selected); - - if (keepActive) { - this.focusItem(li, liData); - this.selectpicker.view.currentActive = li; - this.activeIndex = index; - } else { - this.defocusItem(li); - } - - if (a) { - a.classList.toggle('selected', selected); - - if (selected) { - a.setAttribute('aria-selected', true); - } else { - if (this.multiple) { - a.setAttribute('aria-selected', false); - } else { - a.removeAttribute('aria-selected'); - } - } - } - - if (!keepActive && !activeIndexIsSet && selected && this.prevActiveIndex !== undefined) { - prevActive = this.selectpicker.main.elements[this.prevActiveIndex]; - - this.defocusItem(prevActive); - } - }, - - /** - * @param {number} index - the index of the option that is being disabled - * @param {boolean} disabled - true if the option is being disabled, false if being enabled - */ - setDisabled: function (index, disabled) { - var li = this.selectpicker.main.elements[index], - a; - - this.selectpicker.main.data[index].disabled = disabled; - - a = li.firstChild; - - li.classList.toggle(classNames.DISABLED, disabled); - - if (a) { - if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled); - - if (disabled) { - a.setAttribute('aria-disabled', disabled); - a.setAttribute('tabindex', -1); - } else { - a.removeAttribute('aria-disabled'); - a.setAttribute('tabindex', 0); - } - } - }, - - isDisabled: function () { - return this.$element[0].disabled; - }, - - checkDisabled: function () { - var that = this; - - if (this.isDisabled()) { - this.$newElement[0].classList.add(classNames.DISABLED); - this.$button.addClass(classNames.DISABLED).attr('tabindex', -1).attr('aria-disabled', true); - } else { - if (this.$button[0].classList.contains(classNames.DISABLED)) { - this.$newElement[0].classList.remove(classNames.DISABLED); - this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false); - } - - if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { - this.$button.removeAttr('tabindex'); - } - } - - this.$button.on('click', function () { - return !that.isDisabled(); - }); - }, - - tabIndex: function () { - if (this.$element.data('tabindex') !== this.$element.attr('tabindex') && - (this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) { - this.$element.data('tabindex', this.$element.attr('tabindex')); - this.$button.attr('tabindex', this.$element.data('tabindex')); - } - - this.$element.attr('tabindex', -98); - }, - - clickListener: function () { - var that = this, - $document = $(document); - - $document.data('spaceSelect', false); - - this.$button.on('keyup', function (e) { - if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { - e.preventDefault(); - $document.data('spaceSelect', false); - } - }); - - this.$newElement.on('show.bs.dropdown', function () { - if (version.major > 3 && !that.dropdown) { - that.dropdown = that.$button.data('bs.dropdown'); - that.dropdown._menu = that.$menu[0]; - } - }); - - this.$button.on('click.bs.dropdown.data-api', function () { - if (!that.$newElement.hasClass(classNames.SHOW)) { - that.setSize(); - } - }); - - function setFocus () { - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$menuInner.trigger('focus'); - } - } - - function checkPopperExists () { - if (that.dropdown && that.dropdown._popper && that.dropdown._popper.state.isCreated) { - setFocus(); - } else { - requestAnimationFrame(checkPopperExists); - } - } - - this.$element.on('shown' + EVENT_KEY, function () { - if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) { - that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop; - } - - if (version.major > 3) { - requestAnimationFrame(checkPopperExists); - } else { - setFocus(); - } - }); - - // ensure posinset and setsize are correct before selecting an option via a click - this.$menuInner.on('mouseenter', 'li a', function (e) { - var hoverLi = this.parentElement, - position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, - index = Array.prototype.indexOf.call(hoverLi.parentElement.children, hoverLi), - hoverData = that.selectpicker.current.data[index + position0]; - - that.focusItem(hoverLi, hoverData, true); - }); - - this.$menuInner.on('click', 'li a', function (e, retainActive) { - var $this = $(this), - element = that.$element[0], - position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, - clickedData = that.selectpicker.current.data[$this.parent().index() + position0], - clickedIndex = clickedData.index, - prevValue = getSelectValues(element), - prevIndex = element.selectedIndex, - prevOption = element.options[prevIndex], - triggerChange = true; - - // Don't close on multi choice menu - if (that.multiple && that.options.maxOptions !== 1) { - e.stopPropagation(); - } - - e.preventDefault(); - - // Don't run if the select is disabled - if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) { - var $options = that.$element.find('option'), - option = clickedData.option, - $option = $(option), - state = option.selected, - $optgroup = $option.parent('optgroup'), - $optgroupOptions = $optgroup.find('option'), - maxOptions = that.options.maxOptions, - maxOptionsGrp = $optgroup.data('maxOptions') || false; - - if (clickedIndex === that.activeIndex) retainActive = true; - - if (!retainActive) { - that.prevActiveIndex = that.activeIndex; - that.activeIndex = undefined; - } - - if (!that.multiple) { // Deselect all others if not multi select box - prevOption.selected = false; - option.selected = true; - that.setSelected(clickedIndex, true); - } else { // Toggle the one we have chosen if we are multi select. - option.selected = !state; - - that.setSelected(clickedIndex, !state); - $this.trigger('blur'); - - if (maxOptions !== false || maxOptionsGrp !== false) { - var maxReached = maxOptions < $options.filter(':selected').length, - maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; - - if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { - if (maxOptions && maxOptions == 1) { - $options.prop('selected', false); - $option.prop('selected', true); - - for (var i = 0; i < $options.length; i++) { - that.setSelected(i, false); - } - - that.setSelected(clickedIndex, true); - } else if (maxOptionsGrp && maxOptionsGrp == 1) { - $optgroup.find('option:selected').prop('selected', false); - $option.prop('selected', true); - - for (var i = 0; i < $optgroupOptions.length; i++) { - var option = $optgroupOptions[i]; - that.setSelected($options.index(option), false); - } - - that.setSelected(clickedIndex, true); - } else { - var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, - maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, - maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), - maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), - $notify = $('
    '); - // If {var} is set in array, replace it - /** @deprecated */ - if (maxOptionsArr[2]) { - maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); - maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); - } - - $option.prop('selected', false); - - that.$menu.append($notify); - - if (maxOptions && maxReached) { - $notify.append($('
    ' + maxTxt + '
    ')); - triggerChange = false; - that.$element.trigger('maxReached' + EVENT_KEY); - } - - if (maxOptionsGrp && maxReachedGrp) { - $notify.append($('
    ' + maxTxtGrp + '
    ')); - triggerChange = false; - that.$element.trigger('maxReachedGrp' + EVENT_KEY); - } - - setTimeout(function () { - that.setSelected(clickedIndex, false); - }, 10); - - $notify.delay(750).fadeOut(300, function () { - $(this).remove(); - }); - } - } - } - } - - if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { - that.$button.trigger('focus'); - } else if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } - - // Trigger select 'change' - if (triggerChange) { - if (that.multiple || prevIndex !== element.selectedIndex) { - // $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed. - changedArguments = [option.index, $option.prop('selected'), prevValue]; - that.$element - .triggerNative('change'); - } - } - } - }); - - this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function (e) { - if (e.currentTarget == this) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch && !$(e.target).hasClass('close')) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - } - }); - - this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - }); - - this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function () { - that.$button.trigger('click'); - }); - - this.$searchbox.on('click', function (e) { - e.stopPropagation(); - }); - - this.$menu.on('click', '.actions-btn', function (e) { - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - - e.preventDefault(); - e.stopPropagation(); - - if ($(this).hasClass('bs-select-all')) { - that.selectAll(); - } else { - that.deselectAll(); - } - }); - - this.$element - .on('change' + EVENT_KEY, function () { - that.render(); - that.$element.trigger('changed' + EVENT_KEY, changedArguments); - changedArguments = null; - }) - .on('focus' + EVENT_KEY, function () { - if (!that.options.mobile) that.$button.trigger('focus'); - }); - }, - - liveSearchListener: function () { - var that = this, - noResults = document.createElement('li'); - - this.$button.on('click.bs.dropdown.data-api', function () { - if (!!that.$searchbox.val()) { - that.$searchbox.val(''); - } - }); - - this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function (e) { - e.stopPropagation(); - }); - - this.$searchbox.on('input propertychange', function () { - var searchValue = that.$searchbox.val(); - - that.selectpicker.search.elements = []; - that.selectpicker.search.data = []; - - if (searchValue) { - var i, - searchMatch = [], - q = searchValue.toUpperCase(), - cache = {}, - cacheArr = [], - searchStyle = that._searchStyle(), - normalizeSearch = that.options.liveSearchNormalize; - - if (normalizeSearch) q = normalizeToBase(q); - - that._$lisSelected = that.$menuInner.find('.selected'); - - for (var i = 0; i < that.selectpicker.main.data.length; i++) { - var li = that.selectpicker.main.data[i]; - - if (!cache[i]) { - cache[i] = stringSearch(li, q, searchStyle, normalizeSearch); - } - - if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) { - if (li.headerIndex > 0) { - cache[li.headerIndex - 1] = true; - cacheArr.push(li.headerIndex - 1); - } - - cache[li.headerIndex] = true; - cacheArr.push(li.headerIndex); - - cache[li.lastIndex + 1] = true; - } - - if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i); - } - - for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) { - var index = cacheArr[i], - prevIndex = cacheArr[i - 1], - li = that.selectpicker.main.data[index], - liPrev = that.selectpicker.main.data[prevIndex]; - - if (li.type !== 'divider' || (li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i)) { - that.selectpicker.search.data.push(li); - searchMatch.push(that.selectpicker.main.elements[index]); - } - } - - that.activeIndex = undefined; - that.noScroll = true; - that.$menuInner.scrollTop(0); - that.selectpicker.search.elements = searchMatch; - that.createView(true); - - if (!searchMatch.length) { - noResults.className = 'no-results'; - noResults.innerHTML = that.options.noneResultsText.replace('{0}', '"' + htmlEscape(searchValue) + '"'); - that.$menuInner[0].firstChild.appendChild(noResults); - } - } else { - that.$menuInner.scrollTop(0); - that.createView(false); - } - }); - }, - - _searchStyle: function () { - return this.options.liveSearchStyle || 'contains'; - }, - - val: function (value) { - var element = this.$element[0]; - - if (typeof value !== 'undefined') { - var prevValue = getSelectValues(element); - - changedArguments = [null, null, prevValue]; - - this.$element - .val(value) - .trigger('changed' + EVENT_KEY, changedArguments); - - if (this.$newElement.hasClass(classNames.SHOW)) { - if (this.multiple) { - this.setOptionStatus(true); - } else { - var liSelectedIndex = (element.options[element.selectedIndex] || {}).liIndex; - - if (typeof liSelectedIndex === 'number') { - this.setSelected(this.selectedIndex, false); - this.setSelected(liSelectedIndex, true); - } - } - } - - this.render(); - - changedArguments = null; - - return this.$element; - } else { - return this.$element.val(); - } - }, - - changeAll: function (status) { - if (!this.multiple) return; - if (typeof status === 'undefined') status = true; - - var element = this.$element[0], - previousSelected = 0, - currentSelected = 0, - prevValue = getSelectValues(element); - - element.classList.add('bs-select-hidden'); - - for (var i = 0, len = this.selectpicker.current.elements.length; i < len; i++) { - var liData = this.selectpicker.current.data[i], - option = liData.option; - - if (option && !liData.disabled && liData.type !== 'divider') { - if (liData.selected) previousSelected++; - option.selected = status; - if (status) currentSelected++; - } - } - - element.classList.remove('bs-select-hidden'); - - if (previousSelected === currentSelected) return; - - this.setOptionStatus(); - - changedArguments = [null, null, prevValue]; - - this.$element - .triggerNative('change'); - }, - - selectAll: function () { - return this.changeAll(true); - }, - - deselectAll: function () { - return this.changeAll(false); - }, - - toggle: function (e) { - e = e || window.event; - - if (e) e.stopPropagation(); - - this.$button.trigger('click.bs.dropdown.data-api'); - }, - - keydown: function (e) { - var $this = $(this), - isToggle = $this.hasClass('dropdown-toggle'), - $parent = isToggle ? $this.closest('.dropdown') : $this.closest(Selector.MENU), - that = $parent.data('this'), - $items = that.findLis(), - index, - isActive, - liActive, - activeLi, - offset, - updateScroll = false, - downOnTab = e.which === keyCodes.TAB && !isToggle && !that.options.selectOnTab, - isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab, - scrollTop = that.$menuInner[0].scrollTop, - isVirtual = that.isVirtual(), - position0 = isVirtual === true ? that.selectpicker.view.position0 : 0; - - isActive = that.$newElement.hasClass(classNames.SHOW); - - if ( - !isActive && - ( - isArrowKey || - (e.which >= 48 && e.which <= 57) || - (e.which >= 96 && e.which <= 105) || - (e.which >= 65 && e.which <= 90) - ) - ) { - that.$button.trigger('click.bs.dropdown.data-api'); - - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - return; - } - } - - if (e.which === keyCodes.ESCAPE && isActive) { - e.preventDefault(); - that.$button.trigger('click.bs.dropdown.data-api').trigger('focus'); - } - - if (isArrowKey) { // if up or down - if (!$items.length) return; - - liActive = that.selectpicker.main.elements[that.activeIndex]; - index = liActive ? Array.prototype.indexOf.call(liActive.parentElement.children, liActive) : -1; - - if (index !== -1) { - that.defocusItem(liActive); - } - - if (e.which === keyCodes.ARROW_UP) { // up - if (index !== -1) index--; - if (index + position0 < 0) index += $items.length; - - if (!that.selectpicker.view.canHighlight[index + position0]) { - index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0; - if (index === -1) index = $items.length - 1; - } - } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down - index++; - if (index + position0 >= that.selectpicker.view.canHighlight.length) index = 0; - - if (!that.selectpicker.view.canHighlight[index + position0]) { - index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true); - } - } - - e.preventDefault(); - - var liActiveIndex = position0 + index; - - if (e.which === keyCodes.ARROW_UP) { // up - // scroll to bottom and highlight last option - if (position0 === 0 && index === $items.length - 1) { - that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight; - - liActiveIndex = that.selectpicker.current.elements.length - 1; - } else { - activeLi = that.selectpicker.current.data[liActiveIndex]; - offset = activeLi.position - activeLi.height; - - updateScroll = offset < scrollTop; - } - } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down - // scroll to top and highlight first option - if (index === 0) { - that.$menuInner[0].scrollTop = 0; - - liActiveIndex = 0; - } else { - activeLi = that.selectpicker.current.data[liActiveIndex]; - offset = activeLi.position - that.sizeInfo.menuInnerHeight; - - updateScroll = offset > scrollTop; - } - } - - liActive = that.selectpicker.current.elements[liActiveIndex]; - - that.activeIndex = that.selectpicker.current.data[liActiveIndex].index; - - that.focusItem(liActive); - - that.selectpicker.view.currentActive = liActive; - - if (updateScroll) that.$menuInner[0].scrollTop = offset; - - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - $this.trigger('focus'); - } - } else if ( - (!$this.is('input') && !REGEXP_TAB_OR_ESCAPE.test(e.which)) || - (e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory) - ) { - var searchMatch, - matches = [], - keyHistory; - - e.preventDefault(); - - that.selectpicker.keydown.keyHistory += keyCodeMap[e.which]; - - if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel); - that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start(); - - keyHistory = that.selectpicker.keydown.keyHistory; - - // if all letters are the same, set keyHistory to just the first character when searching - if (/^(.)\1+$/.test(keyHistory)) { - keyHistory = keyHistory.charAt(0); - } - - // find matches - for (var i = 0; i < that.selectpicker.current.data.length; i++) { - var li = that.selectpicker.current.data[i], - hasMatch; - - hasMatch = stringSearch(li, keyHistory, 'startsWith', true); - - if (hasMatch && that.selectpicker.view.canHighlight[i]) { - matches.push(li.index); - } - } - - if (matches.length) { - var matchIndex = 0; - - $items.removeClass('active').find('a').removeClass('active'); - - // either only one key has been pressed or they are all the same key - if (keyHistory.length === 1) { - matchIndex = matches.indexOf(that.activeIndex); - - if (matchIndex === -1 || matchIndex === matches.length - 1) { - matchIndex = 0; - } else { - matchIndex++; - } - } - - searchMatch = matches[matchIndex]; - - activeLi = that.selectpicker.main.data[searchMatch]; - - if (scrollTop - activeLi.position > 0) { - offset = activeLi.position - activeLi.height; - updateScroll = true; - } else { - offset = activeLi.position - that.sizeInfo.menuInnerHeight; - // if the option is already visible at the current scroll position, just keep it the same - updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight; - } - - liActive = that.selectpicker.main.elements[searchMatch]; - - that.activeIndex = matches[matchIndex]; - - that.focusItem(liActive); - - if (liActive) liActive.firstChild.focus(); - - if (updateScroll) that.$menuInner[0].scrollTop = offset; - - $this.trigger('focus'); - } - } - - // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. - if ( - isActive && - ( - (e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory) || - e.which === keyCodes.ENTER || - (e.which === keyCodes.TAB && that.options.selectOnTab) - ) - ) { - if (e.which !== keyCodes.SPACE) e.preventDefault(); - - if (!that.options.liveSearch || e.which !== keyCodes.SPACE) { - that.$menuInner.find('.active a').trigger('click', true); // retain active class - $this.trigger('focus'); - - if (!that.options.liveSearch) { - // Prevent screen from scrolling if the user hits the spacebar - e.preventDefault(); - // Fixes spacebar selection of dropdown items in FF & IE - $(document).data('spaceSelect', true); - } - } - } - }, - - mobile: function () { - this.$element[0].classList.add('mobile-device'); - }, - - refresh: function () { - // update options if data attributes have been changed - var config = $.extend({}, this.options, this.$element.data()); - this.options = config; - - this.checkDisabled(); - this.setStyle(); - this.render(); - this.createLi(); - this.setWidth(); - - this.setSize(true); - - this.$element.trigger('refreshed' + EVENT_KEY); - }, - - hide: function () { - this.$newElement.hide(); - }, - - show: function () { - this.$newElement.show(); - }, - - remove: function () { - this.$newElement.remove(); - this.$element.remove(); - }, - - destroy: function () { - this.$newElement.before(this.$element).remove(); - - if (this.$bsContainer) { - this.$bsContainer.remove(); - } else { - this.$menu.remove(); - } - - this.$element - .off(EVENT_KEY) - .removeData('selectpicker') - .removeClass('bs-select-hidden selectpicker'); - - $(window).off(EVENT_KEY + '.' + this.selectId); - } - }; - - // SELECTPICKER PLUGIN DEFINITION - // ============================== - function Plugin (option) { - // get the args of the outer function.. - var args = arguments; - // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them - // to get lost/corrupted in android 2.3 and IE9 #715 #775 - var _option = option; - - [].shift.apply(args); - - // if the version was not set successfully - if (!version.success) { - // try to retreive it again - try { - version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); - } catch (err) { - // fall back to use BootstrapVersion if set - if (Selectpicker.BootstrapVersion) { - version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.'); - } else { - version.full = [version.major, '0', '0']; - - console.warn( - 'There was an issue retrieving Bootstrap\'s version. ' + - 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' + - 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.', - err - ); - } - } - - version.major = version.full[0]; - version.success = true; - } - - if (version.major === '4') { - // some defaults need to be changed if using Bootstrap 4 - // check to see if they have already been manually changed before forcing them to update - var toUpdate = []; - - if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({ name: 'style', className: 'BUTTONCLASS' }); - if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({ name: 'iconBase', className: 'ICONBASE' }); - if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({ name: 'tickIcon', className: 'TICKICON' }); - - classNames.DIVIDER = 'dropdown-divider'; - classNames.SHOW = 'show'; - classNames.BUTTONCLASS = 'btn-light'; - classNames.POPOVERHEADER = 'popover-header'; - classNames.ICONBASE = ''; - classNames.TICKICON = 'bs-ok-default'; - - for (var i = 0; i < toUpdate.length; i++) { - var option = toUpdate[i]; - Selectpicker.DEFAULTS[option.name] = classNames[option.className]; - } - } - - var value; - var chain = this.each(function () { - var $this = $(this); - if ($this.is('select')) { - var data = $this.data('selectpicker'), - options = typeof _option == 'object' && _option; - - if (!data) { - var dataAttributes = $this.data(); - - for (var dataAttr in dataAttributes) { - if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { - delete dataAttributes[dataAttr]; - } - } - - var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, dataAttributes, options); - config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), dataAttributes.template, options.template); - $this.data('selectpicker', (data = new Selectpicker(this, config))); - } else if (options) { - for (var i in options) { - if (options.hasOwnProperty(i)) { - data.options[i] = options[i]; - } - } - } - - if (typeof _option == 'string') { - if (data[_option] instanceof Function) { - value = data[_option].apply(data, args); - } else { - value = data.options[_option]; - } - } - } - }); - - if (typeof value !== 'undefined') { - // noinspection JSUnusedAssignment - return value; - } else { - return chain; - } - } - - var old = $.fn.selectpicker; - $.fn.selectpicker = Plugin; - $.fn.selectpicker.Constructor = Selectpicker; - - // SELECTPICKER NO CONFLICT - // ======================== - $.fn.selectpicker.noConflict = function () { - $.fn.selectpicker = old; - return this; - }; - - $(document) - .off('keydown.bs.dropdown.data-api') - .on('keydown' + EVENT_KEY, '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', Selectpicker.prototype.keydown) - .on('focusin.modal', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', function (e) { - e.stopPropagation(); - }); - - // SELECTPICKER DATA-API - // ===================== - $(window).on('load' + EVENT_KEY + '.data-api', function () { - $('.selectpicker').each(function () { - var $selectpicker = $(this); - Plugin.call($selectpicker, $selectpicker.data()); - }) - }); -})(jQuery); - - -})); +/*! + * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) + * + * Copyright 2012-2019 SnapAppointments, LLC + * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) + */ + +(function (root, factory) { + if (root === undefined && window !== undefined) root = window; + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function (a0) { + return (factory(a0)); + }); + } else if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + factory(root["jQuery"]); + } +}(this, function (jQuery) { + +(function ($) { + 'use strict'; + + var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; + + var uriAttrs = [ + 'background', + 'cite', + 'href', + 'itemtype', + 'longdesc', + 'poster', + 'src', + 'xlink:href' + ]; + + var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; + + var DefaultWhitelist = { + // Global attributes allowed on any supplied element below. + '*': ['class', 'dir', 'id', 'lang', 'role', 'tabindex', 'style', ARIA_ATTRIBUTE_PATTERN], + a: ['target', 'href', 'title', 'rel'], + area: [], + b: [], + br: [], + col: [], + code: [], + div: [], + em: [], + hr: [], + h1: [], + h2: [], + h3: [], + h4: [], + h5: [], + h6: [], + i: [], + img: ['src', 'alt', 'title', 'width', 'height'], + li: [], + ol: [], + p: [], + pre: [], + s: [], + small: [], + span: [], + sub: [], + sup: [], + strong: [], + u: [], + ul: [] + } + + /** + * A pattern that recognizes a commonly useful subset of URLs that are safe. + * + * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts + */ + var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; + + /** + * A pattern that matches safe data URLs. Only matches image, video and audio types. + * + * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts + */ + var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; + + function allowedAttribute (attr, allowedAttributeList) { + var attrName = attr.nodeName.toLowerCase() + + if ($.inArray(attrName, allowedAttributeList) !== -1) { + if ($.inArray(attrName, uriAttrs) !== -1) { + return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) + } + + return true + } + + var regExp = $(allowedAttributeList).filter(function (index, value) { + return value instanceof RegExp + }) + + // Check if a regular expression validates the attribute. + for (var i = 0, l = regExp.length; i < l; i++) { + if (attrName.match(regExp[i])) { + return true + } + } + + return false + } + + function sanitizeHtml (unsafeElements, whiteList, sanitizeFn) { + if (sanitizeFn && typeof sanitizeFn === 'function') { + return sanitizeFn(unsafeElements); + } + + var whitelistKeys = Object.keys(whiteList); + + for (var i = 0, len = unsafeElements.length; i < len; i++) { + var elements = unsafeElements[i].querySelectorAll('*'); + + for (var j = 0, len2 = elements.length; j < len2; j++) { + var el = elements[j]; + var elName = el.nodeName.toLowerCase(); + + if (whitelistKeys.indexOf(elName) === -1) { + el.parentNode.removeChild(el); + + continue; + } + + var attributeList = [].slice.call(el.attributes); + var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); + + for (var k = 0, len3 = attributeList.length; k < len3; k++) { + var attr = attributeList[k]; + + if (!allowedAttribute(attr, whitelistedAttributes)) { + el.removeAttribute(attr.nodeName); + } + } + } + } + } + + // Polyfill for browsers with no classList support + // Remove in v2 + if (!('classList' in document.createElement('_'))) { + (function (view) { + if (!('Element' in view)) return; + + var classListProp = 'classList', + protoProp = 'prototype', + elemCtrProto = view.Element[protoProp], + objCtr = Object, + classListGetter = function () { + var $elem = $(this); + + return { + add: function (classes) { + classes = Array.prototype.slice.call(arguments).join(' '); + return $elem.addClass(classes); + }, + remove: function (classes) { + classes = Array.prototype.slice.call(arguments).join(' '); + return $elem.removeClass(classes); + }, + toggle: function (classes, force) { + return $elem.toggleClass(classes, force); + }, + contains: function (classes) { + return $elem.hasClass(classes); + } + } + }; + + if (objCtr.defineProperty) { + var classListPropDesc = { + get: classListGetter, + enumerable: true, + configurable: true + }; + try { + objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); + } catch (ex) { // IE 8 doesn't support enumerable:true + // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36 + // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected + if (ex.number === undefined || ex.number === -0x7FF5EC54) { + classListPropDesc.enumerable = false; + objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); + } + } + } else if (objCtr[protoProp].__defineGetter__) { + elemCtrProto.__defineGetter__(classListProp, classListGetter); + } + }(window)); + } + + var testElement = document.createElement('_'); + + testElement.classList.add('c1', 'c2'); + + if (!testElement.classList.contains('c2')) { + var _add = DOMTokenList.prototype.add, + _remove = DOMTokenList.prototype.remove; + + DOMTokenList.prototype.add = function () { + Array.prototype.forEach.call(arguments, _add.bind(this)); + } + + DOMTokenList.prototype.remove = function () { + Array.prototype.forEach.call(arguments, _remove.bind(this)); + } + } + + testElement.classList.toggle('c3', false); + + // Polyfill for IE 10 and Firefox <24, where classList.toggle does not + // support the second argument. + if (testElement.classList.contains('c3')) { + var _toggle = DOMTokenList.prototype.toggle; + + DOMTokenList.prototype.toggle = function (token, force) { + if (1 in arguments && !this.contains(token) === !force) { + return force; + } else { + return _toggle.call(this, token); + } + }; + } + + testElement = null; + + // shallow array comparison + function isEqual (array1, array2) { + return array1.length === array2.length && array1.every(function (element, index) { + return element === array2[index]; + }); + }; + + // + if (!String.prototype.startsWith) { + (function () { + 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` + var defineProperty = (function () { + // IE 8 only supports `Object.defineProperty` on DOM elements + try { + var object = {}; + var $defineProperty = Object.defineProperty; + var result = $defineProperty(object, object, object) && $defineProperty; + } catch (error) { + } + return result; + }()); + var toString = {}.toString; + var startsWith = function (search) { + if (this == null) { + throw new TypeError(); + } + var string = String(this); + if (search && toString.call(search) == '[object RegExp]') { + throw new TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var position = arguments.length > 1 ? arguments[1] : undefined; + // `ToInteger` + var pos = position ? Number(position) : 0; + if (pos != pos) { // better `isNaN` + pos = 0; + } + var start = Math.min(Math.max(pos, 0), stringLength); + // Avoid the `indexOf` call if no match is possible + if (searchLength + start > stringLength) { + return false; + } + var index = -1; + while (++index < searchLength) { + if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { + return false; + } + } + return true; + }; + if (defineProperty) { + defineProperty(String.prototype, 'startsWith', { + 'value': startsWith, + 'configurable': true, + 'writable': true + }); + } else { + String.prototype.startsWith = startsWith; + } + }()); + } + + if (!Object.keys) { + Object.keys = function ( + o, // object + k, // key + r // result array + ) { + // initialize object and result + r = []; + // iterate over object keys + for (k in o) { + // fill result array with non-prototypical keys + r.hasOwnProperty.call(o, k) && r.push(k); + } + // return result + return r; + }; + } + + if (HTMLSelectElement && !HTMLSelectElement.prototype.hasOwnProperty('selectedOptions')) { + Object.defineProperty(HTMLSelectElement.prototype, 'selectedOptions', { + get: function () { + return this.querySelectorAll(':checked'); + } + }); + } + + function getSelectedOptions (select, ignoreDisabled) { + var selectedOptions = select.selectedOptions, + options = [], + opt; + + if (ignoreDisabled) { + for (var i = 0, len = selectedOptions.length; i < len; i++) { + opt = selectedOptions[i]; + + if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { + options.push(opt); + } + } + + return options; + } + + return selectedOptions; + } + + // much faster than $.val() + function getSelectValues (select, selectedOptions) { + var value = [], + options = selectedOptions || select.selectedOptions, + opt; + + for (var i = 0, len = options.length; i < len; i++) { + opt = options[i]; + + if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { + value.push(opt.value || opt.text); + } + } + + if (!select.multiple) { + return !value.length ? null : value[0]; + } + + return value; + } + + // set data-selected on select element if the value has been programmatically selected + // prior to initialization of bootstrap-select + // * consider removing or replacing an alternative method * + var valHooks = { + useDefault: false, + _set: $.valHooks.select.set + }; + + $.valHooks.select.set = function (elem, value) { + if (value && !valHooks.useDefault) $(elem).data('selected', true); + + return valHooks._set.apply(this, arguments); + }; + + var changedArguments = null; + + var EventIsSupported = (function () { + try { + new Event('change'); + return true; + } catch (e) { + return false; + } + })(); + + $.fn.triggerNative = function (eventName) { + var el = this[0], + event; + + if (el.dispatchEvent) { // for modern browsers & IE9+ + if (EventIsSupported) { + // For modern browsers + event = new Event(eventName, { + bubbles: true + }); + } else { + // For IE since it doesn't support Event constructor + event = document.createEvent('Event'); + event.initEvent(eventName, true, false); + } + + el.dispatchEvent(event); + } else if (el.fireEvent) { // for IE8 + event = document.createEventObject(); + event.eventType = eventName; + el.fireEvent('on' + eventName, event); + } else { + // fall back to jQuery.trigger + this.trigger(eventName); + } + }; + // + + function stringSearch (li, searchString, method, normalize) { + var stringTypes = [ + 'display', + 'subtext', + 'tokens' + ], + searchSuccess = false; + + for (var i = 0; i < stringTypes.length; i++) { + var stringType = stringTypes[i], + string = li[stringType]; + + if (string) { + string = string.toString(); + + // Strip HTML tags. This isn't perfect, but it's much faster than any other method + if (stringType === 'display') { + string = string.replace(/<[^>]+>/g, ''); + } + + if (normalize) string = normalizeToBase(string); + string = string.toUpperCase(); + + if (method === 'contains') { + searchSuccess = string.indexOf(searchString) >= 0; + } else { + searchSuccess = string.startsWith(searchString); + } + + if (searchSuccess) break; + } + } + + return searchSuccess; + } + + function toInteger (value) { + return parseInt(value, 10) || 0; + } + + // Borrowed from Lodash (_.deburr) + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to compose unicode character classes. */ + var rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboMarksExtendedRange = '\\u1ab0-\\u1aff', + rsComboMarksSupplementRange = '\\u1dc0-\\u1dff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange; + + /** Used to compose unicode capture groups. */ + var rsCombo = '[' + rsComboRange + ']'; + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + function deburrLetter (key) { + return deburredLetters[key]; + }; + + function normalizeToBase (string) { + string = string.toString(); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + // List of HTML entities for escaping. + var escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + + // Functions for escaping and unescaping strings to/from HTML interpolation. + var createEscaper = function (map) { + var escaper = function (match) { + return map[match]; + }; + // Regexes for identifying a key that needs to be escaped. + var source = '(?:' + Object.keys(map).join('|') + ')'; + var testRegexp = RegExp(source); + var replaceRegexp = RegExp(source, 'g'); + return function (string) { + string = string == null ? '' : '' + string; + return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; + }; + }; + + var htmlEscape = createEscaper(escapeMap); + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var keyCodeMap = { + 32: ' ', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 59: ';', + 65: 'A', + 66: 'B', + 67: 'C', + 68: 'D', + 69: 'E', + 70: 'F', + 71: 'G', + 72: 'H', + 73: 'I', + 74: 'J', + 75: 'K', + 76: 'L', + 77: 'M', + 78: 'N', + 79: 'O', + 80: 'P', + 81: 'Q', + 82: 'R', + 83: 'S', + 84: 'T', + 85: 'U', + 86: 'V', + 87: 'W', + 88: 'X', + 89: 'Y', + 90: 'Z', + 96: '0', + 97: '1', + 98: '2', + 99: '3', + 100: '4', + 101: '5', + 102: '6', + 103: '7', + 104: '8', + 105: '9' + }; + + var keyCodes = { + ESCAPE: 27, // KeyboardEvent.which value for Escape (Esc) key + ENTER: 13, // KeyboardEvent.which value for Enter key + SPACE: 32, // KeyboardEvent.which value for space key + TAB: 9, // KeyboardEvent.which value for tab key + ARROW_UP: 38, // KeyboardEvent.which value for up arrow key + ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key + } + + var version = { + success: false, + major: '3' + }; + + try { + version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); + version.major = version.full[0]; + version.success = true; + } catch (err) { + // do nothing + } + + var selectId = 0; + + var EVENT_KEY = '.bs.select'; + + var classNames = { + DISABLED: 'disabled', + DIVIDER: 'divider', + SHOW: 'open', + DROPUP: 'dropup', + MENU: 'dropdown-menu', + MENURIGHT: 'dropdown-menu-right', + MENULEFT: 'dropdown-menu-left', + // to-do: replace with more advanced template/customization options + BUTTONCLASS: 'btn-default', + POPOVERHEADER: 'popover-title', + ICONBASE: 'glyphicon', + TICKICON: 'glyphicon-ok' + } + + var Selector = { + MENU: '.' + classNames.MENU + } + + var elementTemplates = { + span: document.createElement('span'), + i: document.createElement('i'), + subtext: document.createElement('small'), + a: document.createElement('a'), + li: document.createElement('li'), + whitespace: document.createTextNode('\u00A0'), + fragment: document.createDocumentFragment() + } + + elementTemplates.a.setAttribute('role', 'option'); + elementTemplates.subtext.className = 'text-muted'; + + elementTemplates.text = elementTemplates.span.cloneNode(false); + elementTemplates.text.className = 'text'; + + elementTemplates.checkMark = elementTemplates.span.cloneNode(false); + + var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN); + var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE); + + var generateOption = { + li: function (content, classes, optgroup) { + var li = elementTemplates.li.cloneNode(false); + + if (content) { + if (content.nodeType === 1 || content.nodeType === 11) { + li.appendChild(content); + } else { + li.innerHTML = content; + } + } + + if (typeof classes !== 'undefined' && classes !== '') li.className = classes; + if (typeof optgroup !== 'undefined' && optgroup !== null) li.classList.add('optgroup-' + optgroup); + + return li; + }, + + a: function (text, classes, inline) { + var a = elementTemplates.a.cloneNode(true); + + if (text) { + if (text.nodeType === 11) { + a.appendChild(text); + } else { + a.insertAdjacentHTML('beforeend', text); + } + } + + if (typeof classes !== 'undefined' && classes !== '') a.className = classes; + if (version.major === '4') a.classList.add('dropdown-item'); + if (inline) a.setAttribute('style', inline); + + return a; + }, + + text: function (options, useFragment) { + var textElement = elementTemplates.text.cloneNode(false), + subtextElement, + iconElement; + + if (options.content) { + textElement.innerHTML = options.content; + } else { + textElement.textContent = options.text; + + if (options.icon) { + var whitespace = elementTemplates.whitespace.cloneNode(false); + + // need to use for icons in the button to prevent a breaking change + // note: switch to span in next major release + iconElement = (useFragment === true ? elementTemplates.i : elementTemplates.span).cloneNode(false); + iconElement.className = options.iconBase + ' ' + options.icon; + + elementTemplates.fragment.appendChild(iconElement); + elementTemplates.fragment.appendChild(whitespace); + } + + if (options.subtext) { + subtextElement = elementTemplates.subtext.cloneNode(false); + subtextElement.textContent = options.subtext; + textElement.appendChild(subtextElement); + } + } + + if (useFragment === true) { + while (textElement.childNodes.length > 0) { + elementTemplates.fragment.appendChild(textElement.childNodes[0]); + } + } else { + elementTemplates.fragment.appendChild(textElement); + } + + return elementTemplates.fragment; + }, + + label: function (options) { + var textElement = elementTemplates.text.cloneNode(false), + subtextElement, + iconElement; + + textElement.innerHTML = options.label; + + if (options.icon) { + var whitespace = elementTemplates.whitespace.cloneNode(false); + + iconElement = elementTemplates.span.cloneNode(false); + iconElement.className = options.iconBase + ' ' + options.icon; + + elementTemplates.fragment.appendChild(iconElement); + elementTemplates.fragment.appendChild(whitespace); + } + + if (options.subtext) { + subtextElement = elementTemplates.subtext.cloneNode(false); + subtextElement.textContent = options.subtext; + textElement.appendChild(subtextElement); + } + + elementTemplates.fragment.appendChild(textElement); + + return elementTemplates.fragment; + } + } + + var Selectpicker = function (element, options) { + var that = this; + + // bootstrap-select has been initialized - revert valHooks.select.set back to its original function + if (!valHooks.useDefault) { + $.valHooks.select.set = valHooks._set; + valHooks.useDefault = true; + } + + this.$element = $(element); + this.$newElement = null; + this.$button = null; + this.$menu = null; + this.options = options; + this.selectpicker = { + main: {}, + search: {}, + current: {}, // current changes if a search is in progress + view: {}, + keydown: { + keyHistory: '', + resetKeyHistory: { + start: function () { + return setTimeout(function () { + that.selectpicker.keydown.keyHistory = ''; + }, 800); + } + } + } + }; + // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a + // data-attribute) + if (this.options.title === null) { + this.options.title = this.$element.attr('title'); + } + + // Format window padding + var winPad = this.options.windowPadding; + if (typeof winPad === 'number') { + this.options.windowPadding = [winPad, winPad, winPad, winPad]; + } + + // Expose public methods + this.val = Selectpicker.prototype.val; + this.render = Selectpicker.prototype.render; + this.refresh = Selectpicker.prototype.refresh; + this.setStyle = Selectpicker.prototype.setStyle; + this.selectAll = Selectpicker.prototype.selectAll; + this.deselectAll = Selectpicker.prototype.deselectAll; + this.destroy = Selectpicker.prototype.destroy; + this.remove = Selectpicker.prototype.remove; + this.show = Selectpicker.prototype.show; + this.hide = Selectpicker.prototype.hide; + + this.init(); + }; + + Selectpicker.VERSION = '1.13.10'; + + // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. + Selectpicker.DEFAULTS = { + noneSelectedText: 'Nothing selected', + noneResultsText: 'No results matched {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? '{0} item selected' : '{0} items selected'; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', + (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' + ]; + }, + selectAllText: 'Select All', + deselectAllText: 'Deselect All', + doneButton: false, + doneButtonText: 'Close', + multipleSeparator: ', ', + styleBase: 'btn', + style: classNames.BUTTONCLASS, + size: 'auto', + title: null, + selectedTextFormat: 'values', + width: false, + container: false, + hideDisabled: false, + showSubtext: false, + showIcon: true, + showContent: true, + dropupAuto: true, + header: false, + liveSearch: false, + liveSearchPlaceholder: null, + liveSearchNormalize: false, + liveSearchStyle: 'contains', + actionsBox: false, + iconBase: classNames.ICONBASE, + tickIcon: classNames.TICKICON, + showTick: false, + template: { + caret: '' + }, + maxOptions: false, + mobile: false, + selectOnTab: false, + dropdownAlignRight: false, + windowPadding: 0, + virtualScroll: 600, + display: false, + sanitize: true, + sanitizeFn: null, + whiteList: DefaultWhitelist + }; + + Selectpicker.prototype = { + + constructor: Selectpicker, + + init: function () { + var that = this, + id = this.$element.attr('id'); + + selectId++; + this.selectId = 'bs-select-' + selectId; + + this.$element[0].classList.add('bs-select-hidden'); + + this.multiple = this.$element.prop('multiple'); + this.autofocus = this.$element.prop('autofocus'); + + if (this.$element[0].classList.contains('show-tick')) { + this.options.showTick = true; + } + + this.$newElement = this.createDropdown(); + this.$element + .after(this.$newElement) + .prependTo(this.$newElement); + + this.$button = this.$newElement.children('button'); + this.$menu = this.$newElement.children(Selector.MENU); + this.$menuInner = this.$menu.children('.inner'); + this.$searchbox = this.$menu.find('input'); + + this.$element[0].classList.remove('bs-select-hidden'); + + if (this.options.dropdownAlignRight === true) this.$menu[0].classList.add(classNames.MENURIGHT); + + if (typeof id !== 'undefined') { + this.$button.attr('data-id', id); + } + + this.checkDisabled(); + this.clickListener(); + + if (this.options.liveSearch) { + this.liveSearchListener(); + this.focusedParent = this.$searchbox[0]; + } else { + this.focusedParent = this.$menuInner[0]; + } + + this.setStyle(); + this.render(); + this.setWidth(); + if (this.options.container) { + this.selectPosition(); + } else { + this.$element.on('hide' + EVENT_KEY, function () { + if (that.isVirtual()) { + // empty menu on close + var menuInner = that.$menuInner[0], + emptyMenu = menuInner.firstChild.cloneNode(false); + + // replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = '' + menuInner.replaceChild(emptyMenu, menuInner.firstChild); + menuInner.scrollTop = 0; + } + }); + } + this.$menu.data('this', this); + this.$newElement.data('this', this); + if (this.options.mobile) this.mobile(); + + this.$newElement.on({ + 'hide.bs.dropdown': function (e) { + that.$element.trigger('hide' + EVENT_KEY, e); + }, + 'hidden.bs.dropdown': function (e) { + that.$element.trigger('hidden' + EVENT_KEY, e); + }, + 'show.bs.dropdown': function (e) { + that.$element.trigger('show' + EVENT_KEY, e); + }, + 'shown.bs.dropdown': function (e) { + that.$element.trigger('shown' + EVENT_KEY, e); + } + }); + + if (that.$element[0].hasAttribute('required')) { + this.$element.on('invalid' + EVENT_KEY, function () { + that.$button[0].classList.add('bs-invalid'); + + that.$element + .on('shown' + EVENT_KEY + '.invalid', function () { + that.$element + .val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened + .off('shown' + EVENT_KEY + '.invalid'); + }) + .on('rendered' + EVENT_KEY, function () { + // if select is no longer invalid, remove the bs-invalid class + if (this.validity.valid) that.$button[0].classList.remove('bs-invalid'); + that.$element.off('rendered' + EVENT_KEY); + }); + + that.$button.on('blur' + EVENT_KEY, function () { + that.$element.trigger('focus').trigger('blur'); + that.$button.off('blur' + EVENT_KEY); + }); + }); + } + + setTimeout(function () { + that.createLi(); + that.$element.trigger('loaded' + EVENT_KEY); + }); + }, + + createDropdown: function () { + // Options + // If we are multiple or showTick option is set, then add the show-tick class + var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '', + multiselectable = this.multiple ? ' aria-multiselectable="true"' : '', + inputGroup = '', + autofocus = this.autofocus ? ' autofocus' : ''; + + if (version.major < 4 && this.$element.parent().hasClass('input-group')) { + inputGroup = ' input-group-btn'; + } + + // Elements + var drop, + header = '', + searchbox = '', + actionsbox = '', + donebutton = ''; + + if (this.options.header) { + header = + '
    ' + + '' + + this.options.header + + '
    '; + } + + if (this.options.liveSearch) { + searchbox = + ''; + } + + if (this.multiple && this.options.actionsBox) { + actionsbox = + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    '; + } + + if (this.multiple && this.options.doneButton) { + donebutton = + '
    ' + + '
    ' + + '' + + '
    ' + + '
    '; + } + + drop = + ''; + + return $(drop); + }, + + setPositionData: function () { + this.selectpicker.view.canHighlight = []; + this.selectpicker.view.size = 0; + + for (var i = 0; i < this.selectpicker.current.data.length; i++) { + var li = this.selectpicker.current.data[i], + canHighlight = true; + + if (li.type === 'divider') { + canHighlight = false; + li.height = this.sizeInfo.dividerHeight; + } else if (li.type === 'optgroup-label') { + canHighlight = false; + li.height = this.sizeInfo.dropdownHeaderHeight; + } else { + li.height = this.sizeInfo.liHeight; + } + + if (li.disabled) canHighlight = false; + + this.selectpicker.view.canHighlight.push(canHighlight); + + if (canHighlight) { + this.selectpicker.view.size++; + li.posinset = this.selectpicker.view.size; + } + + li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height; + } + }, + + isVirtual: function () { + return (this.options.virtualScroll !== false) && (this.selectpicker.main.elements.length >= this.options.virtualScroll) || this.options.virtualScroll === true; + }, + + createView: function (isSearching, setSize, refresh) { + var that = this, + scrollTop = 0, + active = [], + selected, + prevActive; + + this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main; + + this.setPositionData(); + + if (setSize) { + if (refresh) { + scrollTop = this.$menuInner[0].scrollTop; + } else if (!that.multiple) { + var element = that.$element[0], + selectedIndex = (element.options[element.selectedIndex] || {}).liIndex; + + if (typeof selectedIndex === 'number' && that.options.size !== false) { + var selectedData = that.selectpicker.main.data[selectedIndex], + position = selectedData && selectedData.position; + + if (position) { + scrollTop = position - ((that.sizeInfo.menuInnerHeight + that.sizeInfo.liHeight) / 2); + } + } + } + } + + scroll(scrollTop, true); + + this.$menuInner.off('scroll.createView').on('scroll.createView', function (e, updateValue) { + if (!that.noScroll) scroll(this.scrollTop, updateValue); + that.noScroll = false; + }); + + function scroll (scrollTop, init) { + var size = that.selectpicker.current.elements.length, + chunks = [], + chunkSize, + chunkCount, + firstChunk, + lastChunk, + currentChunk, + prevPositions, + positionIsDifferent, + previousElements, + menuIsDifferent = true, + isVirtual = that.isVirtual(); + + that.selectpicker.view.scrollTop = scrollTop; + + if (isVirtual === true) { + // if an option that is encountered that is wider than the current menu width, update the menu width accordingly + if (that.sizeInfo.hasScrollBar && that.$menu[0].offsetWidth > that.sizeInfo.totalMenuWidth) { + that.sizeInfo.menuWidth = that.$menu[0].offsetWidth; + that.sizeInfo.totalMenuWidth = that.sizeInfo.menuWidth + that.sizeInfo.scrollBarWidth; + that.$menu.css('min-width', that.sizeInfo.menuWidth); + } + } + + chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk + chunkCount = Math.round(size / chunkSize) || 1; // number of chunks + + for (var i = 0; i < chunkCount; i++) { + var endOfChunk = (i + 1) * chunkSize; + + if (i === chunkCount - 1) { + endOfChunk = size; + } + + chunks[i] = [ + (i) * chunkSize + (!i ? 0 : 1), + endOfChunk + ]; + + if (!size) break; + + if (currentChunk === undefined && scrollTop <= that.selectpicker.current.data[endOfChunk - 1].position - that.sizeInfo.menuInnerHeight) { + currentChunk = i; + } + } + + if (currentChunk === undefined) currentChunk = 0; + + prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1]; + + // always display previous, current, and next chunks + firstChunk = Math.max(0, currentChunk - 1); + lastChunk = Math.min(chunkCount - 1, currentChunk + 1); + + that.selectpicker.view.position0 = isVirtual === false ? 0 : (Math.max(0, chunks[firstChunk][0]) || 0); + that.selectpicker.view.position1 = isVirtual === false ? size : (Math.min(size, chunks[lastChunk][1]) || 0); + + positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1; + + if (that.activeIndex !== undefined) { + prevActive = that.selectpicker.main.elements[that.prevActiveIndex]; + active = that.selectpicker.main.elements[that.activeIndex]; + selected = that.selectpicker.main.elements[that.selectedIndex]; + + if (init) { + if (that.activeIndex !== that.selectedIndex) { + that.defocusItem(active); + } + that.activeIndex = undefined; + } + + if (that.activeIndex && that.activeIndex !== that.selectedIndex) { + that.defocusItem(selected); + } + } + + if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex) { + that.defocusItem(prevActive); + } + + if (init || positionIsDifferent) { + previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : []; + + if (isVirtual === false) { + that.selectpicker.view.visibleElements = that.selectpicker.current.elements; + } else { + that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1); + } + + that.setOptionStatus(); + + // if searching, check to make sure the list has actually been updated before updating DOM + // this prevents unnecessary repaints + if (isSearching || (isVirtual === false && init)) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements); + + // if virtual scroll is disabled and not searching, + // menu should never need to be updated more than once + if ((init || isVirtual === true) && menuIsDifferent) { + var menuInner = that.$menuInner[0], + menuFragment = document.createDocumentFragment(), + emptyMenu = menuInner.firstChild.cloneNode(false), + marginTop, + marginBottom, + elements = that.selectpicker.view.visibleElements, + toSanitize = []; + + // replace the existing UL with an empty one - this is faster than $.empty() + menuInner.replaceChild(emptyMenu, menuInner.firstChild); + + for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) { + var element = elements[i], + elText, + elementData; + + if (that.options.sanitize) { + elText = element.lastChild; + + if (elText) { + elementData = that.selectpicker.current.data[i + that.selectpicker.view.position0]; + + if (elementData && elementData.content && !elementData.sanitized) { + toSanitize.push(elText); + elementData.sanitized = true; + } + } + } + + menuFragment.appendChild(element); + } + + if (that.options.sanitize && toSanitize.length) { + sanitizeHtml(toSanitize, that.options.whiteList, that.options.sanitizeFn); + } + + if (isVirtual === true) { + marginTop = (that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position); + marginBottom = (that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position); + + menuInner.firstChild.style.marginTop = marginTop + 'px'; + menuInner.firstChild.style.marginBottom = marginBottom + 'px'; + } else { + menuInner.firstChild.style.marginTop = 0; + menuInner.firstChild.style.marginBottom = 0; + } + + menuInner.firstChild.appendChild(menuFragment); + } + } + + that.prevActiveIndex = that.activeIndex; + + if (!that.options.liveSearch) { + that.$menuInner.trigger('focus'); + } else if (isSearching && init) { + var index = 0, + newActive; + + if (!that.selectpicker.view.canHighlight[index]) { + index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true); + } + + newActive = that.selectpicker.view.visibleElements[index]; + + that.defocusItem(that.selectpicker.view.currentActive); + + that.activeIndex = (that.selectpicker.current.data[index] || {}).index; + + that.focusItem(newActive); + } + } + + $(window) + .off('resize' + EVENT_KEY + '.' + this.selectId + '.createView') + .on('resize' + EVENT_KEY + '.' + this.selectId + '.createView', function () { + var isActive = that.$newElement.hasClass(classNames.SHOW); + + if (isActive) scroll(that.$menuInner[0].scrollTop); + }); + }, + + focusItem: function (li, liData, noStyle) { + if (li) { + liData = liData || this.selectpicker.main.data[this.activeIndex]; + var a = li.firstChild; + + if (a) { + a.setAttribute('aria-setsize', this.selectpicker.view.size); + a.setAttribute('aria-posinset', liData.posinset); + + if (noStyle !== true) { + this.focusedParent.setAttribute('aria-activedescendant', a.id); + li.classList.add('active'); + a.classList.add('active'); + } + } + } + }, + + defocusItem: function (li) { + if (li) { + li.classList.remove('active'); + if (li.firstChild) li.firstChild.classList.remove('active'); + } + }, + + setPlaceholder: function () { + var updateIndex = false; + + if (this.options.title && !this.multiple) { + if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option'); + + // this option doesn't create a new
  • element, but does add a new option at the start, + // so startIndex should increase to prevent having to check every option for the bs-title-option class + updateIndex = true; + + var element = this.$element[0], + isSelected = false, + titleNotAppended = !this.selectpicker.view.titleOption.parentNode; + + if (titleNotAppended) { + // Use native JS to prepend option (faster) + this.selectpicker.view.titleOption.className = 'bs-title-option'; + this.selectpicker.view.titleOption.value = ''; + + // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. + // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, + // if so, the select will have the data-selected attribute + var $opt = $(element.options[element.selectedIndex]); + isSelected = $opt.attr('selected') === undefined && this.$element.data('selected') === undefined; + } + + if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) { + element.insertBefore(this.selectpicker.view.titleOption, element.firstChild); + } + + // Set selected *after* appending to select, + // otherwise the option doesn't get selected in IE + // set using selectedIndex, as setting the selected attr to true here doesn't work in IE11 + if (isSelected) element.selectedIndex = 0; + } + + return updateIndex; + }, + + createLi: function () { + var that = this, + iconBase = this.options.iconBase, + optionSelector = ':not([hidden]):not([data-hidden="true"])', + mainElements = [], + mainData = [], + widestOptionLength = 0, + optID = 0, + startIndex = this.setPlaceholder() ? 1 : 0; // append the titleOption if necessary and skip the first option in the loop + + if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; + + if ((that.options.showTick || that.multiple) && !elementTemplates.checkMark.parentNode) { + elementTemplates.checkMark.className = iconBase + ' ' + that.options.tickIcon + ' check-mark'; + elementTemplates.a.appendChild(elementTemplates.checkMark); + } + + var selectOptions = this.$element[0].querySelectorAll('select > *' + optionSelector); + + function addDivider (config) { + var previousData = mainData[mainData.length - 1]; + + // ensure optgroup doesn't create back-to-back dividers + if ( + previousData && + previousData.type === 'divider' && + (previousData.optID || config.optID) + ) { + return; + } + + config = config || {}; + config.type = 'divider'; + + mainElements.push( + generateOption.li( + false, + classNames.DIVIDER, + (config.optID ? config.optID + 'div' : undefined) + ) + ); + + mainData.push(config); + } + + function addOption (option, config) { + config = config || {}; + + config.divider = option.getAttribute('data-divider') === 'true'; + + if (config.divider) { + addDivider({ + optID: config.optID + }); + } else { + var liIndex = mainData.length, + cssText = option.style.cssText, + inlineStyle = cssText ? htmlEscape(cssText) : '', + optionClass = (option.className || '') + (config.optgroupClass || ''); + + if (config.optID) optionClass = 'opt ' + optionClass; + + config.text = option.textContent; + + config.content = option.getAttribute('data-content'); + config.tokens = option.getAttribute('data-tokens'); + config.subtext = option.getAttribute('data-subtext'); + config.icon = option.getAttribute('data-icon'); + config.iconBase = iconBase; + + var textElement = generateOption.text(config); + var liElement = generateOption.li( + generateOption.a( + textElement, + optionClass, + inlineStyle + ), + '', + config.optID + ); + + if (liElement.firstChild) { + liElement.firstChild.id = that.selectId + '-' + liIndex; + } + + mainElements.push(liElement); + + option.liIndex = liIndex; + + config.display = config.content || config.text; + config.type = 'option'; + config.index = liIndex; + config.option = option; + config.disabled = config.disabled || option.disabled; + + mainData.push(config); + + var combinedLength = 0; + + // count the number of characters in the option - not perfect, but should work in most cases + if (config.display) combinedLength += config.display.length; + if (config.subtext) combinedLength += config.subtext.length; + // if there is an icon, ensure this option's width is checked + if (config.icon) combinedLength += 1; + + if (combinedLength > widestOptionLength) { + widestOptionLength = combinedLength; + + // guess which option is the widest + // use this when calculating menu width + // not perfect, but it's fast, and the width will be updating accordingly when scrolling + that.selectpicker.view.widestOption = mainElements[mainElements.length - 1]; + } + } + } + + function addOptgroup (index, selectOptions) { + var optgroup = selectOptions[index], + previous = selectOptions[index - 1], + next = selectOptions[index + 1], + options = optgroup.querySelectorAll('option' + optionSelector); + + if (!options.length) return; + + var config = { + label: htmlEscape(optgroup.label), + subtext: optgroup.getAttribute('data-subtext'), + icon: optgroup.getAttribute('data-icon'), + iconBase: iconBase + }, + optgroupClass = ' ' + (optgroup.className || ''), + headerIndex, + lastIndex; + + optID++; + + if (previous) { + addDivider({ optID: optID }); + } + + var labelElement = generateOption.label(config); + + mainElements.push( + generateOption.li(labelElement, 'dropdown-header' + optgroupClass, optID) + ); + + mainData.push({ + display: config.label, + subtext: config.subtext, + type: 'optgroup-label', + optID: optID + }); + + for (var j = 0, len = options.length; j < len; j++) { + var option = options[j]; + + if (j === 0) { + headerIndex = mainData.length - 1; + lastIndex = headerIndex + len; + } + + addOption(option, { + headerIndex: headerIndex, + lastIndex: lastIndex, + optID: optID, + optgroupClass: optgroupClass, + disabled: optgroup.disabled + }); + } + + if (next) { + addDivider({ optID: optID }); + } + } + + for (var len = selectOptions.length; startIndex < len; startIndex++) { + var item = selectOptions[startIndex]; + + if (item.tagName !== 'OPTGROUP') { + addOption(item, {}); + } else { + addOptgroup(startIndex, selectOptions); + } + } + + this.selectpicker.main.elements = mainElements; + this.selectpicker.main.data = mainData; + + this.selectpicker.current = this.selectpicker.main; + }, + + findLis: function () { + return this.$menuInner.find('.inner > li'); + }, + + render: function () { + // ensure titleOption is appended and selected (if necessary) before getting selectedOptions + this.setPlaceholder(); + + var that = this, + element = this.$element[0], + selectedOptions = getSelectedOptions(element, this.options.hideDisabled), + selectedCount = selectedOptions.length, + button = this.$button[0], + buttonInner = button.querySelector('.filter-option-inner-inner'), + multipleSeparator = document.createTextNode(this.options.multipleSeparator), + titleFragment = elementTemplates.fragment.cloneNode(false), + showCount, + countMax, + hasContent = false; + + button.classList.toggle('bs-placeholder', that.multiple ? !selectedCount : !getSelectValues(element, selectedOptions)); + + this.tabIndex(); + + if (this.options.selectedTextFormat === 'static') { + titleFragment = generateOption.text({ text: this.options.title }, true); + } else { + showCount = this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1 && selectedCount > 1; + + // determine if the number of selected options will be shown (showCount === true) + if (showCount) { + countMax = this.options.selectedTextFormat.split('>'); + showCount = (countMax.length > 1 && selectedCount > countMax[1]) || (countMax.length === 1 && selectedCount >= 2); + } + + // only loop through all selected options if the count won't be shown + if (showCount === false) { + for (var selectedIndex = 0; selectedIndex < selectedCount; selectedIndex++) { + if (selectedIndex < 50) { + var option = selectedOptions[selectedIndex], + titleOptions = {}, + thisData = { + content: option.getAttribute('data-content'), + subtext: option.getAttribute('data-subtext'), + icon: option.getAttribute('data-icon') + }; + + if (this.multiple && selectedIndex > 0) { + titleFragment.appendChild(multipleSeparator.cloneNode(false)); + } + + if (option.title) { + titleOptions.text = option.title; + } else if (thisData.content && that.options.showContent) { + titleOptions.content = thisData.content.toString(); + hasContent = true; + } else { + if (that.options.showIcon) { + titleOptions.icon = thisData.icon; + titleOptions.iconBase = this.options.iconBase; + } + if (that.options.showSubtext && !that.multiple && thisData.subtext) titleOptions.subtext = ' ' + thisData.subtext; + titleOptions.text = option.textContent.trim(); + } + + titleFragment.appendChild(generateOption.text(titleOptions, true)); + } else { + break; + } + } + + // add ellipsis + if (selectedCount > 49) { + titleFragment.appendChild(document.createTextNode('...')); + } + } else { + var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])'; + if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; + + // If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc. + var totalCount = this.$element[0].querySelectorAll('select > option' + optionSelector + ', optgroup' + optionSelector + ' option' + optionSelector).length, + tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedCount, totalCount) : this.options.countSelectedText; + + titleFragment = generateOption.text({ + text: tr8nText.replace('{0}', selectedCount.toString()).replace('{1}', totalCount.toString()) + }, true); + } + } + + if (this.options.title == undefined) { + // use .attr to ensure undefined is returned if title attribute is not set + this.options.title = this.$element.attr('title'); + } + + // If the select doesn't have a title, then use the default, or if nothing is set at all, use noneSelectedText + if (!titleFragment.childNodes.length) { + titleFragment = generateOption.text({ + text: typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText + }, true); + } + + // strip all HTML tags and trim the result, then unescape any escaped tags + button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim(); + + if (this.options.sanitize && hasContent) { + sanitizeHtml([titleFragment], that.options.whiteList, that.options.sanitizeFn); + } + + buttonInner.innerHTML = ''; + buttonInner.appendChild(titleFragment); + + if (version.major < 4 && this.$newElement[0].classList.contains('bs3-has-addon')) { + var filterExpand = button.querySelector('.filter-expand'), + clone = buttonInner.cloneNode(true); + + clone.className = 'filter-expand'; + + if (filterExpand) { + button.replaceChild(clone, filterExpand); + } else { + button.appendChild(clone); + } + } + + this.$element.trigger('rendered' + EVENT_KEY); + }, + + /** + * @param [style] + * @param [status] + */ + setStyle: function (newStyle, status) { + var button = this.$button[0], + newElement = this.$newElement[0], + style = this.options.style.trim(), + buttonClass; + + if (this.$element.attr('class')) { + this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); + } + + if (version.major < 4) { + newElement.classList.add('bs3'); + + if (newElement.parentNode.classList.contains('input-group') && + (newElement.previousElementSibling || newElement.nextElementSibling) && + (newElement.previousElementSibling || newElement.nextElementSibling).classList.contains('input-group-addon') + ) { + newElement.classList.add('bs3-has-addon'); + } + } + + if (newStyle) { + buttonClass = newStyle.trim(); + } else { + buttonClass = style; + } + + if (status == 'add') { + if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); + } else if (status == 'remove') { + if (buttonClass) button.classList.remove.apply(button.classList, buttonClass.split(' ')); + } else { + if (style) button.classList.remove.apply(button.classList, style.split(' ')); + if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); + } + }, + + liHeight: function (refresh) { + if (!refresh && (this.options.size === false || this.sizeInfo)) return; + + if (!this.sizeInfo) this.sizeInfo = {}; + + var newElement = document.createElement('div'), + menu = document.createElement('div'), + menuInner = document.createElement('div'), + menuInnerInner = document.createElement('ul'), + divider = document.createElement('li'), + dropdownHeader = document.createElement('li'), + li = document.createElement('li'), + a = document.createElement('a'), + text = document.createElement('span'), + header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null, + search = this.options.liveSearch ? document.createElement('div') : null, + actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, + doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null, + firstOption = this.$element.find('option')[0]; + + this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth; + + text.className = 'text'; + a.className = 'dropdown-item ' + (firstOption ? firstOption.className : ''); + newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW; + newElement.style.width = this.sizeInfo.selectWidth + 'px'; + if (this.options.width === 'auto') menu.style.minWidth = 0; + menu.className = classNames.MENU + ' ' + classNames.SHOW; + menuInner.className = 'inner ' + classNames.SHOW; + menuInnerInner.className = classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : ''); + divider.className = classNames.DIVIDER; + dropdownHeader.className = 'dropdown-header'; + + text.appendChild(document.createTextNode('\u200b')); + a.appendChild(text); + li.appendChild(a); + dropdownHeader.appendChild(text.cloneNode(true)); + + if (this.selectpicker.view.widestOption) { + menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true)); + } + + menuInnerInner.appendChild(li); + menuInnerInner.appendChild(divider); + menuInnerInner.appendChild(dropdownHeader); + if (header) menu.appendChild(header); + if (search) { + var input = document.createElement('input'); + search.className = 'bs-searchbox'; + input.className = 'form-control'; + search.appendChild(input); + menu.appendChild(search); + } + if (actions) menu.appendChild(actions); + menuInner.appendChild(menuInnerInner); + menu.appendChild(menuInner); + if (doneButton) menu.appendChild(doneButton); + newElement.appendChild(menu); + + document.body.appendChild(newElement); + + var liHeight = li.offsetHeight, + dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0, + headerHeight = header ? header.offsetHeight : 0, + searchHeight = search ? search.offsetHeight : 0, + actionsHeight = actions ? actions.offsetHeight : 0, + doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, + dividerHeight = $(divider).outerHeight(true), + // fall back to jQuery if getComputedStyle is not supported + menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false, + menuWidth = menu.offsetWidth, + $menu = menuStyle ? null : $(menu), + menuPadding = { + vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + + toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + + toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + + toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), + horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + + toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + + toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + + toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) + }, + menuExtras = { + vert: menuPadding.vert + + toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + + toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, + horiz: menuPadding.horiz + + toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + + toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 + }, + scrollBarWidth; + + menuInner.style.overflowY = 'scroll'; + + scrollBarWidth = menu.offsetWidth - menuWidth; + + document.body.removeChild(newElement); + + this.sizeInfo.liHeight = liHeight; + this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight; + this.sizeInfo.headerHeight = headerHeight; + this.sizeInfo.searchHeight = searchHeight; + this.sizeInfo.actionsHeight = actionsHeight; + this.sizeInfo.doneButtonHeight = doneButtonHeight; + this.sizeInfo.dividerHeight = dividerHeight; + this.sizeInfo.menuPadding = menuPadding; + this.sizeInfo.menuExtras = menuExtras; + this.sizeInfo.menuWidth = menuWidth; + this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth; + this.sizeInfo.scrollBarWidth = scrollBarWidth; + this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight; + + this.setPositionData(); + }, + + getSelectPosition: function () { + var that = this, + $window = $(window), + pos = that.$newElement.offset(), + $container = $(that.options.container), + containerPos; + + if (that.options.container && $container.length && !$container.is('body')) { + containerPos = $container.offset(); + containerPos.top += parseInt($container.css('borderTopWidth')); + containerPos.left += parseInt($container.css('borderLeftWidth')); + } else { + containerPos = { top: 0, left: 0 }; + } + + var winPad = that.options.windowPadding; + + this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); + this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo.selectHeight - containerPos.top - winPad[2]; + this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); + this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo.selectWidth - containerPos.left - winPad[1]; + this.sizeInfo.selectOffsetTop -= winPad[0]; + this.sizeInfo.selectOffsetLeft -= winPad[3]; + }, + + setMenuSize: function (isAuto) { + this.getSelectPosition(); + + var selectWidth = this.sizeInfo.selectWidth, + liHeight = this.sizeInfo.liHeight, + headerHeight = this.sizeInfo.headerHeight, + searchHeight = this.sizeInfo.searchHeight, + actionsHeight = this.sizeInfo.actionsHeight, + doneButtonHeight = this.sizeInfo.doneButtonHeight, + divHeight = this.sizeInfo.dividerHeight, + menuPadding = this.sizeInfo.menuPadding, + menuInnerHeight, + menuHeight, + divLength = 0, + minHeight, + _minHeight, + maxHeight, + menuInnerMinHeight, + estimate; + + if (this.options.dropupAuto) { + // Get the estimated height of the menu without scrollbars. + // This is useful for smaller menus, where there might be plenty of room + // below the button without setting dropup, but we can't know + // the exact height of the menu until createView is called later + estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert; + this.$newElement.toggleClass(classNames.DROPUP, this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot); + } + + if (this.options.size === 'auto') { + _minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0; + menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert; + minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; + menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0); + + if (this.$newElement.hasClass(classNames.DROPUP)) { + menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert; + } + + maxHeight = menuHeight; + menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert; + } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { + for (var i = 0; i < this.options.size; i++) { + if (this.selectpicker.current.data[i].type === 'divider') divLength++; + } + + menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; + menuInnerHeight = menuHeight - menuPadding.vert; + maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; + minHeight = menuInnerMinHeight = ''; + } + + if (this.options.dropdownAlignRight === 'auto') { + this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < (this.sizeInfo.totalMenuWidth - selectWidth)); + } + + this.$menu.css({ + 'max-height': maxHeight + 'px', + 'overflow': 'hidden', + 'min-height': minHeight + 'px' + }); + + this.$menuInner.css({ + 'max-height': menuInnerHeight + 'px', + 'overflow-y': 'auto', + 'min-height': menuInnerMinHeight + 'px' + }); + + // ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView + this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1); + + if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) { + this.sizeInfo.hasScrollBar = true; + this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth; + + this.$menu.css('min-width', this.sizeInfo.totalMenuWidth); + } + + if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update(); + }, + + setSize: function (refresh) { + this.liHeight(refresh); + + if (this.options.header) this.$menu.css('padding-top', 0); + if (this.options.size === false) return; + + var that = this, + $window = $(window); + + this.setMenuSize(); + + if (this.options.liveSearch) { + this.$searchbox + .off('input.setMenuSize propertychange.setMenuSize') + .on('input.setMenuSize propertychange.setMenuSize', function () { + return that.setMenuSize(); + }); + } + + if (this.options.size === 'auto') { + $window + .off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize') + .on('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize', function () { + return that.setMenuSize(); + }); + } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { + $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize'); + } + + that.createView(false, true, refresh); + }, + + setWidth: function () { + var that = this; + + if (this.options.width === 'auto') { + requestAnimationFrame(function () { + that.$menu.css('min-width', '0'); + + that.$element.on('loaded' + EVENT_KEY, function () { + that.liHeight(); + that.setMenuSize(); + + // Get correct width if element is hidden + var $selectClone = that.$newElement.clone().appendTo('body'), + btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth(); + + $selectClone.remove(); + + // Set width to whatever's larger, button title or longest option + that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth); + that.$newElement.css('width', that.sizeInfo.selectWidth + 'px'); + }); + }); + } else if (this.options.width === 'fit') { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', '').addClass('fit-width'); + } else if (this.options.width) { + // Remove inline min-width so width can be changed from 'auto' + this.$menu.css('min-width', ''); + this.$newElement.css('width', this.options.width); + } else { + // Remove inline min-width/width so width can be changed + this.$menu.css('min-width', ''); + this.$newElement.css('width', ''); + } + // Remove fit-width class if width is changed programmatically + if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { + this.$newElement[0].classList.remove('fit-width'); + } + }, + + selectPosition: function () { + this.$bsContainer = $('
    '); + + var that = this, + $container = $(this.options.container), + pos, + containerPos, + actualHeight, + getPlacement = function ($element) { + var containerPosition = {}, + // fall back to dropdown's default display setting if display is not manually set + display = that.options.display || ( + // Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default + $.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display + : false + ); + + that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP)); + pos = $element.offset(); + + if (!$container.is('body')) { + containerPos = $container.offset(); + containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop(); + containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft(); + } else { + containerPos = { top: 0, left: 0 }; + } + + actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight; + + // Bootstrap 4+ uses Popper for menu positioning + if (version.major < 4 || display === 'static') { + containerPosition.top = pos.top - containerPos.top + actualHeight; + containerPosition.left = pos.left - containerPos.left; + } + + containerPosition.width = $element[0].offsetWidth; + + that.$bsContainer.css(containerPosition); + }; + + this.$button.on('click.bs.dropdown.data-api', function () { + if (that.isDisabled()) { + return; + } + + getPlacement(that.$newElement); + + that.$bsContainer + .appendTo(that.options.container) + .toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW)) + .append(that.$menu); + }); + + $(window) + .off('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId) + .on('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId, function () { + var isActive = that.$newElement.hasClass(classNames.SHOW); + + if (isActive) getPlacement(that.$newElement); + }); + + this.$element.on('hide' + EVENT_KEY, function () { + that.$menu.data('height', that.$menu.height()); + that.$bsContainer.detach(); + }); + }, + + setOptionStatus: function (selectedOnly) { + var that = this; + + that.noScroll = false; + + if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) { + for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) { + var liData = that.selectpicker.current.data[i + that.selectpicker.view.position0], + option = liData.option; + + if (option) { + if (selectedOnly !== true) { + that.setDisabled( + liData.index, + liData.disabled + ); + } + + that.setSelected( + liData.index, + option.selected + ); + } + } + } + }, + + /** + * @param {number} index - the index of the option that is being changed + * @param {boolean} selected - true if the option is being selected, false if being deselected + */ + setSelected: function (index, selected) { + var li = this.selectpicker.main.elements[index], + liData = this.selectpicker.main.data[index], + activeIndexIsSet = this.activeIndex !== undefined, + thisIsActive = this.activeIndex === index, + prevActive, + a, + // if current option is already active + // OR + // if the current option is being selected, it's NOT multiple, and + // activeIndex is undefined: + // - when the menu is first being opened, OR + // - after a search has been performed, OR + // - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex) + keepActive = thisIsActive || (selected && !this.multiple && !activeIndexIsSet); + + liData.selected = selected; + + a = li.firstChild; + + if (selected) { + this.selectedIndex = index; + } + + li.classList.toggle('selected', selected); + + if (keepActive) { + this.focusItem(li, liData); + this.selectpicker.view.currentActive = li; + this.activeIndex = index; + } else { + this.defocusItem(li); + } + + if (a) { + a.classList.toggle('selected', selected); + + if (selected) { + a.setAttribute('aria-selected', true); + } else { + if (this.multiple) { + a.setAttribute('aria-selected', false); + } else { + a.removeAttribute('aria-selected'); + } + } + } + + if (!keepActive && !activeIndexIsSet && selected && this.prevActiveIndex !== undefined) { + prevActive = this.selectpicker.main.elements[this.prevActiveIndex]; + + this.defocusItem(prevActive); + } + }, + + /** + * @param {number} index - the index of the option that is being disabled + * @param {boolean} disabled - true if the option is being disabled, false if being enabled + */ + setDisabled: function (index, disabled) { + var li = this.selectpicker.main.elements[index], + a; + + this.selectpicker.main.data[index].disabled = disabled; + + a = li.firstChild; + + li.classList.toggle(classNames.DISABLED, disabled); + + if (a) { + if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled); + + if (disabled) { + a.setAttribute('aria-disabled', disabled); + a.setAttribute('tabindex', -1); + } else { + a.removeAttribute('aria-disabled'); + a.setAttribute('tabindex', 0); + } + } + }, + + isDisabled: function () { + return this.$element[0].disabled; + }, + + checkDisabled: function () { + var that = this; + + if (this.isDisabled()) { + this.$newElement[0].classList.add(classNames.DISABLED); + this.$button.addClass(classNames.DISABLED).attr('tabindex', -1).attr('aria-disabled', true); + } else { + if (this.$button[0].classList.contains(classNames.DISABLED)) { + this.$newElement[0].classList.remove(classNames.DISABLED); + this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false); + } + + if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { + this.$button.removeAttr('tabindex'); + } + } + + this.$button.on('click', function () { + return !that.isDisabled(); + }); + }, + + tabIndex: function () { + if (this.$element.data('tabindex') !== this.$element.attr('tabindex') && + (this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) { + this.$element.data('tabindex', this.$element.attr('tabindex')); + this.$button.attr('tabindex', this.$element.data('tabindex')); + } + + this.$element.attr('tabindex', -98); + }, + + clickListener: function () { + var that = this, + $document = $(document); + + $document.data('spaceSelect', false); + + this.$button.on('keyup', function (e) { + if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { + e.preventDefault(); + $document.data('spaceSelect', false); + } + }); + + this.$newElement.on('show.bs.dropdown', function () { + if (version.major > 3 && !that.dropdown) { + that.dropdown = that.$button.data('bs.dropdown'); + that.dropdown._menu = that.$menu[0]; + } + }); + + this.$button.on('click.bs.dropdown.data-api', function () { + if (!that.$newElement.hasClass(classNames.SHOW)) { + that.setSize(); + } + }); + + function setFocus () { + if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + } else { + that.$menuInner.trigger('focus'); + } + } + + function checkPopperExists () { + if (that.dropdown && that.dropdown._popper && that.dropdown._popper.state.isCreated) { + setFocus(); + } else { + requestAnimationFrame(checkPopperExists); + } + } + + this.$element.on('shown' + EVENT_KEY, function () { + if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) { + that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop; + } + + if (version.major > 3) { + requestAnimationFrame(checkPopperExists); + } else { + setFocus(); + } + }); + + // ensure posinset and setsize are correct before selecting an option via a click + this.$menuInner.on('mouseenter', 'li a', function (e) { + var hoverLi = this.parentElement, + position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, + index = Array.prototype.indexOf.call(hoverLi.parentElement.children, hoverLi), + hoverData = that.selectpicker.current.data[index + position0]; + + that.focusItem(hoverLi, hoverData, true); + }); + + this.$menuInner.on('click', 'li a', function (e, retainActive) { + var $this = $(this), + element = that.$element[0], + position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, + clickedData = that.selectpicker.current.data[$this.parent().index() + position0], + clickedIndex = clickedData.index, + prevValue = getSelectValues(element), + prevIndex = element.selectedIndex, + prevOption = element.options[prevIndex], + triggerChange = true; + + // Don't close on multi choice menu + if (that.multiple && that.options.maxOptions !== 1) { + e.stopPropagation(); + } + + e.preventDefault(); + + // Don't run if the select is disabled + if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) { + var $options = that.$element.find('option'), + option = clickedData.option, + $option = $(option), + state = option.selected, + $optgroup = $option.parent('optgroup'), + $optgroupOptions = $optgroup.find('option'), + maxOptions = that.options.maxOptions, + maxOptionsGrp = $optgroup.data('maxOptions') || false; + + if (clickedIndex === that.activeIndex) retainActive = true; + + if (!retainActive) { + that.prevActiveIndex = that.activeIndex; + that.activeIndex = undefined; + } + + if (!that.multiple) { // Deselect all others if not multi select box + prevOption.selected = false; + option.selected = true; + that.setSelected(clickedIndex, true); + } else { // Toggle the one we have chosen if we are multi select. + option.selected = !state; + + that.setSelected(clickedIndex, !state); + $this.trigger('blur'); + + if (maxOptions !== false || maxOptionsGrp !== false) { + var maxReached = maxOptions < $options.filter(':selected').length, + maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; + + if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { + if (maxOptions && maxOptions == 1) { + $options.prop('selected', false); + $option.prop('selected', true); + + for (var i = 0; i < $options.length; i++) { + that.setSelected(i, false); + } + + that.setSelected(clickedIndex, true); + } else if (maxOptionsGrp && maxOptionsGrp == 1) { + $optgroup.find('option:selected').prop('selected', false); + $option.prop('selected', true); + + for (var i = 0; i < $optgroupOptions.length; i++) { + var option = $optgroupOptions[i]; + that.setSelected($options.index(option), false); + } + + that.setSelected(clickedIndex, true); + } else { + var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, + maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, + maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), + maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), + $notify = $('
    '); + // If {var} is set in array, replace it + /** @deprecated */ + if (maxOptionsArr[2]) { + maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); + maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); + } + + $option.prop('selected', false); + + that.$menu.append($notify); + + if (maxOptions && maxReached) { + $notify.append($('
    ' + maxTxt + '
    ')); + triggerChange = false; + that.$element.trigger('maxReached' + EVENT_KEY); + } + + if (maxOptionsGrp && maxReachedGrp) { + $notify.append($('
    ' + maxTxtGrp + '
    ')); + triggerChange = false; + that.$element.trigger('maxReachedGrp' + EVENT_KEY); + } + + setTimeout(function () { + that.setSelected(clickedIndex, false); + }, 10); + + $notify.delay(750).fadeOut(300, function () { + $(this).remove(); + }); + } + } + } + } + + if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { + that.$button.trigger('focus'); + } else if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + } + + // Trigger select 'change' + if (triggerChange) { + if (that.multiple || prevIndex !== element.selectedIndex) { + // $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed. + changedArguments = [option.index, $option.prop('selected'), prevValue]; + that.$element + .triggerNative('change'); + } + } + } + }); + + this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function (e) { + if (e.currentTarget == this) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch && !$(e.target).hasClass('close')) { + that.$searchbox.trigger('focus'); + } else { + that.$button.trigger('focus'); + } + } + }); + + this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { + e.preventDefault(); + e.stopPropagation(); + if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + } else { + that.$button.trigger('focus'); + } + }); + + this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function () { + that.$button.trigger('click'); + }); + + this.$searchbox.on('click', function (e) { + e.stopPropagation(); + }); + + this.$menu.on('click', '.actions-btn', function (e) { + if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + } else { + that.$button.trigger('focus'); + } + + e.preventDefault(); + e.stopPropagation(); + + if ($(this).hasClass('bs-select-all')) { + that.selectAll(); + } else { + that.deselectAll(); + } + }); + + this.$element + .on('change' + EVENT_KEY, function () { + that.render(); + that.$element.trigger('changed' + EVENT_KEY, changedArguments); + changedArguments = null; + }) + .on('focus' + EVENT_KEY, function () { + if (!that.options.mobile) that.$button.trigger('focus'); + }); + }, + + liveSearchListener: function () { + var that = this, + noResults = document.createElement('li'); + + this.$button.on('click.bs.dropdown.data-api', function () { + if (!!that.$searchbox.val()) { + that.$searchbox.val(''); + } + }); + + this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function (e) { + e.stopPropagation(); + }); + + this.$searchbox.on('input propertychange', function () { + var searchValue = that.$searchbox.val(); + + that.selectpicker.search.elements = []; + that.selectpicker.search.data = []; + + if (searchValue) { + var i, + searchMatch = [], + q = searchValue.toUpperCase(), + cache = {}, + cacheArr = [], + searchStyle = that._searchStyle(), + normalizeSearch = that.options.liveSearchNormalize; + + if (normalizeSearch) q = normalizeToBase(q); + + that._$lisSelected = that.$menuInner.find('.selected'); + + for (var i = 0; i < that.selectpicker.main.data.length; i++) { + var li = that.selectpicker.main.data[i]; + + if (!cache[i]) { + cache[i] = stringSearch(li, q, searchStyle, normalizeSearch); + } + + if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) { + if (li.headerIndex > 0) { + cache[li.headerIndex - 1] = true; + cacheArr.push(li.headerIndex - 1); + } + + cache[li.headerIndex] = true; + cacheArr.push(li.headerIndex); + + cache[li.lastIndex + 1] = true; + } + + if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i); + } + + for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) { + var index = cacheArr[i], + prevIndex = cacheArr[i - 1], + li = that.selectpicker.main.data[index], + liPrev = that.selectpicker.main.data[prevIndex]; + + if (li.type !== 'divider' || (li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i)) { + that.selectpicker.search.data.push(li); + searchMatch.push(that.selectpicker.main.elements[index]); + } + } + + that.activeIndex = undefined; + that.noScroll = true; + that.$menuInner.scrollTop(0); + that.selectpicker.search.elements = searchMatch; + that.createView(true); + + if (!searchMatch.length) { + noResults.className = 'no-results'; + noResults.innerHTML = that.options.noneResultsText.replace('{0}', '"' + htmlEscape(searchValue) + '"'); + that.$menuInner[0].firstChild.appendChild(noResults); + } + } else { + that.$menuInner.scrollTop(0); + that.createView(false); + } + }); + }, + + _searchStyle: function () { + return this.options.liveSearchStyle || 'contains'; + }, + + val: function (value) { + var element = this.$element[0]; + + if (typeof value !== 'undefined') { + var prevValue = getSelectValues(element); + + changedArguments = [null, null, prevValue]; + + this.$element + .val(value) + .trigger('changed' + EVENT_KEY, changedArguments); + + if (this.$newElement.hasClass(classNames.SHOW)) { + if (this.multiple) { + this.setOptionStatus(true); + } else { + var liSelectedIndex = (element.options[element.selectedIndex] || {}).liIndex; + + if (typeof liSelectedIndex === 'number') { + this.setSelected(this.selectedIndex, false); + this.setSelected(liSelectedIndex, true); + } + } + } + + this.render(); + + changedArguments = null; + + return this.$element; + } else { + return this.$element.val(); + } + }, + + changeAll: function (status) { + if (!this.multiple) return; + if (typeof status === 'undefined') status = true; + + var element = this.$element[0], + previousSelected = 0, + currentSelected = 0, + prevValue = getSelectValues(element); + + element.classList.add('bs-select-hidden'); + + for (var i = 0, len = this.selectpicker.current.elements.length; i < len; i++) { + var liData = this.selectpicker.current.data[i], + option = liData.option; + + if (option && !liData.disabled && liData.type !== 'divider') { + if (liData.selected) previousSelected++; + option.selected = status; + if (status) currentSelected++; + } + } + + element.classList.remove('bs-select-hidden'); + + if (previousSelected === currentSelected) return; + + this.setOptionStatus(); + + changedArguments = [null, null, prevValue]; + + this.$element + .triggerNative('change'); + }, + + selectAll: function () { + return this.changeAll(true); + }, + + deselectAll: function () { + return this.changeAll(false); + }, + + toggle: function (e) { + e = e || window.event; + + if (e) e.stopPropagation(); + + this.$button.trigger('click.bs.dropdown.data-api'); + }, + + keydown: function (e) { + var $this = $(this), + isToggle = $this.hasClass('dropdown-toggle'), + $parent = isToggle ? $this.closest('.dropdown') : $this.closest(Selector.MENU), + that = $parent.data('this'), + $items = that.findLis(), + index, + isActive, + liActive, + activeLi, + offset, + updateScroll = false, + downOnTab = e.which === keyCodes.TAB && !isToggle && !that.options.selectOnTab, + isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab, + scrollTop = that.$menuInner[0].scrollTop, + isVirtual = that.isVirtual(), + position0 = isVirtual === true ? that.selectpicker.view.position0 : 0; + + isActive = that.$newElement.hasClass(classNames.SHOW); + + if ( + !isActive && + ( + isArrowKey || + (e.which >= 48 && e.which <= 57) || + (e.which >= 96 && e.which <= 105) || + (e.which >= 65 && e.which <= 90) + ) + ) { + that.$button.trigger('click.bs.dropdown.data-api'); + + if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + return; + } + } + + if (e.which === keyCodes.ESCAPE && isActive) { + e.preventDefault(); + that.$button.trigger('click.bs.dropdown.data-api').trigger('focus'); + } + + if (isArrowKey) { // if up or down + if (!$items.length) return; + + liActive = that.selectpicker.main.elements[that.activeIndex]; + index = liActive ? Array.prototype.indexOf.call(liActive.parentElement.children, liActive) : -1; + + if (index !== -1) { + that.defocusItem(liActive); + } + + if (e.which === keyCodes.ARROW_UP) { // up + if (index !== -1) index--; + if (index + position0 < 0) index += $items.length; + + if (!that.selectpicker.view.canHighlight[index + position0]) { + index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0; + if (index === -1) index = $items.length - 1; + } + } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down + index++; + if (index + position0 >= that.selectpicker.view.canHighlight.length) index = 0; + + if (!that.selectpicker.view.canHighlight[index + position0]) { + index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true); + } + } + + e.preventDefault(); + + var liActiveIndex = position0 + index; + + if (e.which === keyCodes.ARROW_UP) { // up + // scroll to bottom and highlight last option + if (position0 === 0 && index === $items.length - 1) { + that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight; + + liActiveIndex = that.selectpicker.current.elements.length - 1; + } else { + activeLi = that.selectpicker.current.data[liActiveIndex]; + offset = activeLi.position - activeLi.height; + + updateScroll = offset < scrollTop; + } + } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down + // scroll to top and highlight first option + if (index === 0) { + that.$menuInner[0].scrollTop = 0; + + liActiveIndex = 0; + } else { + activeLi = that.selectpicker.current.data[liActiveIndex]; + offset = activeLi.position - that.sizeInfo.menuInnerHeight; + + updateScroll = offset > scrollTop; + } + } + + liActive = that.selectpicker.current.elements[liActiveIndex]; + + that.activeIndex = that.selectpicker.current.data[liActiveIndex].index; + + that.focusItem(liActive); + + that.selectpicker.view.currentActive = liActive; + + if (updateScroll) that.$menuInner[0].scrollTop = offset; + + if (that.options.liveSearch) { + that.$searchbox.trigger('focus'); + } else { + $this.trigger('focus'); + } + } else if ( + (!$this.is('input') && !REGEXP_TAB_OR_ESCAPE.test(e.which)) || + (e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory) + ) { + var searchMatch, + matches = [], + keyHistory; + + e.preventDefault(); + + that.selectpicker.keydown.keyHistory += keyCodeMap[e.which]; + + if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel); + that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start(); + + keyHistory = that.selectpicker.keydown.keyHistory; + + // if all letters are the same, set keyHistory to just the first character when searching + if (/^(.)\1+$/.test(keyHistory)) { + keyHistory = keyHistory.charAt(0); + } + + // find matches + for (var i = 0; i < that.selectpicker.current.data.length; i++) { + var li = that.selectpicker.current.data[i], + hasMatch; + + hasMatch = stringSearch(li, keyHistory, 'startsWith', true); + + if (hasMatch && that.selectpicker.view.canHighlight[i]) { + matches.push(li.index); + } + } + + if (matches.length) { + var matchIndex = 0; + + $items.removeClass('active').find('a').removeClass('active'); + + // either only one key has been pressed or they are all the same key + if (keyHistory.length === 1) { + matchIndex = matches.indexOf(that.activeIndex); + + if (matchIndex === -1 || matchIndex === matches.length - 1) { + matchIndex = 0; + } else { + matchIndex++; + } + } + + searchMatch = matches[matchIndex]; + + activeLi = that.selectpicker.main.data[searchMatch]; + + if (scrollTop - activeLi.position > 0) { + offset = activeLi.position - activeLi.height; + updateScroll = true; + } else { + offset = activeLi.position - that.sizeInfo.menuInnerHeight; + // if the option is already visible at the current scroll position, just keep it the same + updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight; + } + + liActive = that.selectpicker.main.elements[searchMatch]; + + that.activeIndex = matches[matchIndex]; + + that.focusItem(liActive); + + if (liActive) liActive.firstChild.focus(); + + if (updateScroll) that.$menuInner[0].scrollTop = offset; + + $this.trigger('focus'); + } + } + + // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. + if ( + isActive && + ( + (e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory) || + e.which === keyCodes.ENTER || + (e.which === keyCodes.TAB && that.options.selectOnTab) + ) + ) { + if (e.which !== keyCodes.SPACE) e.preventDefault(); + + if (!that.options.liveSearch || e.which !== keyCodes.SPACE) { + that.$menuInner.find('.active a').trigger('click', true); // retain active class + $this.trigger('focus'); + + if (!that.options.liveSearch) { + // Prevent screen from scrolling if the user hits the spacebar + e.preventDefault(); + // Fixes spacebar selection of dropdown items in FF & IE + $(document).data('spaceSelect', true); + } + } + } + }, + + mobile: function () { + this.$element[0].classList.add('mobile-device'); + }, + + refresh: function () { + // update options if data attributes have been changed + var config = $.extend({}, this.options, this.$element.data()); + this.options = config; + + this.checkDisabled(); + this.setStyle(); + this.render(); + this.createLi(); + this.setWidth(); + + this.setSize(true); + + this.$element.trigger('refreshed' + EVENT_KEY); + }, + + hide: function () { + this.$newElement.hide(); + }, + + show: function () { + this.$newElement.show(); + }, + + remove: function () { + this.$newElement.remove(); + this.$element.remove(); + }, + + destroy: function () { + this.$newElement.before(this.$element).remove(); + + if (this.$bsContainer) { + this.$bsContainer.remove(); + } else { + this.$menu.remove(); + } + + this.$element + .off(EVENT_KEY) + .removeData('selectpicker') + .removeClass('bs-select-hidden selectpicker'); + + $(window).off(EVENT_KEY + '.' + this.selectId); + } + }; + + // SELECTPICKER PLUGIN DEFINITION + // ============================== + function Plugin (option) { + // get the args of the outer function.. + var args = arguments; + // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them + // to get lost/corrupted in android 2.3 and IE9 #715 #775 + var _option = option; + + [].shift.apply(args); + + // if the version was not set successfully + if (!version.success) { + // try to retreive it again + try { + version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); + } catch (err) { + // fall back to use BootstrapVersion if set + if (Selectpicker.BootstrapVersion) { + version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.'); + } else { + version.full = [version.major, '0', '0']; + + console.warn( + 'There was an issue retrieving Bootstrap\'s version. ' + + 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' + + 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.', + err + ); + } + } + + version.major = version.full[0]; + version.success = true; + } + + if (version.major === '4') { + // some defaults need to be changed if using Bootstrap 4 + // check to see if they have already been manually changed before forcing them to update + var toUpdate = []; + + if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({ name: 'style', className: 'BUTTONCLASS' }); + if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({ name: 'iconBase', className: 'ICONBASE' }); + if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({ name: 'tickIcon', className: 'TICKICON' }); + + classNames.DIVIDER = 'dropdown-divider'; + classNames.SHOW = 'show'; + classNames.BUTTONCLASS = 'btn-light'; + classNames.POPOVERHEADER = 'popover-header'; + classNames.ICONBASE = ''; + classNames.TICKICON = 'bs-ok-default'; + + for (var i = 0; i < toUpdate.length; i++) { + var option = toUpdate[i]; + Selectpicker.DEFAULTS[option.name] = classNames[option.className]; + } + } + + var value; + var chain = this.each(function () { + var $this = $(this); + if ($this.is('select')) { + var data = $this.data('selectpicker'), + options = typeof _option == 'object' && _option; + + if (!data) { + var dataAttributes = $this.data(); + + for (var dataAttr in dataAttributes) { + if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { + delete dataAttributes[dataAttr]; + } + } + + var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, dataAttributes, options); + config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), dataAttributes.template, options.template); + $this.data('selectpicker', (data = new Selectpicker(this, config))); + } else if (options) { + for (var i in options) { + if (options.hasOwnProperty(i)) { + data.options[i] = options[i]; + } + } + } + + if (typeof _option == 'string') { + if (data[_option] instanceof Function) { + value = data[_option].apply(data, args); + } else { + value = data.options[_option]; + } + } + } + }); + + if (typeof value !== 'undefined') { + // noinspection JSUnusedAssignment + return value; + } else { + return chain; + } + } + + var old = $.fn.selectpicker; + $.fn.selectpicker = Plugin; + $.fn.selectpicker.Constructor = Selectpicker; + + // SELECTPICKER NO CONFLICT + // ======================== + $.fn.selectpicker.noConflict = function () { + $.fn.selectpicker = old; + return this; + }; + + $(document) + .off('keydown.bs.dropdown.data-api') + .on('keydown' + EVENT_KEY, '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', Selectpicker.prototype.keydown) + .on('focusin.modal', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', function (e) { + e.stopPropagation(); + }); + + // SELECTPICKER DATA-API + // ===================== + $(window).on('load' + EVENT_KEY + '.data-api', function () { + $('.selectpicker').each(function () { + var $selectpicker = $(this); + Plugin.call($selectpicker, $selectpicker.data()); + }) + }); +})(jQuery); + + +})); //# sourceMappingURL=bootstrap-select.js.map \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css index 579ee12c2..dafcce3a0 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css @@ -1,6 +1,6 @@ -/*! - * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2019 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) +/*! + * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) + * + * Copyright 2012-2019 SnapAppointments, LLC + * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) */.bootstrap-select>select.bs-select-hidden,select.bs-select-hidden,select.selectpicker{display:none!important}.bootstrap-select{width:220px\0;vertical-align:middle}.bootstrap-select>.dropdown-toggle{position:relative;width:100%;text-align:right;white-space:nowrap;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.bootstrap-select>.dropdown-toggle:after{margin-top:-1px}.bootstrap-select>.dropdown-toggle.bs-placeholder,.bootstrap-select>.dropdown-toggle.bs-placeholder:active,.bootstrap-select>.dropdown-toggle.bs-placeholder:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder:hover{color:#999}.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:hover{color:rgba(255,255,255,.5)}.bootstrap-select>select{position:absolute!important;bottom:0;left:50%;display:block!important;width:.5px!important;height:100%!important;padding:0!important;opacity:0!important;border:none;z-index:0!important}.bootstrap-select>select.mobile-device{top:0;left:0;display:block!important;width:100%!important;z-index:2!important}.bootstrap-select.is-invalid .dropdown-toggle,.error .bootstrap-select .dropdown-toggle,.has-error .bootstrap-select .dropdown-toggle,.was-validated .bootstrap-select .selectpicker:invalid+.dropdown-toggle{border-color:#b94a48}.bootstrap-select.is-valid .dropdown-toggle,.was-validated .bootstrap-select .selectpicker:valid+.dropdown-toggle{border-color:#28a745}.bootstrap-select.fit-width{width:auto!important}.bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn){width:220px}.bootstrap-select .dropdown-toggle:focus,.bootstrap-select>select.mobile-device:focus+.dropdown-toggle{outline:thin dotted #333!important;outline:5px auto -webkit-focus-ring-color!important;outline-offset:-2px}.bootstrap-select.form-control{margin-bottom:0;padding:0;border:none;height:auto}:not(.input-group)>.bootstrap-select.form-control:not([class*=col-]){width:100%}.bootstrap-select.form-control.input-group-btn{float:none;z-index:auto}.form-inline .bootstrap-select,.form-inline .bootstrap-select.form-control:not([class*=col-]){width:auto}.bootstrap-select:not(.input-group-btn),.bootstrap-select[class*=col-]{float:none;display:inline-block;margin-left:0}.bootstrap-select.dropdown-menu-right,.bootstrap-select[class*=col-].dropdown-menu-right,.row .bootstrap-select[class*=col-].dropdown-menu-right{float:right}.form-group .bootstrap-select,.form-horizontal .bootstrap-select,.form-inline .bootstrap-select{margin-bottom:0}.form-group-lg .bootstrap-select.form-control,.form-group-sm .bootstrap-select.form-control{padding:0}.form-group-lg .bootstrap-select.form-control .dropdown-toggle,.form-group-sm .bootstrap-select.form-control .dropdown-toggle{height:100%;font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-lg .dropdown-toggle,.bootstrap-select.form-control-sm .dropdown-toggle{font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-sm .dropdown-toggle{padding:.25rem .5rem}.bootstrap-select.form-control-lg .dropdown-toggle{padding:.5rem 1rem}.form-inline .bootstrap-select .form-control{width:100%}.bootstrap-select.disabled,.bootstrap-select>.disabled{cursor:not-allowed}.bootstrap-select.disabled:focus,.bootstrap-select>.disabled:focus{outline:0!important}.bootstrap-select.bs-container{position:absolute;top:0;left:0;height:0!important;padding:0!important}.bootstrap-select.bs-container .dropdown-menu{z-index:1060}.bootstrap-select .dropdown-toggle .filter-option{position:static;top:0;left:0;float:left;height:100%;width:100%;text-align:left;overflow:hidden;-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto}.bs3.bootstrap-select .dropdown-toggle .filter-option{padding-right:inherit}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option{position:absolute;padding-top:inherit;padding-bottom:inherit;padding-left:inherit;float:none}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner{padding-right:inherit}.bootstrap-select .dropdown-toggle .filter-option-inner-inner{overflow:hidden}.bootstrap-select .dropdown-toggle .filter-expand{width:0!important;float:left;opacity:0!important;overflow:hidden}.bootstrap-select .dropdown-toggle .caret{position:absolute;top:50%;right:12px;margin-top:-2px;vertical-align:middle}.input-group .bootstrap-select.form-control .dropdown-toggle{border-radius:inherit}.bootstrap-select[class*=col-] .dropdown-toggle{width:100%}.bootstrap-select .dropdown-menu{min-width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .dropdown-menu>.inner:focus{outline:0!important}.bootstrap-select .dropdown-menu.inner{position:static;float:none;border:0;padding:0;margin:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}.bootstrap-select .dropdown-menu li{position:relative}.bootstrap-select .dropdown-menu li.active small{color:rgba(255,255,255,.5)!important}.bootstrap-select .dropdown-menu li.disabled a{cursor:not-allowed}.bootstrap-select .dropdown-menu li a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bootstrap-select .dropdown-menu li a.opt{position:relative;padding-left:2.25em}.bootstrap-select .dropdown-menu li a span.check-mark{display:none}.bootstrap-select .dropdown-menu li a span.text{display:inline-block}.bootstrap-select .dropdown-menu li small{padding-left:.5em}.bootstrap-select .dropdown-menu .notify{position:absolute;bottom:5px;width:96%;margin:0 2%;min-height:26px;padding:3px 5px;background:#f5f5f5;border:1px solid #e3e3e3;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05);pointer-events:none;opacity:.9;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .no-results{padding:3px;background:#f5f5f5;margin:0 5px;white-space:nowrap}.bootstrap-select.fit-width .dropdown-toggle .filter-option{position:static;display:inline;padding:0}.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner{display:inline}.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before{content:'\00a0'}.bootstrap-select.fit-width .dropdown-toggle .caret{position:static;top:auto;margin-top:-1px}.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark{position:absolute;display:inline-block;right:15px;top:5px}.bootstrap-select.show-tick .dropdown-menu li a span.text{margin-right:34px}.bootstrap-select .bs-ok-default:after{content:'';display:block;width:.5em;height:1em;border-style:solid;border-width:0 .26em .26em 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle{z-index:1061}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before{content:'';border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid rgba(204,204,204,.2);position:absolute;bottom:-4px;left:9px;display:none}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after{content:'';border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;bottom:-4px;left:10px;display:none}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before{bottom:auto;top:-4px;border-top:7px solid rgba(204,204,204,.2);border-bottom:0}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after{bottom:auto;top:-4px;border-top:6px solid #fff;border-bottom:0}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before{right:12px;left:auto}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after{right:13px;left:auto}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:before,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:before{display:block}.bs-actionsbox,.bs-donebutton,.bs-searchbox{padding:4px 8px}.bs-actionsbox{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-actionsbox .btn-group button{width:50%}.bs-donebutton{float:left;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-donebutton .btn-group button{width:100%}.bs-searchbox+.bs-actionsbox{padding:0 8px 4px}.bs-searchbox .form-control{margin-bottom:0;width:100%;float:none} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js index 058acb90e..f9cb0638d 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js @@ -1,9 +1,9 @@ -/*! - * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2019 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - -!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(z){"use strict";var d=["sanitize","whiteList","sanitizeFn"],r=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],e={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},l=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,a=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function v(e,t){var i=e.nodeName.toLowerCase();if(-1!==z.inArray(i,t))return-1===z.inArray(i,r)||Boolean(e.nodeValue.match(l)||e.nodeValue.match(a));for(var s=z(t).filter(function(e,t){return t instanceof RegExp}),n=0,o=s.length;n]+>/g,"")),s&&(a=w(a)),a=a.toUpperCase(),o="contains"===i?0<=a.indexOf(t):a.startsWith(t)))break}return o}function A(e){return parseInt(e,10)||0}z.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(u?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var f={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},m=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,g=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function b(e){return f[e]}function w(e){return(e=e.toString())&&e.replace(m,b).replace(g,"")}var I,x,$,y,S,E=(I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},x=function(e){return I[e]},$="(?:"+Object.keys(I).join("|")+")",y=RegExp($),S=RegExp($,"g"),function(e){return e=null==e?"":""+e,y.test(e)?e.replace(S,x):e}),C={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},L=27,N=13,D=32,H=9,B=38,W=40,M={success:!1,major:"3"};try{M.full=(z.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var R=0,U=".bs.select",j={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},V={MENU:"."+j.MENU},F={span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode("\xa0"),fragment:document.createDocumentFragment()};F.a.setAttribute("role","option"),F.subtext.className="text-muted",F.text=F.span.cloneNode(!1),F.text.className="text",F.checkMark=F.span.cloneNode(!1);var _=new RegExp(B+"|"+W),G=new RegExp("^"+H+"$|"+L),q=function(e,t,i){var s=F.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},K=function(e,t,i){var s=F.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&(s.className=t),"4"===M.major&&s.classList.add("dropdown-item"),i&&s.setAttribute("style",i),s},Y=function(e,t){var i,s,n=F.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=F.whitespace.cloneNode(!1);(s=(!0===t?F.i:F.span).cloneNode(!1)).className=e.iconBase+" "+e.icon,F.fragment.appendChild(s),F.fragment.appendChild(o)}e.subtext&&((i=F.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;0'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:e},J.prototype={constructor:J,init:function(){var i=this,e=this.$element.attr("id");R++,this.selectId="bs-select-"+R,this.$element[0].classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$element[0].classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(V.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element[0].classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(j.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+U,function(){if(i.isVirtual()){var e=i.$menuInner[0],t=e.firstChild.cloneNode(!1);e.replaceChild(t,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){i.$element.trigger("hide"+U,e)},"hidden.bs.dropdown":function(e){i.$element.trigger("hidden"+U,e)},"show.bs.dropdown":function(e){i.$element.trigger("show"+U,e)},"shown.bs.dropdown":function(e){i.$element.trigger("shown"+U,e)}}),i.$element[0].hasAttribute("required")&&this.$element.on("invalid"+U,function(){i.$button[0].classList.add("bs-invalid"),i.$element.on("shown"+U+".invalid",function(){i.$element.val(i.$element.val()).off("shown"+U+".invalid")}).on("rendered"+U,function(){this.validity.valid&&i.$button[0].classList.remove("bs-invalid"),i.$element.off("rendered"+U)}),i.$button.on("blur"+U,function(){i.$element.trigger("focus").trigger("blur"),i.$button.off("blur"+U)})}),setTimeout(function(){i.createLi(),i.$element.trigger("loaded"+U)})},createDropdown:function(){var e=this.multiple||this.options.showTick?" show-tick":"",t=this.multiple?' aria-multiselectable="true"':"",i="",s=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(i=" input-group-btn");var n,o="",r="",l="",a="";return this.options.header&&(o='
    '+this.options.header+"
    "),this.options.liveSearch&&(r=''),this.multiple&&this.options.actionsBox&&(l='
    "),this.multiple&&this.options.doneButton&&(a='
    "),n='",z(n)},setPositionData:function(){this.selectpicker.view.canHighlight=[];for(var e=this.selectpicker.view.size=0;e=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(A,e,t){var L,N,D=this,i=0,H=[];if(this.selectpicker.current=A?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),e)if(t)i=this.$menuInner[0].scrollTop;else if(!D.multiple){var s=D.$element[0],n=(s.options[s.selectedIndex]||{}).liIndex;if("number"==typeof n&&!1!==D.options.size){var o=D.selectpicker.main.data[n],r=o&&o.position;r&&(i=r-(D.sizeInfo.menuInnerHeight+D.sizeInfo.liHeight)/2)}}function l(e,t){var i,s,n,o,r,l,a,c,d,h,p=D.selectpicker.current.elements.length,u=[],f=!0,m=D.isVirtual();D.selectpicker.view.scrollTop=e,!0===m&&D.sizeInfo.hasScrollBar&&D.$menu[0].offsetWidth>D.sizeInfo.totalMenuWidth&&(D.sizeInfo.menuWidth=D.$menu[0].offsetWidth,D.sizeInfo.totalMenuWidth=D.sizeInfo.menuWidth+D.sizeInfo.scrollBarWidth,D.$menu.css("min-width",D.sizeInfo.menuWidth)),i=Math.ceil(D.sizeInfo.menuInnerHeight/D.sizeInfo.liHeight*1.5),s=Math.round(p/i)||1;for(var v=0;vp-1?0:D.selectpicker.current.data[p-1].position-D.selectpicker.current.data[D.selectpicker.view.position1-1].position,I.firstChild.style.marginTop=b+"px",w+"px"):I.firstChild.style.marginTop=0,I.firstChild.appendChild(x)}if(D.prevActiveIndex=D.activeIndex,D.options.liveSearch){if(A&&t){var z,T=0;D.selectpicker.view.canHighlight[T]||(T=1+D.selectpicker.view.canHighlight.slice(1).indexOf(!0)),z=D.selectpicker.view.visibleElements[T],D.defocusItem(D.selectpicker.view.currentActive),D.activeIndex=(D.selectpicker.current.data[T]||{}).index,D.focusItem(z)}}else D.$menuInner.trigger("focus")}l(i,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){D.noScroll||l(this.scrollTop,t),D.noScroll=!1}),z(window).off("resize"+U+"."+this.selectId+".createView").on("resize"+U+"."+this.selectId+".createView",function(){D.$newElement.hasClass(j.SHOW)&&l(D.$menuInner[0].scrollTop)})},focusItem:function(e,t,i){if(e){t=t||this.selectpicker.main.data[this.activeIndex];var s=e.firstChild;s&&(s.setAttribute("aria-setsize",this.selectpicker.view.size),s.setAttribute("aria-posinset",t.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",s.id),e.classList.add("active"),s.classList.add("active")))}},defocusItem:function(e){e&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),e=!0;var t=this.$element[0],i=!1,s=!this.selectpicker.view.titleOption.parentNode;if(s)this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",i=void 0===z(t.options[t.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected");(s||0!==this.selectpicker.view.titleOption.index)&&t.insertBefore(this.selectpicker.view.titleOption,t.firstChild),i&&(t.selectedIndex=0)}return e},createLi:function(){var c=this,f=this.options.iconBase,m=':not([hidden]):not([data-hidden="true"])',v=[],g=[],d=0,b=0,e=this.setPlaceholder()?1:0;this.options.hideDisabled&&(m+=":not(:disabled)"),!c.options.showTick&&!c.multiple||F.checkMark.parentNode||(F.checkMark.className=f+" "+c.options.tickIcon+" check-mark",F.a.appendChild(F.checkMark));var t=this.$element[0].querySelectorAll("select > *"+m);function w(e){var t=g[g.length-1];t&&"divider"===t.type&&(t.optID||e.optID)||((e=e||{}).type="divider",v.push(q(!1,j.DIVIDER,e.optID?e.optID+"div":void 0)),g.push(e))}function I(e,t){if((t=t||{}).divider="true"===e.getAttribute("data-divider"),t.divider)w({optID:t.optID});else{var i=g.length,s=e.style.cssText,n=s?E(s):"",o=(e.className||"")+(t.optgroupClass||"");t.optID&&(o="opt "+o),t.text=e.textContent,t.content=e.getAttribute("data-content"),t.tokens=e.getAttribute("data-tokens"),t.subtext=e.getAttribute("data-subtext"),t.icon=e.getAttribute("data-icon"),t.iconBase=f;var r=Y(t),l=q(K(r,o,n),"",t.optID);l.firstChild&&(l.firstChild.id=c.selectId+"-"+i),v.push(l),e.liIndex=i,t.display=t.content||t.text,t.type="option",t.index=i,t.option=e,t.disabled=t.disabled||e.disabled,g.push(t);var a=0;t.display&&(a+=t.display.length),t.subtext&&(a+=t.subtext.length),t.icon&&(a+=1),d li")},render:function(){this.setPlaceholder();var e,t,i=this,s=this.$element[0],n=function(e,t){var i,s=e.selectedOptions,n=[];if(t){for(var o=0,r=s.length;o")).length&&o>t[1]||1===t.length&&2<=o),!1===e){for(var h=0;h option"+m+", optgroup"+m+" option"+m).length,g="function"==typeof this.options.countSelectedText?this.options.countSelectedText(o,v):this.options.countSelectedText;c=Y({text:g.replace("{0}",o.toString()).replace("{1}",v.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),c.childNodes.length||(c=Y({text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),r.title=c.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&d&&P([c],i.options.whiteList,i.options.sanitizeFn),l.innerHTML="",l.appendChild(c),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var b=r.querySelector(".filter-expand"),w=l.cloneNode(!0);w.className="filter-expand",b?r.replaceChild(w,b):r.appendChild(w)}this.$element.trigger("rendered"+U)},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(e){if(e||!1!==this.options.size&&!this.sizeInfo){this.sizeInfo||(this.sizeInfo={});var t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("ul"),o=document.createElement("li"),r=document.createElement("li"),l=document.createElement("li"),a=document.createElement("a"),c=document.createElement("span"),d=this.options.header&&0this.sizeInfo.menuExtras.vert&&l+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot)),"auto"===this.options.size)n=3this.options.size){for(var g=0;gthis.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth,this.$menu.css("min-width",this.sizeInfo.totalMenuWidth)),this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(e){if(this.liHeight(e),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var t=this,i=z(window);this.setMenuSize(),this.options.liveSearch&&this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return t.setMenuSize()}),"auto"===this.options.size?i.off("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize").on("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize",function(){return t.setMenuSize()}):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&i.off("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize"),t.createView(!1,!0,e)}},setWidth:function(){var i=this;"auto"===this.options.width?requestAnimationFrame(function(){i.$menu.css("min-width","0"),i.$element.on("loaded"+U,function(){i.liHeight(),i.setMenuSize();var e=i.$newElement.clone().appendTo("body"),t=e.css("width","auto").children("button").outerWidth();e.remove(),i.sizeInfo.selectWidth=Math.max(i.sizeInfo.totalMenuWidth,t),i.$newElement.css("width",i.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=z('
    ');var s,n,o,r=this,l=z(this.options.container),e=function(e){var t={},i=r.options.display||!!z.fn.dropdown.Constructor.Default&&z.fn.dropdown.Constructor.Default.display;r.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(j.DROPUP,e.hasClass(j.DROPUP)),s=e.offset(),l.is("body")?n={top:0,left:0}:((n=l.offset()).top+=parseInt(l.css("borderTopWidth"))-l.scrollTop(),n.left+=parseInt(l.css("borderLeftWidth"))-l.scrollLeft()),o=e.hasClass(j.DROPUP)?0:e[0].offsetHeight,(M.major<4||"static"===i)&&(t.top=s.top-n.top+o,t.left=s.left-n.left),t.width=e[0].offsetWidth,r.$bsContainer.css(t)};this.$button.on("click.bs.dropdown.data-api",function(){r.isDisabled()||(e(r.$newElement),r.$bsContainer.appendTo(r.options.container).toggleClass(j.SHOW,!r.$button.hasClass(j.SHOW)).append(r.$menu))}),z(window).off("resize"+U+"."+this.selectId+" scroll"+U+"."+this.selectId).on("resize"+U+"."+this.selectId+" scroll"+U+"."+this.selectId,function(){r.$newElement.hasClass(j.SHOW)&&e(r.$newElement)}),this.$element.on("hide"+U,function(){r.$menu.data("height",r.$menu.height()),r.$bsContainer.detach()})},setOptionStatus:function(e){var t=this;if(t.noScroll=!1,t.selectpicker.view.visibleElements&&t.selectpicker.view.visibleElements.length)for(var i=0;i
    ');$[2]&&(y=y.replace("{var}",$[2][1"+y+"
    ")),d=!1,C.$element.trigger("maxReached"+U)),b&&I&&(E.append(z("
    "+S+"
    ")),d=!1,C.$element.trigger("maxReachedGrp"+U)),setTimeout(function(){C.setSelected(r,!1)},10),E.delay(750).fadeOut(300,function(){z(this).remove()})}}}else c.selected=!1,p.selected=!0,C.setSelected(r,!0);!C.multiple||C.multiple&&1===C.options.maxOptions?C.$button.trigger("focus"):C.options.liveSearch&&C.$searchbox.trigger("focus"),d&&(C.multiple||a!==s.selectedIndex)&&(T=[p.index,u.prop("selected"),l],C.$element.triggerNative("change"))}}),this.$menu.on("click","li."+j.DISABLED+" a, ."+j.POPOVERHEADER+", ."+j.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),C.options.liveSearch&&!z(e.target).hasClass("close")?C.$searchbox.trigger("focus"):C.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus")}),this.$menu.on("click","."+j.POPOVERHEADER+" .close",function(){C.$button.trigger("click")}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus"),e.preventDefault(),e.stopPropagation(),z(this).hasClass("bs-select-all")?C.selectAll():C.deselectAll()}),this.$element.on("change"+U,function(){C.render(),C.$element.trigger("changed"+U,T),T=null}).on("focus"+U,function(){C.options.mobile||C.$button.trigger("focus")})},liveSearchListener:function(){var u=this,f=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){u.$searchbox.val()&&u.$searchbox.val("")}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var e=u.$searchbox.val();if(u.selectpicker.search.elements=[],u.selectpicker.search.data=[],e){var t=[],i=e.toUpperCase(),s={},n=[],o=u._searchStyle(),r=u.options.liveSearchNormalize;r&&(i=w(i)),u._$lisSelected=u.$menuInner.find(".selected");for(var l=0;l=a.selectpicker.view.canHighlight.length&&(t=0),a.selectpicker.view.canHighlight[t+f]||(t=t+1+a.selectpicker.view.canHighlight.slice(t+f+1).indexOf(!0))),e.preventDefault();var m=f+t;e.which===B?0===f&&t===c.length-1?(a.$menuInner[0].scrollTop=a.$menuInner[0].scrollHeight,m=a.selectpicker.current.elements.length-1):d=(o=(n=a.selectpicker.current.data[m]).position-n.height)u+a.sizeInfo.menuInnerHeight),s=a.selectpicker.main.elements[v],a.activeIndex=b[x],a.focusItem(s),s&&s.firstChild.focus(),d&&(a.$menuInner[0].scrollTop=o),r.trigger("focus")}}i&&(e.which===D&&!a.selectpicker.keydown.keyHistory||e.which===N||e.which===H&&a.options.selectOnTab)&&(e.which!==D&&e.preventDefault(),a.options.liveSearch&&e.which===D||(a.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),a.options.liveSearch||(e.preventDefault(),z(document).data("spaceSelect",!0))))}},mobile:function(){this.$element[0].classList.add("mobile-device")},refresh:function(){var e=z.extend({},this.options,this.$element.data());this.options=e,this.checkDisabled(),this.setStyle(),this.render(),this.createLi(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+U)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(U).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),z(window).off(U+"."+this.selectId)}};var X=z.fn.selectpicker;z.fn.selectpicker=Q,z.fn.selectpicker.Constructor=J,z.fn.selectpicker.noConflict=function(){return z.fn.selectpicker=X,this},z(document).off("keydown.bs.dropdown.data-api").on("keydown"+U,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',J.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),z(window).on("load"+U+".data-api",function(){z(".selectpicker").each(function(){var e=z(this);Q.call(e,e.data())})})}(e)}); +/*! + * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) + * + * Copyright 2012-2019 SnapAppointments, LLC + * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) + */ + +!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(z){"use strict";var d=["sanitize","whiteList","sanitizeFn"],r=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],e={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},l=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,a=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function v(e,t){var i=e.nodeName.toLowerCase();if(-1!==z.inArray(i,t))return-1===z.inArray(i,r)||Boolean(e.nodeValue.match(l)||e.nodeValue.match(a));for(var s=z(t).filter(function(e,t){return t instanceof RegExp}),n=0,o=s.length;n]+>/g,"")),s&&(a=w(a)),a=a.toUpperCase(),o="contains"===i?0<=a.indexOf(t):a.startsWith(t)))break}return o}function A(e){return parseInt(e,10)||0}z.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(u?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var f={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},m=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,g=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function b(e){return f[e]}function w(e){return(e=e.toString())&&e.replace(m,b).replace(g,"")}var I,x,$,y,S,E=(I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},x=function(e){return I[e]},$="(?:"+Object.keys(I).join("|")+")",y=RegExp($),S=RegExp($,"g"),function(e){return e=null==e?"":""+e,y.test(e)?e.replace(S,x):e}),C={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},L=27,N=13,D=32,H=9,B=38,W=40,M={success:!1,major:"3"};try{M.full=(z.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var R=0,U=".bs.select",j={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},V={MENU:"."+j.MENU},F={span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode("\xa0"),fragment:document.createDocumentFragment()};F.a.setAttribute("role","option"),F.subtext.className="text-muted",F.text=F.span.cloneNode(!1),F.text.className="text",F.checkMark=F.span.cloneNode(!1);var _=new RegExp(B+"|"+W),G=new RegExp("^"+H+"$|"+L),q=function(e,t,i){var s=F.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},K=function(e,t,i){var s=F.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&(s.className=t),"4"===M.major&&s.classList.add("dropdown-item"),i&&s.setAttribute("style",i),s},Y=function(e,t){var i,s,n=F.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=F.whitespace.cloneNode(!1);(s=(!0===t?F.i:F.span).cloneNode(!1)).className=e.iconBase+" "+e.icon,F.fragment.appendChild(s),F.fragment.appendChild(o)}e.subtext&&((i=F.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;0'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:e},J.prototype={constructor:J,init:function(){var i=this,e=this.$element.attr("id");R++,this.selectId="bs-select-"+R,this.$element[0].classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$element[0].classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(V.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element[0].classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(j.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+U,function(){if(i.isVirtual()){var e=i.$menuInner[0],t=e.firstChild.cloneNode(!1);e.replaceChild(t,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){i.$element.trigger("hide"+U,e)},"hidden.bs.dropdown":function(e){i.$element.trigger("hidden"+U,e)},"show.bs.dropdown":function(e){i.$element.trigger("show"+U,e)},"shown.bs.dropdown":function(e){i.$element.trigger("shown"+U,e)}}),i.$element[0].hasAttribute("required")&&this.$element.on("invalid"+U,function(){i.$button[0].classList.add("bs-invalid"),i.$element.on("shown"+U+".invalid",function(){i.$element.val(i.$element.val()).off("shown"+U+".invalid")}).on("rendered"+U,function(){this.validity.valid&&i.$button[0].classList.remove("bs-invalid"),i.$element.off("rendered"+U)}),i.$button.on("blur"+U,function(){i.$element.trigger("focus").trigger("blur"),i.$button.off("blur"+U)})}),setTimeout(function(){i.createLi(),i.$element.trigger("loaded"+U)})},createDropdown:function(){var e=this.multiple||this.options.showTick?" show-tick":"",t=this.multiple?' aria-multiselectable="true"':"",i="",s=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(i=" input-group-btn");var n,o="",r="",l="",a="";return this.options.header&&(o='
    '+this.options.header+"
    "),this.options.liveSearch&&(r=''),this.multiple&&this.options.actionsBox&&(l='
    "),this.multiple&&this.options.doneButton&&(a='
    "),n='",z(n)},setPositionData:function(){this.selectpicker.view.canHighlight=[];for(var e=this.selectpicker.view.size=0;e=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(A,e,t){var L,N,D=this,i=0,H=[];if(this.selectpicker.current=A?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),e)if(t)i=this.$menuInner[0].scrollTop;else if(!D.multiple){var s=D.$element[0],n=(s.options[s.selectedIndex]||{}).liIndex;if("number"==typeof n&&!1!==D.options.size){var o=D.selectpicker.main.data[n],r=o&&o.position;r&&(i=r-(D.sizeInfo.menuInnerHeight+D.sizeInfo.liHeight)/2)}}function l(e,t){var i,s,n,o,r,l,a,c,d,h,p=D.selectpicker.current.elements.length,u=[],f=!0,m=D.isVirtual();D.selectpicker.view.scrollTop=e,!0===m&&D.sizeInfo.hasScrollBar&&D.$menu[0].offsetWidth>D.sizeInfo.totalMenuWidth&&(D.sizeInfo.menuWidth=D.$menu[0].offsetWidth,D.sizeInfo.totalMenuWidth=D.sizeInfo.menuWidth+D.sizeInfo.scrollBarWidth,D.$menu.css("min-width",D.sizeInfo.menuWidth)),i=Math.ceil(D.sizeInfo.menuInnerHeight/D.sizeInfo.liHeight*1.5),s=Math.round(p/i)||1;for(var v=0;vp-1?0:D.selectpicker.current.data[p-1].position-D.selectpicker.current.data[D.selectpicker.view.position1-1].position,I.firstChild.style.marginTop=b+"px",w+"px"):I.firstChild.style.marginTop=0,I.firstChild.appendChild(x)}if(D.prevActiveIndex=D.activeIndex,D.options.liveSearch){if(A&&t){var z,T=0;D.selectpicker.view.canHighlight[T]||(T=1+D.selectpicker.view.canHighlight.slice(1).indexOf(!0)),z=D.selectpicker.view.visibleElements[T],D.defocusItem(D.selectpicker.view.currentActive),D.activeIndex=(D.selectpicker.current.data[T]||{}).index,D.focusItem(z)}}else D.$menuInner.trigger("focus")}l(i,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){D.noScroll||l(this.scrollTop,t),D.noScroll=!1}),z(window).off("resize"+U+"."+this.selectId+".createView").on("resize"+U+"."+this.selectId+".createView",function(){D.$newElement.hasClass(j.SHOW)&&l(D.$menuInner[0].scrollTop)})},focusItem:function(e,t,i){if(e){t=t||this.selectpicker.main.data[this.activeIndex];var s=e.firstChild;s&&(s.setAttribute("aria-setsize",this.selectpicker.view.size),s.setAttribute("aria-posinset",t.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",s.id),e.classList.add("active"),s.classList.add("active")))}},defocusItem:function(e){e&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),e=!0;var t=this.$element[0],i=!1,s=!this.selectpicker.view.titleOption.parentNode;if(s)this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",i=void 0===z(t.options[t.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected");(s||0!==this.selectpicker.view.titleOption.index)&&t.insertBefore(this.selectpicker.view.titleOption,t.firstChild),i&&(t.selectedIndex=0)}return e},createLi:function(){var c=this,f=this.options.iconBase,m=':not([hidden]):not([data-hidden="true"])',v=[],g=[],d=0,b=0,e=this.setPlaceholder()?1:0;this.options.hideDisabled&&(m+=":not(:disabled)"),!c.options.showTick&&!c.multiple||F.checkMark.parentNode||(F.checkMark.className=f+" "+c.options.tickIcon+" check-mark",F.a.appendChild(F.checkMark));var t=this.$element[0].querySelectorAll("select > *"+m);function w(e){var t=g[g.length-1];t&&"divider"===t.type&&(t.optID||e.optID)||((e=e||{}).type="divider",v.push(q(!1,j.DIVIDER,e.optID?e.optID+"div":void 0)),g.push(e))}function I(e,t){if((t=t||{}).divider="true"===e.getAttribute("data-divider"),t.divider)w({optID:t.optID});else{var i=g.length,s=e.style.cssText,n=s?E(s):"",o=(e.className||"")+(t.optgroupClass||"");t.optID&&(o="opt "+o),t.text=e.textContent,t.content=e.getAttribute("data-content"),t.tokens=e.getAttribute("data-tokens"),t.subtext=e.getAttribute("data-subtext"),t.icon=e.getAttribute("data-icon"),t.iconBase=f;var r=Y(t),l=q(K(r,o,n),"",t.optID);l.firstChild&&(l.firstChild.id=c.selectId+"-"+i),v.push(l),e.liIndex=i,t.display=t.content||t.text,t.type="option",t.index=i,t.option=e,t.disabled=t.disabled||e.disabled,g.push(t);var a=0;t.display&&(a+=t.display.length),t.subtext&&(a+=t.subtext.length),t.icon&&(a+=1),d li")},render:function(){this.setPlaceholder();var e,t,i=this,s=this.$element[0],n=function(e,t){var i,s=e.selectedOptions,n=[];if(t){for(var o=0,r=s.length;o")).length&&o>t[1]||1===t.length&&2<=o),!1===e){for(var h=0;h option"+m+", optgroup"+m+" option"+m).length,g="function"==typeof this.options.countSelectedText?this.options.countSelectedText(o,v):this.options.countSelectedText;c=Y({text:g.replace("{0}",o.toString()).replace("{1}",v.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),c.childNodes.length||(c=Y({text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),r.title=c.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&d&&P([c],i.options.whiteList,i.options.sanitizeFn),l.innerHTML="",l.appendChild(c),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var b=r.querySelector(".filter-expand"),w=l.cloneNode(!0);w.className="filter-expand",b?r.replaceChild(w,b):r.appendChild(w)}this.$element.trigger("rendered"+U)},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(e){if(e||!1!==this.options.size&&!this.sizeInfo){this.sizeInfo||(this.sizeInfo={});var t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("ul"),o=document.createElement("li"),r=document.createElement("li"),l=document.createElement("li"),a=document.createElement("a"),c=document.createElement("span"),d=this.options.header&&0this.sizeInfo.menuExtras.vert&&l+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot)),"auto"===this.options.size)n=3this.options.size){for(var g=0;gthis.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth,this.$menu.css("min-width",this.sizeInfo.totalMenuWidth)),this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(e){if(this.liHeight(e),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var t=this,i=z(window);this.setMenuSize(),this.options.liveSearch&&this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return t.setMenuSize()}),"auto"===this.options.size?i.off("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize").on("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize",function(){return t.setMenuSize()}):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&i.off("resize"+U+"."+this.selectId+".setMenuSize scroll"+U+"."+this.selectId+".setMenuSize"),t.createView(!1,!0,e)}},setWidth:function(){var i=this;"auto"===this.options.width?requestAnimationFrame(function(){i.$menu.css("min-width","0"),i.$element.on("loaded"+U,function(){i.liHeight(),i.setMenuSize();var e=i.$newElement.clone().appendTo("body"),t=e.css("width","auto").children("button").outerWidth();e.remove(),i.sizeInfo.selectWidth=Math.max(i.sizeInfo.totalMenuWidth,t),i.$newElement.css("width",i.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=z('
    ');var s,n,o,r=this,l=z(this.options.container),e=function(e){var t={},i=r.options.display||!!z.fn.dropdown.Constructor.Default&&z.fn.dropdown.Constructor.Default.display;r.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(j.DROPUP,e.hasClass(j.DROPUP)),s=e.offset(),l.is("body")?n={top:0,left:0}:((n=l.offset()).top+=parseInt(l.css("borderTopWidth"))-l.scrollTop(),n.left+=parseInt(l.css("borderLeftWidth"))-l.scrollLeft()),o=e.hasClass(j.DROPUP)?0:e[0].offsetHeight,(M.major<4||"static"===i)&&(t.top=s.top-n.top+o,t.left=s.left-n.left),t.width=e[0].offsetWidth,r.$bsContainer.css(t)};this.$button.on("click.bs.dropdown.data-api",function(){r.isDisabled()||(e(r.$newElement),r.$bsContainer.appendTo(r.options.container).toggleClass(j.SHOW,!r.$button.hasClass(j.SHOW)).append(r.$menu))}),z(window).off("resize"+U+"."+this.selectId+" scroll"+U+"."+this.selectId).on("resize"+U+"."+this.selectId+" scroll"+U+"."+this.selectId,function(){r.$newElement.hasClass(j.SHOW)&&e(r.$newElement)}),this.$element.on("hide"+U,function(){r.$menu.data("height",r.$menu.height()),r.$bsContainer.detach()})},setOptionStatus:function(e){var t=this;if(t.noScroll=!1,t.selectpicker.view.visibleElements&&t.selectpicker.view.visibleElements.length)for(var i=0;i
    ');$[2]&&(y=y.replace("{var}",$[2][1"+y+"
  • ")),d=!1,C.$element.trigger("maxReached"+U)),b&&I&&(E.append(z("
    "+S+"
    ")),d=!1,C.$element.trigger("maxReachedGrp"+U)),setTimeout(function(){C.setSelected(r,!1)},10),E.delay(750).fadeOut(300,function(){z(this).remove()})}}}else c.selected=!1,p.selected=!0,C.setSelected(r,!0);!C.multiple||C.multiple&&1===C.options.maxOptions?C.$button.trigger("focus"):C.options.liveSearch&&C.$searchbox.trigger("focus"),d&&(C.multiple||a!==s.selectedIndex)&&(T=[p.index,u.prop("selected"),l],C.$element.triggerNative("change"))}}),this.$menu.on("click","li."+j.DISABLED+" a, ."+j.POPOVERHEADER+", ."+j.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),C.options.liveSearch&&!z(e.target).hasClass("close")?C.$searchbox.trigger("focus"):C.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus")}),this.$menu.on("click","."+j.POPOVERHEADER+" .close",function(){C.$button.trigger("click")}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus"),e.preventDefault(),e.stopPropagation(),z(this).hasClass("bs-select-all")?C.selectAll():C.deselectAll()}),this.$element.on("change"+U,function(){C.render(),C.$element.trigger("changed"+U,T),T=null}).on("focus"+U,function(){C.options.mobile||C.$button.trigger("focus")})},liveSearchListener:function(){var u=this,f=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){u.$searchbox.val()&&u.$searchbox.val("")}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var e=u.$searchbox.val();if(u.selectpicker.search.elements=[],u.selectpicker.search.data=[],e){var t=[],i=e.toUpperCase(),s={},n=[],o=u._searchStyle(),r=u.options.liveSearchNormalize;r&&(i=w(i)),u._$lisSelected=u.$menuInner.find(".selected");for(var l=0;l=a.selectpicker.view.canHighlight.length&&(t=0),a.selectpicker.view.canHighlight[t+f]||(t=t+1+a.selectpicker.view.canHighlight.slice(t+f+1).indexOf(!0))),e.preventDefault();var m=f+t;e.which===B?0===f&&t===c.length-1?(a.$menuInner[0].scrollTop=a.$menuInner[0].scrollHeight,m=a.selectpicker.current.elements.length-1):d=(o=(n=a.selectpicker.current.data[m]).position-n.height)u+a.sizeInfo.menuInnerHeight),s=a.selectpicker.main.elements[v],a.activeIndex=b[x],a.focusItem(s),s&&s.firstChild.focus(),d&&(a.$menuInner[0].scrollTop=o),r.trigger("focus")}}i&&(e.which===D&&!a.selectpicker.keydown.keyHistory||e.which===N||e.which===H&&a.options.selectOnTab)&&(e.which!==D&&e.preventDefault(),a.options.liveSearch&&e.which===D||(a.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),a.options.liveSearch||(e.preventDefault(),z(document).data("spaceSelect",!0))))}},mobile:function(){this.$element[0].classList.add("mobile-device")},refresh:function(){var e=z.extend({},this.options,this.$element.data());this.options=e,this.checkDisabled(),this.setStyle(),this.render(),this.createLi(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+U)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(U).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),z(window).off(U+"."+this.selectId)}};var X=z.fn.selectpicker;z.fn.selectpicker=Q,z.fn.selectpicker.Constructor=J,z.fn.selectpicker.noConflict=function(){return z.fn.selectpicker=X,this},z(document).off("keydown.bs.dropdown.data-api").on("keydown"+U,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',J.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),z(window).on("load"+U+".data-api",function(){z(".selectpicker").each(function(){var e=z(this);Q.call(e,e.data())})})}(e)}); //# sourceMappingURL=bootstrap-select.min.js.map \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css similarity index 100% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js index 48a112a14..0c8f43c25 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js @@ -1,7 +1,7 @@ -/** - * @author zhixin wen - * version: 1.11.0 - * https://github.com/wenzhixin/bootstrap-table/ - */ -(function(j){var k=null;var m=function(u){var s=arguments,r=true,t=1;u=u.replace(/%s/g,function(){var v=s[t++];if(typeof v==="undefined"){r=false;return""}return v});return r?u:""};var c=function(t,v,u,s){var r="";j.each(t,function(w,x){if(x[v]===s){r=x[u];return false}return true});return r};var i=function(s,t){var r=-1;j.each(s,function(u,v){if(v.field===t){r=u;return false}return true});return r};var l=function(u){var y,x,w,A=0,B=[];for(y=0;y").addClass("fixed-table-scroll-inner"),u=j("
    ").addClass("fixed-table-scroll-outer"),s,r;u.append(t);j("body").append(u);s=t[0].offsetWidth;u.css("overflow","scroll");r=t[0].offsetWidth;if(s===r){r=u[0].clientWidth}u.remove();k=s-r}return k};var q=function(s,u,t,r){var v=u;if(typeof u==="string"){var w=u.split(".");if(w.length>1){v=window;j.each(w,function(x,y){v=v[y]})}else{v=window[u]}}if(typeof v==="object"){return v}if(typeof v==="function"){return v.apply(s,t)}if(!v&&typeof u==="string"&&m.apply(this,[u].concat(t))){return m.apply(this,[u].concat(t))}return r};var f=function(s,r,w){var x=Object.getOwnPropertyNames(s),u=Object.getOwnPropertyNames(r),v="";if(w){if(x.length!==u.length){return false}}for(var t=0;t-1){if(s[v]!==r[v]){return false}}}return true};var p=function(r){if(typeof r==="string"){return r.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`")}return r};var d=function(s){var r=0;s.children().each(function(){if(r0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var h=function(){if(!Object.keys){Object.keys=(function(){var t=Object.prototype.hasOwnProperty,u=!({toString:null}).propertyIsEnumerable("toString"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=s.length;return function(x){if(typeof x!=="object"&&(typeof x!=="function"||x===null)){throw new TypeError("Object.keys called on non-object")}var v=[],y,w;for(y in x){if(t.call(x,y)){v.push(y)}}if(u){for(w=0;w','
    ',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'
    ':"",'
    ','
    ','
    ','
    ',this.options.formatLoadingMessage(),"
    ","
    ",'',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'
    ':"","
    ","
    "].join(""));this.$container.insertAfter(this.$el);this.$tableContainer=this.$container.find(".fixed-table-container");this.$tableHeader=this.$container.find(".fixed-table-header");this.$tableBody=this.$container.find(".fixed-table-body");this.$tableLoading=this.$container.find(".fixed-table-loading");this.$tableFooter=this.$container.find(".fixed-table-footer");this.$toolbar=this.$container.find(".fixed-table-toolbar");this.$pagination=this.$container.find(".fixed-table-pagination");this.$tableBody.append(this.$el);this.$container.after('
    ');this.$el.addClass(this.options.classes);if(this.options.striped){this.$el.addClass("table-striped")}if(j.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};e.prototype.initTable=function(){var t=this,s=[],u=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=j("").appendTo(this.$el)}this.$header.find("tr").each(function(){var v=[];j(this).find("th").each(function(){if(typeof j(this).data("field")!=="undefined"){j(this).data("field",j(this).data("field")+"")}v.push(j.extend({},{title:j(this).html(),"class":j(this).attr("class"),titleTooltip:j(this).attr("title"),rowspan:j(this).attr("rowspan")?+j(this).attr("rowspan"):undefined,colspan:j(this).attr("colspan")?+j(this).attr("colspan"):undefined},j(this).data()))});s.push(v)});if(!j.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=j.extend(true,[],s,this.options.columns);this.columns=[];l(this.options.columns);j.each(this.options.columns,function(w,v){j.each(v,function(x,y){y=j.extend({},e.COLUMN_DEFAULTS,y);if(typeof y.fieldIndex!=="undefined"){t.columns[y.fieldIndex]=y}t.options.columns[w][x]=y})});if(this.options.data.length){return}var r=[];this.$el.find(">tbody>tr").each(function(w){var v={};v._id=j(this).attr("id");v._class=j(this).attr("class");v._data=g(j(this).data());j(this).find(">td").each(function(z){var E=j(this),B=+E.attr("colspan")||1,C=+E.attr("rowspan")||1,A,y;for(;r[w]&&r[w][z];z++){}for(A=z;A");if(v===0&&!t.options.cardView&&t.options.detailView){s.push(m('
    ',t.options.columns.length))}j.each(u,function(B,A){var F="",C="",E="",w="",D=m(' class="%s"',A["class"]),z=t.options.sortOrder||A.order,y="px",x=A.width;if(A.width!==undefined&&(!t.options.cardView)){if(typeof A.width==="string"){if(A.width.indexOf("%")!==-1){y="%"}}}if(A.width&&typeof A.width==="string"){x=A.width.replace("%","").replace("px","")}C=m("text-align: %s; ",A.halign?A.halign:A.align);E=m("text-align: %s; ",A.align);w=m("vertical-align: %s; ",A.valign);w+=m("width: %s; ",(A.checkbox||A.radio)&&!x?"36px":(x?x+y:undefined));if(typeof A.fieldIndex!=="undefined"){t.header.fields[A.fieldIndex]=A.field;t.header.styles[A.fieldIndex]=E+w;t.header.classes[A.fieldIndex]=D;t.header.formatters[A.fieldIndex]=A.formatter;t.header.events[A.fieldIndex]=A.events;t.header.sorters[A.fieldIndex]=A.sorter;t.header.sortNames[A.fieldIndex]=A.sortName;t.header.cellStyles[A.fieldIndex]=A.cellStyle;t.header.searchables[A.fieldIndex]=A.searchable;if(!A.visible){return}if(t.options.cardView&&(!A.cardVisible)){return}r[A.field]=A}s.push("");s.push(m('
    ',t.options.sortable&&A.sortable?"sortable both":""));F=A.title;if(A.checkbox){if(!t.options.singleSelect&&t.options.checkboxHeader){F=''}t.header.stateField=A.field}if(A.radio){F="";t.header.stateField=A.field;t.options.singleSelect=true}s.push(F);s.push("
    ");s.push('
    ');s.push("
    ");s.push("")});s.push("")});this.$header.html(s.join(""));this.$header.find("th[data-field]").each(function(u){j(this).data(r[j(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(u){var v=j(this);if(t.options.detailView){if(v.closest(".bootstrap-table")[0]!==t.$container[0]){return false}}if(t.options.sortable&&v.parent().data().sortable){t.onSort(u)}});this.$header.children().children().off("keypress").on("keypress",function(v){if(t.options.sortable&&j(this).data().sortable){var u=v.keyCode||v.which;if(u==13){t.onSort(v)}}});j(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();j(window).on("resize.bootstrap-table",j.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var u=j(this).prop("checked");t[u?"checkAll":"uncheckAll"]();t.updateSelected()})};e.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};e.prototype.initData=function(s,r){if(r==="append"){this.data=this.data.concat(s)}else{if(r==="prepend"){this.data=[].concat(s).concat(this.data)}else{this.data=s||this.options.data}}if(r==="append"){this.options.data=this.options.data.concat(s)}else{if(r==="prepend"){this.options.data=[].concat(s).concat(this.options.data)}else{this.options.data=this.data}}if(this.options.sidePagination==="server"){return}this.initSort()};e.prototype.initSort=function(){var u=this,t=this.options.sortName,r=this.options.sortOrder==="desc"?-1:1,s=j.inArray(this.options.sortName,this.header.fields);if(this.options.customSort!==j.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(s!==-1){if(this.options.sortStable){j.each(this.data,function(v,w){if(!w.hasOwnProperty("_position")){w._position=v}})}this.data.sort(function(w,v){if(u.header.sortNames[s]){t=u.header.sortNames[s]}var y=o(w,t,u.options.escape),z=o(v,t,u.options.escape),x=q(u.header,u.header.sorters[s],[y,z]);if(x!==undefined){return r*x}if(y===undefined||y===null){y=""}if(z===undefined||z===null){z=""}if(u.options.sortStable&&y===z){y=w._position;z=v._position}if(j.isNumeric(y)&&j.isNumeric(z)){y=parseFloat(y);z=parseFloat(z);if(y
    ',this.options.toolbarAlign)).appendTo(this.$toolbar).append(j(this.options.toolbar))}t=[m('
    ',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=q(null,this.options.icons)}if(this.options.showSearch){t.push(m('")}if(this.options.showPaginationSwitch){t.push(m('")}if(this.options.showRefresh){t.push(m('")}if(this.options.showToggle){t.push(m('")}if(this.options.showColumns){t.push(m('
    ',this.options.formatColumns()),'",'","
    ")}t.push("
    ");if(this.showToolbar||t.length>2){this.$toolbar.append(t.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",j.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",j.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){u.toggleView()})}if(this.options.showSearch){this.$toolbar.find('button[name="showSearch"]').off("click").on("click",function(){j(this).parents(".select-table").siblings().slideToggle()})}if(this.options.showColumns){s=this.$toolbar.find(".keep-open");if(r<=this.options.minimumCountColumns){s.find("input").prop("disabled",true)}s.find("li").off("click").on("click",function(x){x.stopImmediatePropagation()});s.find("input").off("click").on("click",function(){var x=j(this);u.toggleColumn(j(this).val(),x.prop("checked"),false);u.trigger("column-switch",j(this).data("field"),x.prop("checked"))})}if(this.options.search){t=[];t.push('");this.$toolbar.append(t.join(""));v=this.$toolbar.find(".search input");v.off("keyup drop").on("keyup drop",function(x){if(u.options.searchOnEnterKey&&x.keyCode!==13){return}if(j.inArray(x.keyCode,[37,38,39,40])>-1){return}clearTimeout(w);w=setTimeout(function(){u.onSearch(x)},u.options.searchTimeOut)});if(b()){v.off("mouseup").on("mouseup",function(x){clearTimeout(w);w=setTimeout(function(){u.onSearch(x)},u.options.searchTimeOut)})}}};e.prototype.onSearch=function(r){var s=j.trim(j(r.currentTarget).val());if(this.options.trimOnSearch&&j(r.currentTarget).val()!==s){j(r.currentTarget).val(s)}if(s===this.searchText){return}this.searchText=s;this.options.searchText=s;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",s)};e.prototype.initSearch=function(){var t=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==j.noop){this.options.customSearch.apply(this,[this.searchText]);return}var r=this.searchText&&(this.options.escape?p(this.searchText):this.searchText).toLowerCase();var u=j.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=u?j.grep(this.options.data,function(w,v){for(var s in u){if(j.isArray(u[s])&&j.inArray(w[s],u[s])===-1||w[s]!==u[s]){return false}}return true}):this.options.data;this.data=r?j.grep(this.data,function(A,x){for(var v=0;v-1){r=true}}}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1;this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages){this.options.pageNumber=this.totalPages}this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1;this.pageTo=this.options.pageNumber*this.options.pageSize;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}x.push('
    ','',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"");if(!this.options.onlyInfoPagination){x.push('');var F=[m('',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'",'");x.push(this.options.formatRecordsPerPage(F.join("")));x.push("");x.push("
    ",'")}this.$pagination.html(x.join(""));if(!this.options.onlyInfoPagination){w=this.$pagination.find(".page-list a");G=this.$pagination.find(".page-first");I=this.$pagination.find(".page-pre");E=this.$pagination.find(".page-next");y=this.$pagination.find(".page-last");u=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(t.length<2||this.options.totalRows<=t[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(r){this.options.pageSize=this.options.formatAllRows()}w.off("click").on("click",j.proxy(this.onPageListChange,this));G.off("click").on("click",j.proxy(this.onPageFirst,this));I.off("click").on("click",j.proxy(this.onPagePre,this));E.off("click").on("click",j.proxy(this.onPageNext,this));y.off("click").on("click",j.proxy(this.onPageLast,this));u.off("click").on("click",j.proxy(this.onPageNumber,this))}if(this.options.showPageGo){var v=this,C=this.$pagination.find("ul.pagination"),B=C.find("li.pageGo");if(!B.length){B=j(['
  • ',m('',this.options.pageNumber),'","
  • "].join("")).appendTo(C);B.find("button").click(function(){var K=parseInt(B.find("input").val())||1;if(K<1||K>v.options.totalPages){K=1}v.selectPage(K)})}}};e.prototype.updatePagination=function(r){if(r&&j(r.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};e.prototype.onPageListChange=function(r){var s=j(r.currentTarget);s.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=s.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+s.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(r)};e.prototype.onPageFirst=function(r){this.options.pageNumber=1;this.updatePagination(r)};e.prototype.onPagePre=function(r){if((this.options.pageNumber-1)===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(r)};e.prototype.onPageNext=function(r){if((this.options.pageNumber+1)>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(r)};e.prototype.onPageLast=function(r){this.options.pageNumber=this.totalPages;this.updatePagination(r)};e.prototype.onPageNumber=function(r){if(this.options.pageNumber===+j(r.currentTarget).text()){return}this.options.pageNumber=+j(r.currentTarget).text();this.updatePagination(r)};e.prototype.initBody=function(x){var z=this,y=[],v=this.getData();this.trigger("pre-body",v);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=j("").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=v.length}for(var w=this.pageFrom-1;w");if(this.options.cardView){y.push(m('
    ',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){y.push("",'',m('',this.options.iconsPrefix,this.options.icons.detailOpen),"","")}j.each(this.header.fields,function(I,L){var P="",M=o(C,L,z.options.escape),K="",E={},Q="",J=z.header.classes[I],G="",O="",R="",H="",F=z.columns[I];if(z.fromHtml&&typeof M==="undefined"){return}if(!F.visible){return}if(z.options.cardView&&!F.cardVisible){return}r=m('style="%s"',s.concat(z.header.styles[I]).join("; "));if(C["_"+L+"_id"]){Q=m(' id="%s"',C["_"+L+"_id"])}if(C["_"+L+"_class"]){J=m(' class="%s"',C["_"+L+"_class"])}if(C["_"+L+"_rowspan"]){O=m(' rowspan="%s"',C["_"+L+"_rowspan"])}if(C["_"+L+"_colspan"]){R=m(' colspan="%s"',C["_"+L+"_colspan"])}if(C["_"+L+"_title"]){H=m(' title="%s"',C["_"+L+"_title"])}E=q(z.header,z.header.cellStyles[I],[M,C,w,L],E);if(E.classes){J=m(' class="%s"',E.classes)}if(E.css){var D=[];for(var N in E.css){D.push(N+": "+E.css[N])}r=m('style="%s"',D.concat(z.header.styles[I]).join("; "))}M=q(F,z.header.formatters[I],[M,C,w],M);if(C["_"+L+"_data"]&&!j.isEmptyObject(C["_"+L+"_data"])){j.each(C["_"+L+"_data"],function(T,S){if(T==="index"){return}G+=m(' data-%s="%s"',T,S)})}if(F.checkbox||F.radio){K=F.checkbox?"checkbox":K;K=F.radio?"radio":K;P=[m(z.options.cardView?'
    ':'',F["class"]||""),"",z.header.formatters[I]&&typeof M==="string"?M:"",z.options.cardView?"
    ":""].join("");C[z.header.stateField]=M===true||(M&&M.checked)}else{M=typeof M==="undefined"||M===null?z.options.undefinedText:M;P=z.options.cardView?['
    ',z.options.showHeader?m('%s',r,c(z.columns,"field","title",L)):"",m('%s',M),"
    "].join(""):[m("",Q,J,r,G,O,R,H),M,""].join("");if(z.options.cardView&&z.options.smartDisplay&&M===""){P='
    '}}y.push(P)});if(this.options.cardView){y.push("
    ")}y.push("")}if(!y.length){y.push('',m('%s',this.$header.find("th").length,this.options.formatNoMatches()),"")}this.$body.html(y.join(""));if(!x){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(J){var D=j(this),F=D.parent(),M=z.data[F.data("index")],H=D[0].cellIndex,G=z.getVisibleFields(),K=G[z.options.detailView&&!z.options.cardView?H-1:H],E=z.columns[i(z.columns,K)],L=o(M,K,z.options.escape);if(D.find(".detail-icon").length){return}z.trigger(J.type==="click"?"click-cell":"dbl-click-cell",K,L,M,D);z.trigger(J.type==="click"?"click-row":"dbl-click-row",M,F,K);if(J.type==="click"&&z.options.clickToSelect&&E.clickToSelect){var I=F.find(m('[name="%s"]',z.options.selectItemName));if(I.length){I[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var H=j(this),G=H.parent().parent(),E=G.data("index"),I=v[E];if(G.next().is("tr.detail-view")){H.find("i").attr("class",m("%s %s",z.options.iconsPrefix,z.options.icons.detailOpen));G.next().remove();z.trigger("collapse-row",E,I)}else{H.find("i").attr("class",m("%s %s",z.options.iconsPrefix,z.options.icons.detailClose));G.after(m('',G.find("td").length));var D=G.next().find("td");var F=q(z.options,z.options.detailFormatter,[E,I,D],"");if(D.length===1){D.append(F)}z.trigger("expand-row",E,I,D)}z.resetView()});this.$selectItem=this.$body.find(m('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(E){E.stopImmediatePropagation();var F=j(this),D=F.prop("checked"),G=z.data[F.data("index")];if(z.options.maintainSelected&&j(this).is(":radio")){j.each(z.options.data,function(H,I){I[z.header.stateField]=false})}G[z.header.stateField]=D;if(z.options.singleSelect){z.$selectItem.not(this).each(function(){z.data[j(this).data("index")][z.header.stateField]=false});z.$selectItem.filter(":checked").not(this).prop("checked",false)}z.updateSelected();z.trigger(D?"check":"uncheck",G,F)});j.each(this.header.events,function(G,F){if(!F){return}if(typeof F==="string"){F=q(null,F)}var H=z.header.fields[G],D=j.inArray(H,z.getVisibleFields());if(z.options.detailView&&!z.options.cardView){D+=1}for(var E in F){z.$body.find(">tr:not(.no-records-found)").each(function(){var M=j(this),N=M.find(z.options.cardView?".card-view":"td").eq(D),J=E.indexOf(" "),I=E.substring(0,J),K=E.substring(J+1),L=F[E];N.find(K).off(I).on(I,function(Q){var O=M.data("index"),R=z.data[O],P=R[H];L.apply(this,[Q,P,R,O])})})}});this.updateSelected();this.resetView();this.trigger("post-body",v)};e.prototype.initServer=function(r,w,s){var u=this,v={},x={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},t;if(this.options.pagination){x.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;x.pageNumber=this.options.pageNumber}if(!this.options.firstLoad&&!firstLoadTable.includes(this.options.id)){firstLoadTable.push(this.options.id);return}if(!(s||this.options.url)&&!this.options.ajax){return}if(this.options.queryParamsType==="limit"){x={search:x.searchText,sort:x.sortName,order:x.sortOrder};if(this.options.pagination){x.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);x.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize}}if(!(j.isEmptyObject(this.filterColumnsPartial))){x.filter=JSON.stringify(this.filterColumnsPartial,null)}v=q(this.options,this.options.queryParams,[x],v);j.extend(v,w||{});if(v===false){return}if(!r){this.$tableLoading.show()}t=j.extend({},q(null,this.options.ajaxOptions),{type:this.options.method,url:s||this.options.url,data:this.options.contentType==="application/json"&&this.options.method==="post"?JSON.stringify(v):v,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(y){y=q(u.options,u.options.responseHandler,[y],y);u.load(y);u.trigger("load-success",y);if(!r){u.$tableLoading.hide()}},error:function(y){u.trigger("load-error",y.status,y);if(!r){u.$tableLoading.hide()}}});if(this.options.ajax){q(this,this.options.ajax,[t],null)}else{if(this._xhr&&this._xhr.readyState!==4){this._xhr.abort()}this._xhr=j.ajax(t)}};e.prototype.initSearchText=function(){if(this.options.search){if(this.options.searchText!==""){var r=this.$toolbar.find(".search input");r.val(this.options.searchText);this.onSearch({currentTarget:r})}}};e.prototype.getCaret=function(){var r=this;j.each(this.$header.find("th"),function(s,t){j(t).find(".sortable").removeClass("desc asc").addClass((j(t).data("field")===r.options.sortName||j(t).data("sortName")===r.options.sortName)?r.options.sortOrder:"both")})};e.prototype.updateSelected=function(){var r=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;var s=j(".left-fixed-table-columns input[name=btSelectItem]");if(s.length>0){r=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===s.filter(":enabled").filter(":checked").length}this.$selectAll.add(this.$selectAll_).prop("checked",r);this.$selectItem.each(function(){j(this).closest("tr")[j(this).prop("checked")?"addClass":"removeClass"]("selected")})};e.prototype.updateRows=function(){var r=this;this.$selectItem.each(function(){r.data[j(this).data("index")][r.header.stateField]=j(this).prop("checked")})};e.prototype.resetRows=function(){var r=this;j.each(this.data,function(s,t){r.$selectAll.prop("checked",false);r.$selectItem.prop("checked",false);if(r.header.stateField){t[r.header.stateField]=false}})};e.prototype.trigger=function(s){var r=Array.prototype.slice.call(arguments,1);s+=".bs.table";this.options[e.EVENTS[s]].apply(this.options,r);this.$el.trigger(j.Event(s),r);this.options.onAll(s,r);this.$el.trigger(j.Event("all.bs.table"),[s,r])};e.prototype.resetHeader=function(){clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout(j.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)};e.prototype.fitHeader=function(){var t=this,u,r,x,y;if(t.$el.is(":hidden")){t.timeoutId_=setTimeout(j.proxy(t.fitHeader,t),100);return}u=this.$tableBody.get(0);r=u.scrollWidth>u.clientWidth&&u.scrollHeight>u.clientHeight+this.$header.outerHeight()?a():0;this.$el.css("margin-top",-this.$header.outerHeight());x=j(":focus");if(x.length>0){var z=x.parents("th");if(z.length>0){var A=z.attr("data-field");if(A!==undefined){var s=this.$header.find("[data-field='"+A+"']");if(s.length>0){s.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":r}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);y=j(".focus-temp:visible:eq(0)");if(y.length>0){y.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(B){t.$header_.find(m('th[data-field="%s"]',j(this).data("field"))).data(j(this).data())});var w=this.getVisibleFields(),v=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(C){var E=j(this),B=C;if(t.options.detailView&&!t.options.cardView){if(C===0){t.$header_.find("th.detail").find(".fht-cell").width(E.innerWidth())}B=C-1}var D=t.$header_.find(m('th[data-field="%s"]',w[B]));if(D.length>1){D=j(v[E[0].cellIndex])}D.find(".fht-cell").width(E.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){t.$tableHeader.scrollLeft(j(this).scrollLeft());if(t.options.showFooter&&!t.options.cardView){t.$tableFooter.scrollLeft(j(this).scrollLeft())}});t.trigger("post-header")};e.prototype.resetFooter=function(){var s=this,t=s.getData(),r=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){r.push('
     
    ')}j.each(this.columns,function(x,z){var w,B="",v="",A=[],y={},u=m(' class="%s"',z["class"]);if(!z.visible){return}if(s.options.cardView&&(!z.cardVisible)){return}B=m("text-align: %s; ",z.falign?z.falign:z.align);v=m("vertical-align: %s; ",z.valign);y=q(null,s.options.footerStyle);if(y&&y.css){for(w in y.css){A.push(w+": "+y.css[w])}}r.push("");r.push('
    ');r.push(q(z,z.footerFormatter,[t]," ")||" ");r.push("
    ");r.push('
    ');r.push("
    ");r.push("")});this.$tableFooter.find("tr").html(r.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout(j.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};e.prototype.fitFooter=function(){var u=this,r,t,s;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout(j.proxy(this.fitFooter,this),100);return}t=this.$el.css("width");s=t>this.$tableBody.width()?a():0;this.$tableFooter.css({"margin-right":s}).find("table").css("width",t).attr("class",this.$el.attr("class"));r=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(v){var w=j(this);r.eq(v).find(".fht-cell").width(w.innerWidth())})};e.prototype.toggleColumn=function(r,s,u){if(r===-1){return}this.columns[r].visible=s;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var t=this.$toolbar.find(".keep-open input").prop("disabled",false);if(u){t.filter(m('[value="%s"]',r)).prop("checked",s)}if(t.filter(":checked").length<=this.options.minimumCountColumns){t.filter(":checked").prop("disabled",true)}}};e.prototype.toggleRow=function(r,t,s){if(r===-1){return}this.$body.find(typeof r!=="undefined"?m('tr[data-index="%s"]',r):m('tr[data-uniqueid="%s"]',t))[s?"show":"hide"]()};e.prototype.getVisibleFields=function(){var s=this,r=[];j.each(this.header.fields,function(t,v){var u=s.columns[i(s.columns,v)];if(!u.visible){return}r.push(v)});return r};e.prototype.resetView=function(u){var s=0;if(u&&u.height){this.options.height=u.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var t=d(this.$toolbar),v=d(this.$pagination),r=this.options.height-t-v;this.$tableContainer.css("height",r+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();s+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){s+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",s+"px");this.trigger("reset-view")};e.prototype.getData=function(r){return(this.searchText||!j.isEmptyObject(this.filterColumns)||!j.isEmptyObject(this.filterColumnsPartial))?(r?this.data.slice(this.pageFrom-1,this.pageTo):this.data):(r?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data)};e.prototype.load=function(s){var r=false;if(this.options.sidePagination==="server"){this.options.totalRows=s.total;r=s.fixedScroll;s=s[this.options.dataField]}else{if(!j.isArray(s)){r=s.fixedScroll;s=s.data}}this.initData(s);this.initSearch();this.initPagination();this.initBody(r)};e.prototype.append=function(r){this.initData(r,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.prepend=function(r){this.initData(r,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.remove=function(u){var r=this.options.data.length,s,t;if(!u.hasOwnProperty("field")||!u.hasOwnProperty("values")){return}for(s=r-1;s>=0;s--){t=this.options.data[s];if(!t.hasOwnProperty(u.field)){continue}if(j.inArray(t[u.field],u.values)!==-1){this.options.data.splice(s,1)}}if(r===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};e.prototype.getRowByUniqueId=function(x){var w=this.options.uniqueId,r=this.options.data.length,s=null,t,v,u;for(t=r-1;t>=0;t--){v=this.options.data[t];if(v.hasOwnProperty(w)){u=v[w]}else{if(v._data.hasOwnProperty(w)){u=v._data[w]}else{continue}}if(typeof u==="string"){x=x.toString()}else{if(typeof u==="number"){if((Number(u)===u)&&(u%1===0)){x=parseInt(x)}else{if((u===Number(u))&&(u!==0)){x=parseFloat(x)}}}}if(u===x){s=v;break}}return s};e.prototype.removeByUniqueId=function(t){var r=this.options.data.length,s=this.getRowByUniqueId(t);if(s){this.options.data.splice(this.options.data.indexOf(s),1)}if(r===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};e.prototype.updateByUniqueId=function(t){var r=this;var s=j.isArray(t)?t:[t];j.each(s,function(u,w){var v;if(!w.hasOwnProperty("id")||!w.hasOwnProperty("row")){return}v=j.inArray(r.getRowByUniqueId(w.id),r.options.data);if(v===-1){return}j.extend(r.options.data[v],w.row)});this.initSearch();this.initSort();this.initBody(true)};e.prototype.insertRow=function(r){if(!r.hasOwnProperty("index")||!r.hasOwnProperty("row")){return}this.data.splice(r.index,0,r.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.updateRow=function(t){var r=this;var s=j.isArray(t)?t:[t];j.each(s,function(u,v){if(!v.hasOwnProperty("index")||!v.hasOwnProperty("row")){return}j.extend(r.options.data[v.index],v.row)});this.initSearch();this.initSort();this.initBody(true)};e.prototype.showRow=function(r){if(!r.hasOwnProperty("index")&&!r.hasOwnProperty("uniqueId")){return}this.toggleRow(r.index,r.uniqueId,true)};e.prototype.hideRow=function(r){if(!r.hasOwnProperty("index")&&!r.hasOwnProperty("uniqueId")){return}this.toggleRow(r.index,r.uniqueId,false)};e.prototype.getRowsHidden=function(r){var t=j(this.$body[0]).children().filter(":hidden"),s=0;if(r){for(;str"),r;if(this.options.detailView&&!this.options.cardView){t+=1}r=x.eq(y).find(">td").eq(t);if(y<0||t<0||y>=this.data.length){return}for(w=y;wtd").eq(v).hide()}}r.attr("rowspan",u).attr("colspan",s).show()};e.prototype.updateCell=function(r){if(!r.hasOwnProperty("index")||!r.hasOwnProperty("field")||!r.hasOwnProperty("value")){return}this.data[r.index][r.field]=r.value;if(r.reinit===false){return}this.initSort();this.initBody(true)};e.prototype.getOptions=function(){return this.options};e.prototype.getSelections=function(){var r=this;return j.grep(this.options.data,function(s){return s[r.header.stateField]})};e.prototype.getAllSelections=function(){var r=this;return j.grep(this.options.data,function(s){return s[r.header.stateField]})};e.prototype.checkAll=function(){this.checkAll_(true)};e.prototype.uncheckAll=function(){this.checkAll_(false)};e.prototype.checkInvert=function(){var s=this;var t=s.$selectItem.filter(":enabled");var r=t.filter(":checked");t.each(function(){j(this).prop("checked",!j(this).prop("checked"))});s.updateRows();s.updateSelected();s.trigger("uncheck-some",r);r=s.getSelections();s.trigger("check-some",r)};e.prototype.checkAll_=function(r){var s;if(!r){s=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",r);this.$selectItem.filter(":enabled").prop("checked",r);this.updateRows();if(r){s=this.getSelections()}this.trigger(r?"check-all":"uncheck-all",s)};e.prototype.check=function(r){this.check_(true,r) +/** + * @author zhixin wen + * version: 1.11.0 + * https://github.com/wenzhixin/bootstrap-table/ + */ +(function(j){var k=null;var m=function(u){var s=arguments,r=true,t=1;u=u.replace(/%s/g,function(){var v=s[t++];if(typeof v==="undefined"){r=false;return""}return v});return r?u:""};var c=function(t,v,u,s){var r="";j.each(t,function(w,x){if(x[v]===s){r=x[u];return false}return true});return r};var i=function(s,t){var r=-1;j.each(s,function(u,v){if(v.field===t){r=u;return false}return true});return r};var l=function(u){var y,x,w,A=0,B=[];for(y=0;y").addClass("fixed-table-scroll-inner"),u=j("
    ").addClass("fixed-table-scroll-outer"),s,r;u.append(t);j("body").append(u);s=t[0].offsetWidth;u.css("overflow","scroll");r=t[0].offsetWidth;if(s===r){r=u[0].clientWidth}u.remove();k=s-r}return k};var q=function(s,u,t,r){var v=u;if(typeof u==="string"){var w=u.split(".");if(w.length>1){v=window;j.each(w,function(x,y){v=v[y]})}else{v=window[u]}}if(typeof v==="object"){return v}if(typeof v==="function"){return v.apply(s,t)}if(!v&&typeof u==="string"&&m.apply(this,[u].concat(t))){return m.apply(this,[u].concat(t))}return r};var f=function(s,r,w){var x=Object.getOwnPropertyNames(s),u=Object.getOwnPropertyNames(r),v="";if(w){if(x.length!==u.length){return false}}for(var t=0;t-1){if(s[v]!==r[v]){return false}}}return true};var p=function(r){if(typeof r==="string"){return r.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`")}return r};var d=function(s){var r=0;s.children().each(function(){if(r0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var h=function(){if(!Object.keys){Object.keys=(function(){var t=Object.prototype.hasOwnProperty,u=!({toString:null}).propertyIsEnumerable("toString"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=s.length;return function(x){if(typeof x!=="object"&&(typeof x!=="function"||x===null)){throw new TypeError("Object.keys called on non-object")}var v=[],y,w;for(y in x){if(t.call(x,y)){v.push(y)}}if(u){for(w=0;w','
    ',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'
    ':"",'
    ','
    ','
    ','
    ',this.options.formatLoadingMessage(),"
    ","
    ",'',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'
    ':"","
    ","
    "].join(""));this.$container.insertAfter(this.$el);this.$tableContainer=this.$container.find(".fixed-table-container");this.$tableHeader=this.$container.find(".fixed-table-header");this.$tableBody=this.$container.find(".fixed-table-body");this.$tableLoading=this.$container.find(".fixed-table-loading");this.$tableFooter=this.$container.find(".fixed-table-footer");this.$toolbar=this.$container.find(".fixed-table-toolbar");this.$pagination=this.$container.find(".fixed-table-pagination");this.$tableBody.append(this.$el);this.$container.after('
    ');this.$el.addClass(this.options.classes);if(this.options.striped){this.$el.addClass("table-striped")}if(j.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};e.prototype.initTable=function(){var t=this,s=[],u=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=j("").appendTo(this.$el)}this.$header.find("tr").each(function(){var v=[];j(this).find("th").each(function(){if(typeof j(this).data("field")!=="undefined"){j(this).data("field",j(this).data("field")+"")}v.push(j.extend({},{title:j(this).html(),"class":j(this).attr("class"),titleTooltip:j(this).attr("title"),rowspan:j(this).attr("rowspan")?+j(this).attr("rowspan"):undefined,colspan:j(this).attr("colspan")?+j(this).attr("colspan"):undefined},j(this).data()))});s.push(v)});if(!j.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=j.extend(true,[],s,this.options.columns);this.columns=[];l(this.options.columns);j.each(this.options.columns,function(w,v){j.each(v,function(x,y){y=j.extend({},e.COLUMN_DEFAULTS,y);if(typeof y.fieldIndex!=="undefined"){t.columns[y.fieldIndex]=y}t.options.columns[w][x]=y})});if(this.options.data.length){return}var r=[];this.$el.find(">tbody>tr").each(function(w){var v={};v._id=j(this).attr("id");v._class=j(this).attr("class");v._data=g(j(this).data());j(this).find(">td").each(function(z){var E=j(this),B=+E.attr("colspan")||1,C=+E.attr("rowspan")||1,A,y;for(;r[w]&&r[w][z];z++){}for(A=z;A");if(v===0&&!t.options.cardView&&t.options.detailView){s.push(m('
    ',t.options.columns.length))}j.each(u,function(B,A){var F="",C="",E="",w="",D=m(' class="%s"',A["class"]),z=t.options.sortOrder||A.order,y="px",x=A.width;if(A.width!==undefined&&(!t.options.cardView)){if(typeof A.width==="string"){if(A.width.indexOf("%")!==-1){y="%"}}}if(A.width&&typeof A.width==="string"){x=A.width.replace("%","").replace("px","")}C=m("text-align: %s; ",A.halign?A.halign:A.align);E=m("text-align: %s; ",A.align);w=m("vertical-align: %s; ",A.valign);w+=m("width: %s; ",(A.checkbox||A.radio)&&!x?"36px":(x?x+y:undefined));if(typeof A.fieldIndex!=="undefined"){t.header.fields[A.fieldIndex]=A.field;t.header.styles[A.fieldIndex]=E+w;t.header.classes[A.fieldIndex]=D;t.header.formatters[A.fieldIndex]=A.formatter;t.header.events[A.fieldIndex]=A.events;t.header.sorters[A.fieldIndex]=A.sorter;t.header.sortNames[A.fieldIndex]=A.sortName;t.header.cellStyles[A.fieldIndex]=A.cellStyle;t.header.searchables[A.fieldIndex]=A.searchable;if(!A.visible){return}if(t.options.cardView&&(!A.cardVisible)){return}r[A.field]=A}s.push("");s.push(m('
    ',t.options.sortable&&A.sortable?"sortable both":""));F=A.title;if(A.checkbox){if(!t.options.singleSelect&&t.options.checkboxHeader){F=''}t.header.stateField=A.field}if(A.radio){F="";t.header.stateField=A.field;t.options.singleSelect=true}s.push(F);s.push("
    ");s.push('
    ');s.push("
    ");s.push("")});s.push("")});this.$header.html(s.join(""));this.$header.find("th[data-field]").each(function(u){j(this).data(r[j(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(u){var v=j(this);if(t.options.detailView){if(v.closest(".bootstrap-table")[0]!==t.$container[0]){return false}}if(t.options.sortable&&v.parent().data().sortable){t.onSort(u)}});this.$header.children().children().off("keypress").on("keypress",function(v){if(t.options.sortable&&j(this).data().sortable){var u=v.keyCode||v.which;if(u==13){t.onSort(v)}}});j(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();j(window).on("resize.bootstrap-table",j.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var u=j(this).prop("checked");t[u?"checkAll":"uncheckAll"]();t.updateSelected()})};e.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};e.prototype.initData=function(s,r){if(r==="append"){this.data=this.data.concat(s)}else{if(r==="prepend"){this.data=[].concat(s).concat(this.data)}else{this.data=s||this.options.data}}if(r==="append"){this.options.data=this.options.data.concat(s)}else{if(r==="prepend"){this.options.data=[].concat(s).concat(this.options.data)}else{this.options.data=this.data}}if(this.options.sidePagination==="server"){return}this.initSort()};e.prototype.initSort=function(){var u=this,t=this.options.sortName,r=this.options.sortOrder==="desc"?-1:1,s=j.inArray(this.options.sortName,this.header.fields);if(this.options.customSort!==j.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(s!==-1){if(this.options.sortStable){j.each(this.data,function(v,w){if(!w.hasOwnProperty("_position")){w._position=v}})}this.data.sort(function(w,v){if(u.header.sortNames[s]){t=u.header.sortNames[s]}var y=o(w,t,u.options.escape),z=o(v,t,u.options.escape),x=q(u.header,u.header.sorters[s],[y,z]);if(x!==undefined){return r*x}if(y===undefined||y===null){y=""}if(z===undefined||z===null){z=""}if(u.options.sortStable&&y===z){y=w._position;z=v._position}if(j.isNumeric(y)&&j.isNumeric(z)){y=parseFloat(y);z=parseFloat(z);if(y
    ',this.options.toolbarAlign)).appendTo(this.$toolbar).append(j(this.options.toolbar))}t=[m('
    ',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=q(null,this.options.icons)}if(this.options.showSearch){t.push(m('")}if(this.options.showPaginationSwitch){t.push(m('")}if(this.options.showRefresh){t.push(m('")}if(this.options.showToggle){t.push(m('")}if(this.options.showColumns){t.push(m('
    ',this.options.formatColumns()),'",'","
    ")}t.push("
    ");if(this.showToolbar||t.length>2){this.$toolbar.append(t.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",j.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",j.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){u.toggleView()})}if(this.options.showSearch){this.$toolbar.find('button[name="showSearch"]').off("click").on("click",function(){j(this).parents(".select-table").siblings().slideToggle()})}if(this.options.showColumns){s=this.$toolbar.find(".keep-open");if(r<=this.options.minimumCountColumns){s.find("input").prop("disabled",true)}s.find("li").off("click").on("click",function(x){x.stopImmediatePropagation()});s.find("input").off("click").on("click",function(){var x=j(this);u.toggleColumn(j(this).val(),x.prop("checked"),false);u.trigger("column-switch",j(this).data("field"),x.prop("checked"))})}if(this.options.search){t=[];t.push('");this.$toolbar.append(t.join(""));v=this.$toolbar.find(".search input");v.off("keyup drop").on("keyup drop",function(x){if(u.options.searchOnEnterKey&&x.keyCode!==13){return}if(j.inArray(x.keyCode,[37,38,39,40])>-1){return}clearTimeout(w);w=setTimeout(function(){u.onSearch(x)},u.options.searchTimeOut)});if(b()){v.off("mouseup").on("mouseup",function(x){clearTimeout(w);w=setTimeout(function(){u.onSearch(x)},u.options.searchTimeOut)})}}};e.prototype.onSearch=function(r){var s=j.trim(j(r.currentTarget).val());if(this.options.trimOnSearch&&j(r.currentTarget).val()!==s){j(r.currentTarget).val(s)}if(s===this.searchText){return}this.searchText=s;this.options.searchText=s;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",s)};e.prototype.initSearch=function(){var t=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==j.noop){this.options.customSearch.apply(this,[this.searchText]);return}var r=this.searchText&&(this.options.escape?p(this.searchText):this.searchText).toLowerCase();var u=j.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=u?j.grep(this.options.data,function(w,v){for(var s in u){if(j.isArray(u[s])&&j.inArray(w[s],u[s])===-1||w[s]!==u[s]){return false}}return true}):this.options.data;this.data=r?j.grep(this.data,function(A,x){for(var v=0;v-1){r=true}}}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1;this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages){this.options.pageNumber=this.totalPages}this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1;this.pageTo=this.options.pageNumber*this.options.pageSize;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}x.push('
    ','',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"");if(!this.options.onlyInfoPagination){x.push('');var F=[m('',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'",'");x.push(this.options.formatRecordsPerPage(F.join("")));x.push("");x.push("
    ",'")}this.$pagination.html(x.join(""));if(!this.options.onlyInfoPagination){w=this.$pagination.find(".page-list a");G=this.$pagination.find(".page-first");I=this.$pagination.find(".page-pre");E=this.$pagination.find(".page-next");y=this.$pagination.find(".page-last");u=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(t.length<2||this.options.totalRows<=t[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(r){this.options.pageSize=this.options.formatAllRows()}w.off("click").on("click",j.proxy(this.onPageListChange,this));G.off("click").on("click",j.proxy(this.onPageFirst,this));I.off("click").on("click",j.proxy(this.onPagePre,this));E.off("click").on("click",j.proxy(this.onPageNext,this));y.off("click").on("click",j.proxy(this.onPageLast,this));u.off("click").on("click",j.proxy(this.onPageNumber,this))}if(this.options.showPageGo){var v=this,C=this.$pagination.find("ul.pagination"),B=C.find("li.pageGo");if(!B.length){B=j(['
  • ',m('',this.options.pageNumber),'","
  • "].join("")).appendTo(C);B.find("button").click(function(){var K=parseInt(B.find("input").val())||1;if(K<1||K>v.options.totalPages){K=1}v.selectPage(K)})}}};e.prototype.updatePagination=function(r){if(r&&j(r.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};e.prototype.onPageListChange=function(r){var s=j(r.currentTarget);s.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=s.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+s.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(r)};e.prototype.onPageFirst=function(r){this.options.pageNumber=1;this.updatePagination(r)};e.prototype.onPagePre=function(r){if((this.options.pageNumber-1)===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(r)};e.prototype.onPageNext=function(r){if((this.options.pageNumber+1)>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(r)};e.prototype.onPageLast=function(r){this.options.pageNumber=this.totalPages;this.updatePagination(r)};e.prototype.onPageNumber=function(r){if(this.options.pageNumber===+j(r.currentTarget).text()){return}this.options.pageNumber=+j(r.currentTarget).text();this.updatePagination(r)};e.prototype.initBody=function(x){var z=this,y=[],v=this.getData();this.trigger("pre-body",v);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=j("").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=v.length}for(var w=this.pageFrom-1;w");if(this.options.cardView){y.push(m('
    ',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){y.push("",'',m('',this.options.iconsPrefix,this.options.icons.detailOpen),"","")}j.each(this.header.fields,function(I,L){var P="",M=o(C,L,z.options.escape),K="",E={},Q="",J=z.header.classes[I],G="",O="",R="",H="",F=z.columns[I];if(z.fromHtml&&typeof M==="undefined"){return}if(!F.visible){return}if(z.options.cardView&&!F.cardVisible){return}r=m('style="%s"',s.concat(z.header.styles[I]).join("; "));if(C["_"+L+"_id"]){Q=m(' id="%s"',C["_"+L+"_id"])}if(C["_"+L+"_class"]){J=m(' class="%s"',C["_"+L+"_class"])}if(C["_"+L+"_rowspan"]){O=m(' rowspan="%s"',C["_"+L+"_rowspan"])}if(C["_"+L+"_colspan"]){R=m(' colspan="%s"',C["_"+L+"_colspan"])}if(C["_"+L+"_title"]){H=m(' title="%s"',C["_"+L+"_title"])}E=q(z.header,z.header.cellStyles[I],[M,C,w,L],E);if(E.classes){J=m(' class="%s"',E.classes)}if(E.css){var D=[];for(var N in E.css){D.push(N+": "+E.css[N])}r=m('style="%s"',D.concat(z.header.styles[I]).join("; "))}M=q(F,z.header.formatters[I],[M,C,w],M);if(C["_"+L+"_data"]&&!j.isEmptyObject(C["_"+L+"_data"])){j.each(C["_"+L+"_data"],function(T,S){if(T==="index"){return}G+=m(' data-%s="%s"',T,S)})}if(F.checkbox||F.radio){K=F.checkbox?"checkbox":K;K=F.radio?"radio":K;P=[m(z.options.cardView?'
    ':'',F["class"]||""),"",z.header.formatters[I]&&typeof M==="string"?M:"",z.options.cardView?"
    ":""].join("");C[z.header.stateField]=M===true||(M&&M.checked)}else{M=typeof M==="undefined"||M===null?z.options.undefinedText:M;P=z.options.cardView?['
    ',z.options.showHeader?m('%s',r,c(z.columns,"field","title",L)):"",m('%s',M),"
    "].join(""):[m("",Q,J,r,G,O,R,H),M,""].join("");if(z.options.cardView&&z.options.smartDisplay&&M===""){P='
    '}}y.push(P)});if(this.options.cardView){y.push("
    ")}y.push("")}if(!y.length){y.push('',m('%s',this.$header.find("th").length,this.options.formatNoMatches()),"")}this.$body.html(y.join(""));if(!x){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(J){var D=j(this),F=D.parent(),M=z.data[F.data("index")],H=D[0].cellIndex,G=z.getVisibleFields(),K=G[z.options.detailView&&!z.options.cardView?H-1:H],E=z.columns[i(z.columns,K)],L=o(M,K,z.options.escape);if(D.find(".detail-icon").length){return}z.trigger(J.type==="click"?"click-cell":"dbl-click-cell",K,L,M,D);z.trigger(J.type==="click"?"click-row":"dbl-click-row",M,F,K);if(J.type==="click"&&z.options.clickToSelect&&E.clickToSelect){var I=F.find(m('[name="%s"]',z.options.selectItemName));if(I.length){I[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var H=j(this),G=H.parent().parent(),E=G.data("index"),I=v[E];if(G.next().is("tr.detail-view")){H.find("i").attr("class",m("%s %s",z.options.iconsPrefix,z.options.icons.detailOpen));G.next().remove();z.trigger("collapse-row",E,I)}else{H.find("i").attr("class",m("%s %s",z.options.iconsPrefix,z.options.icons.detailClose));G.after(m('',G.find("td").length));var D=G.next().find("td");var F=q(z.options,z.options.detailFormatter,[E,I,D],"");if(D.length===1){D.append(F)}z.trigger("expand-row",E,I,D)}z.resetView()});this.$selectItem=this.$body.find(m('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(E){E.stopImmediatePropagation();var F=j(this),D=F.prop("checked"),G=z.data[F.data("index")];if(z.options.maintainSelected&&j(this).is(":radio")){j.each(z.options.data,function(H,I){I[z.header.stateField]=false})}G[z.header.stateField]=D;if(z.options.singleSelect){z.$selectItem.not(this).each(function(){z.data[j(this).data("index")][z.header.stateField]=false});z.$selectItem.filter(":checked").not(this).prop("checked",false)}z.updateSelected();z.trigger(D?"check":"uncheck",G,F)});j.each(this.header.events,function(G,F){if(!F){return}if(typeof F==="string"){F=q(null,F)}var H=z.header.fields[G],D=j.inArray(H,z.getVisibleFields());if(z.options.detailView&&!z.options.cardView){D+=1}for(var E in F){z.$body.find(">tr:not(.no-records-found)").each(function(){var M=j(this),N=M.find(z.options.cardView?".card-view":"td").eq(D),J=E.indexOf(" "),I=E.substring(0,J),K=E.substring(J+1),L=F[E];N.find(K).off(I).on(I,function(Q){var O=M.data("index"),R=z.data[O],P=R[H];L.apply(this,[Q,P,R,O])})})}});this.updateSelected();this.resetView();this.trigger("post-body",v)};e.prototype.initServer=function(r,w,s){var u=this,v={},x={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},t;if(this.options.pagination){x.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;x.pageNumber=this.options.pageNumber}if(!this.options.firstLoad&&!firstLoadTable.includes(this.options.id)){firstLoadTable.push(this.options.id);return}if(!(s||this.options.url)&&!this.options.ajax){return}if(this.options.queryParamsType==="limit"){x={search:x.searchText,sort:x.sortName,order:x.sortOrder};if(this.options.pagination){x.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);x.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize}}if(!(j.isEmptyObject(this.filterColumnsPartial))){x.filter=JSON.stringify(this.filterColumnsPartial,null)}v=q(this.options,this.options.queryParams,[x],v);j.extend(v,w||{});if(v===false){return}if(!r){this.$tableLoading.show()}t=j.extend({},q(null,this.options.ajaxOptions),{type:this.options.method,url:s||this.options.url,data:this.options.contentType==="application/json"&&this.options.method==="post"?JSON.stringify(v):v,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(y){y=q(u.options,u.options.responseHandler,[y],y);u.load(y);u.trigger("load-success",y);if(!r){u.$tableLoading.hide()}},error:function(y){u.trigger("load-error",y.status,y);if(!r){u.$tableLoading.hide()}}});if(this.options.ajax){q(this,this.options.ajax,[t],null)}else{if(this._xhr&&this._xhr.readyState!==4){this._xhr.abort()}this._xhr=j.ajax(t)}};e.prototype.initSearchText=function(){if(this.options.search){if(this.options.searchText!==""){var r=this.$toolbar.find(".search input");r.val(this.options.searchText);this.onSearch({currentTarget:r})}}};e.prototype.getCaret=function(){var r=this;j.each(this.$header.find("th"),function(s,t){j(t).find(".sortable").removeClass("desc asc").addClass((j(t).data("field")===r.options.sortName||j(t).data("sortName")===r.options.sortName)?r.options.sortOrder:"both")})};e.prototype.updateSelected=function(){var r=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;var s=j(".left-fixed-table-columns input[name=btSelectItem]");if(s.length>0){r=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===s.filter(":enabled").filter(":checked").length}this.$selectAll.add(this.$selectAll_).prop("checked",r);this.$selectItem.each(function(){j(this).closest("tr")[j(this).prop("checked")?"addClass":"removeClass"]("selected")})};e.prototype.updateRows=function(){var r=this;this.$selectItem.each(function(){r.data[j(this).data("index")][r.header.stateField]=j(this).prop("checked")})};e.prototype.resetRows=function(){var r=this;j.each(this.data,function(s,t){r.$selectAll.prop("checked",false);r.$selectItem.prop("checked",false);if(r.header.stateField){t[r.header.stateField]=false}})};e.prototype.trigger=function(s){var r=Array.prototype.slice.call(arguments,1);s+=".bs.table";this.options[e.EVENTS[s]].apply(this.options,r);this.$el.trigger(j.Event(s),r);this.options.onAll(s,r);this.$el.trigger(j.Event("all.bs.table"),[s,r])};e.prototype.resetHeader=function(){clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout(j.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)};e.prototype.fitHeader=function(){var t=this,u,r,x,y;if(t.$el.is(":hidden")){t.timeoutId_=setTimeout(j.proxy(t.fitHeader,t),100);return}u=this.$tableBody.get(0);r=u.scrollWidth>u.clientWidth&&u.scrollHeight>u.clientHeight+this.$header.outerHeight()?a():0;this.$el.css("margin-top",-this.$header.outerHeight());x=j(":focus");if(x.length>0){var z=x.parents("th");if(z.length>0){var A=z.attr("data-field");if(A!==undefined){var s=this.$header.find("[data-field='"+A+"']");if(s.length>0){s.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":r}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);y=j(".focus-temp:visible:eq(0)");if(y.length>0){y.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(B){t.$header_.find(m('th[data-field="%s"]',j(this).data("field"))).data(j(this).data())});var w=this.getVisibleFields(),v=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(C){var E=j(this),B=C;if(t.options.detailView&&!t.options.cardView){if(C===0){t.$header_.find("th.detail").find(".fht-cell").width(E.innerWidth())}B=C-1}var D=t.$header_.find(m('th[data-field="%s"]',w[B]));if(D.length>1){D=j(v[E[0].cellIndex])}D.find(".fht-cell").width(E.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){t.$tableHeader.scrollLeft(j(this).scrollLeft());if(t.options.showFooter&&!t.options.cardView){t.$tableFooter.scrollLeft(j(this).scrollLeft())}});t.trigger("post-header")};e.prototype.resetFooter=function(){var s=this,t=s.getData(),r=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){r.push('
     
    ')}j.each(this.columns,function(x,z){var w,B="",v="",A=[],y={},u=m(' class="%s"',z["class"]);if(!z.visible){return}if(s.options.cardView&&(!z.cardVisible)){return}B=m("text-align: %s; ",z.falign?z.falign:z.align);v=m("vertical-align: %s; ",z.valign);y=q(null,s.options.footerStyle);if(y&&y.css){for(w in y.css){A.push(w+": "+y.css[w])}}r.push("");r.push('
    ');r.push(q(z,z.footerFormatter,[t]," ")||" ");r.push("
    ");r.push('
    ');r.push("");r.push("")});this.$tableFooter.find("tr").html(r.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout(j.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};e.prototype.fitFooter=function(){var u=this,r,t,s;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout(j.proxy(this.fitFooter,this),100);return}t=this.$el.css("width");s=t>this.$tableBody.width()?a():0;this.$tableFooter.css({"margin-right":s}).find("table").css("width",t).attr("class",this.$el.attr("class"));r=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(v){var w=j(this);r.eq(v).find(".fht-cell").width(w.innerWidth())})};e.prototype.toggleColumn=function(r,s,u){if(r===-1){return}this.columns[r].visible=s;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var t=this.$toolbar.find(".keep-open input").prop("disabled",false);if(u){t.filter(m('[value="%s"]',r)).prop("checked",s)}if(t.filter(":checked").length<=this.options.minimumCountColumns){t.filter(":checked").prop("disabled",true)}}};e.prototype.toggleRow=function(r,t,s){if(r===-1){return}this.$body.find(typeof r!=="undefined"?m('tr[data-index="%s"]',r):m('tr[data-uniqueid="%s"]',t))[s?"show":"hide"]()};e.prototype.getVisibleFields=function(){var s=this,r=[];j.each(this.header.fields,function(t,v){var u=s.columns[i(s.columns,v)];if(!u.visible){return}r.push(v)});return r};e.prototype.resetView=function(u){var s=0;if(u&&u.height){this.options.height=u.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var t=d(this.$toolbar),v=d(this.$pagination),r=this.options.height-t-v;this.$tableContainer.css("height",r+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();s+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){s+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",s+"px");this.trigger("reset-view")};e.prototype.getData=function(r){return(this.searchText||!j.isEmptyObject(this.filterColumns)||!j.isEmptyObject(this.filterColumnsPartial))?(r?this.data.slice(this.pageFrom-1,this.pageTo):this.data):(r?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data)};e.prototype.load=function(s){var r=false;if(this.options.sidePagination==="server"){this.options.totalRows=s.total;r=s.fixedScroll;s=s[this.options.dataField]}else{if(!j.isArray(s)){r=s.fixedScroll;s=s.data}}this.initData(s);this.initSearch();this.initPagination();this.initBody(r)};e.prototype.append=function(r){this.initData(r,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.prepend=function(r){this.initData(r,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.remove=function(u){var r=this.options.data.length,s,t;if(!u.hasOwnProperty("field")||!u.hasOwnProperty("values")){return}for(s=r-1;s>=0;s--){t=this.options.data[s];if(!t.hasOwnProperty(u.field)){continue}if(j.inArray(t[u.field],u.values)!==-1){this.options.data.splice(s,1)}}if(r===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};e.prototype.getRowByUniqueId=function(x){var w=this.options.uniqueId,r=this.options.data.length,s=null,t,v,u;for(t=r-1;t>=0;t--){v=this.options.data[t];if(v.hasOwnProperty(w)){u=v[w]}else{if(v._data.hasOwnProperty(w)){u=v._data[w]}else{continue}}if(typeof u==="string"){x=x.toString()}else{if(typeof u==="number"){if((Number(u)===u)&&(u%1===0)){x=parseInt(x)}else{if((u===Number(u))&&(u!==0)){x=parseFloat(x)}}}}if(u===x){s=v;break}}return s};e.prototype.removeByUniqueId=function(t){var r=this.options.data.length,s=this.getRowByUniqueId(t);if(s){this.options.data.splice(this.options.data.indexOf(s),1)}if(r===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};e.prototype.updateByUniqueId=function(t){var r=this;var s=j.isArray(t)?t:[t];j.each(s,function(u,w){var v;if(!w.hasOwnProperty("id")||!w.hasOwnProperty("row")){return}v=j.inArray(r.getRowByUniqueId(w.id),r.options.data);if(v===-1){return}j.extend(r.options.data[v],w.row)});this.initSearch();this.initSort();this.initBody(true)};e.prototype.insertRow=function(r){if(!r.hasOwnProperty("index")||!r.hasOwnProperty("row")){return}this.data.splice(r.index,0,r.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};e.prototype.updateRow=function(t){var r=this;var s=j.isArray(t)?t:[t];j.each(s,function(u,v){if(!v.hasOwnProperty("index")||!v.hasOwnProperty("row")){return}j.extend(r.options.data[v.index],v.row)});this.initSearch();this.initSort();this.initBody(true)};e.prototype.showRow=function(r){if(!r.hasOwnProperty("index")&&!r.hasOwnProperty("uniqueId")){return}this.toggleRow(r.index,r.uniqueId,true)};e.prototype.hideRow=function(r){if(!r.hasOwnProperty("index")&&!r.hasOwnProperty("uniqueId")){return}this.toggleRow(r.index,r.uniqueId,false)};e.prototype.getRowsHidden=function(r){var t=j(this.$body[0]).children().filter(":hidden"),s=0;if(r){for(;str"),r;if(this.options.detailView&&!this.options.cardView){t+=1}r=x.eq(y).find(">td").eq(t);if(y<0||t<0||y>=this.data.length){return}for(w=y;wtd").eq(v).hide()}}r.attr("rowspan",u).attr("colspan",s).show()};e.prototype.updateCell=function(r){if(!r.hasOwnProperty("index")||!r.hasOwnProperty("field")||!r.hasOwnProperty("value")){return}this.data[r.index][r.field]=r.value;if(r.reinit===false){return}this.initSort();this.initBody(true)};e.prototype.getOptions=function(){return this.options};e.prototype.getSelections=function(){var r=this;return j.grep(this.options.data,function(s){return s[r.header.stateField]})};e.prototype.getAllSelections=function(){var r=this;return j.grep(this.options.data,function(s){return s[r.header.stateField]})};e.prototype.checkAll=function(){this.checkAll_(true)};e.prototype.uncheckAll=function(){this.checkAll_(false)};e.prototype.checkInvert=function(){var s=this;var t=s.$selectItem.filter(":enabled");var r=t.filter(":checked");t.each(function(){j(this).prop("checked",!j(this).prop("checked"))});s.updateRows();s.updateSelected();s.trigger("uncheck-some",r);r=s.getSelections();s.trigger("check-some",r)};e.prototype.checkAll_=function(r){var s;if(!r){s=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",r);this.$selectItem.filter(":enabled").prop("checked",r);this.updateRows();if(r){s=this.getSelections()}this.trigger(r?"check-all":"uncheck-all",s)};e.prototype.check=function(r){this.check_(true,r) };e.prototype.uncheck=function(r){this.check_(false,r)};e.prototype.check_=function(t,r){var s=this.$selectItem.filter(m('[data-index="%s"]',r)).prop("checked",t);this.data[r][this.header.stateField]=t;this.updateSelected();this.trigger(t?"check":"uncheck",this.data[r],s)};e.prototype.checkBy=function(r){this.checkBy_(true,r)};e.prototype.uncheckBy=function(r){this.checkBy_(false,r)};e.prototype.checkBy_=function(s,u){if(!u.hasOwnProperty("field")||!u.hasOwnProperty("values")){return}var r=this,t=[];j.each(this.options.data,function(v,x){if(!x.hasOwnProperty(u.field)){return false}if(j.inArray(x[u.field],u.values)!==-1){var w=r.$selectItem.filter(":enabled").filter(m('[data-index="%s"]',v)).prop("checked",s);x[r.header.stateField]=s;t.push(x);r.trigger(s?"check":"uncheck",x,w)}});this.updateSelected();this.trigger(s?"check-some":"uncheck-some",t)};e.prototype.destroy=function(){this.$el.insertBefore(this.$container);j(this.options.toolbar).insertBefore(this.$el);this.$container.next().remove();this.$container.remove();this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")};e.prototype.showLoading=function(){this.$tableLoading.show()};e.prototype.hideLoading=function(){this.$tableLoading.hide()};e.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var r=this.$toolbar.find('button[name="paginationSwitch"] i');if(this.options.pagination){r.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown)}else{r.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp)}this.updatePagination()};e.prototype.refresh=function(r){if(r&&r.url){this.options.pageNumber=1}table.rememberSelecteds={};table.rememberSelectedIds={};this.initServer(r&&r.silent,r&&r.query,r&&r.url);this.trigger("refresh",r)};e.prototype.resetWidth=function(){if(this.options.showHeader&&this.options.height){this.fitHeader()}if(this.options.showFooter){this.fitFooter()}};e.prototype.showColumn=function(r){this.toggleColumn(i(this.columns,r),true,true)};e.prototype.hideColumn=function(r){this.toggleColumn(i(this.columns,r),false,true)};e.prototype.getHiddenColumns=function(){return j.grep(this.columns,function(r){return !r.visible})};e.prototype.getVisibleColumns=function(){return j.grep(this.columns,function(r){return r.visible})};e.prototype.toggleAllColumns=function(r){j.each(this.columns,function(t,u){this.columns[t].visible=r});this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var s=this.$toolbar.find(".keep-open input").prop("disabled",false);if(s.filter(":checked").length<=this.options.minimumCountColumns){s.filter(":checked").prop("disabled",true)}}};e.prototype.showAllColumns=function(){this.toggleAllColumns(true)};e.prototype.hideAllColumns=function(){this.toggleAllColumns(false)};e.prototype.filterBy=function(r){this.filterColumns=j.isEmptyObject(r)?{}:r;this.options.pageNumber=1;this.initSearch();this.updatePagination()};e.prototype.scrollTo=function(r){if(typeof r==="string"){r=r==="bottom"?this.$tableBody[0].scrollHeight:0}if(typeof r==="number"){this.$tableBody.scrollTop(r)}if(typeof r==="undefined"){return this.$tableBody.scrollTop()}};e.prototype.getScrollPosition=function(){return this.scrollTo()};e.prototype.selectPage=function(r){if(r>0&&r<=this.options.totalPages){this.options.pageNumber=r;this.updatePagination()}};e.prototype.prevPage=function(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}};e.prototype.nextPage=function(){if(this.options.pageNumber tr[data-index="%s"]',r));if(t.next().is("tr.detail-view")===(s?false:true)){t.find("> td > .detail-icon").click()}};e.prototype.expandRow=function(r){this.expandRow_(true,r)};e.prototype.collapseRow=function(r){this.expandRow_(false,r)};e.prototype.expandAllRows=function(r){if(r){var w=this.$body.find(m('> tr[data-index="%s"]',0)),x=this,u=null,v=false,s=-1;if(!w.next().is("tr.detail-view")){w.find("> td > .detail-icon").click();v=true}else{if(!w.next().next().is("tr.detail-view")){w.next().find(".detail-icon").click();v=true}}if(v){try{s=setInterval(function(){u=x.$body.find("tr.detail-view").last().find(".detail-icon");if(u.length>0){u.click()}else{clearInterval(s)}},1)}catch(z){clearInterval(s)}}}else{var y=this.$body.children();for(var t=0;t div { - display: none; -} -.datepicker.days div.datepicker-days { - display: block; -} -.datepicker.months div.datepicker-months { - display: block; -} -.datepicker.years div.datepicker-years { - display: block; -} -.datepicker table { - margin: 0; -} -.datepicker td, -.datepicker th { - text-align: center; - width: 20px; - height: 20px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border: none; -} -.table-striped .datepicker table tr td, -.table-striped .datepicker table tr th { - background-color: transparent; -} -.datepicker table tr td.day:hover { - background: #eeeeee; - cursor: pointer; -} -.datepicker table tr td.old, -.datepicker table tr td.new { - color: #999999; -} -.datepicker table tr td.disabled, -.datepicker table tr td.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td.today, -.datepicker table tr td.today:hover, -.datepicker table tr td.today.disabled, -.datepicker table tr td.today.disabled:hover { - background-color: #fde19a; - background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); - background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); - background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); - background-image: linear-gradient(top, #fdd49a, #fdf59a); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); - border-color: #fdf59a #fdf59a #fbed50; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #000; -} -.datepicker table tr td.today:hover, -.datepicker table tr td.today:hover:hover, -.datepicker table tr td.today.disabled:hover, -.datepicker table tr td.today.disabled:hover:hover, -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active, -.datepicker table tr td.today.disabled, -.datepicker table tr td.today:hover.disabled, -.datepicker table tr td.today.disabled.disabled, -.datepicker table tr td.today.disabled:hover.disabled, -.datepicker table tr td.today[disabled], -.datepicker table tr td.today:hover[disabled], -.datepicker table tr td.today.disabled[disabled], -.datepicker table tr td.today.disabled:hover[disabled] { - background-color: #fdf59a; -} -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active { - background-color: #fbf069 \9; -} -.datepicker table tr td.today:hover:hover { - color: #000; -} -.datepicker table tr td.today.active:hover { - color: #fff; -} -.datepicker table tr td.range, -.datepicker table tr td.range:hover, -.datepicker table tr td.range.disabled, -.datepicker table tr td.range.disabled:hover { - background: #eeeeee; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.datepicker table tr td.range.today, -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today.disabled:hover { - background-color: #f3d17a; - background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a)); - background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a); - background-image: -o-linear-gradient(top, #f3c17a, #f3e97a); - background-image: linear-gradient(top, #f3c17a, #f3e97a); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0); - border-color: #f3e97a #f3e97a #edde34; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today:hover:hover, -.datepicker table tr td.range.today.disabled:hover, -.datepicker table tr td.range.today.disabled:hover:hover, -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active, -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today:hover.disabled, -.datepicker table tr td.range.today.disabled.disabled, -.datepicker table tr td.range.today.disabled:hover.disabled, -.datepicker table tr td.range.today[disabled], -.datepicker table tr td.range.today:hover[disabled], -.datepicker table tr td.range.today.disabled[disabled], -.datepicker table tr td.range.today.disabled:hover[disabled] { - background-color: #f3e97a; -} -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active { - background-color: #efe24b \9; -} -.datepicker table tr td.selected, -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected.disabled:hover { - background-color: #9e9e9e; - background-image: -moz-linear-gradient(top, #b3b3b3, #808080); - background-image: -ms-linear-gradient(top, #b3b3b3, #808080); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080)); - background-image: -webkit-linear-gradient(top, #b3b3b3, #808080); - background-image: -o-linear-gradient(top, #b3b3b3, #808080); - background-image: linear-gradient(top, #b3b3b3, #808080); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0); - border-color: #808080 #808080 #595959; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected:hover:hover, -.datepicker table tr td.selected.disabled:hover, -.datepicker table tr td.selected.disabled:hover:hover, -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active, -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected:hover.disabled, -.datepicker table tr td.selected.disabled.disabled, -.datepicker table tr td.selected.disabled:hover.disabled, -.datepicker table tr td.selected[disabled], -.datepicker table tr td.selected:hover[disabled], -.datepicker table tr td.selected.disabled[disabled], -.datepicker table tr td.selected.disabled:hover[disabled] { - background-color: #808080; -} -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active { - background-color: #666666 \9; -} -.datepicker table tr td.active, -.datepicker table tr td.active:hover, -.datepicker table tr td.active.disabled, -.datepicker table tr td.active.disabled:hover { - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.active:hover, -.datepicker table tr td.active:hover:hover, -.datepicker table tr td.active.disabled:hover, -.datepicker table tr td.active.disabled:hover:hover, -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active, -.datepicker table tr td.active.disabled, -.datepicker table tr td.active:hover.disabled, -.datepicker table tr td.active.disabled.disabled, -.datepicker table tr td.active.disabled:hover.disabled, -.datepicker table tr td.active[disabled], -.datepicker table tr td.active:hover[disabled], -.datepicker table tr td.active.disabled[disabled], -.datepicker table tr td.active.disabled:hover[disabled] { - background-color: #0044cc; -} -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active { - background-color: #003399 \9; -} -.datepicker table tr td span { - display: block; - width: 23%; - height: 54px; - line-height: 54px; - float: left; - margin: 1%; - cursor: pointer; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.datepicker table tr td span:hover { - background: #eeeeee; -} -.datepicker table tr td span.disabled, -.datepicker table tr td span.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td span.active, -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active.disabled:hover { - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active:hover:hover, -.datepicker table tr td span.active.disabled:hover, -.datepicker table tr td span.active.disabled:hover:hover, -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active, -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active:hover.disabled, -.datepicker table tr td span.active.disabled.disabled, -.datepicker table tr td span.active.disabled:hover.disabled, -.datepicker table tr td span.active[disabled], -.datepicker table tr td span.active:hover[disabled], -.datepicker table tr td span.active.disabled[disabled], -.datepicker table tr td span.active.disabled:hover[disabled] { - background-color: #0044cc; -} -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active { - background-color: #003399 \9; -} -.datepicker table tr td span.old, -.datepicker table tr td span.new { - color: #999999; -} -.datepicker th.datepicker-switch { - width: 145px; -} -.datepicker thead tr:first-child th, -.datepicker tfoot tr th { - cursor: pointer; -} -.datepicker thead tr:first-child th:hover, -.datepicker tfoot tr th:hover { - background: #eeeeee; -} -.datepicker .cw { - font-size: 10px; - width: 12px; - padding: 0 2px 0 5px; - vertical-align: middle; -} -.datepicker thead tr:first-child th.cw { - cursor: default; - background-color: transparent; -} -.input-append.date .add-on i, -.input-prepend.date .add-on i { - display: block; - cursor: pointer; - width: 16px; - height: 16px; -} -.input-daterange input { - text-align: center; -} -.input-daterange input:first-child { - -webkit-border-radius: 3px 0 0 3px; - -moz-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; -} -.input-daterange input:last-child { - -webkit-border-radius: 0 3px 3px 0; - -moz-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; -} -.input-daterange .add-on { - display: inline-block; - width: auto; - min-width: 16px; - height: 18px; - padding: 4px 5px; - font-weight: normal; - line-height: 18px; - text-align: center; - text-shadow: 0 1px 0 #ffffff; - vertical-align: middle; - background-color: #eeeeee; - border: 1px solid #ccc; - margin-left: -5px; - margin-right: -5px; +/*! X-editable - v1.5.1 +* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery +* http://github.com/vitalets/x-editable +* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */ +.editableform { + margin-bottom: 0; /* overwrites bootstrap margin */ +} + +.editableform .control-group { + margin-bottom: 0; /* overwrites bootstrap margin */ + white-space: nowrap; /* prevent wrapping buttons on new line */ + line-height: 20px; /* overwriting bootstrap line-height. See #133 */ +} + +/* + BS3 width:1005 for inputs breaks editable form in popup + See: https://github.com/vitalets/x-editable/issues/393 +*/ +.editableform .form-control { + width: auto; +} + +.editable-buttons { + display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ + vertical-align: top; + margin-left: 7px; + /* inline-block emulation for IE7*/ + zoom: 1; + *display: inline; +} + +.editable-buttons.editable-buttons-bottom { + display: block; + margin-top: 7px; + margin-left: 0; +} + +.editable-input { + vertical-align: top; + display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */ + width: auto; /* bootstrap-responsive has width: 100% that breakes layout */ + white-space: normal; /* reset white-space decalred in parent*/ + /* display-inline emulation for IE7*/ + zoom: 1; + *display: inline; +} + +.editable-buttons .editable-cancel { + margin-left: 7px; +} + +/*for jquery-ui buttons need set height to look more pretty*/ +.editable-buttons button.ui-button-icon-only { + height: 24px; + width: 30px; +} + +.editableform-loading { + background: url('loading.gif') center center no-repeat; + height: 25px; + width: auto; + min-width: 25px; +} + +.editable-inline .editableform-loading { + background-position: left 5px; +} + + .editable-error-block { + max-width: 300px; + margin: 5px 0 0 0; + width: auto; + white-space: normal; +} + +/*add padding for jquery ui*/ +.editable-error-block.ui-state-error { + padding: 3px; +} + +.editable-error { + color: red; +} + +/* ---- For specific types ---- */ + +.editableform .editable-date { + padding: 0; + margin: 0; + float: left; +} + +/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */ +.editable-inline .add-on .icon-th { + margin-top: 3px; + margin-left: 1px; +} + + +/* checklist vertical alignment */ +.editable-checklist label input[type="checkbox"], +.editable-checklist label span { + vertical-align: middle; + margin: 0; +} + +.editable-checklist label { + white-space: nowrap; +} + +/* set exact width of textarea to fit buttons toolbar */ +.editable-wysihtml5 { + width: 566px; + height: 250px; +} + +/* clear button shown as link in date inputs */ +.editable-clear { + clear: both; + font-size: 0.9em; + text-decoration: none; + text-align: right; +} + +/* IOS-style clear button for text inputs */ +.editable-clear-x { + background: url('clear.png') center center no-repeat; + display: block; + width: 13px; + height: 13px; + position: absolute; + opacity: 0.6; + z-index: 100; + + top: 50%; + right: 6px; + margin-top: -6px; + +} + +.editable-clear-x:hover { + opacity: 1; +} + +.editable-pre-wrapped { + white-space: pre-wrap; +} +.editable-container.editable-popup { + max-width: none !important; /* without this rule poshytip/tooltip does not stretch */ +} + +.editable-container.popover { + width: auto; /* without this rule popover does not stretch */ +} + +.editable-container.editable-inline { + display: inline-block; + vertical-align: middle; + width: auto; + /* inline-block emulation for IE7*/ + zoom: 1; + *display: inline; +} + +.editable-container.ui-widget { + font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */ + z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */ +} +.editable-click, +a.editable-click, +a.editable-click:hover { + text-decoration: none; + border-bottom: dashed 1px #0088cc; +} + +.editable-click.editable-disabled, +a.editable-click.editable-disabled, +a.editable-click.editable-disabled:hover { + color: #585858; + cursor: default; + border-bottom: none; +} + +.editable-empty, .editable-empty:hover, .editable-empty:focus{ + font-style: italic; + color: #DD1144; + /* border-bottom: none; */ + text-decoration: none; +} + +.editable-unsaved { + font-weight: bold; +} + +.editable-unsaved:after { +/* content: '*'*/ +} + +.editable-bg-transition { + -webkit-transition: background-color 1400ms ease-out; + -moz-transition: background-color 1400ms ease-out; + -o-transition: background-color 1400ms ease-out; + -ms-transition: background-color 1400ms ease-out; + transition: background-color 1400ms ease-out; +} + +/*see https://github.com/vitalets/x-editable/issues/139 */ +.form-horizontal .editable +{ + padding-top: 5px; + display:inline-block; +} + + +/*! + * Datepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +.datepicker { + padding: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + direction: ltr; + /*.dow { + border-top: 1px solid #ddd !important; + }*/ + +} +.datepicker-inline { + width: 220px; +} +.datepicker.datepicker-rtl { + direction: rtl; +} +.datepicker.datepicker-rtl table tr td span { + float: right; +} +.datepicker-dropdown { + top: 0; + left: 0; +} +.datepicker-dropdown:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 6px; +} +.datepicker-dropdown:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 7px; +} +.datepicker > div { + display: none; +} +.datepicker.days div.datepicker-days { + display: block; +} +.datepicker.months div.datepicker-months { + display: block; +} +.datepicker.years div.datepicker-years { + display: block; +} +.datepicker table { + margin: 0; +} +.datepicker td, +.datepicker th { + text-align: center; + width: 20px; + height: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + border: none; +} +.table-striped .datepicker table tr td, +.table-striped .datepicker table tr th { + background-color: transparent; +} +.datepicker table tr td.day:hover { + background: #eeeeee; + cursor: pointer; +} +.datepicker table tr td.old, +.datepicker table tr td.new { + color: #999999; +} +.datepicker table tr td.disabled, +.datepicker table tr td.disabled:hover { + background: none; + color: #999999; + cursor: default; +} +.datepicker table tr td.today, +.datepicker table tr td.today:hover, +.datepicker table tr td.today.disabled, +.datepicker table tr td.today.disabled:hover { + background-color: #fde19a; + background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); + background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); + background-image: linear-gradient(top, #fdd49a, #fdf59a); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); + border-color: #fdf59a #fdf59a #fbed50; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #000; +} +.datepicker table tr td.today:hover, +.datepicker table tr td.today:hover:hover, +.datepicker table tr td.today.disabled:hover, +.datepicker table tr td.today.disabled:hover:hover, +.datepicker table tr td.today:active, +.datepicker table tr td.today:hover:active, +.datepicker table tr td.today.disabled:active, +.datepicker table tr td.today.disabled:hover:active, +.datepicker table tr td.today.active, +.datepicker table tr td.today:hover.active, +.datepicker table tr td.today.disabled.active, +.datepicker table tr td.today.disabled:hover.active, +.datepicker table tr td.today.disabled, +.datepicker table tr td.today:hover.disabled, +.datepicker table tr td.today.disabled.disabled, +.datepicker table tr td.today.disabled:hover.disabled, +.datepicker table tr td.today[disabled], +.datepicker table tr td.today:hover[disabled], +.datepicker table tr td.today.disabled[disabled], +.datepicker table tr td.today.disabled:hover[disabled] { + background-color: #fdf59a; +} +.datepicker table tr td.today:active, +.datepicker table tr td.today:hover:active, +.datepicker table tr td.today.disabled:active, +.datepicker table tr td.today.disabled:hover:active, +.datepicker table tr td.today.active, +.datepicker table tr td.today:hover.active, +.datepicker table tr td.today.disabled.active, +.datepicker table tr td.today.disabled:hover.active { + background-color: #fbf069 \9; +} +.datepicker table tr td.today:hover:hover { + color: #000; +} +.datepicker table tr td.today.active:hover { + color: #fff; +} +.datepicker table tr td.range, +.datepicker table tr td.range:hover, +.datepicker table tr td.range.disabled, +.datepicker table tr td.range.disabled:hover { + background: #eeeeee; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.datepicker table tr td.range.today, +.datepicker table tr td.range.today:hover, +.datepicker table tr td.range.today.disabled, +.datepicker table tr td.range.today.disabled:hover { + background-color: #f3d17a; + background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a); + background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a)); + background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a); + background-image: -o-linear-gradient(top, #f3c17a, #f3e97a); + background-image: linear-gradient(top, #f3c17a, #f3e97a); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0); + border-color: #f3e97a #f3e97a #edde34; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.datepicker table tr td.range.today:hover, +.datepicker table tr td.range.today:hover:hover, +.datepicker table tr td.range.today.disabled:hover, +.datepicker table tr td.range.today.disabled:hover:hover, +.datepicker table tr td.range.today:active, +.datepicker table tr td.range.today:hover:active, +.datepicker table tr td.range.today.disabled:active, +.datepicker table tr td.range.today.disabled:hover:active, +.datepicker table tr td.range.today.active, +.datepicker table tr td.range.today:hover.active, +.datepicker table tr td.range.today.disabled.active, +.datepicker table tr td.range.today.disabled:hover.active, +.datepicker table tr td.range.today.disabled, +.datepicker table tr td.range.today:hover.disabled, +.datepicker table tr td.range.today.disabled.disabled, +.datepicker table tr td.range.today.disabled:hover.disabled, +.datepicker table tr td.range.today[disabled], +.datepicker table tr td.range.today:hover[disabled], +.datepicker table tr td.range.today.disabled[disabled], +.datepicker table tr td.range.today.disabled:hover[disabled] { + background-color: #f3e97a; +} +.datepicker table tr td.range.today:active, +.datepicker table tr td.range.today:hover:active, +.datepicker table tr td.range.today.disabled:active, +.datepicker table tr td.range.today.disabled:hover:active, +.datepicker table tr td.range.today.active, +.datepicker table tr td.range.today:hover.active, +.datepicker table tr td.range.today.disabled.active, +.datepicker table tr td.range.today.disabled:hover.active { + background-color: #efe24b \9; +} +.datepicker table tr td.selected, +.datepicker table tr td.selected:hover, +.datepicker table tr td.selected.disabled, +.datepicker table tr td.selected.disabled:hover { + background-color: #9e9e9e; + background-image: -moz-linear-gradient(top, #b3b3b3, #808080); + background-image: -ms-linear-gradient(top, #b3b3b3, #808080); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080)); + background-image: -webkit-linear-gradient(top, #b3b3b3, #808080); + background-image: -o-linear-gradient(top, #b3b3b3, #808080); + background-image: linear-gradient(top, #b3b3b3, #808080); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0); + border-color: #808080 #808080 #595959; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.datepicker table tr td.selected:hover, +.datepicker table tr td.selected:hover:hover, +.datepicker table tr td.selected.disabled:hover, +.datepicker table tr td.selected.disabled:hover:hover, +.datepicker table tr td.selected:active, +.datepicker table tr td.selected:hover:active, +.datepicker table tr td.selected.disabled:active, +.datepicker table tr td.selected.disabled:hover:active, +.datepicker table tr td.selected.active, +.datepicker table tr td.selected:hover.active, +.datepicker table tr td.selected.disabled.active, +.datepicker table tr td.selected.disabled:hover.active, +.datepicker table tr td.selected.disabled, +.datepicker table tr td.selected:hover.disabled, +.datepicker table tr td.selected.disabled.disabled, +.datepicker table tr td.selected.disabled:hover.disabled, +.datepicker table tr td.selected[disabled], +.datepicker table tr td.selected:hover[disabled], +.datepicker table tr td.selected.disabled[disabled], +.datepicker table tr td.selected.disabled:hover[disabled] { + background-color: #808080; +} +.datepicker table tr td.selected:active, +.datepicker table tr td.selected:hover:active, +.datepicker table tr td.selected.disabled:active, +.datepicker table tr td.selected.disabled:hover:active, +.datepicker table tr td.selected.active, +.datepicker table tr td.selected:hover.active, +.datepicker table tr td.selected.disabled.active, +.datepicker table tr td.selected.disabled:hover.active { + background-color: #666666 \9; +} +.datepicker table tr td.active, +.datepicker table tr td.active:hover, +.datepicker table tr td.active.disabled, +.datepicker table tr td.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.datepicker table tr td.active:hover, +.datepicker table tr td.active:hover:hover, +.datepicker table tr td.active.disabled:hover, +.datepicker table tr td.active.disabled:hover:hover, +.datepicker table tr td.active:active, +.datepicker table tr td.active:hover:active, +.datepicker table tr td.active.disabled:active, +.datepicker table tr td.active.disabled:hover:active, +.datepicker table tr td.active.active, +.datepicker table tr td.active:hover.active, +.datepicker table tr td.active.disabled.active, +.datepicker table tr td.active.disabled:hover.active, +.datepicker table tr td.active.disabled, +.datepicker table tr td.active:hover.disabled, +.datepicker table tr td.active.disabled.disabled, +.datepicker table tr td.active.disabled:hover.disabled, +.datepicker table tr td.active[disabled], +.datepicker table tr td.active:hover[disabled], +.datepicker table tr td.active.disabled[disabled], +.datepicker table tr td.active.disabled:hover[disabled] { + background-color: #0044cc; +} +.datepicker table tr td.active:active, +.datepicker table tr td.active:hover:active, +.datepicker table tr td.active.disabled:active, +.datepicker table tr td.active.disabled:hover:active, +.datepicker table tr td.active.active, +.datepicker table tr td.active:hover.active, +.datepicker table tr td.active.disabled.active, +.datepicker table tr td.active.disabled:hover.active { + background-color: #003399 \9; +} +.datepicker table tr td span { + display: block; + width: 23%; + height: 54px; + line-height: 54px; + float: left; + margin: 1%; + cursor: pointer; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.datepicker table tr td span:hover { + background: #eeeeee; +} +.datepicker table tr td span.disabled, +.datepicker table tr td span.disabled:hover { + background: none; + color: #999999; + cursor: default; +} +.datepicker table tr td span.active, +.datepicker table tr td span.active:hover, +.datepicker table tr td span.active.disabled, +.datepicker table tr td span.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.datepicker table tr td span.active:hover, +.datepicker table tr td span.active:hover:hover, +.datepicker table tr td span.active.disabled:hover, +.datepicker table tr td span.active.disabled:hover:hover, +.datepicker table tr td span.active:active, +.datepicker table tr td span.active:hover:active, +.datepicker table tr td span.active.disabled:active, +.datepicker table tr td span.active.disabled:hover:active, +.datepicker table tr td span.active.active, +.datepicker table tr td span.active:hover.active, +.datepicker table tr td span.active.disabled.active, +.datepicker table tr td span.active.disabled:hover.active, +.datepicker table tr td span.active.disabled, +.datepicker table tr td span.active:hover.disabled, +.datepicker table tr td span.active.disabled.disabled, +.datepicker table tr td span.active.disabled:hover.disabled, +.datepicker table tr td span.active[disabled], +.datepicker table tr td span.active:hover[disabled], +.datepicker table tr td span.active.disabled[disabled], +.datepicker table tr td span.active.disabled:hover[disabled] { + background-color: #0044cc; +} +.datepicker table tr td span.active:active, +.datepicker table tr td span.active:hover:active, +.datepicker table tr td span.active.disabled:active, +.datepicker table tr td span.active.disabled:hover:active, +.datepicker table tr td span.active.active, +.datepicker table tr td span.active:hover.active, +.datepicker table tr td span.active.disabled.active, +.datepicker table tr td span.active.disabled:hover.active { + background-color: #003399 \9; +} +.datepicker table tr td span.old, +.datepicker table tr td span.new { + color: #999999; +} +.datepicker th.datepicker-switch { + width: 145px; +} +.datepicker thead tr:first-child th, +.datepicker tfoot tr th { + cursor: pointer; +} +.datepicker thead tr:first-child th:hover, +.datepicker tfoot tr th:hover { + background: #eeeeee; +} +.datepicker .cw { + font-size: 10px; + width: 12px; + padding: 0 2px 0 5px; + vertical-align: middle; +} +.datepicker thead tr:first-child th.cw { + cursor: default; + background-color: transparent; +} +.input-append.date .add-on i, +.input-prepend.date .add-on i { + display: block; + cursor: pointer; + width: 16px; + height: 16px; +} +.input-daterange input { + text-align: center; +} +.input-daterange input:first-child { + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-daterange input:last-child { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.input-daterange .add-on { + display: inline-block; + width: auto; + min-width: 16px; + height: 18px; + padding: 4px 5px; + font-weight: normal; + line-height: 18px; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + vertical-align: middle; + background-color: #eeeeee; + border: 1px solid #ccc; + margin-left: -5px; + margin-right: -5px; } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js similarity index 99% rename from ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js rename to infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js index ec9cf3e5f..e2703aee8 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js +++ b/infosouth-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js @@ -1,7 +1,7 @@ -/*! X-editable - v1.5.1 -* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery -* http://github.com/vitalets/x-editable -* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */ -!function(a){"use strict";var b=function(b,c){this.options=a.extend({},a.fn.editableform.defaults,c),this.$div=a(b),this.options.scope||(this.options.scope=this)};b.prototype={constructor:b,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value),this.input.prerender()},initTemplate:function(){this.$form=a(a.fn.editableform.template)},initButtons:function(){var b=this.$form.find(".editable-buttons");b.append(a.fn.editableform.buttons),"bottom"===this.options.showbuttons&&b.addClass("editable-buttons-bottom")},render:function(){this.$loading=a(a.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),a.when(this.input.render()).then(a.proxy(function(){if(this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(a.proxy(this.cancel,this)),this.input.error)this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(a){a.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var b=null===this.value||void 0===this.value||""===this.value?this.options.defaultValue:this.value;this.input.value2input(b),this.$form.submit(a.proxy(this.submit,this))}this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var a,b;this.$form?(a=this.$form.outerWidth(),b=this.$form.outerHeight(),a&&this.$loading.width(a),b&&this.$loading.height(b),this.$form.hide()):(a=this.$loading.parent().width(),a&&this.$loading.width(a)),this.$loading.show()},showForm:function(a){this.$loading.hide(),this.$form.show(),a!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(b){var c,d=this.$form.find(".control-group"),e=this.$form.find(".editable-error-block");if(b===!1)d.removeClass(a.fn.editableform.errorGroupClass),e.removeClass(a.fn.editableform.errorBlockClass).empty().hide();else{if(b){c=(""+b).split("\n");for(var f=0;f").text(c[f]).html();b=c.join("
    ")}d.addClass(a.fn.editableform.errorGroupClass),e.addClass(a.fn.editableform.errorBlockClass).html(b).show()}},submit:function(b){b.stopPropagation(),b.preventDefault();var c=this.input.input2value(),d=this.validate(c);if("object"===a.type(d)&&void 0!==d.newValue){if(c=d.newValue,this.input.value2input(c),"string"==typeof d.msg)return this.error(d.msg),this.showForm(),void 0}else if(d)return this.error(d),this.showForm(),void 0;if(!this.options.savenochange&&this.input.value2str(c)==this.input.value2str(this.value))return this.$div.triggerHandler("nochange"),void 0;var e=this.input.value2submit(c);this.isSaving=!0,a.when(this.save(e)).done(a.proxy(function(a){this.isSaving=!1;var b="function"==typeof this.options.success?this.options.success.call(this.options.scope,a,c):null;return b===!1?(this.error(!1),this.showForm(!1),void 0):"string"==typeof b?(this.error(b),this.showForm(),void 0):(b&&"object"==typeof b&&b.hasOwnProperty("newValue")&&(c=b.newValue),this.error(!1),this.value=c,this.$div.triggerHandler("save",{newValue:c,submitValue:e,response:a}),void 0)},this)).fail(a.proxy(function(a){this.isSaving=!1;var b;b="function"==typeof this.options.error?this.options.error.call(this.options.scope,a,c):"string"==typeof a?a:a.responseText||a.statusText||"Unknown error!",this.error(b),this.showForm()},this))},save:function(b){this.options.pk=a.fn.editableutils.tryParseJson(this.options.pk,!0);var c,d="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,e=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==d&&void 0!==d));return e?(this.showLoading(),c={name:this.options.name||"",value:b,pk:d},"function"==typeof this.options.params?c=this.options.params.call(this.options.scope,c):(this.options.params=a.fn.editableutils.tryParseJson(this.options.params,!0),a.extend(c,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,c):a.ajax(a.extend({url:this.options.url,data:c,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(a){return void 0===a&&(a=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,a):void 0},option:function(a,b){a in this.options&&(this.options[a]=b),"value"===a&&this.setValue(b)},setValue:function(a,b){this.value=b?this.input.str2value(a):a,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},a.fn.editableform=function(c){var d=arguments;return this.each(function(){var e=a(this),f=e.data("editableform"),g="object"==typeof c&&c;f||e.data("editableform",f=new b(this,g)),"string"==typeof c&&f[c].apply(f,Array.prototype.slice.call(d,1))})},a.fn.editableform.Constructor=b,a.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},a.fn.editableform.template='
    ',a.fn.editableform.loading='
    ',a.fn.editableform.buttons='',a.fn.editableform.errorGroupClass=null,a.fn.editableform.errorBlockClass="editable-error",a.fn.editableform.engine="jquery"}(window.jQuery),function(a){"use strict";a.fn.editableutils={inherit:function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a,a.superclass=b.prototype},setCursorPosition:function(a,b){if(a.setSelectionRange)a.setSelectionRange(b,b);else if(a.createTextRange){var c=a.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",b),c.select()}},tryParseJson:function(a,b){if("string"==typeof a&&a.length&&a.match(/^[\{\[].*[\}\]]$/))if(b)try{a=new Function("return "+a)()}catch(c){}finally{return a}else a=new Function("return "+a)();return a},sliceObj:function(b,c,d){var e,f,g={};if(!a.isArray(c)||!c.length)return g;for(var h=0;h").text(b).html()},itemsByValue:function(b,c,d){if(!c||null===b)return[];if("function"!=typeof d){var e=d||"value";d=function(a){return a[e]}}var f=a.isArray(b),g=[],h=this;return a.each(c,function(c,e){if(e.children)g=g.concat(h.itemsByValue(b,e.children,d));else if(f)a.grep(b,function(a){return a==(e&&"object"==typeof e?d(e):e)}).length&&g.push(e);else{var i=e&&"object"==typeof e?d(e):e;b==i&&g.push(e)}}),g},createInput:function(b){var c,d,e,f=b.type;return"date"===f&&("inline"===b.mode?a.fn.editabletypes.datefield?f="datefield":a.fn.editabletypes.dateuifield&&(f="dateuifield"):a.fn.editabletypes.date?f="date":a.fn.editabletypes.dateui&&(f="dateui"),"date"!==f||a.fn.editabletypes.date||(f="combodate")),"datetime"===f&&"inline"===b.mode&&(f="datetimefield"),"wysihtml5"!==f||a.fn.editabletypes[f]||(f="textarea"),"function"==typeof a.fn.editabletypes[f]?(c=a.fn.editabletypes[f],d=this.sliceObj(b,this.objectKeys(c.defaults)),e=new c(d)):(a.error("Unknown type: "+f),!1)},supportsTransitions:function(){var a=document.body||document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(a){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return this.delayedHide={reason:a},void 0;this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",a||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(a){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(a)},setPosition:function(){},save:function(a,b){this.$element.triggerHandler("save",b),this.hide("save")},option:function(a,b){this.options[a]=b,a in this.containerOptions?(this.containerOptions[a]=b,this.setContainerOption(a,b)):(this.formOptions[a]=b,this.$form&&this.$form.editableform("option",a,b))},setContainerOption:function(a,b){this.call("option",a,b)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(b){a(".editable-open").each(function(c,d){if(d!==b&&!a(d).find(b).length){var e=a(d),f=e.data("editableContainer");f&&("cancel"===f.options.onblur?e.data("editableContainer").hide("onblur"):"submit"===f.options.onblur&&e.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},a.fn.editableContainer=function(d){var e=arguments;return this.each(function(){var f=a(this),g="editableContainer",h=f.data(g),i="object"==typeof d&&d,j="inline"===i.mode?c:b;h||f.data(g,h=new j(this,i)),"string"==typeof d&&h[d].apply(h,Array.prototype.slice.call(e,1))})},a.fn.editableContainer.Popup=b,a.fn.editableContainer.Inline=c,a.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(a){a.handler&&a.handler()}}}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Inline.prototype,a.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=a(""),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,a.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.editable.defaults,c,a.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!a.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};b.prototype={constructor:b,init:function(){var b,c=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=a.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(a.trim(this.$element.html())),c=!0):(this.options.value=a.fn.editableutils.tryParseJson(this.options.value,!0),this.value="string"==typeof this.options.value?this.input.str2value(this.options.value):this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",a.proxy(function(a){if(this.options.disabled||a.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var b="click"!==this.options.toggle;this.toggle(b)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":b=!0;break;case"auto":b=!a.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!c;break;default:b=!1}a.when(b?this.render():!0).then(a.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var b=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",b,a.proxy(function(b){var c=a(b.target);c.data("editable")||(c.hasClass(this.options.emptyclass)&&c.empty(),c.editable(this.options).trigger(b))},this))},render:function(a){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,a):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,a):this.input.value2html(this.value,this.$element[0]):void 0},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(b,c){return b&&"object"==typeof b?(a.each(b,a.proxy(function(b,c){this.option(a.trim(b),c)},this)),void 0):(this.options[b]=c,"disabled"===b?c?this.disable():this.enable():("value"===b&&this.setValue(c),this.container&&this.container.option(b,c),this.input.option&&this.input.option(b,c),void 0))},handleEmpty:function(b){this.options.display!==!1&&(this.isEmpty=void 0!==b?b:"function"==typeof this.input.isEmpty?this.input.isEmpty(this.$element):""===a.trim(this.$element.html()),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(b){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var c=a.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(c),this.$element.on("save.internal",a.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(b)}},hide:function(){this.container&&this.container.hide()},toggle:function(a){this.container&&this.container.tip().is(":visible")?this.hide():this.show(a)},save:function(a,b){if(this.options.unsavedclass){var c=!1;c=c||"function"==typeof this.options.url,c=c||this.options.display===!1,c=c||void 0!==b.response,c=c||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(b.newValue),c?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var d=this.$element,e=d.css("background-color");d.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===e&&(e=""),d.css("background-color",e),d.addClass("editable-bg-transition"),setTimeout(function(){d.removeClass("editable-bg-transition")},1700)},10)}this.setValue(b.newValue,!1,b.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(b,c,d){this.value=c?this.input.str2value(b):b,this.container&&this.container.option("value",this.value),a.when(this.render(d)).then(a.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},a.fn.editable=function(c){var d={},e=arguments,f="editable";switch(c){case"validate":return this.each(function(){var b,c=a(this),e=c.data(f);e&&(b=e.validate())&&(d[e.options.name]=b)}),d;case"getValue":return 2===arguments.length&&arguments[1]===!0?d=this.eq(0).data(f).value:this.each(function(){var b=a(this),c=b.data(f);c&&void 0!==c.value&&null!==c.value&&(d[c.options.name]=c.input.value2submit(c.value))}),d;case"submit":var g=arguments[1]||{},h=this,i=this.editable("validate");if(a.isEmptyObject(i)){var j={};if(1===h.length){var k=h.data("editable"),l={name:k.options.name||"",value:k.input.value2submit(k.value),pk:"function"==typeof k.options.pk?k.options.pk.call(k.options.scope):k.options.pk};"function"==typeof k.options.params?l=k.options.params.call(k.options.scope,l):(k.options.params=a.fn.editableutils.tryParseJson(k.options.params,!0),a.extend(l,k.options.params)),j={url:k.options.url,data:l,type:"POST"},g.success=g.success||k.options.success,g.error=g.error||k.options.error}else{var m=this.editable("getValue");j={url:g.url,data:m,type:"POST"}}j.success="function"==typeof g.success?function(a){g.success.call(h,a,g)}:a.noop,j.error="function"==typeof g.error?function(){g.error.apply(h,arguments)}:a.noop,g.ajaxOptions&&a.extend(j,g.ajaxOptions),g.data&&a.extend(j.data,g.data),a.ajax(j)}else"function"==typeof g.error&&g.error.call(h,i);return this}return this.each(function(){var d=a(this),g=d.data(f),h="object"==typeof c&&c;return h&&h.selector?(g=new b(this,h),void 0):(g||d.data(f,g=new b(this,h)),"string"==typeof c&&g[c].apply(g,Array.prototype.slice.call(e,1)),void 0)})},a.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(a){"use strict";a.fn.editabletypes={};var b=function(){};b.prototype={init:function(b,c,d){this.type=b,this.options=a.extend({},d,c)},prerender:function(){this.$tpl=a(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(b,c){a(c)[this.options.escape?"text":"html"](a.trim(b))},html2value:function(b){return a("
    ").html(b).text()},value2str:function(a){return a},str2value:function(a){return a},value2submit:function(a){return a},value2input:function(a){this.$input.val(a)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(b){return a("
    ").text(b).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(a){void 0!==this.options[a]&&null!==this.options[a]&&this.$input.attr(a,this.options[a])},option:function(a,b){this.options[a]=b}},b.defaults={tpl:"",inputclass:null,escape:!0,scope:null,showbuttons:!0},a.extend(a.fn.editabletypes,{abstractinput:b})}(window.jQuery),function(a){"use strict";var b=function(){};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){var b=a.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),b.resolve()},function(){this.error=this.options.sourceError,b.resolve()}),b.promise()},html2value:function(){return null},value2html:function(b,c,d,e){var f=a.Deferred(),g=function(){"function"==typeof d?d.call(c,b,this.sourceData,e):this.value2htmlFinal(b,c),f.resolve()};return null===b?g.call(this):this.onSourceReady(g,function(){f.resolve()}),f.promise()},onSourceReady:function(b,c){var d;if(a.isFunction(this.options.source)?(d=this.options.source.call(this.options.scope),this.sourceData=null):d=this.options.source,this.options.sourceCache&&a.isArray(this.sourceData))return b.call(this),void 0;try{d=a.fn.editableutils.tryParseJson(d,!1)}catch(e){return c.call(this),void 0}if("string"==typeof d){if(this.options.sourceCache){var f,g=d;if(a(document).data(g)||a(document).data(g,{}),f=a(document).data(g),f.loading===!1&&f.sourceData)return this.sourceData=f.sourceData,this.doPrepend(),b.call(this),void 0;if(f.loading===!0)return f.callbacks.push(a.proxy(function(){this.sourceData=f.sourceData,this.doPrepend(),b.call(this)},this)),f.err_callbacks.push(a.proxy(c,this)),void 0;f.loading=!0,f.callbacks=[],f.err_callbacks=[]}var h=a.extend({url:d,type:"get",cache:!1,dataType:"json",success:a.proxy(function(d){f&&(f.loading=!1),this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(f&&(f.sourceData=this.sourceData,a.each(f.callbacks,function(){this.call()})),this.doPrepend(),b.call(this)):(c.call(this),f&&a.each(f.err_callbacks,function(){this.call()}))},this),error:a.proxy(function(){c.call(this),f&&(f.loading=!1,a.each(f.err_callbacks,function(){this.call()}))},this)},this.options.sourceOptions);a.ajax(h)}else this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(this.doPrepend(),b.call(this)):c.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(a.isArray(this.prependData)||(a.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=a.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),a.isArray(this.prependData)&&a.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(){},makeArray:function(b){var c,d,e,f,g=[];if(!b||"string"==typeof b)return null;if(a.isArray(b)){f=function(a,b){return d={value:a,text:b},c++>=2?!1:void 0};for(var h=0;h1&&(e.children&&(e.children=this.makeArray(e.children)),g.push(e))):g.push({value:e,text:e})}else a.each(b,function(a,b){g.push({value:a,text:b})});return g},option:function(a,b){this.options[a]=b,"source"===a&&(this.sourceData=null),"prepend"===a&&(this.prependData=null)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0,sourceOptions:null}),a.fn.editabletypes.list=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("text",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),a.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=a(''),this.$input.after(this.$clear).css("padding-right",24).keyup(a.proxy(function(b){if(!~a.inArray(b.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var c=this;this.t=setTimeout(function(){c.toggleClear(b)},100)}},this)).parent().css("position","relative"),this.$clear.click(a.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(){if(this.$clear){var a=this.$input.val().length,b=this.$clear.is(":visible");a&&!b&&this.$clear.show(),!a&&b&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),a.fn.editabletypes.text=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("textarea",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(b){b.ctrlKey&&13===b.which&&a(this).closest("form").submit()})},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),a.fn.editabletypes.textarea=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("select",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){this.$input.empty();var b=function(c,d){var e;if(a.isArray(d))for(var f=0;f",e),d[f].children))):(e.value=d[f].value,d[f].disabled&&(e.disabled=!0),c.append(a("