diff --git a/application/admin/command/Install/fastadmin.sql b/application/admin/command/Install/fastadmin.sql index cf8e91e4becc2f9b7a72859b23dca438f0c0746e..019126f07345f9d2e04cd76aea89bfdfe7e69fc5 100755 --- a/application/admin/command/Install/fastadmin.sql +++ b/application/admin/command/Install/fastadmin.sql @@ -26,6 +26,7 @@ CREATE TABLE `fa_admin` ( `loginip` varchar(50) DEFAULT NULL COMMENT '登录IP', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', + `expiretime` int(10) DEFAULT NULL COMMENT '过期时间', `token` varchar(59) NOT NULL DEFAULT '' COMMENT 'Session标识', `status` varchar(30) NOT NULL DEFAULT 'normal' COMMENT '状态', PRIMARY KEY (`id`), @@ -36,7 +37,7 @@ CREATE TABLE `fa_admin` ( -- Records of fa_admin -- ---------------------------- BEGIN; -INSERT INTO `fa_admin` VALUES (1, 'admin', 'Admin', '075eaec83636846f51c152f29b98a2fd', 's4f3', '/assets/img/avatar.png', 'admin@fastadmin.net', 0, 1502029281, '127.0.0.1',1492186163, 1502029281, 'd3992c3b-5ecc-4ecb-9dc2-8997780fcadc', 'normal'); +INSERT INTO `fa_admin` VALUES (1, 'admin', 'Admin', '075eaec83636846f51c152f29b98a2fd', 's4f3', '/assets/img/avatar.png', 'admin@fastadmin.net', 0, 1502029281, '127.0.0.1',1492186163, 1502029281, 0, 'd3992c3b-5ecc-4ecb-9dc2-8997780fcadc', 'normal'); COMMIT; -- ---------------------------- @@ -99,6 +100,7 @@ CREATE TABLE `fa_auth_group` ( `rules` text NOT NULL COMMENT '规则ID', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', + `expiretime` int(10) DEFAULT NULL COMMENT '过期时间', `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='分组表'; @@ -107,11 +109,11 @@ CREATE TABLE `fa_auth_group` ( -- Records of fa_auth_group -- ---------------------------- BEGIN; -INSERT INTO `fa_auth_group` VALUES (1, 0, 'Admin group', '*', 1490883540, 149088354, 'normal'); -INSERT INTO `fa_auth_group` VALUES (2, 1, 'Second group', '13,14,16,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,1,9,10,11,7,6,8,2,4,5', 1490883540, 1505465692, 'normal'); -INSERT INTO `fa_auth_group` VALUES (3, 2, 'Third group', '1,4,9,10,11,13,14,15,16,17,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,5', 1490883540, 1502205322, 'normal'); -INSERT INTO `fa_auth_group` VALUES (4, 1, 'Second group 2', '1,4,13,14,15,16,17,55,56,57,58,59,60,61,62,63,64,65', 1490883540, 1502205350, 'normal'); -INSERT INTO `fa_auth_group` VALUES (5, 2, 'Third group 2', '1,2,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34', 1490883540, 1502205344, 'normal'); +INSERT INTO `fa_auth_group` VALUES (1, 0, 'Admin group', '*', 1490883540, 149088354, 0,'normal'); +INSERT INTO `fa_auth_group` VALUES (2, 1, 'Second group', '13,14,16,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,1,9,10,11,7,6,8,2,4,5', 1490883540, 1505465692, 0, 'normal'); +INSERT INTO `fa_auth_group` VALUES (3, 2, 'Third group', '1,4,9,10,11,13,14,15,16,17,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,5', 1490883540, 1502205322, 0, 'normal'); +INSERT INTO `fa_auth_group` VALUES (4, 1, 'Second group 2', '1,4,13,14,15,16,17,55,56,57,58,59,60,61,62,63,64,65', 1490883540, 1502205350, 0, 'normal'); +INSERT INTO `fa_auth_group` VALUES (5, 2, 'Third group 2', '1,2,6,7,8,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34', 1490883540, 1502205344, 0, 'normal'); COMMIT; -- ---------------------------- diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index a8d23606a3c8a6a2d7361e3f6861d4a319701e3c..d88001dd28f9ea8604aaae9573bb19132e6459e0 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -129,6 +129,7 @@ class Admin extends Backend $params['salt'] = Random::alnum(); $params['password'] = md5(md5($params['password']) . $params['salt']); $params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 + $params['expiretime'] = $params['expiretime']==0 ? 0 : strtotime($params['expiretime']); $result = $this->model->validate('Admin.add')->save($params); if ($result === false) { $this->error($this->model->getError()); @@ -174,6 +175,7 @@ class Admin extends Backend } else { unset($params['password'], $params['salt']); } + $params['expiretime'] = $params['expiretime']==0 ? 0 : strtotime($params['expiretime']); //这里需要针对username和email做唯一验证 $adminValidate = \think\Loader::validate('Admin'); $adminValidate->rule([ @@ -208,6 +210,7 @@ class Admin extends Backend foreach ($grouplist as $k => $v) { $groupids[] = $v['id']; } + $row['expiretime'] = $row['expiretime'] === 0 ? 0 : date("Y-m-d H:i:s", $row['expiretime']); $this->view->assign("row", $row); $this->view->assign("groupids", $groupids); return $this->view->fetch(); diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 0e82c8d89d7ee5301cbc219820f4dfe85fdaffd9..22e0080e3b467877f3f8dd0bf533716247f173a5 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -111,6 +111,11 @@ class Group extends Backend // 如果当前组别不是超级管理员则需要过滤规则节点,不能超当前组别的权限 $rules = in_array('*', $currentrules) ? $rules : array_intersect($currentrules, $rules); $params['rules'] = implode(',', $rules); + //日期转时间戳 + $params['expiretime'] = empty($params['expiretime']) ? 0 : strtotime($params['expiretime']); + if (false === $params['expiretime']) { + $this->error(__('Invalid format of expire time')); + } if ($params) { $this->model->create($params); $this->success(); @@ -144,6 +149,11 @@ class Group extends Backend $this->error(__('The parent group can not be its own child or itself')); } $params['rules'] = explode(',', $params['rules']); + //日期转时间戳 + $params['expiretime'] = empty($params['expiretime']) ? 0 : strtotime($params['expiretime']); + if (false === $params['expiretime']) { + $this->error(__('Invalid format of expire time')); + } $parentmodel = model("AuthGroup")->get($params['pid']); if (!$parentmodel) { @@ -180,6 +190,7 @@ class Group extends Backend $this->error(); return; } + $row['expiretime'] = $row['expiretime'] === 0 ? 0 : date("Y-m-d H:i:s", $row['expiretime']); $this->view->assign("row", $row); return $this->view->fetch(); } diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index b18b5bf6660c52db49c989a84fb22563c5bbbe56..746c2db1bf0e872efabed1c98b50d2aca27b550b 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -96,6 +96,7 @@ return [ 'End time' => '结束时间', 'Create time' => '创建时间', 'Update time' => '更新时间', + 'Expire time' => '过期时间', 'Flag' => '标志', 'Drag to sort' => '拖动进行排序', 'Redirect now' => '立即跳转', diff --git a/application/admin/lang/zh-cn/auth/group.php b/application/admin/lang/zh-cn/auth/group.php index 3a63f5860e905d01015bd40e4f955146292d034e..dbf52e561e0e2fa9dbdc3899eee02f4e076d70df 100644 --- a/application/admin/lang/zh-cn/auth/group.php +++ b/application/admin/lang/zh-cn/auth/group.php @@ -9,4 +9,5 @@ return [ 'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组', 'The parent group exceeds permission limit' => '父组别超出权限范围', 'The parent group can not be its own child or itself' => '父组别不能是它的子组别及本身', + 'Invalid format of expire time' => '过期时间格式错误', ]; diff --git a/application/admin/lang/zh-cn/index.php b/application/admin/lang/zh-cn/index.php index 04aa093560af0f00ab82d58fa8cda7ec177d5801..bf5cfcb37ec0cf50f07dca197c7dde7433ca9517 100644 --- a/application/admin/lang/zh-cn/index.php +++ b/application/admin/lang/zh-cn/index.php @@ -27,6 +27,7 @@ return [ 'Username is incorrect' => '用户名不正确', 'Password is incorrect' => '密码不正确', 'Admin is forbidden' => '管理员已经被禁止登录', + 'Admin is expired' => '管理员已过期', 'Please try again after 1 day' => '请于1天后再尝试登录', 'Login successful' => '登录成功!', 'Logout successful' => '退出成功!', diff --git a/application/admin/library/Auth.php b/application/admin/library/Auth.php index 73826e454721b7969522c847db96294cae905845..3ae2ac05aa88b85edced24aea30baadd4b57ef22 100644 --- a/application/admin/library/Auth.php +++ b/application/admin/library/Auth.php @@ -47,6 +47,10 @@ class Auth extends \fast\Auth $this->setError('Admin is forbidden'); return false; } + if ($admin['expiretime'] < time() && $admin['expiretime']!=0) { + $this->setError('Admin is expired'); + return false; + } if (Config::get('fastadmin.login_failure_retry') && $admin->loginfailure >= 10 && time() - $admin->updatetime < 86400) { $this->setError('Please try again after 1 day'); return false; @@ -282,7 +286,8 @@ class Auth extends \fast\Auth } } // 取出所有分组 - $groupList = \app\admin\model\AuthGroup::where(['status' => 'normal'])->select(); +// $groupList = \app\admin\model\AuthGroup::where(['status' => 'normal'])->select(); + $groupList = \app\admin\model\AuthGroup::all(); $objList = []; foreach ($groups as $k => $v) { if ($v['rules'] === '*') { diff --git a/application/admin/validate/Admin.php b/application/admin/validate/Admin.php index 5b4e4e8617f7b2edba1834b9a1b9b7aa8ea1cad5..76aa4f97c79844ed3e1f9bac19c88a40adfc1183 100644 --- a/application/admin/validate/Admin.php +++ b/application/admin/validate/Admin.php @@ -11,10 +11,11 @@ class Admin extends Validate * 验证规则 */ protected $rule = [ - 'username' => 'require|regex:\w{3,12}|unique:admin', + 'username' => 'require|max:50|unique:admin', 'nickname' => 'require', - 'password' => 'require|regex:\S{32}', + 'password' => 'require', 'email' => 'require|email|unique:admin,email', + 'expiretime' => 'require|integer' ]; /** @@ -33,8 +34,8 @@ class Admin extends Validate * 验证场景 */ protected $scene = [ - 'add' => ['username', 'email', 'nickname', 'password'], - 'edit' => ['username', 'email', 'nickname', 'password'], + 'add' => ['username', 'email', 'nickname', 'password', 'expiretime'], + 'edit' => ['username', 'email', 'nickname', 'expiretime'], ]; public function __construct(array $rules = [], $message = [], $field = []) @@ -45,11 +46,6 @@ class Admin extends Validate 'password' => __('Password'), 'email' => __('Email'), ]; - $this->message = array_merge($this->message, [ - 'username.regex' => __('Please input correct username'), - 'password.regex' => __('Please input correct password') - ]); parent::__construct($rules, $message, $field); } - } diff --git a/application/admin/view/auth/admin/add.html b/application/admin/view/auth/admin/add.html index 6f984d288b8271548c127b7ecc6e896e9f8ec594..b863dc91171ad753bf28303bb28285bd18259fbf 100644 --- a/application/admin/view/auth/admin/add.html +++ b/application/admin/view/auth/admin/add.html @@ -30,6 +30,17 @@ +
+ +
+ + + + +
+
diff --git a/application/admin/view/auth/admin/edit.html b/application/admin/view/auth/admin/edit.html index 64131d3ecc47036c041ea15c830fe107d0fe38af..03d3ab591af20ad87e4b01a3370368865c291127 100644 --- a/application/admin/view/auth/admin/edit.html +++ b/application/admin/view/auth/admin/edit.html @@ -9,19 +9,19 @@
- +
- +
- +
@@ -36,6 +36,17 @@
+
+ +
+ + + + +
+
diff --git a/application/admin/view/auth/group/add.html b/application/admin/view/auth/group/add.html index 0eb848b546226576f523b0fd7a163cbc21389408..b5bdfcf6751e036fa836a2b8e84ba2b7bdd224a5 100644 --- a/application/admin/view/auth/group/add.html +++ b/application/admin/view/auth/group/add.html @@ -22,6 +22,17 @@
+
+ +
+ + + + +
+
diff --git a/application/admin/view/auth/group/edit.html b/application/admin/view/auth/group/edit.html index c691bd16005b80365366c278722b5bff99d4d3e3..a853c98ad3085a766f19c37d6b572a8691f7ced4 100644 --- a/application/admin/view/auth/group/edit.html +++ b/application/admin/view/auth/group/edit.html @@ -22,6 +22,17 @@
+
+ +
+ + + + +
+
diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 4cc5a2ab88ac6cc6e8f98601bfe27b6cefaef848..b3155214a810cec4650b5d65267348fd5752e838 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -202,7 +202,7 @@ class User extends Api /** * 修改手机号 * - * @param string $email 手机号 + * @param string $mobile 手机号 * @param string $captcha 验证码 */ public function changemobile() diff --git a/extend/fast/Auth.php b/extend/fast/Auth.php index 396c4cfc9a935cb500109798b164b5d96b9b5e65..628abc2fab9f51f3333332dadb0940e8698178ec 100644 --- a/extend/fast/Auth.php +++ b/extend/fast/Auth.php @@ -153,11 +153,12 @@ class Auth } // 执行查询 + $nowTime = time(); $user_groups = Db::name($this->config['auth_group_access']) ->alias('aga') ->join('__' . strtoupper($this->config['auth_group']) . '__ ag', 'aga.group_id = ag.id', 'LEFT') ->field('aga.uid,aga.group_id,ag.id,ag.pid,ag.name,ag.rules') - ->where("aga.uid='{$uid}' and ag.status='normal'") + ->where("aga.uid='{$uid}' and ag.status='normal' and (ag.expiretime>={$nowTime} or ag.expiretime=0)") ->select(); $groups[$uid] = $user_groups ?: []; return $groups[$uid]; diff --git a/public/assets/js/backend/auth/admin.js b/public/assets/js/backend/auth/admin.js index 89f4ebee1c44f1b52367708170532d647a4274ef..c8050c99744c8daacc9b1614c6fea757b4dd8188 100755 --- a/public/assets/js/backend/auth/admin.js +++ b/public/assets/js/backend/auth/admin.js @@ -37,6 +37,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'email', title: __('Email')}, {field: 'status', title: __("Status"), formatter: Table.api.formatter.status}, {field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, + {field: 'expiretime', title: __('Expire time'), formatter: Table.api.formatter.expiretime, expireOn:'now'}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) { if(row.id == Config.admin.id){ return ''; @@ -52,9 +53,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin }, add: function () { Form.api.bindevent($("form[role=form]")); + Controller.api.bindevent(); }, edit: function () { Form.api.bindevent($("form[role=form]")); + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + //过期时间: 永久和选择时间 + $(document).on("click", "#for_ever", function () { + $("#expiretime-select").attr("style","display:none;"); + $("input[name='row[expiretime]']").val('0'); + $("#select_time").removeAttr("checked"); + }); + $(document).on("click", "#select_time", function () { + $("#expiretime-select").attr("style","display:block;"); + $("#for_ever").removeAttr("checked"); + var nowDate = new Date(); + $("input[name='row[expiretime]']").val(nowDate.getFullYear() + '-' + (nowDate.getMonth()+1) + '-' + nowDate.getDate() + ' 23:59:59'); + }); + } } }; return Controller; diff --git a/public/assets/js/backend/auth/group.js b/public/assets/js/backend/auth/group.js index 94a4b4b438f59aa03c8736ff0d2eef3e6765568e..180264f9200668c8091cc08650bbf3537c78ee53 100755 --- a/public/assets/js/backend/auth/group.js +++ b/public/assets/js/backend/auth/group.js @@ -50,6 +50,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ( {field: 'pid', title: __('Parent')}, {field: 'name', title: __('Name'), align: 'left'}, {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, + {field: 'expiretime', title: __('Expire time'), formatter: Table.api.formatter.expiretime}, { field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) { if (Config.admin.group_ids.indexOf(parseInt(row.id)) > -1) { @@ -122,6 +123,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ( $(document).on("click", "#expandall", function () { $("#treeview").jstree($(this).prop("checked") ? "open_all" : "close_all"); }); + //过期时间: 永久和选择时间 + $(document).on("click", "#for_ever", function () { + $("#expiretime-select").attr("style","display:none;"); + $("input[name='row[expiretime]']").val('0'); + $("#select_time").removeAttr("checked"); + }); + $(document).on("click", "#select_time", function () { + $("#expiretime-select").attr("style","display:block;"); + $("#for_ever").removeAttr("checked"); + var nowDate = new Date(); + $("input[name='row[expiretime]']").val(nowDate.getFullYear() + '-' + (nowDate.getMonth()+1) + '-' + nowDate.getDate() + ' 23:59:59'); + }); $("select[name='row[pid]']").trigger("change"); }, rendertree: function (content) { diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index 056879aee475b3990d5f85ad814196bcdb918e01..c53af8bb3a2bb667dde19cff273f9176c8cf8005 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -6063,93 +6063,93 @@ define("bootstrap-table-lang", ["bootstrap-table"], (function (global) { /* tableExport.jquery.plugin - Version 1.10.11 + Version 1.10.13 - Copyright (c) 2015-2019 hhurz, https://github.com/hhurz + Copyright (c) 2015-2019 hhurz, https://github.com/hhurz/tableExport.jquery.plugin - Original Work Copyright (c) 2014 Giri Raj + Based on https://github.com/kayalshri/tableExport.jquery.plugin Licensed under the MIT License */ -var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,h,x){c instanceof String&&(c=String(c));for(var B=c.length,D=0;De&&"undefined"!==typeof U[e]&&-1!==c.inArray(U[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function C(b,d,e,q,f){if("function"===typeof f){var m=!1;"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(c(b),e));if(!1===m&&(0===a.ignoreRow.length||-1===c.inArray(e,a.ignoreRow)&&-1===c.inArray(e-q,a.ignoreRow))&&J(c(b))){var r=D(c(b),d),k=0;r.each(function(b){var a=c(this),d,m=P(this),q=V(this);c.each(H, -function(){if(e>=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(d=0;d<=this.e.c-this.s.c;++d)f(null,e,k++)});if(!1===ua(a,r.length,b)){if(q||m)m=m||1,H.push({s:{r:e,c:k},e:{r:e+(q||1)-1,c:k+m-1}});f(this,e,k++)}if(m)for(d=0;d=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(da=0;da<=this.e.c-this.s.c;++da)f(null,e,k++)})}}}function va(b,a,e,c){if("undefined"!==typeof c.images&&(e=c.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect(); -var d=b.width/b.height,m=a.width/a.height,q=b.width,k=b.height,y=19.049976/25.4,g=0;m<=d?(k=Math.min(b.height,a.height),q=a.width*k/a.height):m>d&&(q=Math.min(b.width,a.width),k=a.height*q/a.width);q*=y;k*=y;kb.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(y.charAt(0))&&(h=y.charAt(0),g=e.doc.getStringUnitWidth(h)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(h,q,f,m),y=y.substring(1,y.length)),g=e.doc.getStringUnitWidth(y)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;y.length&&q+g>b.textPos.x+b.width;)y=y.substring(0,y.length-1),g=e.doc.getStringUnitWidth(y)*e.doc.internal.getFontSize(); -e.doc.autoTableText(y,q,f,m);q+=g}if(r||k)c(d).is("b")?r=!1:c(d).is("i")&&(k=!1),e.doc.setFontType(r||k?r?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,m)}}function ha(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/, -"")}function Ca(b){a.date.pattern.lastIndex=0;var d=a.date.pattern.exec(b);if(null==d)return!1;b=+d[a.date.match_y];if(0>b||8099]*)>)/gi,"\u2060"),p=c("
").html(l).contents();b=!1;l="";c.each(p.text().split("\u2028"),function(b,d){0b?1:0)).split(".");1===p.length&&(p[1]="");var n=3b?"-":"")+(a.numbers.output.thousandsSeparator? -(n?p[0].substr(0,n)+a.numbers.output.thousandsSeparator:"")+p[0].substr(n).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=k;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(r,d,e,f,m))}void 0!==q&&(q.type=m);return f}function Da(b){return 0m?f+=String.fromCharCode(m):(127m?f+=String.fromCharCode(m>>6|192):(f+=String.fromCharCode(m>>12|224),f+=String.fromCharCode(m>>6&63|128)),f+=String.fromCharCode(m&63|128))}a=f}for(;q>2;r=(r&3)<<4|f>>4;var k=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?k=g=64:isNaN(b)&&(g=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)+ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return c}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p", -unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml", -onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1, -trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66], -b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},A=this,ia=null,u=[],t= -[],p=0,n="",U=[],H=[],Ga,K=[],W=!1;c.extend(!0,a,h);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"=== -a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){h= -[];h.dd="(3[01]|[12][0-9]|0?[1-9])";h.mm="(1[012]|0?[1-9])";h.yyyy="((?:1[6-9]|2[0-2])\\d{2})";h.yy="(\\d{2})";var v=a.date.html.match(/[^a-zA-Z0-9]/)[0];v=a.date.html.toLowerCase().split(v);a.date.regex="^\\s*";a.date.regex+=h[v[0]];a.date.regex+="(.)";a.date.regex+=h[v[1]];a.date.regex+="\\2";a.date.regex+=h[v[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");h=v.indexOf("dd")+1;a.date.match_d=h+(1"+F(a,c,e)+""});p++});R+="";var sa=1;t=B(c(A));c(t).each(function(){var a=1;n="";C(this,"td,th",p,u.length+t.length,function(b,c,g){n+=""+F(b,c,g)+"";a++});0"!==n&&(R+=''+n+"",sa++);p++}); -R+="";if("string"===a.outputMode)return R;if("base64"===a.outputMode)return L(R);N(R,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var ta=[],G=[];c(A).filter(function(){return J(c(this))}).each(function(){function b(a,b,d){var f=[];c(a).each(function(){var b=0,e=0;n="";C(this,"td,th",p,d+a.length,function(a,d,m){if(null!==a){var k="";d=F(a,d,m);m="String";if(!1!==jQuery.isNumeric(d))m="Number";else{var g=Na(d);!1!== -g&&(d=g,m="Number",k+=' ss:StyleID="pct1"')}"Number"!==m&&(d=d.replace(/\n/g,"
"));g=P(a);a=V(a);c.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||g)a=a||1,g=g||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+g-1}});1'+c("
").text(d).html()+"\r"; -e++}});0\r'+n+"\r");p++});return a.length}var d=c(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(G.length+1):"undefined"!==typeof a.mso.worksheetName[G.length]&&(e=a.mso.worksheetName[G.length]);e.length||(e=d.find("caption").text()||"");e.length||(e="Table "+(G.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));G.push(c("
").text(e).html());!1===a.exportHiddenCells&&(K= -d.find("tr, th, td").filter(":hidden"),W=0\r";e=b(x(d),"th,td",0);b(B(d),"td,th",e);I+="\r";ta.push(I)});h={};v={};for(var l,S,Y=0,da=G.length;Y\r\r\r\r '+ +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,h,y){c instanceof String&&(c=String(c));for(var B=c.length,C=0;Ce&&"undefined"!==typeof T[e]&&-1!==c.inArray(T[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,d,e,q,f){if("function"===typeof f){var m=!1;"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(c(b),e));if(!1===m&&(0===a.ignoreRow.length||-1===c.inArray(e,a.ignoreRow)&&-1===c.inArray(e-q,a.ignoreRow))&&I(c(b))){var t=C(c(b),d),k=0;t.each(function(b){var a=c(this),d,m=O(this),q=U(this);c.each(G, +function(){if(e>=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(d=0;d<=this.e.c-this.s.c;++d)f(null,e,k++)});if(!1===ta(a,t.length,b)){if(q||m)m=m||1,G.push({s:{r:e,c:k},e:{r:e+(q||1)-1,c:k+m-1}});f(this,e,k++)}if(m)for(d=0;d=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(ca=0;ca<=this.e.c-this.s.c;++ca)f(null,e,k++)})}}}function ua(b,a,e,c){if("undefined"!==typeof c.images&&(e=c.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect(); +var d=b.width/b.height,m=a.width/a.height,q=b.width,k=b.height,z=19.049976/25.4,g=0;m<=d?(k=Math.min(b.height,a.height),q=a.width*k/a.height):m>d&&(q=Math.min(b.width,a.width),k=a.height*q/a.width);q*=z;k*=z;kb.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(z.charAt(0))&&(h=z.charAt(0),g=e.doc.getStringUnitWidth(h)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(h,q,f,m),z=z.substring(1,z.length)),g=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;z.length&&q+g>b.textPos.x+b.width;)z=z.substring(0,z.length-1),g=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize(); +e.doc.autoTableText(z,q,f,m);q+=g}if(t||k)c(d).is("b")?t=!1:c(d).is("i")&&(k=!1),e.doc.setFontType(t||k?t?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,m)}}function fa(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function ka(b){return null==b?"":b.toString().replace(/^\s+/,"")}function la(b){return null==b?"":b.toString().replace(/\s+$/, +"")}function Ba(b){a.date.pattern.lastIndex=0;var d=a.date.pattern.exec(b);if(null==d)return!1;b=+d[a.date.match_y];if(0>b||8099]*)>)/gi,"\u2060"),p=c("
").html(l).contents();b=!1;l="";c.each(p.text().split("\u2028"),function(b,d){0b?1:0)).split(".");1===p.length&&(p[1]="");var n=3b?"-":"")+ +(a.numbers.output.thousandsSeparator?(n?p[0].substr(0,n)+a.numbers.output.thousandsSeparator:"")+p[0].substr(n).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=k;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(t,d,e,f,m))}void 0!==q&&(q.type=m);return f}function Ca(b){return 0m?f+=String.fromCharCode(m):(127m?f+=String.fromCharCode(m>>6|192):(f+=String.fromCharCode(m>>12|224),f+=String.fromCharCode(m>>6&63|128)),f+=String.fromCharCode(m&63|128))}a=f}for(;q>2;t=(t&3)<<4|f>>4;var k=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?k=g=64:isNaN(b)&& +(g=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return c}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content", +ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null, +onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait", +defaultStyle:{font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},N={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09], +b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792, +1224],"credit-card":[153,243]},A=this,ha=null,u=[],r=[],p=0,n="",T=[],G=[],Fa,J=[],V=!1;c.extend(!0,a,h);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation); +"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html= +a.date.html||"";if(a.date.html.length){h=[];h.dd="(3[01]|[12][0-9]|0?[1-9])";h.mm="(1[012]|0?[1-9])";h.yyyy="((?:1[6-9]|2[0-2])\\d{2})";h.yy="(\\d{2})";var v=a.date.html.match(/[^a-zA-Z0-9]/)[0];v=a.date.html.toLowerCase().split(v);a.date.regex="^\\s*";a.date.regex+=h[v[0]];a.date.regex+="(.)";a.date.regex+=h[v[1]];a.date.regex+="\\2";a.date.regex+=h[v[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");h=v.indexOf("dd")+1;a.date.match_d=h+(1"+F(a,c,e)+""});p++});Q+="";var ra=1;r=B(c(A));c(r).each(function(){var a=1;n="";E(this,"td,th",p,u.length+r.length,function(b,c,g){n+=""+F(b,c,g)+"";a++});0"!==n&&(Q+=''+n+"",ra++);p++}); +Q+="";if("string"===a.outputMode)return Q;if("base64"===a.outputMode)return K(Q);M(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],D=[];c(A).filter(function(){return I(c(this))}).each(function(){function b(a,b,d){var f=[];c(a).each(function(){var b=0,e=0;n="";E(this,"td,th",p,d+a.length,function(a,d,m){if(null!==a){var k="";d=F(a,d,m);m="String";if(!1!==jQuery.isNumeric(d))m="Number";else{var g=Ma(d);!1!== +g&&(d=g,m="Number",k+=' ss:StyleID="pct1"')}"Number"!==m&&(d=d.replace(/\n/g,"
"));g=O(a);a=U(a);c.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||g)a=a||1,g=g||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+g-1}});1'+c("
").text(d).html()+"\r"; +e++}});0\r'+n+"\r");p++});return a.length}var d=c(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(D.length+1):"undefined"!==typeof a.mso.worksheetName[D.length]&&(e=a.mso.worksheetName[D.length]);e.length||(e=d.find("caption").text()||"");e.length||(e="Table "+(D.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));D.push(c("
").text(e).html());!1===a.exportHiddenCells&&(J= +d.find("tr, th, td").filter(":hidden"),V=0\r";e=b(y(d),"th,td",0);b(B(d),"td,th",e);H+="\r";sa.push(H)});h={};v={};for(var l,R,X=0,ca=D.length;X\r\r\r\r '+ (new Date).toISOString()+'\r\r\r \r\r\r 9000\r 13860\r 0\r 0\r False\r False\r\r\r \r \r \r\r'; -for(v=0;v\r'+ta[v],h=a.mso.rtl?h+'\r\r\r':h+'\r',h+="\r";h+="\r";if("string"===a.outputMode)return h;if("base64"===a.outputMode)return L(h);N(h,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"=== -a.type&&"xlsx"===a.mso.fileFormat){var aa=[],Ha=XLSX.utils.book_new();c(A).filter(function(){return J(c(this))}).each(function(){for(var b=c(this),d={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],m,r=[],k=0,h=0,l,n,u,v,t,x=XLSX.SSF.get_table();kh;++k)if(l=e[k],n=!1,"function"===typeof a.onIgnoreRow&&(n=a.onIgnoreRow(c(l),k)),!1===n&&-1===c.inArray(p,a.ignoreRow)&&-1===c.inArray(p-sa,a.ignoreRow)&&J(c(l))){var A=l.children,D=0;for(l=0;lw||36w||48===w)C="n";else if("date"===m.type||13w||44w||56===w)C="d";null!=E&&(0===E.length?z.t=C||"z":0!==E.trim().length&&"s"!==C&&("function"===m.type?z={f:E}:"TRUE"===E?z={t:"b",v:!0}:"FALSE"===E?z={t:"b",v:!1}:"n"!==C&&isNaN(Fa(E,a.numbers.output))?"d"===C||!1!==Ca(E)?(0===w&&"function"!==typeof a.mso.xslx.formatId.date&&(w=a.mso.xslx.formatId.date),z={t:"d",v:Ca(E),z:"string"=== -typeof w?w:w in x?x[w]:"m/d/yy"}):""===C&&c(t).find("a").length&&(E="href"!==a.htmlHyperlink?E:"",z={f:'=HYPERLINK("'+c(t).find("a").attr("href")+(E.length?'","'+E:"")+'")'}):(0===w&&"function"!==typeof a.mso.xslx.formatId.numbers&&(w=a.mso.xslx.formatId.numbers),z={t:"n",v:Fa(E,a.numbers.output),z:"string"===typeof w?w:w in x?x[w]:"0.00"})));d[oa({c:n,r:h})]=z;g.e.c";u=x(b);c(u).each(function(){var b=c(this);n="";C(this,"th,td",p,u.length,function(c,d,f){if(null!==c){var e="";n+=""}});0"+n+"");p++});I+="";t=B(b);c(t).each(function(){var b=c(this);n="";C(this,"td,th",p,u.length+t.length,function(d,g,f){if(null!==d){var e=F(d,g,f),h="",k=c(d).attr("data-tableexport-msonumberformat");"undefined"===typeof k&&"function"===typeof a.mso.onMsoNumberFormat&&(k=a.mso.onMsoNumberFormat(d, -g,f));"undefined"!==typeof k&&""!==k&&(h="style=\"mso-number-format:'"+k+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(d,null);f=document.defaultView.getComputedStyle(b[0],null);for(var l in a.mso.styles)k=g[a.mso.styles[l]],""===k&&(k=f[a.mso.styles[l]]),""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(h+=""===h?'style="':";",h+=a.mso.styles[l]+":"+k)}n+=""));n+=">"+e+""}});0"+n+"");p++});a.displayTableName&&(I+=""+F(c("

"+a.tableName+"

"))+"");I+=""});l=''+('');l+="";"excel"===h&&(l+="\x3c!--[if gte mso 9]>", -l+="",l+="",l+="",l+="",l+="",l+=ba,l+="",l+="",l+="",a.mso.rtl&&(l+=""),l+="",l+="",l+="",l+="",l+="",l+="";l+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";l+="@page Section1 {size:"+O[a.mso.pageFormat][0]+ -"pt "+O[a.mso.pageFormat][1]+"pt";l+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";l+="div.Section1 {page:Section1;}";l+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";l+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";l+="div.Section2 {page:Section2;}";l+="br {mso-data-placement:same-cell;}";l+=""; -l+="";l+="";l+='
';l+=I;l+="
";l+="";l+="";if("string"===a.outputMode)return l;if("base64"===a.outputMode)return L(l);N(l,a.fileName+"."+v,"application/vnd.ms-"+h,"","base64",!1)}else if("png"===a.type)html2canvas(c(A)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),g=new Uint8Array(e),f=0;fKa){a>O.a0[0]&&(ja="a0",ca= -"l");for(var d in O)O.hasOwnProperty(d)&&O[d][1]>a&&(ja=d,ca="l",O[d][0]>a&&(ca="p"));Ka=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===ca?"w":ca}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(c(A).filter(function(){return J(c(this))}).each(function(){var b=0;H=[];!1===a.exportHiddenCells&& -(K=c(this).find("tr, th, td").filter(":hidden"),W=0a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===d.headerStyles.halign?"center":d.headerStyles.halign;a.styles.valign=d.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===d.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!== -typeof d.createdCell&&(d.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===d.styles.halign?"center":d.styles.halign;a.styles.valign=d.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===d.styles.halign&&(a.styles.halign=b.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&& -(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?xa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var d=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof d&&d.isCanvas))xa(a,b,d)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!==typeof d&&"undefined"!==typeof d.elements&& -d.elements.length?(b=a.height/d.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/d.rect.width,b=a.textPos.y,Aa(a,d.elements,g),a.textPos.y=b,Ba(a,d.elements,g)):Ba(a,{},g));else{d=d.elements[0];var e=c(d).attr("data-tableexport-canvas"),f=d.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;va(a,d,e,g)}return!1});g.headerrows=[];u=x(c(this));c(u).each(function(){b=0;g.headerrows[p]=[];C(this,"th,td",p,u.length,function(a, -c,d){var e=Ea(a);e.title=F(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0\r'+sa[v],h=a.mso.rtl?h+'\r\r\r':h+'\r',h+="\r";h+="\r";if("string"===a.outputMode)return h;if("base64"===a.outputMode)return K(h);M(h,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"=== +a.type&&"xlsx"===a.mso.fileFormat){var Z=[],Ga=XLSX.utils.book_new();c(A).filter(function(){return I(c(this))}).each(function(){for(var b=c(this),d={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],m,t=[],k=0,h=0,l,n,u,v,r,y=XLSX.SSF.get_table();kh;++k)if(l=e[k],n=!1,"function"===typeof a.onIgnoreRow&&(n=a.onIgnoreRow(c(l),k)),!1===n&&-1===c.inArray(p,a.ignoreRow)&&-1===c.inArray(p-ra,a.ignoreRow)&&I(c(l))){var A=l.children,C=0;for(l=0;lx||36x||48===x)D="n";else if("date"===E.type||13x||44x||56===x)D="d"}else D="s";if(null!=m)if(0===m.length)w.t=D||"z";else if(0!==m.trim().length&&"s"!==D)if("function"===E.type)w={f:m};else if("TRUE"===m)w={t:"b",v:!0};else if("FALSE"===m)w={t:"b",v:!1};else if(""===D&&c(r).find("a").length)m="href"!==a.htmlHyperlink? +m:"",w={f:'=HYPERLINK("'+c(r).find("a").attr("href")+(m.length?'","'+m:"")+'")'};else if("n"===D||!isNaN(Ea(m,a.numbers.output)))r=Ea(m,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isNaN(r)&&isNaN(m)||(w={t:"n",v:isNaN(r)?m:r,z:"string"===typeof x?x:x in y?y[x]:"0.00"});else if("d"===D||!1!==Ba(m))r=Ba(m),0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),w={t:"d",v:!1!==r?r:m,z:"string"===typeof x?x:x in y? +y[x]:"m/d/yy"};d[na({c:n,r:h})]=w;g.e.c";u=y(b);c(u).each(function(){var b=c(this);n="";E(this,"th,td",p,u.length,function(c,d,f){if(null!==c){var e="";n+=""}});0"+n+"");p++});H+="";r=B(b);c(r).each(function(){var b=c(this);n="";E(this,"td,th",p,u.length+r.length,function(d,g,f){if(null!==d){var e=F(d,g,f), +h="",k=c(d).attr("data-tableexport-msonumberformat");"undefined"===typeof k&&"function"===typeof a.mso.onMsoNumberFormat&&(k=a.mso.onMsoNumberFormat(d,g,f));"undefined"!==typeof k&&""!==k&&(h="style=\"mso-number-format:'"+k+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(d,null);f=document.defaultView.getComputedStyle(b[0],null);for(var l in a.mso.styles)k=g[a.mso.styles[l]],""===k&&(k=f[a.mso.styles[l]]),""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(h+=""===h? +'style="':";",h+=a.mso.styles[l]+":"+k)}n+=""));n+=">"+e+""}});0"+n+"");p++});a.displayTableName&&(H+=""+F(c("

"+a.tableName+"

"))+"");H+=""});l=''+ +('');l+="";"excel"===h&&(l+="\x3c!--[if gte mso 9]>",l+="",l+="",l+="",l+="",l+="",l+=aa,l+="",l+="",l+="",a.mso.rtl&&(l+=""),l+="",l+="",l+="",l+="",l+="",l+=""; +l+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";l+="@page Section1 {size:"+N[a.mso.pageFormat][0]+"pt "+N[a.mso.pageFormat][1]+"pt";l+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";l+="div.Section1 {page:Section1;}";l+="@page Section2 {size:"+N[a.mso.pageFormat][1]+"pt "+N[a.mso.pageFormat][0]+"pt";l+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}"; +l+="div.Section2 {page:Section2;}";l+="br {mso-data-placement:same-cell;}";l+="";l+="";l+="";l+='
';l+=H;l+="
";l+="";l+="";if("string"===a.outputMode)return l;if("base64"===a.outputMode)return K(l);M(l,a.fileName+"."+v,"application/vnd.ms-"+h,"","base64",!1)}else if("png"===a.type)html2canvas(c(A)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length), +g=new Uint8Array(e),f=0;fJa){a>N.a0[0]&&(ia="a0",ba="l");for(var d in N)N.hasOwnProperty(d)&&N[d][1]>a&&(ia=d,ba="l",N[d][0]>a&&(ba="p"));Ja=a}}});a.jspdf.format=""===ia?"a4":ia;a.jspdf.orientation=""===ba?"w":ba}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(c(A).filter(function(){return I(c(this))}).each(function(){var b= +0;G=[];!1===a.exportHiddenCells&&(J=c(this).find("tr, th, td").filter(":hidden"),V=0a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===d.headerStyles.halign?"center":d.headerStyles.halign;a.styles.valign=d.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===d.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}}); +"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===d.styles.halign?"center":d.styles.halign;a.styles.valign=d.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===d.styles.halign&&(a.styles.halign=b.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&& +(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var d=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof d&&d.isCanvas))wa(a,b,d)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!==typeof d&&"undefined"!==typeof d.elements&& +d.elements.length?(b=a.height/d.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/d.rect.width,b=a.textPos.y,za(a,d.elements,g),a.textPos.y=b,Aa(a,d.elements,g)):Aa(a,{},g));else{d=d.elements[0];var e=c(d).attr("data-tableexport-canvas"),f=d.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,d,e,g)}return!1});g.headerrows=[];u=y(c(this));c(u).each(function(){b=0;g.headerrows[p]=[];E(this,"th,td",p,u.length,function(a, +c,d){var e=Da(a);e.title=F(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0= expireTimestamp) { + result = Moment(parseInt(valueTimestamp) * 1000).format('YYYY-MM-DD HH:mm:ss'); + } else { + result = '已过期'; + color = 'danger'; + } + } + return '' + result + ''; + }, operate: function (value, row, index) { var table = this.table; // 操作配置 @@ -10741,387 +10772,387 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr return Table; }); -// jQuery List DragSort v0.5.2 -// Website: http://dragsort.codeplex.com/ -// License: http://dragsort.codeplex.com/license - -(function($) { - - $.fn.dragsort = function(options) { - if (options == "destroy") { - $(this.selector).trigger("dragsort-uninit"); - return; - } - - var opts = $.extend({}, $.fn.dragsort.defaults, options); - var lists = []; - var list = null, lastPos = null; - - this.each(function(i, cont) { - - //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected - if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody")) - cont = $(cont).children().get(0); - - var newList = { - draggedItem: null, - placeHolderItem: null, - pos: null, - offset: null, - offsetLimit: null, - scroll: null, - container: cont, - - init: function() { - //set options to default values if not set - opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName; - if (opts.itemSelector == "") - opts.itemSelector = opts.tagName; - if (opts.dragSelector == "") - opts.dragSelector = opts.tagName; - if (opts.placeHolderTemplate == "") - opts.placeHolderTemplate = "<" + opts.tagName + "> "; - - //listidx allows reference back to correct list variable instance - $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); - this.styleDragHandlers(true); - }, - - uninit: function() { - var list = lists[$(this).attr("data-listidx")]; - $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); - list.styleDragHandlers(false); - }, - - getItems: function() { - return $(this.container).children(opts.itemSelector); - }, - - styleDragHandlers: function(cursor) { - this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : ""); - }, - - grabItem: function(e) { - var list = lists[$(this).attr("data-listidx")]; - var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); - var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0; - - //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return - if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem) - return; - - //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved, - //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude - //e.preventDefault(); - - //change cursor to move while dragging - var dragHandle = e.target; - while (!$(dragHandle).is(opts.dragSelector)) { - if (dragHandle == this) return; - dragHandle = dragHandle.parentNode; - } - $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); - $(dragHandle).css("cursor", "move"); - - //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work - var listElem = this; - var trigger = function() { - list.dragStart.call(listElem, e); - $(list.container).unbind("mousemove", trigger); - }; - $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); - }, - - dragStart: function(e) { - if (list != null && list.draggedItem != null) - list.dropItem(); - - list = lists[$(this).attr("data-listidx")]; - list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) - - //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items - list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); - - //calculate mouse offset relative to draggedItem - var mt = parseInt(list.draggedItem.css("marginTop")); - var ml = parseInt(list.draggedItem.css("marginLeft")); - list.offset = list.draggedItem.offset(); - list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; - list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; - - //calculate box the dragged item can't be dragged outside of - if (!opts.dragBetween) { - var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); - list.offsetLimit = $(list.container).offset(); - list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); - list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); - } - - //create placeholder item - var h = list.draggedItem.height(); - var w = list.draggedItem.width(); - if (opts.tagName == "tr") { - list.draggedItem.children().each(function() { $(this).width($(this).width()); }); - list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true); - list.draggedItem.after(list.placeHolderItem); - //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); - list.placeHolderItem.children().each(function() { $(this).html(" "); }); - } else { - list.draggedItem.after(opts.placeHolderTemplate); - list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true); - } - - if (opts.tagName == "td") { - var listTable = list.draggedItem.closest("table").get(0); - $("
").appendTo("body").children().append(list.draggedItem); - } - - //style draggedItem while dragging - var orig = list.draggedItem.attr("style"); - list.draggedItem.attr("data-origstyle", orig ? orig : ""); - list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w }); - - //auto-scroll setup - list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; - list.scroll.scrollY = window.setInterval(function() { - if (opts.scrollContainer != window) { - $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); - return; - } - var t = $(opts.scrollContainer).scrollTop(); - if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { - $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); - list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); - } - }, 10); - list.scroll.scrollX = window.setInterval(function() { - if (opts.scrollContainer != window) { - $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); - return; - } - var l = $(opts.scrollContainer).scrollLeft(); - if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { - $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); - list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); - } - }, 10); - - //misc - $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); - list.setPos(e.pageX, e.pageY); - $(document).bind("mousemove", list.swapItems); - $(document).bind("mouseup", list.dropItem); - if (opts.scrollContainer != window) - $(window).bind("wheel", list.wheel); - }, - - //set position of draggedItem - setPos: function(x, y) { - //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner - var top = y - this.offset.top; - var left = x - this.offset.left; - - //limit top, left to within box draggedItem can't be dragged outside of - if (!opts.dragBetween) { - top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); - left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); - } - - //adjust top & left calculations to parent offset - var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin - if (parent != null) { - top -= parent.top; - left -= parent.left; - } - - //set x or y auto-scroll amount - if (opts.scrollContainer == window) { - y -= $(window).scrollTop(); - x -= $(window).scrollLeft(); - y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); - x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); - } else { - var cont = $(opts.scrollContainer); - var offset = cont.offset(); - y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); - x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); - } - - list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); - list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); - - //move draggedItem to new mouse cursor location - this.draggedItem.css({ top: top, left: left }); - }, - - //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over - wheel: function(e) { - if (list && opts.scrollContainer != window) { - var cont = $(opts.scrollContainer); - var offset = cont.offset(); - e = e.originalEvent; - if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { - var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; - cont.scrollTop(cont.scrollTop() + deltaY); - e.preventDefault(); - } - } - }, - - //build a table recording all the positions of the moveable list items - buildPositionTable: function() { - var pos = []; - this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { - var loc = $(this).offset(); - loc.right = loc.left + $(this).outerWidth(); - loc.bottom = loc.top + $(this).outerHeight(); - loc.elm = this; - pos[i] = loc; - }); - this.pos = pos; - }, - - dropItem: function() { - if (list.draggedItem == null) - return; - - //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower - //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower) - var orig = list.draggedItem.attr("data-origstyle"); - list.draggedItem.attr("style", orig); - if (orig == "") - list.draggedItem.removeAttr("style"); - list.draggedItem.removeAttr("data-origstyle"); - - list.styleDragHandlers(true); - - list.placeHolderItem.before(list.draggedItem); - list.placeHolderItem.remove(); - - $("[data-droptarget], .dragSortItem").remove(); - - window.clearInterval(list.scroll.scrollY); - window.clearInterval(list.scroll.scrollX); - - //if position changed call dragEnd - if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) - if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order - var pos = list.draggedItem.attr("data-origpos").split('-'); - var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); - if (nextItem.size() > 0) - nextItem.before(list.draggedItem); - else if (pos[1] == 0) //was the only item in list - $(lists[pos[0]].container).prepend(list.draggedItem); - else //was the last item in list - $(lists[pos[0]].container).append(list.draggedItem); - } - list.draggedItem.removeAttr("data-origpos"); - - list.draggedItem = null; - $(document).unbind("mousemove", list.swapItems); - $(document).unbind("mouseup", list.dropItem); - if (opts.scrollContainer != window) - $(window).unbind("wheel", list.wheel); - return false; - }, - - //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of - swapItems: function(e) { - if (list.draggedItem == null) - return false; - - //move draggedItem to mouse location - list.setPos(e.pageX, e.pageY); - - //retrieve list and item position mouse cursor is over - var ei = list.findPos(e.pageX, e.pageY); - var nlist = list; - for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { - ei = lists[i].findPos(e.pageX, e.pageY); - nlist = lists[i]; - } - - //if not over another moveable list item return - if (ei == -1) - return false; - - //save fixed items locations - var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; - var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); - - //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after - if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) - $(nlist.pos[ei].elm).before(list.placeHolderItem); - else - $(nlist.pos[ei].elm).after(list.placeHolderItem); - - //restore fixed items location - fixed.each(function() { - var elm = children().eq(this.idx).get(0); - if (this != elm && children().index(this) < this.idx) - $(this).insertAfter(elm); - else if (this != elm) - $(this).insertBefore(elm); - }); - - //misc - $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); - lastPos = list.draggedItem.offset(); - return false; - }, - - //returns the index of the list item the mouse is over - findPos: function(x, y) { - for (var i = 0; i < this.pos.length; i++) { - if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) - return i; - } - return -1; - }, - - //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position - createDropTargets: function() { - if (!opts.dragBetween) - return; - - $(lists).each(function() { - var ph = $(this.container).find("[data-placeholder]"); - var dt = $(this.container).find("[data-droptarget]"); - if (ph.size() > 0 && dt.size() > 0) - dt.remove(); - else if (ph.size() == 0 && dt.size() == 0) { - if (opts.tagName == "td") - $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); - else - //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8) - $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true)); - - list.placeHolderItem.attr("data-placeholder", true); - } - }); - } - }; - - newList.init(); - lists.push(newList); - }); - - return this; - }; - - $.fn.dragsort.defaults = { - tagName:"", - itemSelector: "", - dragSelector: "", - dragSelectorExclude: "input, textarea", - dragEnd: function() { }, - dragBetween: false, - placeHolderTemplate: "", - scrollContainer: window, - scrollSpeed: 5 - }; - -})(jQuery); +// jQuery List DragSort v0.5.2 +// Website: http://dragsort.codeplex.com/ +// License: http://dragsort.codeplex.com/license + +(function($) { + + $.fn.dragsort = function(options) { + if (options == "destroy") { + $(this.selector).trigger("dragsort-uninit"); + return; + } + + var opts = $.extend({}, $.fn.dragsort.defaults, options); + var lists = []; + var list = null, lastPos = null; + + this.each(function(i, cont) { + + //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected + if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody")) + cont = $(cont).children().get(0); + + var newList = { + draggedItem: null, + placeHolderItem: null, + pos: null, + offset: null, + offsetLimit: null, + scroll: null, + container: cont, + + init: function() { + //set options to default values if not set + opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName; + if (opts.itemSelector == "") + opts.itemSelector = opts.tagName; + if (opts.dragSelector == "") + opts.dragSelector = opts.tagName; + if (opts.placeHolderTemplate == "") + opts.placeHolderTemplate = "<" + opts.tagName + "> "; + + //listidx allows reference back to correct list variable instance + $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); + this.styleDragHandlers(true); + }, + + uninit: function() { + var list = lists[$(this).attr("data-listidx")]; + $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); + list.styleDragHandlers(false); + }, + + getItems: function() { + return $(this.container).children(opts.itemSelector); + }, + + styleDragHandlers: function(cursor) { + this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : ""); + }, + + grabItem: function(e) { + var list = lists[$(this).attr("data-listidx")]; + var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); + var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0; + + //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return + if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem) + return; + + //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved, + //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude + //e.preventDefault(); + + //change cursor to move while dragging + var dragHandle = e.target; + while (!$(dragHandle).is(opts.dragSelector)) { + if (dragHandle == this) return; + dragHandle = dragHandle.parentNode; + } + $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); + $(dragHandle).css("cursor", "move"); + + //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work + var listElem = this; + var trigger = function() { + list.dragStart.call(listElem, e); + $(list.container).unbind("mousemove", trigger); + }; + $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); + }, + + dragStart: function(e) { + if (list != null && list.draggedItem != null) + list.dropItem(); + + list = lists[$(this).attr("data-listidx")]; + list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) + + //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items + list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); + + //calculate mouse offset relative to draggedItem + var mt = parseInt(list.draggedItem.css("marginTop")); + var ml = parseInt(list.draggedItem.css("marginLeft")); + list.offset = list.draggedItem.offset(); + list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; + list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; + + //calculate box the dragged item can't be dragged outside of + if (!opts.dragBetween) { + var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); + list.offsetLimit = $(list.container).offset(); + list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); + list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); + } + + //create placeholder item + var h = list.draggedItem.height(); + var w = list.draggedItem.width(); + if (opts.tagName == "tr") { + list.draggedItem.children().each(function() { $(this).width($(this).width()); }); + list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true); + list.draggedItem.after(list.placeHolderItem); + //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); + list.placeHolderItem.children().each(function() { $(this).html(" "); }); + } else { + list.draggedItem.after(opts.placeHolderTemplate); + list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true); + } + + if (opts.tagName == "td") { + var listTable = list.draggedItem.closest("table").get(0); + $("
").appendTo("body").children().append(list.draggedItem); + } + + //style draggedItem while dragging + var orig = list.draggedItem.attr("style"); + list.draggedItem.attr("data-origstyle", orig ? orig : ""); + list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w }); + + //auto-scroll setup + list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; + list.scroll.scrollY = window.setInterval(function() { + if (opts.scrollContainer != window) { + $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); + return; + } + var t = $(opts.scrollContainer).scrollTop(); + if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { + $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); + list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); + } + }, 10); + list.scroll.scrollX = window.setInterval(function() { + if (opts.scrollContainer != window) { + $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); + return; + } + var l = $(opts.scrollContainer).scrollLeft(); + if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { + $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); + list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); + } + }, 10); + + //misc + $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); + list.setPos(e.pageX, e.pageY); + $(document).bind("mousemove", list.swapItems); + $(document).bind("mouseup", list.dropItem); + if (opts.scrollContainer != window) + $(window).bind("wheel", list.wheel); + }, + + //set position of draggedItem + setPos: function(x, y) { + //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner + var top = y - this.offset.top; + var left = x - this.offset.left; + + //limit top, left to within box draggedItem can't be dragged outside of + if (!opts.dragBetween) { + top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); + left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); + } + + //adjust top & left calculations to parent offset + var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin + if (parent != null) { + top -= parent.top; + left -= parent.left; + } + + //set x or y auto-scroll amount + if (opts.scrollContainer == window) { + y -= $(window).scrollTop(); + x -= $(window).scrollLeft(); + y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); + x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); + } else { + var cont = $(opts.scrollContainer); + var offset = cont.offset(); + y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); + x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); + } + + list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); + list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); + + //move draggedItem to new mouse cursor location + this.draggedItem.css({ top: top, left: left }); + }, + + //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over + wheel: function(e) { + if (list && opts.scrollContainer != window) { + var cont = $(opts.scrollContainer); + var offset = cont.offset(); + e = e.originalEvent; + if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { + var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; + cont.scrollTop(cont.scrollTop() + deltaY); + e.preventDefault(); + } + } + }, + + //build a table recording all the positions of the moveable list items + buildPositionTable: function() { + var pos = []; + this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { + var loc = $(this).offset(); + loc.right = loc.left + $(this).outerWidth(); + loc.bottom = loc.top + $(this).outerHeight(); + loc.elm = this; + pos[i] = loc; + }); + this.pos = pos; + }, + + dropItem: function() { + if (list.draggedItem == null) + return; + + //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower + //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower) + var orig = list.draggedItem.attr("data-origstyle"); + list.draggedItem.attr("style", orig); + if (orig == "") + list.draggedItem.removeAttr("style"); + list.draggedItem.removeAttr("data-origstyle"); + + list.styleDragHandlers(true); + + list.placeHolderItem.before(list.draggedItem); + list.placeHolderItem.remove(); + + $("[data-droptarget], .dragSortItem").remove(); + + window.clearInterval(list.scroll.scrollY); + window.clearInterval(list.scroll.scrollX); + + //if position changed call dragEnd + if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) + if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order + var pos = list.draggedItem.attr("data-origpos").split('-'); + var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); + if (nextItem.size() > 0) + nextItem.before(list.draggedItem); + else if (pos[1] == 0) //was the only item in list + $(lists[pos[0]].container).prepend(list.draggedItem); + else //was the last item in list + $(lists[pos[0]].container).append(list.draggedItem); + } + list.draggedItem.removeAttr("data-origpos"); + + list.draggedItem = null; + $(document).unbind("mousemove", list.swapItems); + $(document).unbind("mouseup", list.dropItem); + if (opts.scrollContainer != window) + $(window).unbind("wheel", list.wheel); + return false; + }, + + //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of + swapItems: function(e) { + if (list.draggedItem == null) + return false; + + //move draggedItem to mouse location + list.setPos(e.pageX, e.pageY); + + //retrieve list and item position mouse cursor is over + var ei = list.findPos(e.pageX, e.pageY); + var nlist = list; + for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { + ei = lists[i].findPos(e.pageX, e.pageY); + nlist = lists[i]; + } + + //if not over another moveable list item return + if (ei == -1) + return false; + + //save fixed items locations + var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; + var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); + + //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after + if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) + $(nlist.pos[ei].elm).before(list.placeHolderItem); + else + $(nlist.pos[ei].elm).after(list.placeHolderItem); + + //restore fixed items location + fixed.each(function() { + var elm = children().eq(this.idx).get(0); + if (this != elm && children().index(this) < this.idx) + $(this).insertAfter(elm); + else if (this != elm) + $(this).insertBefore(elm); + }); + + //misc + $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); + lastPos = list.draggedItem.offset(); + return false; + }, + + //returns the index of the list item the mouse is over + findPos: function(x, y) { + for (var i = 0; i < this.pos.length; i++) { + if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) + return i; + } + return -1; + }, + + //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position + createDropTargets: function() { + if (!opts.dragBetween) + return; + + $(lists).each(function() { + var ph = $(this.container).find("[data-placeholder]"); + var dt = $(this.container).find("[data-droptarget]"); + if (ph.size() > 0 && dt.size() > 0) + dt.remove(); + else if (ph.size() == 0 && dt.size() == 0) { + if (opts.tagName == "td") + $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); + else + //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8) + $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true)); + + list.placeHolderItem.attr("data-placeholder", true); + } + }); + } + }; + + newList.init(); + lists.push(newList); + }); + + return this; + }; + + $.fn.dragsort.defaults = { + tagName:"", + itemSelector: "", + dragSelector: "", + dragSelectorExclude: "input, textarea", + dragEnd: function() { }, + dragBetween: false, + placeHolderTemplate: "", + scrollContainer: window, + scrollSpeed: 5 + }; + +})(jQuery); define("dragsort", function(){}); @@ -11141,244 +11172,244 @@ define("drag", function(){}); ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k -1 ? "&" : "?") + "ref=addtabs") : url; - try { - window.history.pushState(state, title, pushurl); - } catch (e) { - - } - } - $(this).data("pushstate", null); - _add.call(this, { - id: id, - title: $(this).attr('title') ? $(this).attr('title') : $(this).html(), - content: content, - url: url, - ajax: ajax - }); - } - }); - - navobj.on('click', '.close-tab', function () { - var id = $(this).prev("a").attr("aria-controls"); - _close(id); - return false; - }); - navobj.on('dblclick', 'li[role=presentation]', function () { - $(this).find(".close-tab").trigger("click"); - }); - navobj.on('click', 'li[role=presentation]', function () { - $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click"); - }); - - $(window).resize(function () { - if (typeof options.nav === 'object') { - var siblingsWidth = 0; - navobj.siblings().each(function () { - siblingsWidth += $(this).outerWidth(); - }); - navobj.width(navobj.parent().width() - siblingsWidth); - } else { - $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); - } - _drop(); - }); - - var _add = function (opts) { - var id, tabid, conid, url; - id = opts.id; - tabid = 'tab_' + opts.id; - conid = 'con_' + opts.id; - url = opts.url; - url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1"); - - var tabitem = $('#' + tabid, navobj); - var conitem = $('#' + conid, tabobj); - - navobj.find("[role='presentation']").removeClass('active'); - tabobj.find("[role='tabpanel']").removeClass('active'); - - //如果TAB不存在,创建一个新的TAB - if (tabitem.size() === 0) { - //创建新TAB的title - tabitem = $(''); - //是否允许关闭 - if (options.close && $("li", navobj).size() > 0) { - tabitem.append(' '); - } - if (conitem.size() === 0) { - //创建新TAB的内容 - conitem = $('
'); - //是否指定TAB内容 - if (opts.content) { - conitem.append(opts.content); - } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 - var height = options.iframeHeight; - conitem.append('
'); - } else { - $.get(url, function (data) { - conitem.append(data); - }); - } - tabobj.append(conitem); - } - //加入TABS - if ($('.tabdrop li', navobj).size() > 0) { - $('.tabdrop ul', navobj).append(tabitem); - } else { - navobj.append(tabitem); - } - } else { - //强制刷新iframe - if (options.iframeForceRefresh) { - $("#" + conid + " iframe").attr('src', function (i, val) { - return val; - }); - } else if (options.iframeForceRefreshTable) { - try { - //检测iframe中是否存在刷新按钮 - if ($("#" + conid + " iframe").contents().find(".btn-refresh").size() > 0) { - $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh").trigger("click"); - } - } catch (e) { - - } - } - } - localStorage.setItem("addtabs", $(this).prop('outerHTML')); - //激活TAB - tabitem.addClass('active'); - conitem.addClass("active"); - _drop(); - }; - - var _close = function (id) { - var tabid = 'tab_' + id; - var conid = 'con_' + id; - var tabitem = $('#' + tabid, navobj); - var conitem = $('#' + conid, tabobj); - //如果关闭的是当前激活的TAB,激活他的前一个TAB - if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) { - var prev = tabitem.prev().not(".tabdrop"); - var next = tabitem.next().not(".tabdrop"); - if (prev.size() > 0) { - prev.find('a').trigger("click"); - } else if (next.size() > 0) { - next.find('a').trigger("click"); - } else { - $(">li:not(.tabdrop):last > a", navobj).trigger('click'); - } - } - //关闭TAB - tabitem.remove(); - conitem.remove(); - _drop(); - options.callback(); - }; - - var _drop = function () { - navobj.refreshAddtabs(); - }; - }; - //刷新Addtabs - $.fn.refreshAddtabs = function () { - var navobj = $(this); - var dropdown = $(".tabdrop", navobj); - if (dropdown.size() === 0) { - dropdown = $(''); - dropdown.prependTo(navobj); - } - - //检测是否有下拉样式 - if (navobj.parent().is('.tabs-below')) { - dropdown.addClass('dropup'); - } - - var collection = 0; - var maxwidth = navobj.width() - 65; - - var liwidth = 0; - //检查超过一行的标签页 - var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop'); - var totalwidth = 0; - litabs.each(function () { - totalwidth += $(this).outerWidth(true); - }); - if (navobj.width() < totalwidth) { - litabs.each(function () { - liwidth += $(this).outerWidth(true); - if (liwidth > maxwidth) { - dropdown.find('ul').append($(this)); - collection++; - } - }); - if (collection > 0) { - dropdown.removeClass('hide'); - if (dropdown.find('.active').length === 1) { - dropdown.addClass('active'); - } else { - dropdown.removeClass('active'); - } - } - } else { - dropdown.addClass('hide'); - } - - }; -})(jQuery); +/** + * http://git.oschina.net/hbbcs/bootStrap-addTabs + * Created by joe on 2015-12-19. + * Modified by Karson + */ + +(function ($) { + + $.fn.addtabs = function (options) { + var obj = $(this); + options = $.extend({ + content: '', //直接指定所有页面TABS内容 + close: true, //是否可以关闭 + monitor: 'body', //监视的区域 + nav: '.nav-addtabs', + tab: '.tab-addtabs', + iframeUse: true, //使用iframe还是ajax + iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改 + iframeForceRefresh: false, //点击后强制加载对应的iframe + iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table + callback: function () { + //关闭后回调函数 + } + }, options || {}); + var navobj = $(options.nav); + var tabobj = $(options.tab); + if (history.pushState) { + //浏览器前进后退事件 + $(window).on("popstate", function (e) { + var state = e.originalEvent.state; + if (state) { + $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click"); + } + }); + } + $(options.monitor).on('click', '[addtabs]', function (e) { + if ($(this).attr('url').indexOf("javascript:") !== 0) { + if ($(this).is("a")) { + e.preventDefault(); + } + var id = $(this).attr('addtabs'); + var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text()); + var url = $(this).attr('url'); + var content = options.content ? options.content : $(this).attr('content'); + var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true'; + var state = ({ + url: url, title: title, id: id, content: content, ajax: ajax + }); + + document.title = title; + if (history.pushState && !$(this).data("pushstate")) { + var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url; + try { + window.history.pushState(state, title, pushurl); + } catch (e) { + + } + } + $(this).data("pushstate", null); + _add.call(this, { + id: id, + title: $(this).attr('title') ? $(this).attr('title') : $(this).html(), + content: content, + url: url, + ajax: ajax + }); + } + }); + + navobj.on('click', '.close-tab', function () { + var id = $(this).prev("a").attr("aria-controls"); + _close(id); + return false; + }); + navobj.on('dblclick', 'li[role=presentation]', function () { + $(this).find(".close-tab").trigger("click"); + }); + navobj.on('click', 'li[role=presentation]', function () { + $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click"); + }); + + $(window).resize(function () { + if (typeof options.nav === 'object') { + var siblingsWidth = 0; + navobj.siblings().each(function () { + siblingsWidth += $(this).outerWidth(); + }); + navobj.width(navobj.parent().width() - siblingsWidth); + } else { + $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); + } + _drop(); + }); + + var _add = function (opts) { + var id, tabid, conid, url; + id = opts.id; + tabid = 'tab_' + opts.id; + conid = 'con_' + opts.id; + url = opts.url; + url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1"); + + var tabitem = $('#' + tabid, navobj); + var conitem = $('#' + conid, tabobj); + + navobj.find("[role='presentation']").removeClass('active'); + tabobj.find("[role='tabpanel']").removeClass('active'); + + //如果TAB不存在,创建一个新的TAB + if (tabitem.size() === 0) { + //创建新TAB的title + tabitem = $(''); + //是否允许关闭 + if (options.close && $("li", navobj).size() > 0) { + tabitem.append(' '); + } + if (conitem.size() === 0) { + //创建新TAB的内容 + conitem = $('
'); + //是否指定TAB内容 + if (opts.content) { + conitem.append(opts.content); + } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 + var height = options.iframeHeight; + conitem.append('
'); + } else { + $.get(url, function (data) { + conitem.append(data); + }); + } + tabobj.append(conitem); + } + //加入TABS + if ($('.tabdrop li', navobj).size() > 0) { + $('.tabdrop ul', navobj).append(tabitem); + } else { + navobj.append(tabitem); + } + } else { + //强制刷新iframe + if (options.iframeForceRefresh) { + $("#" + conid + " iframe").attr('src', function (i, val) { + return val; + }); + } else if (options.iframeForceRefreshTable) { + try { + //检测iframe中是否存在刷新按钮 + if ($("#" + conid + " iframe").contents().find(".btn-refresh").size() > 0) { + $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh").trigger("click"); + } + } catch (e) { + + } + } + } + localStorage.setItem("addtabs", $(this).prop('outerHTML')); + //激活TAB + tabitem.addClass('active'); + conitem.addClass("active"); + _drop(); + }; + + var _close = function (id) { + var tabid = 'tab_' + id; + var conid = 'con_' + id; + var tabitem = $('#' + tabid, navobj); + var conitem = $('#' + conid, tabobj); + //如果关闭的是当前激活的TAB,激活他的前一个TAB + if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) { + var prev = tabitem.prev().not(".tabdrop"); + var next = tabitem.next().not(".tabdrop"); + if (prev.size() > 0) { + prev.find('a').trigger("click"); + } else if (next.size() > 0) { + next.find('a').trigger("click"); + } else { + $(">li:not(.tabdrop):last > a", navobj).trigger('click'); + } + } + //关闭TAB + tabitem.remove(); + conitem.remove(); + _drop(); + options.callback(); + }; + + var _drop = function () { + navobj.refreshAddtabs(); + }; + }; + //刷新Addtabs + $.fn.refreshAddtabs = function () { + var navobj = $(this); + var dropdown = $(".tabdrop", navobj); + if (dropdown.size() === 0) { + dropdown = $(''); + dropdown.prependTo(navobj); + } + + //检测是否有下拉样式 + if (navobj.parent().is('.tabs-below')) { + dropdown.addClass('dropup'); + } + + var collection = 0; + var maxwidth = navobj.width() - 65; + + var liwidth = 0; + //检查超过一行的标签页 + var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop'); + var totalwidth = 0; + litabs.each(function () { + totalwidth += $(this).outerWidth(true); + }); + if (navobj.width() < totalwidth) { + litabs.each(function () { + liwidth += $(this).outerWidth(true); + if (liwidth > maxwidth) { + dropdown.find('ul').append($(this)); + collection++; + } + }); + if (collection > 0) { + dropdown.removeClass('hide'); + if (dropdown.find('.active').length === 1) { + dropdown.addClass('active'); + } else { + dropdown.removeClass('active'); + } + } + } else { + dropdown.addClass('hide'); + } + + }; +})(jQuery); define("addtabs", function(){}); diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 878c3195a47e46581610fb7c5551ad406b790eab..7cf7c789cf3fee4e371bc926777945fb04035a29 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -599,6 +599,37 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None'); } }, + expiretime: function (value, row, index) { + if (!value && value!==0) { + return __('None'); + } + var result = ''; + var color = 'success'; + //永久标识 + var forerver = [0,'0000-00-00 00:00:00', '0000-00-00 00:00:00.000000']; + if ($.inArray(value, forerver) !== -1) { + result = "永久" + } else { + //过期时间 + var expireTimestamp = Moment().unix(); + if (typeof this.expireOn !== 'undefined') { + var condition = isNaN(this.expireOn) ? (this.expireOn.toLowerCase() !== 'now') : (this.expireOn !== 0); + if (condition) { + expireTimestamp = isNaN(this.expireOn) ? Moment(this.expireOn).unix() : Moment(parseInt(this.expireOn) * 1000).unix() + } + } + //当前value时间 + var valueTimestamp = isNaN(value) ? Moment(value).unix() : Moment(parseInt(value) * 1000).unix(); + + if (valueTimestamp >= expireTimestamp) { + result = Moment(parseInt(valueTimestamp) * 1000).format('YYYY-MM-DD HH:mm:ss'); + } else { + result = '已过期'; + color = 'danger'; + } + } + return '' + result + ''; + }, operate: function (value, row, index) { var table = this.table; // 操作配置