[dev]更新系统模块
@ -14,8 +14,11 @@
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\Node;
|
||||
use controller\BasicAdmin;
|
||||
use library\Data;
|
||||
use library\Tools;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 系统权限管理控制器
|
||||
@ -44,7 +47,42 @@ class Auth extends BasicAdmin {
|
||||
* 权限授权
|
||||
*/
|
||||
public function apply() {
|
||||
return $this->_form($this->table, 'apply');
|
||||
$auth_id = $this->request->get('id', '0');
|
||||
switch (strtolower($this->request->get('action', '0'))) {
|
||||
case 'getnode':
|
||||
$nodes = Node::get();
|
||||
$checked = Db::name('SystemAuthNode')->where('auth', $auth_id)->column('node');
|
||||
foreach ($nodes as $key => &$node) {
|
||||
$node['checked'] = in_array($node['node'], $checked);
|
||||
if (empty($node['is_auth']) && substr_count($node['node'], '/') > 1) {
|
||||
unset($nodes[$key]);
|
||||
}
|
||||
}
|
||||
return $this->success('获取节点成功!', '', $this->_filterNodes($this->_filterNodes(Tools::arr2tree($nodes, 'node', 'pnode', '_sub_'))));
|
||||
case 'save':
|
||||
$data = [];
|
||||
$post = $this->request->post();
|
||||
foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
|
||||
$data[] = ['auth' => $auth_id, 'node' => $node];
|
||||
}
|
||||
Db::name('SystemAuthNode')->where('auth', $auth_id)->delete();
|
||||
Db::name('SystemAuthNode')->insertAll($data);
|
||||
return $this->success('节点授权更新成功!', '');
|
||||
default :
|
||||
$this->assign('title', '节点授权');
|
||||
return $this->_form($this->table, 'apply');
|
||||
}
|
||||
}
|
||||
|
||||
protected function _filterNodes($nodes, $level = 1) {
|
||||
foreach ($nodes as $key => &$node) {
|
||||
if (!empty($node['_sub_']) && is_array($node['_sub_'])) {
|
||||
$node['_sub_'] = $this->_filterNodes($node['_sub_'], $level + 1);
|
||||
} elseif ($level < 3) {
|
||||
unset($nodes[$key]);
|
||||
}
|
||||
}
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,10 @@ class Login extends BasicAdmin {
|
||||
$user = Db::name('SystemUser')->where('username', $username)->find();
|
||||
empty($user) && $this->error('登录账号不存在,请重新输入!');
|
||||
($user['password'] !== md5($password)) && $this->error('登录密码与账号不匹配,请重新输入!');
|
||||
if (!empty($user['authorize'])) {
|
||||
$authorizeids = explode(',', $user['authorize']);
|
||||
$user['nodes'] = Db::name('SystemAuthNode')->where('auth', 'in', $authorizeids)->column('node');
|
||||
}
|
||||
session('user', $user);
|
||||
$this->success('登录成功,正在进入系统...', '@admin');
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\Node;
|
||||
use controller\BasicAdmin;
|
||||
use library\Data;
|
||||
use library\Node;
|
||||
use library\Tools;
|
||||
use think\Db;
|
||||
|
||||
@ -96,14 +96,13 @@ class Menu extends BasicAdmin {
|
||||
}
|
||||
}
|
||||
// 读取系统功能节点
|
||||
$nodes = Node::getNodeTree(APP_PATH);
|
||||
$denyAll = Db::name('SystemNode')->where('is_menu', '0')->column('node');
|
||||
$nodes = Node::get(APP_PATH);
|
||||
foreach ($nodes as $key => $_vo) {
|
||||
if (in_array($_vo, $denyAll)) {
|
||||
if (empty($_vo['is_menu'])) {
|
||||
unset($nodes[$key]);
|
||||
}
|
||||
}
|
||||
$this->assign('nodes', array_values($nodes));
|
||||
$this->assign('nodes', array_column($nodes, 'node'));
|
||||
$this->assign('menus', $menus);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\Node as NodeModel;
|
||||
use controller\BasicAdmin;
|
||||
use library\Data;
|
||||
use library\Node as ModuleNode;
|
||||
use library\Tools;
|
||||
|
||||
/**
|
||||
@ -38,35 +38,15 @@ class Node extends BasicAdmin {
|
||||
* 显示节点列表
|
||||
*/
|
||||
public function index() {
|
||||
$this->title = '系统节点管理';
|
||||
$alert = [
|
||||
'type' => 'danger',
|
||||
'title' => '安全警告',
|
||||
'content' => '系统数据请勿随意修改!'
|
||||
'content' => '结构为系统自动生成,状态数据请勿随意修改!'
|
||||
];
|
||||
$this->assign('alert', $alert);
|
||||
parent::_list($this->table, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据处理
|
||||
* @param $data
|
||||
*/
|
||||
protected function _index_data_filter($data) {
|
||||
$nodes = [];
|
||||
$alias = [];
|
||||
foreach ($data as $vo) {
|
||||
$alias["{$vo['node']}"] = $vo;
|
||||
}
|
||||
foreach (ModuleNode::getNodeTree(APP_PATH) as $thr) {
|
||||
$tmp = explode('/', $thr);
|
||||
$one = $tmp[0];
|
||||
$two = "{$tmp[0]}/{$tmp[1]}";
|
||||
$nodes[$one] = array_merge(isset($alias[$one]) ? $alias[$one] : ['node' => $one, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => '']);
|
||||
$nodes[$two] = array_merge(isset($alias[$two]) ? $alias[$two] : ['node' => $two, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => $one]);
|
||||
$nodes[$thr] = array_merge(isset($alias[$thr]) ? $alias[$thr] : ['node' => $thr, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => $two]);
|
||||
}
|
||||
$this->assign('nodes', Tools::arr2table($nodes, 'node', 'pnode'));
|
||||
$this->assign('title', '系统节点管理');
|
||||
$this->assign('nodes', Tools::arr2table(NodeModel::get(), 'node', 'pnode'));
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,14 @@ class User extends BasicAdmin {
|
||||
parent::_list($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权管理
|
||||
* @return type
|
||||
*/
|
||||
public function auth() {
|
||||
return $this->_form($this->table, 'auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户添加
|
||||
*/
|
||||
@ -61,6 +69,7 @@ class User extends BasicAdmin {
|
||||
$this->error('系统超级账号禁止操作!');
|
||||
}
|
||||
if ($this->request->isGet()) {
|
||||
$this->assign('verify', false);
|
||||
return $this->_form($this->table, 'pass');
|
||||
}
|
||||
$data = $this->request->post();
|
||||
@ -80,11 +89,17 @@ class User extends BasicAdmin {
|
||||
*/
|
||||
public function _form_filter(&$data) {
|
||||
if ($this->request->isPost()) {
|
||||
if (isset($data['authorize']) && is_array($data['authorize'])) {
|
||||
$data['authorize'] = join(',', $data['authorize']);
|
||||
}
|
||||
if (isset($data['id'])) {
|
||||
unset($data['username']);
|
||||
} elseif (Db::name($this->table)->where('username', $data['username'])->find()) {
|
||||
$this->error('用户账号已经存在,请使用其它账号!');
|
||||
}
|
||||
} else {
|
||||
$data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : '');
|
||||
$this->assign('authorizes', Db::name('SystemAuth')->select());
|
||||
}
|
||||
}
|
||||
|
||||
|
98
application/admin/model/Node.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Think.Admin
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2016~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/Think.Admin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 系统用户管理控制器
|
||||
* Class Node
|
||||
* @package app\admin\model
|
||||
* @author Anyon <zoujingli@qq.com>
|
||||
* @date 2017/03/14 18:12
|
||||
*/
|
||||
class Node {
|
||||
|
||||
/**
|
||||
* 获取系统代码节点
|
||||
* @return array
|
||||
*/
|
||||
static public function get() {
|
||||
$data = Db::name('SystemNode')->select();
|
||||
$nodes = [];
|
||||
$alias = [];
|
||||
foreach ($data as $vo) {
|
||||
$alias["{$vo['node']}"] = $vo;
|
||||
}
|
||||
foreach (self::getNodeTree(APP_PATH) as $thr) {
|
||||
$tmp = explode('/', $thr);
|
||||
$one = $tmp[0];
|
||||
$two = "{$tmp[0]}/{$tmp[1]}";
|
||||
$nodes[$one] = array_merge(isset($alias[$one]) ? $alias[$one] : ['node' => $one, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => '']);
|
||||
$nodes[$two] = array_merge(isset($alias[$two]) ? $alias[$two] : ['node' => $two, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => $one]);
|
||||
$nodes[$thr] = array_merge(isset($alias[$thr]) ? $alias[$thr] : ['node' => $thr, 'title' => '', 'is_menu' => 0, 'is_auth' => 0], ['pnode' => $two]);
|
||||
}
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
* @param string $path
|
||||
* @param array $nodes
|
||||
* @return array
|
||||
*/
|
||||
static public function getNodeTree($path, $nodes = []) {
|
||||
foreach (self::getFilePaths($path) as $vo) {
|
||||
if (stripos($vo, DS . 'controller' . DS) === false) {
|
||||
continue;
|
||||
}
|
||||
$_tmp = explode(DS, $vo);
|
||||
$controllerName = rtrim(array_pop($_tmp), '.php');
|
||||
array_pop($_tmp);
|
||||
$moduleName = array_pop($_tmp);
|
||||
$className = config('app_namespace') . "\\{$moduleName}\\controller\\{$controllerName}";
|
||||
if (!class_exists($className)) {
|
||||
continue;
|
||||
}
|
||||
foreach (get_class_methods($className) as $actionName) {
|
||||
if ($actionName[0] !== '_') {
|
||||
$nodes[] = strtolower("{$moduleName}/{$controllerName}/{$actionName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有PHP文件
|
||||
* @param string $path
|
||||
* @param array $data
|
||||
* @param string $ext
|
||||
* @return array
|
||||
*/
|
||||
static private function getFilePaths($path, $data = [], $ext = 'php') {
|
||||
foreach (scandir($path) as $dir) {
|
||||
if ($dir[0] === '.') {
|
||||
continue;
|
||||
}
|
||||
$tmp = realpath($path . DS . $dir);
|
||||
if ($tmp && (is_dir($tmp) || pathinfo($tmp, PATHINFO_EXTENSION) === $ext)) {
|
||||
is_dir($tmp) ? $data = array_merge($data, self::getFilePaths($tmp)) : $data[] = $tmp;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
108
application/admin/view/auth.apply.html
Normal file
@ -0,0 +1,108 @@
|
||||
{extend name='extra@admin/content' /}
|
||||
|
||||
{block name="content"}
|
||||
|
||||
<style>
|
||||
ul.ztree li span.button.switch{margin-right:5px}
|
||||
ul.ztree ul ul li{display:inline-block;white-space:normal}
|
||||
ul.ztree>li>ul>li{padding:5px}
|
||||
ul.ztree>li{background: #dae6f0}
|
||||
ul.ztree>li:nth-child(even)>ul>li:nth-child(even){background: #eef5fa}
|
||||
ul.ztree>li:nth-child(even)>ul>li:nth-child(odd){background: #f6fbff}
|
||||
ul.ztree>li:nth-child(odd)>ul>li:nth-child(even){background: #eef5fa}
|
||||
ul.ztree>li:nth-child(odd)>ul>li:nth-child(odd){background: #f6fbff}
|
||||
ul.ztree>li>ul{margin-top:12px}
|
||||
ul.ztree>li{padding:15px;padding-right:25px}
|
||||
ul.ztree li{white-space:normal!important}
|
||||
ul.ztree>li>a>span{font-size:15px;font-weight:700}
|
||||
</style>
|
||||
|
||||
<ul id="zTree" class="ztree loading">
|
||||
<li style="height:100px;"></li>
|
||||
</ul>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" data-submit-role type='button'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' onclick="window.history.back()">取消编辑</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(['jquery.ztree'], function () {
|
||||
function showTree() {
|
||||
this.data = {};
|
||||
this.ztree = null;
|
||||
this.setting = {
|
||||
view: {showLine: false, showIcon: false, dblClickExpand: false},
|
||||
check: {enable: true, nocheck: false, chkboxType: {"Y": "ps", "N": "ps"}},
|
||||
callback: {
|
||||
beforeClick: function (treeId, treeNode) {
|
||||
if (treeNode.children.length < 1) {
|
||||
window.roleForm.ztree.checkNode(treeNode, !treeNode.checked, null, true);
|
||||
} else {
|
||||
window.roleForm.ztree.expandNode(treeNode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.listen();
|
||||
}
|
||||
showTree.prototype = {
|
||||
constructor: showTree,
|
||||
listen: function () {
|
||||
this.getData(this);
|
||||
},
|
||||
getData: function (self) {
|
||||
$.msg.loading();
|
||||
jQuery.get('{:url()}?id={$vo.id}', {action: 'getNode'}, function (ret) {
|
||||
$.msg.close();
|
||||
function renderChildren(data, level) {
|
||||
var childrenData = [];
|
||||
for (var i in data) {
|
||||
var children = {};
|
||||
children.open = true;
|
||||
children.node = data[i].node;
|
||||
children.name = data[i].title || data[i].node;
|
||||
children.checked = data[i].checked || false;
|
||||
children.children = renderChildren(data[i]._sub_, level + 1);
|
||||
childrenData.push(children);
|
||||
}
|
||||
return childrenData;
|
||||
}
|
||||
self.data = renderChildren(ret.data, 1);
|
||||
self.showTree();
|
||||
}, 'JSON');
|
||||
},
|
||||
showTree: function () {
|
||||
this.ztree = jQuery.fn.zTree.init(jQuery("#zTree"), this.setting, this.data);
|
||||
while (true) {
|
||||
var reNodes = this.ztree.getNodesByFilter(function (node) {
|
||||
return (!node.node && node.children.length < 1);
|
||||
});
|
||||
if (reNodes.length < 1) {
|
||||
break;
|
||||
}
|
||||
for (var i in reNodes) {
|
||||
this.ztree.removeNode(reNodes[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
submit: function () {
|
||||
var nodes = [];
|
||||
var data = this.ztree.getCheckedNodes(true);
|
||||
for (var i in data) {
|
||||
(data[i].node) && nodes.push(data[i].node);
|
||||
}
|
||||
$.form.load('{:url()}?id={$vo.id}&action=save', {nodes: nodes}, 'POST');
|
||||
}
|
||||
};
|
||||
window.roleForm = new showTree();
|
||||
$('[data-submit-role]').on('click', function () {
|
||||
window.roleForm.submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{/block}
|
@ -50,7 +50,7 @@
|
||||
{/if}
|
||||
{if auth("$classuri/apply")}
|
||||
<span class="text-explode">|</span>
|
||||
<a data-modal='{:url("$classuri/apple")}?id={$vo.id}' href="javascript:void(0)">管理节点</a>
|
||||
<a data-open='{:url("$classuri/apply")}?id={$vo.id}' href="javascript:void(0)">授权</a>
|
||||
{/if}
|
||||
{if $vo.status eq 1 and auth("$classuri/forbid")}
|
||||
<span class="text-explode">|</span>
|
||||
|
@ -7,7 +7,6 @@
|
||||
<th style="width:20px"></th>
|
||||
<th class='text-left'>节点</th>
|
||||
<th class='text-left'></th>
|
||||
<th class='text-left'></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -21,7 +20,7 @@
|
||||
<input class='layui-input layui-input-inline title-input' style='height:28px;line-height:28px;width:auto' name='title.{$vo.node}' value="{$vo.title}"/>
|
||||
{/if}
|
||||
</td>
|
||||
<td class='text-left' style="width:100px">
|
||||
<td class='text-left nowrap'>
|
||||
{if auth("$classuri/save")}
|
||||
<label>
|
||||
{if substr_count($vo['node'],'/')==2}
|
||||
@ -30,13 +29,10 @@
|
||||
{else /}
|
||||
<input name='is_auth.{$vo.node}' class="check-box" type='checkbox' value='1'/>
|
||||
{/notempty}
|
||||
权限控制
|
||||
加入权限控制
|
||||
{/if}
|
||||
</label>
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
<td class='text-left'>
|
||||
{if auth("$classuri/save")}
|
||||
|
||||
<label>
|
||||
{if substr_count($vo['node'],'/')==2}
|
||||
{notempty name='vo.is_menu'}
|
||||
@ -49,7 +45,7 @@
|
||||
</label>
|
||||
{/if}
|
||||
</td>
|
||||
<td></td>
|
||||
<td style="width:100%"></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
35
application/admin/view/user.auth.html
Normal file
@ -0,0 +1,35 @@
|
||||
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="{:url()}" data-auto="true" method="post">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户账号</label>
|
||||
<div class="layui-input-block">
|
||||
{if $vo and $vo.username}
|
||||
<input type="text" readonly="" disabled="" name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="layui-input disabled">
|
||||
{else/}
|
||||
<input type="text" name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="layui-input">
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访问授权</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach $authorizes as $authorize}
|
||||
{if in_array($authorize['id'],$vo['authorize'])}
|
||||
<input type="checkbox" checked name="authorize[]" value="{$authorize.id}" title="{$authorize.title}">
|
||||
{else/}
|
||||
<input type="checkbox" name="authorize[]" value="{$authorize.id}" title="{$authorize.title}">
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
{if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
|
||||
<button class="layui-btn" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||
</div>
|
||||
<script>window.form.render();</script>
|
||||
</form>
|
@ -25,6 +25,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if isset($authorizes)}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访问授权</label>
|
||||
<div class="layui-input-block">
|
||||
{foreach $authorizes as $authorize}
|
||||
{if in_array($authorize['id'],$vo['authorize'])}
|
||||
<input type="checkbox" checked name="authorize[]" value="{$authorize.id}" title="{$authorize.title}">
|
||||
{else/}
|
||||
<input type="checkbox" name="authorize[]" value="{$authorize.id}" title="{$authorize.title}">
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户描述</label>
|
||||
<div class="layui-input-block">
|
||||
@ -32,6 +47,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
@ -39,5 +55,5 @@
|
||||
<button class="layui-btn" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||
</div>
|
||||
|
||||
<script>window.form.render();</script>
|
||||
</form>
|
||||
|
@ -48,7 +48,11 @@
|
||||
<span class="text-explode">|</span>
|
||||
<a data-modal='{:url("$classuri/edit")}?id={$vo.id}' href="javascript:void(0)">编辑</a>
|
||||
{/if}
|
||||
{if auth("$classuri/edit")}
|
||||
{if auth("$classuri/auth")}
|
||||
<span class="text-explode">|</span>
|
||||
<a data-modal='{:url("$classuri/auth")}?id={$vo.id}' href="javascript:void(0)">授权</a>
|
||||
{/if}
|
||||
{if auth("$classuri/pass")}
|
||||
<span class="text-explode">|</span>
|
||||
<a data-modal='{:url("$classuri/pass")}?id={$vo.id}' href="javascript:void(0)">密码</a>
|
||||
{/if}
|
||||
|
@ -12,6 +12,7 @@
|
||||
// | github开源项目:https://github.com/zoujingli/Think.Admin
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use Wechat\Loader;
|
||||
@ -72,7 +73,18 @@ function decode($string) {
|
||||
* @return bool
|
||||
*/
|
||||
function auth($node) {
|
||||
return true;
|
||||
$nodes = cache('need_access_node');
|
||||
if (empty($nodes)) {
|
||||
$nodes = Db::name('SystemNode')->where('is_auth', '1')->column('node');
|
||||
cache('need_access_node', $nodes);
|
||||
}
|
||||
if (session('user.username') === 'admin' || stripos($node, 'admin/index') === 0) {
|
||||
return true;
|
||||
}
|
||||
if (!in_array(strtolower($node), array_values($nodes))) {
|
||||
return true;
|
||||
}
|
||||
return in_array(strtolower($node), (array) session('user.nodes'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,12 +93,31 @@ function auth($node) {
|
||||
* @return string
|
||||
*/
|
||||
function sysconf($name) {
|
||||
static $conf = [];
|
||||
if (empty($conf)) {
|
||||
static $config = [];
|
||||
if (empty($config)) {
|
||||
$list = Db::name('SystemConfig')->select();
|
||||
foreach ($list as $vo) {
|
||||
$conf[$vo['name']] = $vo['value'];
|
||||
$config[$vo['name']] = $vo['value'];
|
||||
}
|
||||
}
|
||||
return isset($conf[$name]) ? $conf[$name] : '';
|
||||
return isset($config[$name]) ? $config[$name] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* array_column 函数兼容
|
||||
*/
|
||||
if (!function_exists("array_column")) {
|
||||
|
||||
function array_column(array &$rows, $column_key, $index_key = null) {
|
||||
$data = [];
|
||||
foreach ($rows as $row) {
|
||||
if (empty($index_key)) {
|
||||
$data[] = $row[$column_key];
|
||||
} else {
|
||||
$data[$row[$index_key]] = $row[$column_key];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
115
extend/controller/BasicApi.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace controller;
|
||||
|
||||
use think\Cache;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* 数据接口通用控制器
|
||||
* @package controller
|
||||
*/
|
||||
class BasicApi {
|
||||
|
||||
/**
|
||||
* 访问请求对象
|
||||
* @var Request
|
||||
*/
|
||||
public $request;
|
||||
|
||||
/**
|
||||
* 当前访问身份
|
||||
* @var string
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* 基础接口SDK
|
||||
* @param Request|null $request
|
||||
*/
|
||||
public function __construct(Request $request = null) {
|
||||
$this->request = is_null($request) ? Request::instance() : $request;
|
||||
if (in_array($this->request->action(), ['response', 'setcache', 'getcache', 'delcache', '_empty'])) {
|
||||
exit($this->response('禁止访问接口安全方法!', 'ACCESS_NOT_ALLOWED')->send());
|
||||
}
|
||||
$this->token = $this->request->request('token', $this->request->header('token', false));
|
||||
if ((empty($this->token) || !$this->getCache($this->token)) && ($this->request->action() !== 'auth')) {
|
||||
exit($this->response('访问TOKEN失效,请重新授权!', 'ACCESS_TOKEN_FAILD')->send());
|
||||
}
|
||||
// CORS 跨域 Options 检测响应
|
||||
if ($this->request->isOptions()) {
|
||||
header('Access-Control-Allow-Origin:*');
|
||||
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-Type,token');
|
||||
header('Access-Control-Allow-Credentials:true');
|
||||
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
|
||||
header('Access-Control-Max-Age:1728000');
|
||||
header('Content-Type:text/plain charset=UTF-8');
|
||||
header('Content-Length: 0', true);
|
||||
header('status: 204');
|
||||
header('HTTP/1.0 204 No Content');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出返回数据
|
||||
* @access protected
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param String $type 返回类型 JSON XML
|
||||
* @param integer $code HTTP状态码
|
||||
* @return Response
|
||||
*/
|
||||
public function response($msg, $code = 'SUCCESS', $data = [], $type = 'json') {
|
||||
$result = ['code' => $code, 'msg' => $msg, 'data' => $data, 'token' => $this->token, 'dataType' => strtolower($type)];
|
||||
return Response::create($result, $type)->code(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入缓存
|
||||
* @param string $name 缓存标识
|
||||
* @param mixed $value 存储数据
|
||||
* @param int|null $expire 有效时间 0为永久
|
||||
* @return bool
|
||||
*/
|
||||
public function setCache($name, $value, $expire = null) {
|
||||
return Cache::set("{$this->token}_{$name}", $value, $expire);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取缓存
|
||||
* @param string $name 缓存标识
|
||||
* @param mixed $default 默认值
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCache($name, $default = false) {
|
||||
return Cache::get("{$this->token}_{$name}", $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
* @param string $name 缓存标识
|
||||
* @return bool
|
||||
*/
|
||||
public function delCache($name) {
|
||||
return Cache::rm("{$this->token}_{$name}");
|
||||
}
|
||||
|
||||
/**
|
||||
* API接口调度
|
||||
* @return Response
|
||||
*/
|
||||
public function _empty() {
|
||||
list($module, $controller, $action, $method) = explode('/', $this->request->path() . '///');
|
||||
if (!empty($module) && !empty($controller) && !empty($action) && !empty($method)) {
|
||||
$action = ucfirst($action);
|
||||
$Api = "app\\{$module}\\{$controller}\\{$action}Api";
|
||||
if (method_exists($Api, $method)) {
|
||||
return $Api::$method($this);
|
||||
}
|
||||
return $this->response('访问的接口不存在!', 'NOT_FOUND');
|
||||
}
|
||||
return $this->response('不符合标准的接口!', 'API_ERROR');
|
||||
}
|
||||
|
||||
}
|
@ -32,7 +32,8 @@ class Data {
|
||||
* @return bool
|
||||
*/
|
||||
static public function deleteSequence($sequence, $type = 'SYSTEM') {
|
||||
return Db::table('system_sequence')->where('type', strtoupper($type))->where('sequence', $sequence)->delete();
|
||||
$data = ['sequence' => $sequence, 'type' => strtoupper($type)];
|
||||
return Db::name('SystemSequence')->where($data)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,35 +42,20 @@ class Data {
|
||||
* @param string $type 序号顾类型
|
||||
* @return string
|
||||
*/
|
||||
static public function createSequence($length = 13, $type = 'SYSTEM') {
|
||||
return self::_createSequence($length, strtoupper($type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测并创建序号
|
||||
* @param int $length
|
||||
* @param string $type
|
||||
* @param int $times
|
||||
* @param string $sequence
|
||||
* @return string
|
||||
*/
|
||||
static protected function _createSequence($length, $type, $times = 0, $sequence = '') {
|
||||
if ($times > 10 || $length < 1) {
|
||||
return null;
|
||||
}
|
||||
$i = 0;
|
||||
while ($i++ < $length) {
|
||||
$sequence .= ($i <= 1 ? rand(1, 9) : rand(0, 9));
|
||||
}
|
||||
$data = ['sequence' => $sequence, 'type' => $type];
|
||||
if (Db::table('system_sequence')->where($data)->count() > 0) {
|
||||
return self::_createSequence($length, $type, ++$times);
|
||||
}
|
||||
if (Db::table('system_sequence')->insert($data) > 0) {
|
||||
return $sequence;
|
||||
} else {
|
||||
return self::_createSequence($length, $type, ++$times);
|
||||
static public function createSequence($length = 10, $type = 'SYSTEM') {
|
||||
$times = 0;
|
||||
while ($times++ < 10) {
|
||||
$sequence = '';
|
||||
$i = 0;
|
||||
while ($i++ < $length) {
|
||||
$sequence .= ($i <= 1 ? rand(1, 9) : rand(0, 9));
|
||||
}
|
||||
$data = ['sequence' => $sequence, 'type' => strtoupper($type)];
|
||||
if (Db::name('SystemSequence')->where($data)->count() < 1 && Db::name('SystemSequence')->insert($data)) {
|
||||
return $sequence;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ class Tools {
|
||||
$tree = array();
|
||||
foreach ($_array_tree as $_tree) {
|
||||
$_tree[$path] = $ppath . '-' . $_tree[$id];
|
||||
$_tree['spl'] = str_repeat(" ├ ", substr_count($ppath, '-'));
|
||||
$_tree['spl'] = str_repeat(" ├ ", substr_count($ppath, '-'));
|
||||
if (!isset($_tree['sub'])) {
|
||||
$_tree['sub'] = array();
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ return array(
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => 'video/mp4',
|
||||
'webm' => 'video/webm',
|
||||
'webp' => 'image/webp',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
|
14
nbproject/customs.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"elements": {},
|
||||
"attributes": {
|
||||
"lay-skin": {
|
||||
"context": "input"
|
||||
},
|
||||
"lay-filter": {
|
||||
"context": "select"
|
||||
},
|
||||
"lay-even": {
|
||||
"context": "table"
|
||||
}
|
||||
}
|
||||
}
|
6
nbproject/private/private.properties
Normal file
@ -0,0 +1,6 @@
|
||||
copy.src.files=false
|
||||
copy.src.on.open=false
|
||||
copy.src.target=
|
||||
index.file=
|
||||
run.as=LOCAL
|
||||
url=http://localhost/git/Think.Admin.git/trunk/public/index.php
|
32
nbproject/private/private.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/extra/view/admin.content.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/public/static/admin/app.js</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/model/User.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/store/view/index.index.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Role.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/view/config.file.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/extend/library/Data.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Plugs.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Auth.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Index.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/view/config.index.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/view/plugs.upfile.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Menu.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/extra/view/admin.main.top.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/store/view/menu.index.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/store/controller/Menu.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/store/controller/Index.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/common.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/public/static/plugs/ueditor/ueditor.js</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/controller/Config.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/extra/view/admin.main.html</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/index/controller/Index.php</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/public/static/admin/plugs.js</file>
|
||||
<file>file:/D:/WebRoot/git/Think.Admin.git/trunk/application/admin/view/auth.form.html</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
7
nbproject/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_54
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=false
|
||||
web.root=.
|
9
nbproject/project.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>Think.Admin</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
@ -28,8 +28,11 @@ require.config({
|
||||
'socket': ['//cdn.bootcss.com/web-socket-js/1.0.0/web_socket.min'],
|
||||
'zeroclipboard': ['//cdn.bootcss.com/zeroclipboard/2.3.0/ZeroClipboard.min'],
|
||||
'json': ['//cdn.bootcss.com/json2/20160511/json2.min', '../plugs/jquery/json2.min'],
|
||||
'qrcode': ['//cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min'],
|
||||
'print': ['../plugs/jquery/jquery.PrintArea'],
|
||||
'base64': ['//cdn.bootcss.com/Base64/1.0.0/base64.min', '../plugs/jquery/base64.min'],
|
||||
'jquery': ['//cdn.bootcss.com/jquery/1.12.4/jquery.min', '../plugs/jquery/jquery.min'],
|
||||
'jquery.ztree': ['//cdn.bootcss.com/zTree.v3/3.5.28/js/jquery.ztree.all.min', '../plugs/ztree/jquery.ztree.all.min'],
|
||||
'jquery.icheck': ['//cdn.bootcss.com/iCheck/1.0.2/icheck.min'],
|
||||
'jquery.cookies': ['//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie', '../plugs/jquery/jquery.cookie'],
|
||||
'bootstrap': ['//cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min', '../plugs/bootstrap/js/bootstrap.min'],
|
||||
@ -49,7 +52,9 @@ require.config({
|
||||
'layui': {deps: ['jquery']},
|
||||
'socket': {deps: ['//cdn.bootcss.com/swfobject/2.2/swfobject.min.js']},
|
||||
'bootstrap': {deps: ['jquery']},
|
||||
'pcasunzips': {deps: ['jquery']},
|
||||
'bootstrap.multiselect': {deps: ['jquery', 'bootstrap', 'css!//cdn.bootcss.com/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css']},
|
||||
'jquery.ztree': {deps: ['jquery', 'css!//cdn.bootcss.com/zTree.v3/3.5.28/css/zTreeStyle/zTreeStyle.min.css']},
|
||||
'jquery.icheck': {deps: ['jquery', 'bootstrap', 'css!//cdn.bootcss.com/iCheck/1.0.2/skins/square/blue.css']},
|
||||
'jquery.cookies': {deps: ['jquery']},
|
||||
'admin.plugs': {deps: ['jquery', 'layui']},
|
||||
|
@ -38,7 +38,7 @@ define(['jquery', 'admin.plugs'], function () {
|
||||
/*! 注册 data-open 事件行为 */
|
||||
this.$body.on('click', '[data-open]', function () {
|
||||
var url = $(this).attr('data-open');
|
||||
window.location.href = '#' + parseUri(url, this);
|
||||
$.form.href(url);
|
||||
});
|
||||
|
||||
/*! 注册 data-reload 事件行为 */
|
||||
@ -57,11 +57,11 @@ define(['jquery', 'admin.plugs'], function () {
|
||||
/*! 注册 data-update 事件行为 */
|
||||
this.$body.on('click', '[data-update]', function () {
|
||||
var id = $(this).attr('data-update') || (function () {
|
||||
var data = [];
|
||||
return $($(this).attr('data-list-target') || 'input.list-check-box').map(function () {
|
||||
(this.checked) && data.push(this.value);
|
||||
}), data.join(',');
|
||||
}).call(this);
|
||||
var data = [];
|
||||
return $($(this).attr('data-list-target') || 'input.list-check-box').map(function () {
|
||||
(this.checked) && data.push(this.value);
|
||||
}), data.join(',');
|
||||
}).call(this);
|
||||
if (id.length < 1) {
|
||||
return $.msg.tips('请选择需要操作的数据!');
|
||||
}
|
||||
|
@ -167,8 +167,8 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
||||
msg.prototype.loading = function (msg, callback) {
|
||||
this.close();
|
||||
return this.index = msg
|
||||
? layer.msg(msg, {icon: 16, scrollbar: false, shade: this.shade, time: 0, end: callback})
|
||||
: layer.load(2, {time: 0, scrollbar: false, shade: this.shade, end: callback});
|
||||
? layer.msg(msg, {icon: 16, scrollbar: false, shade: this.shade, time: 0, end: callback})
|
||||
: layer.load(2, {time: 0, scrollbar: false, shade: this.shade, end: callback});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -321,6 +321,14 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
||||
}, loading, tips);
|
||||
};
|
||||
|
||||
/**
|
||||
* 打开一个内置HTML页面
|
||||
* @param url
|
||||
*/
|
||||
_form.prototype.href = function (url) {
|
||||
window.location.href = '#' + parseUri(url);
|
||||
};
|
||||
|
||||
/**
|
||||
* 加载HTML到弹出层
|
||||
* @param url
|
||||
@ -754,10 +762,10 @@ define(['zeroclipboard', 'jquery'], function (ZeroClipboard) {
|
||||
var callback = $(this).attr('data-callback');
|
||||
$(this).attr('data-listen', "true").validate(function (data) {
|
||||
$.form.load(this.getAttribute('action') || window.location.href, data,
|
||||
this.getAttribute('method') || 'POST',
|
||||
window[callback || '_default_callback'] || undefined, true,
|
||||
this.getAttribute('data-tips') || undefined,
|
||||
this.getAttribute('data-time') || undefined);
|
||||
this.getAttribute('method') || 'POST',
|
||||
window[callback || '_default_callback'] || undefined, true,
|
||||
this.getAttribute('data-tips') || undefined,
|
||||
this.getAttribute('data-time') || undefined);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
193
public/static/plugs/jquery/jquery.PrintArea.js
Normal file
@ -0,0 +1,193 @@
|
||||
/**
|
||||
* Version 2.4.0 Copyright (C) 2013
|
||||
* Tested in IE 11, FF 28.0 and Chrome 33.0.1750.154
|
||||
* No official support for other browsers, but will TRY to accommodate challenges in other browsers.
|
||||
* Example:
|
||||
* Print Button: <div id="print_button">Print</div>
|
||||
* Print Area : <div class="PrintArea" id="MyId" class="MyClass"> ... html ... </div>
|
||||
* Javascript : <script>
|
||||
* $("div#print_button").click(function(){
|
||||
* $("div.PrintArea").printArea( [OPTIONS] );
|
||||
* });
|
||||
* </script>
|
||||
* options are passed as json (example: {mode: "popup", popClose: false})
|
||||
*
|
||||
* {OPTIONS} | [type] | (default), values | Explanation
|
||||
* --------- | --------- | ---------------------- | -----------
|
||||
* @mode | [string] | (iframe),popup | printable window is either iframe or browser popup
|
||||
* @popHt | [number] | (500) | popup window height
|
||||
* @popWd | [number] | (400) | popup window width
|
||||
* @popX | [number] | (500) | popup window screen X position
|
||||
* @popY | [number] | (500) | popup window screen Y position
|
||||
* @popTitle | [string] | ('') | popup window title element
|
||||
* @popClose | [boolean] | (false),true | popup window close after printing
|
||||
* @extraCss | [string] | ('') | comma separated list of extra css to include
|
||||
* @retainAttr | [string[]] | ["id","class","style"] | string array of attributes to retain for the containment area. (ie: id, style, class)
|
||||
* @standard | [string] | strict, loose, (html5) | Only for popup. For html 4.01, strict or loose document standard, or html 5 standard
|
||||
* @extraHead | [string] | ('') | comma separated list of extra elements to be appended to the head tag
|
||||
*/
|
||||
(function($) {
|
||||
var counter = 0;
|
||||
var modes = { iframe : "iframe", popup : "popup" };
|
||||
var standards = { strict : "strict", loose : "loose", html5 : "html5" };
|
||||
var defaults = { mode : modes.iframe,
|
||||
standard : standards.html5,
|
||||
popHt : 500,
|
||||
popWd : 400,
|
||||
popX : 200,
|
||||
popY : 200,
|
||||
popTitle : '',
|
||||
popClose : false,
|
||||
extraCss : '',
|
||||
extraHead : '',
|
||||
retainAttr : ["id","class","style"] };
|
||||
|
||||
var settings = {};//global settings
|
||||
|
||||
$.fn.printArea = function( options )
|
||||
{
|
||||
$.extend( settings, defaults, options );
|
||||
|
||||
counter++;
|
||||
var idPrefix = "printArea_";
|
||||
$( "[id^=" + idPrefix + "]" ).remove();
|
||||
|
||||
settings.id = idPrefix + counter;
|
||||
|
||||
var $printSource = $(this);
|
||||
|
||||
var PrintAreaWindow = PrintArea.getPrintWindow();
|
||||
|
||||
PrintArea.write( PrintAreaWindow.doc, $printSource );
|
||||
|
||||
setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 );
|
||||
};
|
||||
|
||||
var PrintArea = {
|
||||
print : function( PAWindow ) {
|
||||
var paWindow = PAWindow.win;
|
||||
|
||||
$(PAWindow.doc).ready(function(){
|
||||
paWindow.focus();
|
||||
paWindow.print();
|
||||
|
||||
if ( settings.mode == modes.popup && settings.popClose )
|
||||
setTimeout(function() { paWindow.close(); }, 2000);
|
||||
});
|
||||
},
|
||||
write : function ( PADocument, $ele ) {
|
||||
PADocument.open();
|
||||
PADocument.write( PrintArea.docType() + "<html>" + PrintArea.getHead() + PrintArea.getBody( $ele ) + "</html>" );
|
||||
PADocument.close();
|
||||
},
|
||||
docType : function() {
|
||||
if ( settings.mode == modes.iframe ) return "";
|
||||
|
||||
if ( settings.standard == standards.html5 ) return "<!DOCTYPE html>";
|
||||
|
||||
var transitional = settings.standard == standards.loose ? " Transitional" : "";
|
||||
var dtd = settings.standard == standards.loose ? "loose" : "strict";
|
||||
|
||||
return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01' + transitional + '//EN" "http://www.w3.org/TR/html4/' + dtd + '.dtd">';
|
||||
},
|
||||
getHead : function() {
|
||||
var extraHead = "";
|
||||
var links = "";
|
||||
|
||||
if ( settings.extraHead ) settings.extraHead.replace( /([^,]+)/g, function(m){ extraHead += m });
|
||||
|
||||
$(document).find("link")
|
||||
.filter(function(){ // Requirement: <link> element MUST have rel="stylesheet" to be considered in print document
|
||||
var relAttr = $(this).attr("rel");
|
||||
return ($.type(relAttr) === 'undefined') == false && relAttr.toLowerCase() == 'stylesheet';
|
||||
})
|
||||
.filter(function(){ // Include if media is undefined, empty, print or all
|
||||
var mediaAttr = $(this).attr("media");
|
||||
return $.type(mediaAttr) === 'undefined' || mediaAttr == "" || mediaAttr.toLowerCase() == 'print' || mediaAttr.toLowerCase() == 'all'
|
||||
})
|
||||
.each(function(){
|
||||
links += '<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >';
|
||||
});
|
||||
if ( settings.extraCss ) settings.extraCss.replace( /([^,\s]+)/g, function(m){ links += '<link type="text/css" rel="stylesheet" href="' + m + '">' });
|
||||
|
||||
return "<head><title>" + settings.popTitle + "</title>" + extraHead + links + "</head>";
|
||||
},
|
||||
getBody : function ( elements ) {
|
||||
var htm = "";
|
||||
var attrs = settings.retainAttr;
|
||||
elements.each(function() {
|
||||
var ele = PrintArea.getFormData( $(this) );
|
||||
|
||||
var attributes = ""
|
||||
for ( var x = 0; x < attrs.length; x++ )
|
||||
{
|
||||
var eleAttr = $(ele).attr( attrs[x] );
|
||||
if ( eleAttr ) attributes += (attributes.length > 0 ? " ":"") + attrs[x] + "='" + eleAttr + "'";
|
||||
}
|
||||
|
||||
htm += '<div ' + attributes + '>' + $(ele).html() + '</div>';
|
||||
});
|
||||
|
||||
return "<body>" + htm + "</body>";
|
||||
},
|
||||
getFormData : function ( ele ) {
|
||||
var copy = ele.clone();
|
||||
var copiedInputs = $("input,select,textarea", copy);
|
||||
$("input,select,textarea", ele).each(function( i ){
|
||||
var typeInput = $(this).attr("type");
|
||||
if ($.type(typeInput) === 'undefined') typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : "";
|
||||
var copiedInput = copiedInputs.eq( i );
|
||||
|
||||
if ( typeInput == "radio" || typeInput == "checkbox" ) copiedInput.attr( "checked", $(this).is(":checked") );
|
||||
else if ( typeInput == "text" ) copiedInput.attr( "value", $(this).val() );
|
||||
else if ( typeInput == "select" )
|
||||
$(this).find( "option" ).each( function( i ) {
|
||||
if ( $(this).is(":selected") ) $("option", copiedInput).eq( i ).attr( "selected", true );
|
||||
});
|
||||
else if ( typeInput == "textarea" ) copiedInput.text( $(this).val() );
|
||||
});
|
||||
return copy;
|
||||
},
|
||||
getPrintWindow : function () {
|
||||
switch ( settings.mode )
|
||||
{
|
||||
case modes.iframe :
|
||||
var f = new PrintArea.Iframe();
|
||||
return { win : f.contentWindow || f, doc : f.doc };
|
||||
case modes.popup :
|
||||
var p = new PrintArea.Popup();
|
||||
return { win : p, doc : p.doc };
|
||||
}
|
||||
},
|
||||
Iframe : function () {
|
||||
var frameId = settings.id;
|
||||
var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;';
|
||||
var iframe;
|
||||
|
||||
try
|
||||
{
|
||||
iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
$(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() });
|
||||
iframe.doc = null;
|
||||
iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
|
||||
}
|
||||
catch( e ) { throw e + ". iframes may not be supported in this browser."; }
|
||||
|
||||
if ( iframe.doc == null ) throw "Cannot find document.";
|
||||
|
||||
return iframe;
|
||||
},
|
||||
Popup : function () {
|
||||
var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
|
||||
windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
|
||||
windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes";
|
||||
|
||||
var newWin = window.open( "", "_blank", windowAttr );
|
||||
|
||||
newWin.doc = newWin.document;
|
||||
|
||||
return newWin;
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
2
public/static/plugs/jquery/pcasunzips.js
vendored
165
public/static/plugs/ztree/jquery.ztree.all.min.js
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
|
||||
/*
|
||||
* JQuery zTree core v3.5.28
|
||||
* http://treejs.cn/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2017-01-20
|
||||
*/
|
||||
(function(q){var H,I,J,K,L,M,u,r={},v={},w={},N={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url",icon:"icon"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",
|
||||
url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},x=[function(b){var a=b.treeObj,c=f.event;a.bind(c.NODECREATED,function(a,c,g){j.apply(b.callback.onNodeCreated,
|
||||
[a,c,g])});a.bind(c.CLICK,function(a,c,g,l,h){j.apply(b.callback.onClick,[c,g,l,h])});a.bind(c.EXPAND,function(a,c,g){j.apply(b.callback.onExpand,[a,c,g])});a.bind(c.COLLAPSE,function(a,c,g){j.apply(b.callback.onCollapse,[a,c,g])});a.bind(c.ASYNC_SUCCESS,function(a,c,g,l){j.apply(b.callback.onAsyncSuccess,[a,c,g,l])});a.bind(c.ASYNC_ERROR,function(a,c,g,l,h,f){j.apply(b.callback.onAsyncError,[a,c,g,l,h,f])});a.bind(c.REMOVE,function(a,c,g){j.apply(b.callback.onRemove,[a,c,g])});a.bind(c.SELECTED,
|
||||
function(a,c,g){j.apply(b.callback.onSelected,[c,g])});a.bind(c.UNSELECTED,function(a,c,g){j.apply(b.callback.onUnSelected,[c,g])})}],y=[function(b){var a=f.event;b.treeObj.unbind(a.NODECREATED).unbind(a.CLICK).unbind(a.EXPAND).unbind(a.COLLAPSE).unbind(a.ASYNC_SUCCESS).unbind(a.ASYNC_ERROR).unbind(a.REMOVE).unbind(a.SELECTED).unbind(a.UNSELECTED)}],z=[function(b){var a=h.getCache(b);a||(a={},h.setCache(b,a));a.nodes=[];a.doms=[]}],A=[function(b,a,c,d,e,g){if(c){var l=h.getRoot(b),f=b.data.key.children;
|
||||
c.level=a;c.tId=b.treeId+"_"+ ++l.zId;c.parentTId=d?d.tId:null;c.open=typeof c.open=="string"?j.eqs(c.open,"true"):!!c.open;c[f]&&c[f].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent=typeof c.isParent=="string"?j.eqs(c.isParent,"true"):!!c.isParent,c.open=c.isParent&&!b.async.enable?c.open:!1,c.zAsync=!c.isParent);c.isFirstNode=e;c.isLastNode=g;c.getParentNode=function(){return h.getNodeCache(b,c.parentTId)};c.getPreNode=function(){return h.getPreNode(b,c)};c.getNextNode=function(){return h.getNextNode(b,
|
||||
c)};c.getIndex=function(){return h.getNodeIndex(b,c)};c.getPath=function(){return h.getNodePath(b,c)};c.isAjaxing=!1;h.fixPIdKeyValue(b,c)}}],t=[function(b){var a=b.target,c=h.getSetting(b.data.treeId),d="",e=null,g="",l="",i=null,n=null,k=null;if(j.eqs(b.type,"mousedown"))l="mousedown";else if(j.eqs(b.type,"mouseup"))l="mouseup";else if(j.eqs(b.type,"contextmenu"))l="contextmenu";else if(j.eqs(b.type,"click"))if(j.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+f.id.SWITCH)!==null)d=j.getNodeMainDom(a).id,
|
||||
g="switchNode";else{if(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}]))d=j.getNodeMainDom(k).id,g="clickNode"}else if(j.eqs(b.type,"dblclick")&&(l="dblclick",k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}])))d=j.getNodeMainDom(k).id,g="switchNode";if(l.length>0&&d.length==0&&(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+f.id.A}])))d=j.getNodeMainDom(k).id;if(d.length>0)switch(e=h.getNodeCache(c,d),g){case "switchNode":e.isParent?j.eqs(b.type,"click")||j.eqs(b.type,"dblclick")&&
|
||||
j.apply(c.view.dblClickExpand,[c.treeId,e],c.view.dblClickExpand)?i=H:g="":g="";break;case "clickNode":i=I}switch(l){case "mousedown":n=J;break;case "mouseup":n=K;break;case "dblclick":n=L;break;case "contextmenu":n=M}return{stop:!1,node:e,nodeEventType:g,nodeEventCallback:i,treeEventType:l,treeEventCallback:n}}],B=[function(b){var a=h.getRoot(b);a||(a={},h.setRoot(b,a));a[b.data.key.children]=[];a.expandTriggerFlag=!1;a.curSelectedList=[];a.noSelection=!0;a.createdNodes=[];a.zId=0;a._ver=(new Date).getTime()}],
|
||||
C=[],D=[],E=[],F=[],G=[],h={addNodeCache:function(b,a){h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=a},getNodeCacheId:function(b){return b.substring(b.lastIndexOf("_")+1)},addAfterA:function(b){D.push(b)},addBeforeA:function(b){C.push(b)},addInnerAfterA:function(b){F.push(b)},addInnerBeforeA:function(b){E.push(b)},addInitBind:function(b){x.push(b)},addInitUnBind:function(b){y.push(b)},addInitCache:function(b){z.push(b)},addInitNode:function(b){A.push(b)},addInitProxy:function(b,a){a?t.splice(0,0,
|
||||
b):t.push(b)},addInitRoot:function(b){B.push(b)},addNodesData:function(b,a,c,d){var e=b.data.key.children;a[e]?c>=a[e].length&&(c=-1):(a[e]=[],c=-1);if(a[e].length>0&&c===0)a[e][0].isFirstNode=!1,i.setNodeLineIcos(b,a[e][0]);else if(a[e].length>0&&c<0)a[e][a[e].length-1].isLastNode=!1,i.setNodeLineIcos(b,a[e][a[e].length-1]);a.isParent=!0;c<0?a[e]=a[e].concat(d):(b=[c,0].concat(d),a[e].splice.apply(a[e],b))},addSelectedNode:function(b,a){var c=h.getRoot(b);h.isSelectedNode(b,a)||c.curSelectedList.push(a)},
|
||||
addCreatedNode:function(b,a){(b.callback.onNodeCreated||b.view.addDiyDom)&&h.getRoot(b).createdNodes.push(a)},addZTreeTools:function(b){G.push(b)},exSetting:function(b){q.extend(!0,N,b)},fixPIdKeyValue:function(b,a){b.data.simpleData.enable&&(a[b.data.simpleData.pIdKey]=a.parentTId?a.getParentNode()[b.data.simpleData.idKey]:b.data.simpleData.rootPId)},getAfterA:function(b,a,c){for(var d=0,e=D.length;d<e;d++)D[d].apply(this,arguments)},getBeforeA:function(b,a,c){for(var d=0,e=C.length;d<e;d++)C[d].apply(this,
|
||||
arguments)},getInnerAfterA:function(b,a,c){for(var d=0,e=F.length;d<e;d++)F[d].apply(this,arguments)},getInnerBeforeA:function(b,a,c){for(var d=0,e=E.length;d<e;d++)E[d].apply(this,arguments)},getCache:function(b){return w[b.treeId]},getNodeIndex:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),e=0,g=d[c].length-1;e<=g;e++)if(d[c][e]===a)return e;return-1},getNextNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?
|
||||
a.getParentNode():h.getRoot(b),e=0,g=d[c].length-1;e<=g;e++)if(d[c][e]===a)return e==g?null:d[c][e+1];return null},getNodeByParam:function(b,a,c,d){if(!a||!c)return null;for(var e=b.data.key.children,g=0,l=a.length;g<l;g++){if(a[g][c]==d)return a[g];var f=h.getNodeByParam(b,a[g][e],c,d);if(f)return f}return null},getNodeCache:function(b,a){if(!a)return null;var c=w[b.treeId].nodes[h.getNodeCacheId(a)];return c?c:null},getNodeName:function(b,a){return""+a[b.data.key.name]},getNodePath:function(b,a){if(!a)return null;
|
||||
var c;(c=a.parentTId?a.getParentNode().getPath():[])&&c.push(a);return c},getNodeTitle:function(b,a){return""+a[b.data.key.title===""?b.data.key.name:b.data.key.title]},getNodes:function(b){return h.getRoot(b)[b.data.key.children]},getNodesByParam:function(b,a,c,d){if(!a||!c)return[];for(var e=b.data.key.children,g=[],l=0,f=a.length;l<f;l++)a[l][c]==d&&g.push(a[l]),g=g.concat(h.getNodesByParam(b,a[l][e],c,d));return g},getNodesByParamFuzzy:function(b,a,c,d){if(!a||!c)return[];for(var e=b.data.key.children,
|
||||
g=[],d=d.toLowerCase(),l=0,f=a.length;l<f;l++)typeof a[l][c]=="string"&&a[l][c].toLowerCase().indexOf(d)>-1&&g.push(a[l]),g=g.concat(h.getNodesByParamFuzzy(b,a[l][e],c,d));return g},getNodesByFilter:function(b,a,c,d,e){if(!a)return d?null:[];for(var g=b.data.key.children,f=d?null:[],i=0,n=a.length;i<n;i++){if(j.apply(c,[a[i],e],!1)){if(d)return a[i];f.push(a[i])}var k=h.getNodesByFilter(b,a[i][g],c,d,e);if(d&&k)return k;f=d?k:f.concat(k)}return f},getPreNode:function(b,a){if(!a)return null;for(var c=
|
||||
b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),e=0,g=d[c].length;e<g;e++)if(d[c][e]===a)return e==0?null:d[c][e-1];return null},getRoot:function(b){return b?v[b.treeId]:null},getRoots:function(){return v},getSetting:function(b){return r[b]},getSettings:function(){return r},getZTreeTools:function(b){return(b=this.getRoot(this.getSetting(b)))?b.treeTools:null},initCache:function(b){for(var a=0,c=z.length;a<c;a++)z[a].apply(this,arguments)},initNode:function(b,a,c,d,e,g){for(var f=
|
||||
0,h=A.length;f<h;f++)A[f].apply(this,arguments)},initRoot:function(b){for(var a=0,c=B.length;a<c;a++)B[a].apply(this,arguments)},isSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,e=c.curSelectedList.length;d<e;d++)if(a===c.curSelectedList[d])return!0;return!1},removeNodeCache:function(b,a){var c=b.data.key.children;if(a[c])for(var d=0,e=a[c].length;d<e;d++)h.removeNodeCache(b,a[c][d]);h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=null},removeSelectedNode:function(b,a){for(var c=h.getRoot(b),
|
||||
d=0,e=c.curSelectedList.length;d<e;d++)if(a===c.curSelectedList[d]||!h.getNodeCache(b,c.curSelectedList[d].tId))c.curSelectedList.splice(d,1),b.treeObj.trigger(f.event.UNSELECTED,[b.treeId,a]),d--,e--},setCache:function(b,a){w[b.treeId]=a},setRoot:function(b,a){v[b.treeId]=a},setZTreeTools:function(b,a){for(var c=0,d=G.length;c<d;c++)G[c].apply(this,arguments)},transformToArrayFormat:function(b,a){if(!a)return[];var c=b.data.key.children,d=[];if(j.isArray(a))for(var e=0,g=a.length;e<g;e++)d.push(a[e]),
|
||||
a[e][c]&&(d=d.concat(h.transformToArrayFormat(b,a[e][c])));else d.push(a),a[c]&&(d=d.concat(h.transformToArrayFormat(b,a[c])));return d},transformTozTreeFormat:function(b,a){var c,d,e=b.data.simpleData.idKey,g=b.data.simpleData.pIdKey,f=b.data.key.children;if(!e||e==""||!a)return[];if(j.isArray(a)){var h=[],i={};for(c=0,d=a.length;c<d;c++)i[a[c][e]]=a[c];for(c=0,d=a.length;c<d;c++)i[a[c][g]]&&a[c][e]!=a[c][g]?(i[a[c][g]][f]||(i[a[c][g]][f]=[]),i[a[c][g]][f].push(a[c])):h.push(a[c]);return h}else return[a]}},
|
||||
m={bindEvent:function(b){for(var a=0,c=x.length;a<c;a++)x[a].apply(this,arguments)},unbindEvent:function(b){for(var a=0,c=y.length;a<c;a++)y[a].apply(this,arguments)},bindTree:function(b){var a={treeId:b.treeId},c=b.treeObj;b.view.txtSelectedEnable||c.bind("selectstart",u).css({"-moz-user-select":"-moz-none"});c.bind("click",a,m.proxy);c.bind("dblclick",a,m.proxy);c.bind("mouseover",a,m.proxy);c.bind("mouseout",a,m.proxy);c.bind("mousedown",a,m.proxy);c.bind("mouseup",a,m.proxy);c.bind("contextmenu",
|
||||
a,m.proxy)},unbindTree:function(b){b.treeObj.unbind("selectstart",u).unbind("click",m.proxy).unbind("dblclick",m.proxy).unbind("mouseover",m.proxy).unbind("mouseout",m.proxy).unbind("mousedown",m.proxy).unbind("mouseup",m.proxy).unbind("contextmenu",m.proxy)},doProxy:function(b){for(var a=[],c=0,d=t.length;c<d;c++){var e=t[c].apply(this,arguments);a.push(e);if(e.stop)break}return a},proxy:function(b){var a=h.getSetting(b.data.treeId);if(!j.uCanDo(a,b))return!0;for(var a=m.doProxy(b),c=!0,d=0,e=a.length;d<
|
||||
e;d++){var g=a[d];g.nodeEventCallback&&(c=g.nodeEventCallback.apply(g,[b,g.node])&&c);g.treeEventCallback&&(c=g.treeEventCallback.apply(g,[b,g.node])&&c)}return c}};H=function(b,a){var c=h.getSetting(b.data.treeId);if(a.open){if(j.apply(c.callback.beforeCollapse,[c.treeId,a],!0)==!1)return!0}else if(j.apply(c.callback.beforeExpand,[c.treeId,a],!0)==!1)return!0;h.getRoot(c).expandTriggerFlag=!0;i.switchNode(c,a);return!0};I=function(b,a){var c=h.getSetting(b.data.treeId),d=c.view.autoCancelSelected&&
|
||||
(b.ctrlKey||b.metaKey)&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&c.view.selectedMulti?2:1;if(j.apply(c.callback.beforeClick,[c.treeId,a,d],!0)==!1)return!0;d===0?i.cancelPreSelectedNode(c,a):i.selectNode(c,a,d===2);c.treeObj.trigger(f.event.CLICK,[b,c.treeId,a,d]);return!0};J=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseDown,[c.treeId,a],!0)&&j.apply(c.callback.onMouseDown,[b,c.treeId,a]);return!0};K=function(b,a){var c=h.getSetting(b.data.treeId);
|
||||
j.apply(c.callback.beforeMouseUp,[c.treeId,a],!0)&&j.apply(c.callback.onMouseUp,[b,c.treeId,a]);return!0};L=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeDblClick,[c.treeId,a],!0)&&j.apply(c.callback.onDblClick,[b,c.treeId,a]);return!0};M=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeRightClick,[c.treeId,a],!0)&&j.apply(c.callback.onRightClick,[b,c.treeId,a]);return typeof c.callback.onRightClick!="function"};u=function(b){b=b.originalEvent.srcElement.nodeName.toLowerCase();
|
||||
return b==="input"||b==="textarea"};var j={apply:function(b,a,c){return typeof b=="function"?b.apply(O,a?a:[]):c},canAsync:function(b,a){var c=b.data.key.children;return b.async.enable&&a&&a.isParent&&!(a.zAsync||a[c]&&a[c].length>0)},clone:function(b){if(b===null)return null;var a=j.isArray(b)?[]:{},c;for(c in b)a[c]=b[c]instanceof Date?new Date(b[c].getTime()):typeof b[c]==="object"?j.clone(b[c]):b[c];return a},eqs:function(b,a){return b.toLowerCase()===a.toLowerCase()},isArray:function(b){return Object.prototype.toString.apply(b)===
|
||||
"[object Array]"},isElement:function(b){return typeof HTMLElement==="object"?b instanceof HTMLElement:b&&typeof b==="object"&&b!==null&&b.nodeType===1&&typeof b.nodeName==="string"},$:function(b,a,c){a&&typeof a!="string"&&(c=a,a="");return typeof b=="string"?q(b,c?c.treeObj.get(0).ownerDocument:null):q("#"+b.tId+a,c?c.treeObj:null)},getMDom:function(b,a,c){if(!a)return null;for(;a&&a.id!==b.treeId;){for(var d=0,e=c.length;a.tagName&&d<e;d++)if(j.eqs(a.tagName,c[d].tagName)&&a.getAttribute(c[d].attrName)!==
|
||||
null)return a;a=a.parentNode}return null},getNodeMainDom:function(b){return q(b).parent("li").get(0)||q(b).parentsUntil("li").parent().get(0)},isChildOrSelf:function(b,a){return q(b).closest("#"+a).length>0},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d,e){if(!b.data.keep.leaf||!a||a.isParent)if(j.isArray(d)||(d=[d]),b.data.simpleData.enable&&(d=h.transformTozTreeFormat(b,d)),a){var g=k(a,f.id.SWITCH,b),l=k(a,f.id.ICON,b),p=k(a,f.id.UL,b);if(!a.open)i.replaceSwitchClass(a,g,f.folder.CLOSE),
|
||||
i.replaceIcoClass(a,l,f.folder.CLOSE),a.open=!1,p.css({display:"none"});h.addNodesData(b,a,c,d);i.createNodes(b,a.level+1,d,a,c);e||i.expandCollapseParentNode(b,a,!0)}else h.addNodesData(b,h.getRoot(b),c,d),i.createNodes(b,0,d,null,c)},appendNodes:function(b,a,c,d,e,g,f){if(!c)return[];var j=[],n=b.data.key.children,k=(d?d:h.getRoot(b))[n],m,Q;if(!k||e>=k.length-c.length)e=-1;for(var s=0,R=c.length;s<R;s++){var o=c[s];g&&(m=(e===0||k.length==c.length)&&s==0,Q=e<0&&s==c.length-1,h.initNode(b,a,o,d,
|
||||
m,Q,f),h.addNodeCache(b,o));m=[];o[n]&&o[n].length>0&&(m=i.appendNodes(b,a+1,o[n],o,-1,g,f&&o.open));f&&(i.makeDOMNodeMainBefore(j,b,o),i.makeDOMNodeLine(j,b,o),h.getBeforeA(b,o,j),i.makeDOMNodeNameBefore(j,b,o),h.getInnerBeforeA(b,o,j),i.makeDOMNodeIcon(j,b,o),h.getInnerAfterA(b,o,j),i.makeDOMNodeNameAfter(j,b,o),h.getAfterA(b,o,j),o.isParent&&o.open&&i.makeUlHtml(b,o,j,m.join("")),i.makeDOMNodeMainAfter(j,b,o),h.addCreatedNode(b,o))}return j},appendParentULDom:function(b,a){var c=[],d=k(a,b);!d.get(0)&&
|
||||
a.parentTId&&(i.appendParentULDom(b,a.getParentNode()),d=k(a,b));var e=k(a,f.id.UL,b);e.get(0)&&e.remove();e=i.appendNodes(b,a.level+1,a[b.data.key.children],a,-1,!1,!0);i.makeUlHtml(b,a,c,e.join(""));d.append(c.join(""))},asyncNode:function(b,a,c,d){var e,g;if(a&&!a.isParent)return j.apply(d),!1;else if(a&&a.isAjaxing)return!1;else if(j.apply(b.callback.beforeAsync,[b.treeId,a],!0)==!1)return j.apply(d),!1;if(a)a.isAjaxing=!0,k(a,f.id.ICON,b).attr({style:"","class":f.className.BUTTON+" "+f.className.ICO_LOADING});
|
||||
var l={};for(e=0,g=b.async.autoParam.length;a&&e<g;e++){var p=b.async.autoParam[e].split("="),n=p;p.length>1&&(n=p[1],p=p[0]);l[n]=a[p]}if(j.isArray(b.async.otherParam))for(e=0,g=b.async.otherParam.length;e<g;e+=2)l[b.async.otherParam[e]]=b.async.otherParam[e+1];else for(var m in b.async.otherParam)l[m]=b.async.otherParam[m];var P=h.getRoot(b)._ver;q.ajax({contentType:b.async.contentType,cache:!1,type:b.async.type,url:j.apply(b.async.url,[b.treeId,a],b.async.url),data:b.async.contentType.indexOf("application/json")>
|
||||
-1?JSON.stringify(l):l,dataType:b.async.dataType,success:function(e){if(P==h.getRoot(b)._ver){var g=[];try{g=!e||e.length==0?[]:typeof e=="string"?eval("("+e+")"):e}catch(l){g=e}if(a)a.isAjaxing=null,a.zAsync=!0;i.setNodeLineIcos(b,a);g&&g!==""?(g=j.apply(b.async.dataFilter,[b.treeId,a,g],g),i.addNodes(b,a,-1,g?j.clone(g):[],!!c)):i.addNodes(b,a,-1,[],!!c);b.treeObj.trigger(f.event.ASYNC_SUCCESS,[b.treeId,a,e]);j.apply(d)}},error:function(c,d,e){if(P==h.getRoot(b)._ver){if(a)a.isAjaxing=null;i.setNodeLineIcos(b,
|
||||
a);b.treeObj.trigger(f.event.ASYNC_ERROR,[b.treeId,a,c,d,e])}}});return!0},cancelPreSelectedNode:function(b,a,c){var d=h.getRoot(b).curSelectedList,e,g;for(e=d.length-1;e>=0;e--)if(g=d[e],a===g||!a&&(!c||c!==g))if(k(g,f.id.A,b).removeClass(f.node.CURSELECTED),a){h.removeSelectedNode(b,a);break}else d.splice(e,1),b.treeObj.trigger(f.event.UNSELECTED,[b.treeId,g])},createNodeCallback:function(b){if(b.callback.onNodeCreated||b.view.addDiyDom)for(var a=h.getRoot(b);a.createdNodes.length>0;){var c=a.createdNodes.shift();
|
||||
j.apply(b.view.addDiyDom,[b.treeId,c]);b.callback.onNodeCreated&&b.treeObj.trigger(f.event.NODECREATED,[b.treeId,c])}},createNodes:function(b,a,c,d,e){if(c&&c.length!=0){var g=h.getRoot(b),l=b.data.key.children,l=!d||d.open||!!k(d[l][0],b).get(0);g.createdNodes=[];var a=i.appendNodes(b,a,c,d,e,!0,l),j,n;d?(d=k(d,f.id.UL,b),d.get(0)&&(j=d)):j=b.treeObj;j&&(e>=0&&(n=j.children()[e]),e>=0&&n?q(n).before(a.join("")):j.append(a.join("")));i.createNodeCallback(b)}},destroy:function(b){b&&(h.initCache(b),
|
||||
h.initRoot(b),m.unbindTree(b),m.unbindEvent(b),b.treeObj.empty(),delete r[b.treeId])},expandCollapseNode:function(b,a,c,d,e){var g=h.getRoot(b),l=b.data.key.children,p;if(a){if(g.expandTriggerFlag)p=e,e=function(){p&&p();a.open?b.treeObj.trigger(f.event.EXPAND,[b.treeId,a]):b.treeObj.trigger(f.event.COLLAPSE,[b.treeId,a])},g.expandTriggerFlag=!1;if(!a.open&&a.isParent&&(!k(a,f.id.UL,b).get(0)||a[l]&&a[l].length>0&&!k(a[l][0],b).get(0)))i.appendParentULDom(b,a),i.createNodeCallback(b);if(a.open==c)j.apply(e,
|
||||
[]);else{var c=k(a,f.id.UL,b),g=k(a,f.id.SWITCH,b),n=k(a,f.id.ICON,b);a.isParent?(a.open=!a.open,a.iconOpen&&a.iconClose&&n.attr("style",i.makeNodeIcoStyle(b,a)),a.open?(i.replaceSwitchClass(a,g,f.folder.OPEN),i.replaceIcoClass(a,n,f.folder.OPEN),d==!1||b.view.expandSpeed==""?(c.show(),j.apply(e,[])):a[l]&&a[l].length>0?c.slideDown(b.view.expandSpeed,e):(c.show(),j.apply(e,[]))):(i.replaceSwitchClass(a,g,f.folder.CLOSE),i.replaceIcoClass(a,n,f.folder.CLOSE),d==!1||b.view.expandSpeed==""||!(a[l]&&
|
||||
a[l].length>0)?(c.hide(),j.apply(e,[])):c.slideUp(b.view.expandSpeed,e))):j.apply(e,[])}}else j.apply(e,[])},expandCollapseParentNode:function(b,a,c,d,e){a&&(a.parentTId?(i.expandCollapseNode(b,a,c,d),a.parentTId&&i.expandCollapseParentNode(b,a.getParentNode(),c,d,e)):i.expandCollapseNode(b,a,c,d,e))},expandCollapseSonNode:function(b,a,c,d,e){var g=h.getRoot(b),f=b.data.key.children,g=a?a[f]:g[f],f=a?!1:d,j=h.getRoot(b).expandTriggerFlag;h.getRoot(b).expandTriggerFlag=!1;if(g)for(var k=0,m=g.length;k<
|
||||
m;k++)g[k]&&i.expandCollapseSonNode(b,g[k],c,f);h.getRoot(b).expandTriggerFlag=j;i.expandCollapseNode(b,a,c,d,e)},isSelectedNode:function(b,a){if(!a)return!1;var c=h.getRoot(b).curSelectedList,d;for(d=c.length-1;d>=0;d--)if(a===c[d])return!0;return!1},makeDOMNodeIcon:function(b,a,c){var d=h.getNodeName(a,c),d=a.view.nameIsHTML?d:d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");b.push("<span id='",c.tId,f.id.ICON,"' title='' treeNode",f.id.ICON," class='",i.makeNodeIcoClass(a,c),"' style='",
|
||||
i.makeNodeIcoStyle(a,c),"'></span><span id='",c.tId,f.id.SPAN,"' class='",f.className.NAME,"'>",d,"</span>")},makeDOMNodeLine:function(b,a,c){b.push("<span id='",c.tId,f.id.SWITCH,"' title='' class='",i.makeNodeLineClass(a,c),"' treeNode",f.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(b){b.push("</li>")},makeDOMNodeMainBefore:function(b,a,c){b.push("<li id='",c.tId,"' class='",f.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(b){b.push("</a>")},
|
||||
makeDOMNodeNameBefore:function(b,a,c){var d=h.getNodeTitle(a,c),e=i.makeNodeUrl(a,c),g=i.makeNodeFontCss(a,c),l=[],k;for(k in g)l.push(k,":",g[k],";");b.push("<a id='",c.tId,f.id.A,"' class='",f.className.LEVEL,c.level,"' treeNode",f.id.A,' onclick="',c.click||"",'" ',e!=null&&e.length>0?"href='"+e+"'":""," target='",i.makeNodeTarget(c),"' style='",l.join(""),"'");j.apply(a.view.showTitle,[a.treeId,c],a.view.showTitle)&&d&&b.push("title='",d.replace(/'/g,"'").replace(/</g,"<").replace(/>/g,
|
||||
">"),"'");b.push(">")},makeNodeFontCss:function(b,a){var c=j.apply(b.view.fontCss,[b.treeId,a],b.view.fontCss);return c&&typeof c!="function"?c:{}},makeNodeIcoClass:function(b,a){var c=["ico"];a.isAjaxing||(c[0]=(a.iconSkin?a.iconSkin+"_":"")+c[0],a.isParent?c.push(a.open?f.folder.OPEN:f.folder.CLOSE):c.push(f.folder.DOCU));return f.className.BUTTON+" "+c.join("_")},makeNodeIcoStyle:function(b,a){var c=[];if(!a.isAjaxing){var d=a.isParent&&a.iconOpen&&a.iconClose?a.open?a.iconOpen:a.iconClose:
|
||||
a[b.data.key.icon];d&&c.push("background:url(",d,") 0 0 no-repeat;");(b.view.showIcon==!1||!j.apply(b.view.showIcon,[b.treeId,a],!0))&&c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(b,a){var c=[];b.view.showLine?a.level==0&&a.isFirstNode&&a.isLastNode?c.push(f.line.ROOT):a.level==0&&a.isFirstNode?c.push(f.line.ROOTS):a.isLastNode?c.push(f.line.BOTTOM):c.push(f.line.CENTER):c.push(f.line.NOLINE);a.isParent?c.push(a.open?f.folder.OPEN:f.folder.CLOSE):c.push(f.folder.DOCU);
|
||||
return i.makeNodeLineClassEx(a)+c.join("_")},makeNodeLineClassEx:function(b){return f.className.BUTTON+" "+f.className.LEVEL+b.level+" "+f.className.SWITCH+" "},makeNodeTarget:function(b){return b.target||"_blank"},makeNodeUrl:function(b,a){var c=b.data.key.url;return a[c]?a[c]:null},makeUlHtml:function(b,a,c,d){c.push("<ul id='",a.tId,f.id.UL,"' class='",f.className.LEVEL,a.level," ",i.makeUlLineClass(b,a),"' style='display:",a.open?"block":"none","'>");c.push(d);c.push("</ul>")},makeUlLineClass:function(b,
|
||||
a){return b.view.showLine&&!a.isLastNode?f.line.LINE:""},removeChildNodes:function(b,a){if(a){var c=b.data.key.children,d=a[c];if(d){for(var e=0,g=d.length;e<g;e++)h.removeNodeCache(b,d[e]);h.removeSelectedNode(b);delete a[c];b.data.keep.parent?k(a,f.id.UL,b).empty():(a.isParent=!1,a.open=!1,c=k(a,f.id.SWITCH,b),d=k(a,f.id.ICON,b),i.replaceSwitchClass(a,c,f.folder.DOCU),i.replaceIcoClass(a,d,f.folder.DOCU),k(a,f.id.UL,b).remove())}}},scrollIntoView:function(b){if(b){if(!Element.prototype.scrollIntoViewIfNeeded)Element.prototype.scrollIntoViewIfNeeded=
|
||||
function(a){function b(a,d,e,f){return{left:a,top:d,width:e,height:f,right:a+e,bottom:d+f,translate:function(g,h){return b(g+a,h+d,e,f)},relativeFromTo:function(h,i){var j=a,l=d,h=h.offsetParent,i=i.offsetParent;if(h===i)return g;for(;h;h=h.offsetParent)j+=h.offsetLeft+h.clientLeft,l+=h.offsetTop+h.clientTop;for(;i;i=i.offsetParent)j-=i.offsetLeft+i.clientLeft,l-=i.offsetTop+i.clientTop;return b(j,l,e,f)}}}for(var d,e=this,g=b(this.offsetLeft,this.offsetTop,this.offsetWidth,this.offsetHeight);j.isElement(d=
|
||||
e.parentNode);){var f=d.offsetLeft+d.clientLeft,h=d.offsetTop+d.clientTop,g=g.relativeFromTo(e,d).translate(-f,-h);d.scrollLeft=!1===a||g.left<=d.scrollLeft+d.clientWidth&&d.scrollLeft<=g.right-d.clientWidth+d.clientWidth?Math.min(g.left,Math.max(g.right-d.clientWidth,d.scrollLeft)):(g.right-d.clientWidth+g.left)/2;d.scrollTop=!1===a||g.top<=d.scrollTop+d.clientHeight&&d.scrollTop<=g.bottom-d.clientHeight+d.clientHeight?Math.min(g.top,Math.max(g.bottom-d.clientHeight,d.scrollTop)):(g.bottom-d.clientHeight+
|
||||
g.top)/2;g=g.translate(f-d.scrollLeft,h-d.scrollTop);e=d}};b.scrollIntoViewIfNeeded()}},setFirstNode:function(b,a){var c=b.data.key.children;if(a[c].length>0)a[c][0].isFirstNode=!0},setLastNode:function(b,a){var c=b.data.key.children,d=a[c].length;if(d>0)a[c][d-1].isLastNode=!0},removeNode:function(b,a){var c=h.getRoot(b),d=b.data.key.children,e=a.parentTId?a.getParentNode():c;a.isFirstNode=!1;a.isLastNode=!1;a.getPreNode=function(){return null};a.getNextNode=function(){return null};if(h.getNodeCache(b,
|
||||
a.tId)){k(a,b).remove();h.removeNodeCache(b,a);h.removeSelectedNode(b,a);for(var g=0,j=e[d].length;g<j;g++)if(e[d][g].tId==a.tId){e[d].splice(g,1);break}i.setFirstNode(b,e);i.setLastNode(b,e);var p,g=e[d].length;if(!b.data.keep.parent&&g==0)e.isParent=!1,e.open=!1,g=k(e,f.id.UL,b),j=k(e,f.id.SWITCH,b),p=k(e,f.id.ICON,b),i.replaceSwitchClass(e,j,f.folder.DOCU),i.replaceIcoClass(e,p,f.folder.DOCU),g.css("display","none");else if(b.view.showLine&&g>0){var n=e[d][g-1],g=k(n,f.id.UL,b),j=k(n,f.id.SWITCH,
|
||||
b);p=k(n,f.id.ICON,b);e==c?e[d].length==1?i.replaceSwitchClass(n,j,f.line.ROOT):(c=k(e[d][0],f.id.SWITCH,b),i.replaceSwitchClass(e[d][0],c,f.line.ROOTS),i.replaceSwitchClass(n,j,f.line.BOTTOM)):i.replaceSwitchClass(n,j,f.line.BOTTOM);g.removeClass(f.line.LINE)}}},replaceIcoClass:function(b,a,c){if(a&&!b.isAjaxing&&(b=a.attr("class"),b!=void 0)){b=b.split("_");switch(c){case f.folder.OPEN:case f.folder.CLOSE:case f.folder.DOCU:b[b.length-1]=c}a.attr("class",b.join("_"))}},replaceSwitchClass:function(b,
|
||||
a,c){if(a){var d=a.attr("class");if(d!=void 0){d=d.split("_");switch(c){case f.line.ROOT:case f.line.ROOTS:case f.line.CENTER:case f.line.BOTTOM:case f.line.NOLINE:d[0]=i.makeNodeLineClassEx(b)+c;break;case f.folder.OPEN:case f.folder.CLOSE:case f.folder.DOCU:d[1]=c}a.attr("class",d.join("_"));c!==f.folder.DOCU?a.removeAttr("disabled"):a.attr("disabled","disabled")}}},selectNode:function(b,a,c){c||i.cancelPreSelectedNode(b,null,a);k(a,f.id.A,b).addClass(f.node.CURSELECTED);h.addSelectedNode(b,a);
|
||||
b.treeObj.trigger(f.event.SELECTED,[b.treeId,a])},setNodeFontCss:function(b,a){var c=k(a,f.id.A,b),d=i.makeNodeFontCss(b,a);d&&c.css(d)},setNodeLineIcos:function(b,a){if(a){var c=k(a,f.id.SWITCH,b),d=k(a,f.id.UL,b),e=k(a,f.id.ICON,b),g=i.makeUlLineClass(b,a);g.length==0?d.removeClass(f.line.LINE):d.addClass(g);c.attr("class",i.makeNodeLineClass(b,a));a.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");e.removeAttr("style");e.attr("style",i.makeNodeIcoStyle(b,a));e.attr("class",i.makeNodeIcoClass(b,
|
||||
a))}},setNodeName:function(b,a){var c=h.getNodeTitle(b,a),d=k(a,f.id.SPAN,b);d.empty();b.view.nameIsHTML?d.html(h.getNodeName(b,a)):d.text(h.getNodeName(b,a));j.apply(b.view.showTitle,[b.treeId,a],b.view.showTitle)&&k(a,f.id.A,b).attr("title",!c?"":c)},setNodeTarget:function(b,a){k(a,f.id.A,b).attr("target",i.makeNodeTarget(a))},setNodeUrl:function(b,a){var c=k(a,f.id.A,b),d=i.makeNodeUrl(b,a);d==null||d.length==0?c.removeAttr("href"):c.attr("href",d)},switchNode:function(b,a){a.open||!j.canAsync(b,
|
||||
a)?i.expandCollapseNode(b,a,!a.open):b.async.enable?i.asyncNode(b,a)||i.expandCollapseNode(b,a,!a.open):a&&i.expandCollapseNode(b,a,!a.open)}};q.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},
|
||||
id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:j,view:i,event:m,data:h},getZTreeObj:function(b){return(b=h.getZTreeTools(b))?b:null},destroy:function(b){if(b&&b.length>0)i.destroy(h.getSetting(b));else for(var a in r)i.destroy(r[a])},init:function(b,a,c){var d=j.clone(N);q.extend(!0,d,a);d.treeId=
|
||||
b.attr("id");d.treeObj=b;d.treeObj.empty();r[d.treeId]=d;if(typeof document.body.style.maxHeight==="undefined")d.view.expandSpeed="";h.initRoot(d);b=h.getRoot(d);a=d.data.key.children;c=c?j.clone(j.isArray(c)?c:[c]):[];b[a]=d.data.simpleData.enable?h.transformTozTreeFormat(d,c):c;h.initCache(d);m.unbindTree(d);m.bindTree(d);m.unbindEvent(d);m.bindEvent(d);c={setting:d,addNodes:function(a,b,c,f){function h(){i.addNodes(d,a,b,m,f==!0)}a||(a=null);if(a&&!a.isParent&&d.data.keep.leaf)return null;var k=
|
||||
parseInt(b,10);isNaN(k)?(f=!!c,c=b,b=-1):b=k;if(!c)return null;var m=j.clone(j.isArray(c)?c:[c]);j.canAsync(d,a)?i.asyncNode(d,a,f,h):h();return m},cancelSelectedNode:function(a){i.cancelPreSelectedNode(d,a)},destroy:function(){i.destroy(d)},expandAll:function(a){a=!!a;i.expandCollapseSonNode(d,null,a,!0);return a},expandNode:function(a,b,c,f,n){function m(){var b=k(a,d).get(0);b&&f!==!1&&i.scrollIntoView(b)}if(!a||!a.isParent)return null;b!==!0&&b!==!1&&(b=!a.open);if((n=!!n)&&b&&j.apply(d.callback.beforeExpand,
|
||||
[d.treeId,a],!0)==!1)return null;else if(n&&!b&&j.apply(d.callback.beforeCollapse,[d.treeId,a],!0)==!1)return null;b&&a.parentTId&&i.expandCollapseParentNode(d,a.getParentNode(),b,!1);if(b===a.open&&!c)return null;h.getRoot(d).expandTriggerFlag=n;!j.canAsync(d,a)&&c?i.expandCollapseSonNode(d,a,b,!0,m):(a.open=!b,i.switchNode(this.setting,a),m());return b},getNodes:function(){return h.getNodes(d)},getNodeByParam:function(a,b,c){return!a?null:h.getNodeByParam(d,c?c[d.data.key.children]:h.getNodes(d),
|
||||
a,b)},getNodeByTId:function(a){return h.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return!a?null:h.getNodesByParam(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByParamFuzzy:function(a,b,c){return!a?null:h.getNodesByParamFuzzy(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByFilter:function(a,b,c,f){b=!!b;return!a||typeof a!="function"?b?null:[]:h.getNodesByFilter(d,c?c[d.data.key.children]:h.getNodes(d),a,b,f)},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children,
|
||||
c=a.parentTId?a.getParentNode():h.getRoot(d),f=0,i=c[b].length;f<i;f++)if(c[b][f]==a)return f;return-1},getSelectedNodes:function(){for(var a=[],b=h.getRoot(d).curSelectedList,c=0,f=b.length;c<f;c++)a.push(b[c]);return a},isSelectedNode:function(a){return h.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var j=!a;j&&(a=h.getRoot(d));if(b=="refresh"){for(var b=this.setting.data.key.children,n=0,m=a[b]?a[b].length:0;n<m;n++)h.removeNodeCache(d,a[b][n]);h.removeSelectedNode(d);
|
||||
a[b]=[];j?this.setting.treeObj.empty():k(a,f.id.UL,d).empty()}i.asyncNode(this.setting,j?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=h.getRoot(d),b=a[d.data.key.children];h.initRoot(d);a[d.data.key.children]=b;h.initCache(d);i.createNodes(d,0,a[d.data.key.children],null,-1)},removeChildNodes:function(a){if(!a)return null;var b=a[d.data.key.children];i.removeChildNodes(d,a);return b?b:null},removeNode:function(a,b){a&&(b=!!b,b&&j.apply(d.callback.beforeRemove,[d.treeId,a],!0)==
|
||||
!1||(i.removeNode(d,a),b&&this.setting.treeObj.trigger(f.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b,c){function f(){if(!c){var b=k(a,d).get(0);i.scrollIntoView(b)}}if(a&&j.uCanDo(d)){b=d.view.selectedMulti&&b;if(a.parentTId)i.expandCollapseParentNode(d,a.getParentNode(),!0,!1,f);else if(!c)try{k(a,d).focus().blur()}catch(h){}i.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return h.transformTozTreeFormat(d,a)},transformToArray:function(a){return h.transformToArrayFormat(d,a)},updateNode:function(a){a&&
|
||||
k(a,d).get(0)&&j.uCanDo(d)&&(i.setNodeName(d,a),i.setNodeTarget(d,a),i.setNodeUrl(d,a),i.setNodeLineIcos(d,a),i.setNodeFontCss(d,a))}};b.treeTools=c;h.setZTreeTools(d,c);b[a]&&b[a].length>0?i.createNodes(d,0,b[a],null,-1):d.async.enable&&d.async.url&&d.async.url!==""&&i.asyncNode(d);return c}};var O=q.fn.zTree,k=j.$,f=O.consts})(jQuery);
|
||||
|
||||
/*
|
||||
* JQuery zTree excheck v3.5.28
|
||||
* http://treejs.cn/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2017-01-20
|
||||
*/
|
||||
(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
|
||||
a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
|
||||
!0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var f=g.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=f.length-1;d>=0;d--)b=f[d],b[l]&&b!=a&&(b[l]=!1,f.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!=
|
||||
a.parentTId&&e.repairParentChkClassWithSelf(c,b));f.push(a)}else{f=a.parentTId?a.getParentNode():g.getRoot(c);for(d=0,h=f[i].length;d<h;d++)b=f[i][d],b[l]&&b!=a&&(b[l]=!1,e.setChkClass(c,n(b,j.id.CHECK,c),b))}else if(c.check.radioType==b.TYPE_ALL)for(d=0,h=f.length;d<h;d++)if(a==f[d]){f.splice(d,1);break}}else a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,
|
||||
a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+
|
||||
"_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=g.getRoot(c),i=0,l=h[d].length;i<l;i++){var f=h[d][i];f.nocheck!==!0&&f.chkDisabled!==!0&&(f[b]=a);e.setSonNodeCheckBox(c,f,a)}},repairChkClass:function(c,a){if(a&&(g.makeChkFlag(c,a),a.nocheck!==!0)){var b=n(a,j.id.CHECK,c);e.setChkClass(c,b,a)}},repairParentChkClass:function(c,
|
||||
a){if(a&&a.parentTId){var b=a.getParentNode();e.repairChkClass(c,b);e.repairParentChkClass(c,b)}},repairParentChkClassWithSelf:function(c,a){if(a){var b=c.data.key.children;a[b]&&a[b].length>0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(c,a[h][i],b,d)}},repairParentChkDisabled:function(c,
|
||||
a,b,d){if(a){if(a.chkDisabled!=b&&d)a.chkDisabled=b;e.repairChkClass(c,a);e.repairParentChkDisabled(c,a.getParentNode(),b,d)}},setChkClass:function(c,a,b){a&&(b.nocheck===!0?a.hide():a.show(),a.attr("class",e.makeChkClass(c,b)))},setParentNodeCheckBox:function(c,a,b,d){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);g.makeChkFlag(c,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=b,e.setChkClass(c,l,a),c.check.autoCheckTrigger&&a!=d&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,
|
||||
a]));if(a.parentTId){l=!0;if(!b)for(var h=a.getParentNode()[h],f=0,k=h.length;f<k;f++)if(h[f].nocheck!==!0&&h[f].chkDisabled!==!0&&h[f][i]||(h[f].nocheck===!0||h[f].chkDisabled===!0)&&h[f].check_Child_State>0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var f=!1;if(a[h])for(var k=0,m=a[h].length;k<m;k++){var o=a[h][k];e.setSonNodeCheckBox(c,o,b,d);o.chkDisabled===
|
||||
!0&&(f=!0)}if(a!=g.getRoot(c)&&a.chkDisabled!==!0){f&&a.nocheck!==!0&&g.makeChkFlag(c,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=b,!f)a.check_Child_State=a[h]&&a[h].length>0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=g.getRoot(c).radioCheckedList,b=0,d=a.length;b<d;b++)g.getNodeCache(c,a[b].tId)||(a.splice(b,
|
||||
1),b--,d--);return a},getCheckStatus:function(c,a){if(!c.check.enable||a.nocheck||a.chkDisabled)return null;var b=c.data.key.checked;return{checked:a[b],half:a.halfCheck?a.halfCheck:c.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[b]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,d=!d?[]:d,
|
||||
f=0,k=a.length;f<k;f++){if(a[f].nocheck!==!0&&a[f].chkDisabled!==!0&&a[f][i]==b&&(d.push(a[f]),e))break;g.getTreeCheckedNodes(c,a[f][h],b,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&b.push(a[i]),g.getTreeChangeCheckedNodes(c,a[i][d],b);return b},makeChkFlag:function(c,a){if(a){var b=c.data.key.children,
|
||||
d=c.data.key.checked,h=-1;if(a[b])for(var i=0,e=a[b].length;i<e;i++){var f=a[b][i],g=-1;if(c.check.chkStyle==j.radio.STYLE)if(g=f.nocheck===!0||f.chkDisabled===!0?f.check_Child_State:f.halfCheck===!0?2:f[d]?2:f.check_Child_State>0?2:0,g==2){h=2;break}else g==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(g=f.nocheck===!0||f.chkDisabled===!0?f.check_Child_State:f.halfCheck===!0?1:f[d]?f.check_Child_State===-1||f.check_Child_State===2?2:1:f.check_Child_State>0?1:0,g===1){h=1;break}else if(g===
|
||||
2&&h>-1&&i>0&&g!==h){h=1;break}else if(h===2&&g>-1&&g<2){h=1;break}else g>-1&&(h=g)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,g=m._z.data,n=k.$;g.exSetting(v);g.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});g.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});g.addInitCache(function(){});g.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]=
|
||||
k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return g.getCheckStatus(c,
|
||||
b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&g.getRoot(c).radioCheckedList.push(b)}});g.addInitProxy(function(c){var a=c.target,b=g.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
|
||||
k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=g.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);g.addInitRoot(function(c){g.getRoot(c).radioCheckedList=[]});
|
||||
g.addBeforeA(function(c,a,b){c.check.enable&&(g.makeChkFlag(c,a),b.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(c,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});g.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,g){var f=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[f]),g=!!g,(a[f]!==b||c)&&!(g&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&&
|
||||
a.nocheck!==!0))a[f]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),g&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return g.getTreeCheckedNodes(this.setting,g.getRoot(this.setting)[b],a!==!1)};
|
||||
a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return g.getTreeChangeCheckedNodes(this.setting,g.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,g){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!g);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,g){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(g==!0||this.setting.check.chkStyle===
|
||||
j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d,g){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i,j){var f="";u&&(f=u.apply(e,arguments));
|
||||
d&&g.makeChkFlag(c,d);return f}})(jQuery);
|
||||
|
||||
/*
|
||||
* JQuery zTree exedit v3.5.28
|
||||
* http://treejs.cn/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2017-01-20
|
||||
*/
|
||||
(function(v){var J={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
|
||||
m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(B.dragFlag==0&&Math.abs(O-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(P-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(B.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)B.dragNodeShowBefore=
|
||||
[];n=l[a];n.isParent&&n.open?(f.expandCollapseNode(e,n,!n.open),B.dragNodeShowBefore[n.tId]=!0):B.dragNodeShowBefore[n.tId]=!1}B.dragFlag=1;t.showHoverDom=!1;g.showIfameMask(e,!0);n=!0;k=-1;if(l.length>1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a<c;a++)if(B.dragNodeShowBefore[j[a].tId]!==void 0&&(n&&k>-1&&k+1!==a&&(n=!1),i.push(j[a]),k=a),l.length===i.length){l=i;break}}n&&(I=l[0].getPreNode(),R=l[l.length-1].getNextNode());D=o("<ul class='zTreeDragUL'></ul>",
|
||||
e);for(a=0,c=l.length;a<c;a++)n=l[a],n.editNameFlag=!1,f.selectNode(e,n,a>0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("<li id='"+n.tId+"_tmp'></li>",e),k.append(o(n,d.id.A,e).clone()),k.css("padding","0"),k.children("#"+n.tId+d.id.A).removeClass(d.node.CURSELECTED),D.append(k),a==e.edit.drag.maxShowNodeNum-1&&(k=o("<li id='"+n.tId+"_moretmp'><a> ... </a></li>",e),D.append(k)));D.attr("id",l[0].tId+d.id.UL+"_tmp");D.addClass(e.treeObj.attr("class"));D.appendTo(M);A=o("<span class='tmpzTreeMove_arrow'></span>",
|
||||
e);A.attr("id","zTreeMove_arrow_tmp");A.appendTo(M);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(B.dragFlag==1){s&&A.attr("id")==b.target.id&&u&&b.clientX+G.scrollLeft()+2>v("#"+u+d.id.A,s).offset().left?(n=v("#"+u+d.id.A,s),b.target=n.length>0?n.get(0):b.target):s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&v("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_INNER));
|
||||
u=s=null;K=!1;h=e;n=m.getSettings();for(var y in n)if(n[y].treeId&&n[y].edit.enable&&n[y].treeId!=e.treeId&&(b.target.id==n[y].treeId||v(b.target).parents("#"+n[y].treeId).length>0))K=!0,h=n[y];y=G.scrollTop();k=G.scrollLeft();i=h.treeObj.offset();a=h.treeObj.get(0).scrollHeight;n=h.treeObj.get(0).scrollWidth;c=b.clientY+y-i.top;var p=h.treeObj.height()+i.top-b.clientY-y,q=b.clientX+k-i.left,H=h.treeObj.width()+i.left-b.clientX-k;i=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var j=p<e.edit.drag.borderMax&&
|
||||
p>e.edit.drag.borderMin,F=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,x=H<e.edit.drag.borderMax&&H>e.edit.drag.borderMin,p=c>e.edit.drag.borderMin&&p>e.edit.drag.borderMin&&q>e.edit.drag.borderMin&&H>e.edit.drag.borderMin,q=i&&h.treeObj.scrollTop()<=0,H=j&&h.treeObj.scrollTop()+h.treeObj.height()+10>=a,N=F&&h.treeObj.scrollLeft()<=0,Q=x&&h.treeObj.scrollLeft()+h.treeObj.width()+10>=n;if(b.target&&g.isChildOrSelf(b.target,h.treeId)){for(var E=b.target;E&&E.tagName&&!g.eqs(E.tagName,"li")&&E.id!=
|
||||
h.treeId;)E=E.parentNode;var S=!0;for(a=0,c=l.length;a<c;a++)if(n=l[a],E.id===n.tId){S=!1;break}else if(o(n,e).find("#"+E.id).length>0){S=!1;break}if(S&&b.target&&g.isChildOrSelf(b.target,E.id+d.id.A))s=v(E),u=E.id}n=l[0];if(p&&g.isChildOrSelf(b.target,h.treeId)){if(!s&&(b.target.id==h.treeId||q||H||N||Q)&&(K||!K&&n.parentTId))s=h.treeObj;i?h.treeObj.scrollTop(h.treeObj.scrollTop()-10):j&&h.treeObj.scrollTop(h.treeObj.scrollTop()+10);F?h.treeObj.scrollLeft(h.treeObj.scrollLeft()-10):x&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+
|
||||
10);s&&s!=h.treeObj&&s.offset().left<h.treeObj.offset().left&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+s.offset().left-h.treeObj.offset().left)}D.css({top:b.clientY+y+3+"px",left:b.clientX+k+3+"px"});c=a=0;if(s&&s.attr("id")!=h.treeId){var z=u==null?null:m.getNodeCache(h,u);i=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;k=!!(I&&u===I.tId);F=!!(R&&u===R.tId);j=n.parentTId&&n.parentTId==u;n=(i||!F)&&g.apply(h.edit.drag.prev,[h.treeId,l,z],
|
||||
!!h.edit.drag.prev);k=(i||!k)&&g.apply(h.edit.drag.next,[h.treeId,l,z],!!h.edit.drag.next);i=(i||!j)&&!(h.data.keep.leaf&&!z.isParent)&&g.apply(h.edit.drag.inner,[h.treeId,l,z],!!h.edit.drag.inner);j=function(){s=null;u="";w=d.move.TYPE_INNER;A.css({display:"none"});if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null};if(!n&&!k&&!i)j();else if(F=v("#"+u+d.id.A,s),x=z.isLastNode?null:v("#"+z.getNextNode().tId+d.id.A,s.next()),p=F.offset().top,q=F.offset().left,
|
||||
H=n?i?0.25:k?0.5:1:-1,N=k?i?0.75:n?0.5:0:-1,y=(b.clientY+y-p)/F.height(),(H==1||y<=H&&y>=-0.2)&&n?(a=1-A.width(),c=p-A.height()/2,w=d.move.TYPE_PREV):(N==0||y>=N&&y<=1.2)&&k?(a=1-A.width(),c=x==null||z.isParent&&z.open?p+F.height()-A.height()/2:x.offset().top-A.height()/2,w=d.move.TYPE_NEXT):i?(a=5-A.width(),c=p,w=d.move.TYPE_INNER):j(),s){A.css({display:"block",top:c+"px",left:q+a+"px"});F.addClass(d.node.TMPTARGET_NODE+"_"+w);if(T!=u||U!=w)L=(new Date).getTime();if(z&&z.isParent&&w==d.move.TYPE_INNER&&
|
||||
(y=!0,window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==z.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===z.tId&&(y=!1),y))window.zTreeMoveTimer=setTimeout(function(){w==d.move.TYPE_INNER&&z&&z.isParent&&!z.open&&(new Date).getTime()-L>h.edit.drag.autoOpenTime&&g.apply(h.callback.beforeDragOpen,[h.treeId,z],!0)&&(f.switchNode(h,z),h.edit.drag.autoExpandTrigger&&h.treeObj.trigger(d.event.EXPAND,[h.treeId,z]))},
|
||||
h.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=z.tId}}else if(w=d.move.TYPE_INNER,s&&g.apply(h.edit.drag.inner,[h.treeId,l,null],!!h.edit.drag.inner)?s.addClass(d.node.TMPTARGET_TREE):s=null,A.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=u;U=w;e.treeObj.trigger(d.event.DRAGMOVE,[b,e.treeId,l])}return!1}function r(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;U=T=
|
||||
null;G.unbind("mousemove",c);G.unbind("mouseup",r);G.unbind("selectstart",k);M.css("cursor","auto");s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&v("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+J.move.TYPE_INNER));g.showIfameMask(e,!1);t.showHoverDom=!0;if(B.dragFlag!=0){B.dragFlag=0;var a,i,j;for(a=0,i=l.length;a<i;a++)j=l[a],j.isParent&&B.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e,
|
||||
j,!j.open),delete B.dragNodeShowBefore[j.tId]);D&&D.remove();A&&A.remove();var p=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&s&&u&&l[0].parentTId&&u==l[0].parentTId&&w==d.move.TYPE_INNER&&(s=null);if(s){var q=u==null?null:m.getNodeCache(h,u);if(g.apply(e.callback.beforeDrop,[h.treeId,l,q,w,p],!0)==!1)f.selectNodes(x,l);else{var C=p?g.clone(l):l;a=function(){if(K){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);w==d.move.TYPE_INNER?
|
||||
f.addNodes(h,q,-1,C):f.addNodes(h,q.getParentNode(),w==d.move.TYPE_PREV?q.getIndex():q.getIndex()+1,C)}else if(p&&w==d.move.TYPE_INNER)f.addNodes(h,q,-1,C);else if(p)f.addNodes(h,q.getParentNode(),w==d.move.TYPE_PREV?q.getIndex():q.getIndex()+1,C);else if(w!=d.move.TYPE_NEXT)for(a=0,c=C.length;a<c;a++)f.moveNode(h,q,C[a],w,!1);else for(a=-1,c=C.length-1;a<c;c--)f.moveNode(h,q,C[c],w,!1);f.selectNodes(h,C);a=o(C[0],e).get(0);f.scrollIntoView(a);e.treeObj.trigger(d.event.DROP,[b,h.treeId,C,q,w,p])};
|
||||
w==d.move.TYPE_INNER&&g.canAsync(h,q)?f.asyncNode(h,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function k(){return!1}var i,j,e=m.getSetting(b.data.treeId),B=m.getRoot(e),t=m.getRoots();if(b.button==2||!e.edit.enable||!e.edit.drag.isCopy&&!e.edit.drag.isMove)return!0;var p=b.target,q=m.getRoot(e).curSelectedList,l=[];if(m.isSelectedNode(e,a))for(i=0,j=q.length;i<j;i++){if(q[i].editNameFlag&&g.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+
|
||||
d.id.INPUT)!==null)return!0;l.push(q[i]);if(l[0].parentTId!==q[i].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var G=v(e.treeObj.get(0).ownerDocument),M=v(e.treeObj.get(0).ownerDocument.body),D,A,s,K=!1,h=e,x=e,I,R,T=null,U=null,u=null,w=d.move.TYPE_INNER,O=b.clientX,P=b.clientY,L=(new Date).getTime();g.uCanDo(e)&&G.bind("mousemove",c);G.bind("mouseup",r);G.bind("selectstart",k);b.preventDefault&&b.preventDefault();return!0}};v.extend(!0,v.fn.zTree.consts,J);v.extend(!0,
|
||||
v.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left+(document.body.scrollLeft+document.documentElement.scrollLeft),b.top+(document.body.scrollTop+document.documentElement.scrollTop)]},inputFocus:function(b){b.get(0)&&(b.focus(),g.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange();
|
||||
c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f<i;f++){var j=d.get(f),e=g.getAbs(j),j=o("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(o("body",b));c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,
|
||||
a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&g.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+g.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(r);o(a,d.id.EDIT,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;f.editNode(b,a);return!1}).show()}},
|
||||
addRemoveBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.REMOVE,b).length>0)&&g.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+g.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(r);o(a,d.id.REMOVE,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;f.removeNode(b,
|
||||
a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(m.getRoots().showHoverDom)a.isHover=!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),g.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a,c){var r=m.getRoot(b),k=b.data.key.name,i=r.curEditNode;if(i){var j=r.curEditInput,a=a?a:c?i[k]:j.val();if(g.apply(b.callback.beforeRename,[b.treeId,i,a,c],!0)===!1)return!1;i[k]=a;o(i,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT);
|
||||
j.unbind();f.setNodeName(b,i);i.editNameFlag=!1;r.curEditNode=null;r.curEditInput=null;f.selectNode(b,i,!1);b.treeObj.trigger(d.event.RENAME,[b.treeId,i,c])}return r.noSelection=!0},editNode:function(b,a){var c=m.getRoot(b);f.editNodeBlur=!1;if(m.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){g.inputFocus(c.curEditInput)},0);else{var r=b.data.key.name;a.editNameFlag=!0;f.removeTreeDom(b,a);f.cancelCurEditNode(b);f.selectNode(b,a,!1);o(a,d.id.SPAN,b).html("<input type=text class='rename' id='"+
|
||||
a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var k=o(a,d.id.INPUT,b);k.attr("value",a[r]);b.edit.editNameSelectAll?g.inputSelect(k):g.inputFocus(k);k.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(a){a.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):a.keyCode=="27"&&f.cancelCurEditNode(b,null,!0)}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=k;c.noSelection=
|
||||
!1;c.curEditNode=a}},moveNode:function(b,a,c,r,k,i){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||r!=d.move.TYPE_INNER)){var g=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)r=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(r!=d.move.TYPE_PREV&&r!=d.move.TYPE_NEXT)r=d.move.TYPE_INNER;if(r==d.move.TYPE_INNER)if(t)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,f.setNodeLineIcos(b,a);c.parentTId=a.tId}var p;
|
||||
t?p=t=b.treeObj:(!i&&r==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):i||f.expandCollapseNode(b,a.getParentNode(),!0,!1),t=o(a,b),p=o(a,d.id.UL,b),t.get(0)&&!p.get(0)&&(p=[],f.makeUlHtml(b,a,p,""),t.append(p.join(""))),p=o(a,d.id.UL,b));var q=o(c,b);q.get(0)?t.get(0)||q.remove():q=f.appendNodes(b,c.level,[c],null,-1,!1,!0).join("");p.get(0)&&r==d.move.TYPE_INNER?p.append(q):t.get(0)&&r==d.move.TYPE_PREV?t.before(q):t.get(0)&&r==d.move.TYPE_NEXT&&t.after(q);var l=-1,v=0,x=null,t=null,D=c.level;
|
||||
if(c.isFirstNode){if(l=0,g[e].length>1)x=g[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=g[e].length-1,x=g[e][l-1],x.isLastNode=!0;else for(p=0,q=g[e].length;p<q;p++)if(g[e][p].tId==c.tId){l=p;break}l>=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(v=p);if(r==d.move.TYPE_INNER){a[e]||(a[e]=[]);if(a[e].length>0)t=a[e][a[e].length-1],t.isLastNode=!1;a[e].splice(a[e].length,0,c);c.isLastNode=!0;c.isFirstNode=a[e].length==1}else a.isFirstNode&&r==d.move.TYPE_PREV?
|
||||
(j[e].splice(v,0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&r==d.move.TYPE_NEXT?(j[e].splice(v+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(r==d.move.TYPE_PREV?j[e].splice(v,0,c):j[e].splice(v+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);m.fixPIdKeyValue(b,c);m.setSonNodeLevel(b,c.getParentNode(),c);f.setNodeLineIcos(b,c);f.repairNodeLevelClass(b,c,D);!b.data.keep.parent&&g[e].length<
|
||||
1?(g.isParent=!1,g.open=!1,a=o(g,d.id.UL,b),r=o(g,d.id.SWITCH,b),e=o(g,d.id.ICON,b),f.replaceSwitchClass(g,r,d.folder.DOCU),f.replaceIcoClass(g,e,d.folder.DOCU),a.css("display","none")):x&&f.setNodeLineIcos(b,x);t&&f.setNodeLineIcos(b,t);b.check&&b.check.enable&&f.repairChkClass&&(f.repairChkClass(b,g),f.repairParentChkClassWithSelf(b,g),g!=c.parent&&f.repairParentChkClassWithSelf(b,c));i||f.expandCollapseParentNode(b,c.getParentNode(),!0,k)}},removeEditBtn:function(b,a){o(a,d.id.EDIT,b).unbind().remove()},
|
||||
removeRemoveBtn:function(b,a){o(a,d.id.REMOVE,b).unbind().remove()},removeTreeDom:function(b,a){a.isHover=!1;f.removeEditBtn(b,a);f.removeRemoveBtn(b,a);g.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var f=o(a,b),g=o(a,d.id.A,b),b=o(a,d.id.UL,b),c=d.className.LEVEL+c,a=d.className.LEVEL+a.level;f.removeClass(c);f.addClass(a);g.removeClass(c);g.addClass(a);b.removeClass(c);b.addClass(a)}},selectNodes:function(b,a){for(var c=0,d=a.length;c<d;c++)f.selectNode(b,
|
||||
a[c],c>0)}},event:{},data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var I=v.fn.zTree,g=I._z.tools,d=I.consts,f=I._z.view,m=I._z.data,o=g.$;m.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5,
|
||||
maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}});m.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d,f){g.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.DRAG,function(a,c,d,f){g.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DRAGMOVE,function(a,c,d,f){g.apply(b.callback.onDragMove,[c,
|
||||
d,f])});a.bind(c.DROP,function(a,c,d,f,e,m,o){g.apply(b.callback.onDrop,[c,d,f,e,m,o])})});m.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.DRAG);b.unbind(a.DRAGMOVE);b.unbind(a.DROP)});m.addInitCache(function(){});m.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});m.addInitProxy(function(b){var a=b.target,c=m.getSetting(b.data.treeId),f=b.relatedTarget,k="",i=null,j="",e=null,o=null;if(g.eqs(b.type,"mouseover")){if(o=g.getMDom(c,a,[{tagName:"a",
|
||||
attrName:"treeNode"+d.id.A}]))k=g.getNodeMainDom(o).id,j="hoverOverNode"}else if(g.eqs(b.type,"mouseout"))o=g.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),o||(k="remove",j="hoverOutNode");else if(g.eqs(b.type,"mousedown")&&(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))k=g.getNodeMainDom(o).id,j="mousedownNode";if(k.length>0)switch(i=m.getNodeCache(c,k),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e=
|
||||
x.onHoverOutNode}return{stop:!1,node:i,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=[];b.dragMaskList=[];a.showHoverDom=!0});m.addZTreeTools(function(b,a){a.cancelEditName=function(a){m.getRoot(this.setting).curEditNode&&f.cancelCurEditNode(this.setting,a?a:null,!0)};a.copyNode=function(a,b,k,i){if(!b)return null;
|
||||
if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;var j=this,e=g.clone(b);if(!a)a=null,k=d.move.TYPE_INNER;k==d.move.TYPE_INNER?(b=function(){f.addNodes(j.setting,a,-1,[e],i)},g.canAsync(this.setting,a)?f.asyncNode(this.setting,a,i,b):b()):(f.addNodes(this.setting,a.parentNode,-1,[e],i),f.moveNode(this.setting,a,e,k,!1,i));return e};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(this.setting,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(this.setting,a.getParentNode(),
|
||||
!0),f.editNode(this.setting,a))};a.moveNode=function(a,b,k,i){function j(){f.moveNode(e.setting,a,b,k,!1,i)}if(!b)return b;if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;else if(a&&(b.parentTId==a.tId&&k==d.move.TYPE_INNER||o(b,this.setting).find("#"+a.tId).length>0))return null;else a||(a=null);var e=this;g.canAsync(this.setting,a)&&k===d.move.TYPE_INNER?f.asyncNode(this.setting,a,i,j):j();return b};a.setEditable=function(a){this.setting.edit.enable=a;return this.refresh()}});
|
||||
var O=f.cancelPreSelectedNode;f.cancelPreSelectedNode=function(b,a){for(var c=m.getRoot(b).curSelectedList,d=0,g=c.length;d<g;d++)if(!a||a===c[d])if(f.removeTreeDom(b,c[d]),a)break;O&&O.apply(f,arguments)};var P=f.createNodes;f.createNodes=function(b,a,c,d,g){P&&P.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,d)};var W=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:W.apply(f,arguments)};var L=f.removeNode;f.removeNode=function(b,a){var c=
|
||||
m.getRoot(b);if(c.curEditNode===a)c.curEditNode=null;L&&L.apply(f,arguments)};var Q=f.selectNode;f.selectNode=function(b,a,c){var d=m.getRoot(b);if(m.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;Q&&Q.apply(f,arguments);f.addHoverDom(b,a);return!0};var V=g.uCanDo;g.uCanDo=function(b,a){var c=m.getRoot(b);if(a&&(g.eqs(a.type,"mouseover")||g.eqs(a.type,"mouseout")||g.eqs(a.type,"mousedown")||g.eqs(a.type,"mouseup")))return!0;if(c.curEditNode)f.editNodeBlur=!1,c.curEditInput.focus();
|
||||
return!c.curEditNode&&(V?V.apply(f,arguments):!0)}})(jQuery);
|
||||
|
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/1_close.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/1_open.png
Normal file
After Width: | Height: | Size: 580 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/2.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/3.png
Normal file
After Width: | Height: | Size: 762 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/4.png
Normal file
After Width: | Height: | Size: 399 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/5.png
Normal file
After Width: | Height: | Size: 710 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/6.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/7.png
Normal file
After Width: | Height: | Size: 534 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/8.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/diy/9.png
Normal file
After Width: | Height: | Size: 467 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/line_conn.gif
Normal file
After Width: | Height: | Size: 45 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/loading.gif
Normal file
After Width: | Height: | Size: 381 B |
BIN
public/static/plugs/ztree/zTreeStyle/img/zTreeStandard.gif
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
public/static/plugs/ztree/zTreeStyle/img/zTreeStandard.png
Normal file
After Width: | Height: | Size: 11 KiB |
97
public/static/plugs/ztree/zTreeStyle/zTreeStyle.css
Normal file
@ -0,0 +1,97 @@
|
||||
/*-------------------------------------
|
||||
zTree Style
|
||||
|
||||
version: 3.5.19
|
||||
author: Hunter.z
|
||||
email: hunter.z@263.net
|
||||
website: http://code.google.com/p/jquerytree/
|
||||
|
||||
-------------------------------------*/
|
||||
|
||||
.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
|
||||
.ztree {margin:0; padding:5px; color:#333}
|
||||
.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
|
||||
.ztree li ul{ margin:0; padding:0 0 0 18px}
|
||||
.ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;}
|
||||
|
||||
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent;
|
||||
text-decoration:none; vertical-align:top; display: inline-block}
|
||||
.ztree li a:hover {text-decoration:underline}
|
||||
.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
||||
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
||||
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid;
|
||||
opacity:0.8; filter:alpha(opacity=80)}
|
||||
.ztree li a.tmpTargetNode_prev {}
|
||||
.ztree li a.tmpTargetNode_next {}
|
||||
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
|
||||
font-size:12px; border:1px #7EC4CC solid; *border:0px}
|
||||
.ztree li span {line-height:16px; margin-right:2px}
|
||||
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
|
||||
border:0 none; cursor: pointer;outline:none;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
|
||||
|
||||
.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
|
||||
.ztree li span.button.chk.checkbox_false_full {background-position:0 0}
|
||||
.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
|
||||
.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
|
||||
.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
|
||||
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
|
||||
.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
|
||||
.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
|
||||
.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
|
||||
.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
|
||||
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
|
||||
.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
|
||||
.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
|
||||
.ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
|
||||
.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
|
||||
.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
|
||||
.ztree li span.button.chk.radio_true_full {background-position:-42px 0}
|
||||
.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
|
||||
.ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
|
||||
.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
|
||||
.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
|
||||
|
||||
.ztree li span.button.switch {width:18px; height:18px}
|
||||
.ztree li span.button.root_open{background-position:-92px -54px}
|
||||
.ztree li span.button.root_close{background-position:-74px -54px}
|
||||
.ztree li span.button.roots_open{background-position:-92px 0}
|
||||
.ztree li span.button.roots_close{background-position:-74px 0}
|
||||
.ztree li span.button.center_open{background-position:-92px -18px}
|
||||
.ztree li span.button.center_close{background-position:-74px -18px}
|
||||
.ztree li span.button.bottom_open{background-position:-92px -36px}
|
||||
.ztree li span.button.bottom_close{background-position:-74px -36px}
|
||||
.ztree li span.button.noline_open{background-position:-92px -72px}
|
||||
.ztree li span.button.noline_close{background-position:-74px -72px}
|
||||
.ztree li span.button.root_docu{ background:none;}
|
||||
.ztree li span.button.roots_docu{background-position:-56px 0}
|
||||
.ztree li span.button.center_docu{background-position:-56px -18px}
|
||||
.ztree li span.button.bottom_docu{background-position:-56px -36px}
|
||||
.ztree li span.button.noline_docu{ background:none;}
|
||||
|
||||
.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
|
||||
|
||||
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
|
||||
|
||||
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
|
||||
|
||||
span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
|
||||
|
||||
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
|
||||
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
|
||||
|
||||
/* level style*/
|
||||
/*.ztree li span.button.level0 {
|
||||
display:none;
|
||||
}
|
||||
.ztree li ul.level0 {
|
||||
padding:0;
|
||||
background:none;
|
||||
}*/
|
@ -130,13 +130,14 @@ input[type=radio]:checked::after{content:'';display:block;position:relative;top:
|
||||
input[type=checkbox]:checked::after{display:block;position:absolute;top:-2px;left:-4px;content:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAAtklEQVQ4y2P4//8/A7Ux1Q0cxoaCADIbCUgCMTvVXAoE5kA8CYidyXYpGrAH4iVAHIXiCwoMDQTimUBcBsRMlBrKCsTpUANzkC0j11BuIK6EGlgKsoAkQ4FgChD7AzELVI8YEDdDDawDYk6YQaQY6gg1oAqILYC4D8oHGcyLbBAphoJAKtQgGO4EYiHk2CLHUJAXm6AG9gCxNHoSIMdQEJCFGqiALaGSayjMxQwUGzq0S6nhZygA2ojsbh6J67kAAAAASUVORK5CYII=')}
|
||||
input[type=checkbox]:focus,input[type=radio]:focus{outline:none}
|
||||
|
||||
/* 图片上传 */
|
||||
.uploadimage{display:inline-block;width:80px;height:80px;background-image:url('../img/image.png');background-repeat: no-repeat;background-position:center center;background-size:cover;cursor:pointer}
|
||||
/* 延时动画 */
|
||||
.transition{-webkit-transition:all .2s linear;-moz-transition:all .2s linear;-o-transition:all .2s linear;transition:all .2s linear}
|
||||
[data-tips-image]{cursor:pointer !important;cursor:-webkit-zoom-in !important;cursor:-moz-zoom-in !important;cursor:zoom-in !important}
|
||||
select.form-control.input-sm{padding:0 0 0 10px}
|
||||
.form-control.input-sm{line-height:1em}
|
||||
.pointer{cursor:pointer}
|
||||
.wrapper{padding:10px 15px;min-width:900px}
|
||||
.framework-sidebar-mini .wrapper{min-width:950px}
|
||||
.help-block{margin-bottom:0}
|
||||
.text-center{text-align:center}
|
||||
|
BIN
public/static/theme/default/img/image.png
Normal file
After Width: | Height: | Size: 1.6 KiB |