diff --git a/README.md b/V1/README.md similarity index 100% rename from README.md rename to V1/README.md diff --git a/V1/conf/app.conf b/V1/conf/app.conf new file mode 100644 index 0000000..9affc4d --- /dev/null +++ b/V1/conf/app.conf @@ -0,0 +1,18 @@ +appname = PPGo_Job +httpport = 8080 +runmode = dev + +# 允许同时运行的任务数 +jobs.pool = 1000 + +# 站点名称 +site.name = 定时任务管理器 + +# 数据库配置 +db.host = 127.0.0.1 +db.user = root +db.password = "123456" +db.port = 3306 +db.name = ppgo_job +db.prefix = pp_ +db.timezone = Asia/Shanghai diff --git a/V1/controllers/common.go b/V1/controllers/common.go new file mode 100644 index 0000000..e9f225b --- /dev/null +++ b/V1/controllers/common.go @@ -0,0 +1,128 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-19 22:27:09 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-22 11:15:33 + */ +package controllers + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" + "strconv" + "strings" +) + +const ( + MSG_OK = 0 + MSG_ERR = -1 +) + +type BaseController struct { + beego.Controller + controllerName string + actionName string + user *models.User + userId int + userName string + pageSize int +} + +func (this *BaseController) Prepare() { + this.pageSize = 20 + controllerName, actionName := this.GetControllerAndAction() + this.controllerName = strings.ToLower(controllerName[0 : len(controllerName)-10]) + this.actionName = strings.ToLower(actionName) + this.auth() + + this.Data["version"] = beego.AppConfig.String("version") + this.Data["siteName"] = beego.AppConfig.String("site.name") + this.Data["curRoute"] = this.controllerName + "." + this.actionName + this.Data["curController"] = this.controllerName + this.Data["curAction"] = this.actionName + this.Data["loginUserId"] = this.userId + this.Data["loginUserName"] = this.userName + this.Data["menuTag"] = this.controllerName +} + +//登录状态验证 +func (this *BaseController) auth() { + arr := strings.Split(this.Ctx.GetCookie("auth"), "|") + if len(arr) == 2 { + idstr, password := arr[0], arr[1] + userId, _ := strconv.Atoi(idstr) + if userId > 0 { + user, err := models.UserGetById(userId) + if err == nil && password == libs.Md5([]byte(this.getClientIp()+"|"+user.Password+user.Salt)) { + this.userId = user.Id + this.userName = user.UserName + this.user = user + } + } + } + + if this.userId == 0 && (this.controllerName != "main" || + (this.controllerName == "main" && this.actionName != "logout" && this.actionName != "login")) { + this.redirect(beego.URLFor("MainController.Login")) + } +} + +//渲染模版 +func (this *BaseController) display(tpl ...string) { + var tplname string + if len(tpl) > 0 { + tplname = tpl[0] + ".html" + } else { + tplname = this.controllerName + "/" + this.actionName + ".html" + } + this.Layout = "public/layout.html" + this.TplName = tplname +} + +// 重定向 +func (this *BaseController) redirect(url string) { + this.Redirect(url, 302) + this.StopRun() +} + +// 是否POST提交 +func (this *BaseController) isPost() bool { + return this.Ctx.Request.Method == "POST" +} + +// 显示错误信息 +func (this *BaseController) showMsg(args ...string) { + this.Data["message"] = args[0] + redirect := this.Ctx.Request.Referer() + if len(args) > 1 { + redirect = args[1] + } + + this.Data["redirect"] = redirect + this.Data["pageTitle"] = "系统提示" + this.display("error/message") + this.Render() + this.StopRun() +} + +// 输出json +func (this *BaseController) jsonResult(out interface{}) { + this.Data["json"] = out + this.ServeJSON() + this.StopRun() +} + +func (this *BaseController) ajaxMsg(msg interface{}, msgno int) { + out := make(map[string]interface{}) + out["status"] = msgno + out["msg"] = msg + + this.jsonResult(out) +} + +//获取用户IP地址 +func (this *BaseController) getClientIp() string { + s := strings.Split(this.Ctx.Request.RemoteAddr, ":") + return s[0] +} diff --git a/controllers/group.go b/V1/controllers/group.go similarity index 100% rename from controllers/group.go rename to V1/controllers/group.go diff --git a/controllers/help.go b/V1/controllers/help.go similarity index 100% rename from controllers/help.go rename to V1/controllers/help.go diff --git a/controllers/main.go b/V1/controllers/main.go similarity index 100% rename from controllers/main.go rename to V1/controllers/main.go diff --git a/V1/controllers/server.go b/V1/controllers/server.go new file mode 100644 index 0000000..f81ddb8 --- /dev/null +++ b/V1/controllers/server.go @@ -0,0 +1,137 @@ +/* +* @Author: haodaquan +* @Date: 2017-08-16 10:27:40 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-08-16 09:17:22 + */ + +package controllers + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" + "strconv" + "strings" + "time" +) + +type ServerController struct { + BaseController +} + +func (this *ServerController) List() { + page, _ := this.GetInt("page") + if page < 1 { + page = 1 + } + + result, count := models.TaskServerGetList(page, this.pageSize) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + if(v.Type==0){ + row["type"] = "密码" + }else { + row["type"] = "密钥" + } + row["server_name"] = v.ServerName + row["server_ip"] = v.ServerIp + row["detail"] = v.Detail + row["port"] = v.Port + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + list[k] = row + } + this.Data["pageTitle"] = "服务器列表" + this.Data["list"] = list + this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("ServerController.List"), true).ToString() + this.display() +} + +func (this *ServerController) Add() { + if this.isPost() { + server := new(models.TaskServer) + server.ServerName = strings.TrimSpace(this.GetString("server_name")) + server.ServerAccount = strings.TrimSpace(this.GetString("server_account")) + server.ServerIp = strings.TrimSpace(this.GetString("server_ip")) + server.Port,_= strconv.Atoi(this.GetString("port")) + server.Type,_ = strconv.Atoi(this.GetString("type")) + server.PrivateKeySrc = strings.TrimSpace(this.GetString("private_key_src")) + server.PublicKeySrc = strings.TrimSpace(this.GetString("public_key_src")) + server.Password = strings.TrimSpace(this.GetString("password")) + server.Detail = strings.TrimSpace(this.GetString("detail")) + server.CreateTime = time.Now().Unix() + server.UpdateTime = time.Now().Unix() + server.Status = 0 + _, err := models.TaskServerAdd(server) + if err != nil { + this.ajaxMsg(err.Error(), MSG_ERR) + } + this.ajaxMsg("", MSG_OK) + } + this.Data["pageTitle"] = "添加服务器" + this.display() +} + +func (this *ServerController) Edit() { + id, _ := this.GetInt("id") + server, err := models.TaskServerGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + if this.isPost() { + server.ServerName = strings.TrimSpace(this.GetString("server_name")) + server.ServerAccount = strings.TrimSpace(this.GetString("server_account")) + server.ServerIp = strings.TrimSpace(this.GetString("server_ip")) + server.Port,_ = strconv.Atoi(this.GetString("port")) + server.Type,_ = strconv.Atoi(this.GetString("type")) + server.Id,_ = strconv.Atoi(this.GetString("id")) + server.PrivateKeySrc = strings.TrimSpace(this.GetString("private_key_src")) + server.PublicKeySrc = strings.TrimSpace(this.GetString("public_key_src")) + server.Password = strings.TrimSpace(this.GetString("password")) + server.Detail = strings.TrimSpace(this.GetString("detail")) + server.UpdateTime = time.Now().Unix() + server.Status = 0 + err := server.Update() + if err != nil { + this.ajaxMsg(err.Error(), MSG_ERR) + } + this.ajaxMsg("", MSG_OK) + } + + this.Data["pageTitle"] = "编辑服务器" + this.Data["server"] = server + this.display() +} + +//TODO删除更新 +func (this *ServerController) Batch() { + action := this.GetString("action") + ids := this.GetStrings("ids") + if len(ids) < 1 { + this.ajaxMsg("请选择要操作的项目", MSG_ERR) + } + + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + switch action { + case "delete": + //查询服务器是否被占用 + filters := make([]interface{}, 0) + filters = append(filters, "server_id", id) + _, count := models.TaskGetList(1, 1000, filters...) + if count > 0 { + this.ajaxMsg("请先解除该服务器的任务占用", MSG_ERR) + }else{ + models.TaskServerDelById(id) + } + } + } + + this.ajaxMsg("", MSG_OK) +} diff --git a/V1/controllers/task.go b/V1/controllers/task.go new file mode 100644 index 0000000..1c748b8 --- /dev/null +++ b/V1/controllers/task.go @@ -0,0 +1,395 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 10:22:29 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-23 11:04:54 + */ + +package controllers + +import ( + "strconv" + "strings" + "time" + + "github.com/astaxie/beego" + crons "github.com/george518/PPGo_Job/crons" + "github.com/george518/PPGo_Job/jobs" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" +) + +type TaskController struct { + BaseController +} + +// 任务列表 +func (this *TaskController) List() { + page, _ := this.GetInt("page") + if page < 1 { + page = 1 + } + groupId, _ := this.GetInt("groupid") + if groupId > 0 { + this.Ctx.SetCookie("groupid", strconv.Itoa(groupId)+"|job") + } else { + arr := strings.Split(this.Ctx.GetCookie("groupid"), "|") + groupId, _ = strconv.Atoi(arr[0]) + } + + filters := make([]interface{}, 0) + if groupId > 0 && groupId != 99 { + filters = append(filters, "group_id", groupId) + } + result, count := models.TaskGetList(page, this.pageSize, filters...) + + list := make([]map[string]interface{}, len(result)) + + // 分组列表 + groups, _ := models.TaskGroupGetList(1, 100) + groups_map := make(map[int]string) + for _, gname := range groups { + groups_map[gname.Id] = gname.GroupName + } + + //服务器列表 + servers, _ := models.TaskServerGetList(1, 100) + + server_map := make(map[int]string) + for _, sname := range servers { + server_map[sname.Id] = sname.ServerName + } + server_map[0] = "本地" + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["name"] = v.TaskName + row["cron_spec"] = v.CronSpec + row["status"] = v.Status + row["description"] = v.Description + row["group_id"] = v.GroupId + row["group_name"] = groups_map[v.GroupId] + row["server_name"] = server_map[v.ServerId] + row["is_odd"] = k % 2 + + e := jobs.GetEntryById(v.Id) + if e != nil { + row["next_time"] = beego.Date(e.Next, "Y-m-d H:i:s") + row["prev_time"] = "-" + if e.Prev.Unix() > 0 { + row["prev_time"] = beego.Date(e.Prev, "Y-m-d H:i:s") + } else if v.PrevTime > 0 { + row["prev_time"] = beego.Date(time.Unix(v.PrevTime, 0), "Y-m-d H:i:s") + } + row["running"] = 1 + } else { + row["next_time"] = "-" + if v.PrevTime > 0 { + row["prev_time"] = beego.Date(time.Unix(v.PrevTime, 0), "Y-m-d H:i:s") + } else { + row["prev_time"] = "-" + } + row["running"] = 0 + } + list[k] = row + } + + this.Data["pageTitle"] = "任务列表" + this.Data["list"] = list + this.Data["groups"] = groups + this.Data["groupid"] = groupId + this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("TaskController.List", "groupid", groupId), true).ToString() + this.display() +} + +// 添加任务 +func (this *TaskController) Add() { + + if this.isPost() { + task := new(models.Task) + task.UserId = this.userId + task.GroupId, _ = this.GetInt("group_id") + task.TaskName = strings.TrimSpace(this.GetString("task_name")) + task.Description = strings.TrimSpace(this.GetString("description")) + task.Concurrent, _ = this.GetInt("concurrent") + task.ServerId, _ = this.GetInt("server_id") + task.CronSpec = strings.TrimSpace(this.GetString("cron_spec")) + task.Command = strings.TrimSpace(this.GetString("command")) + task.Timeout, _ = this.GetInt("timeout") + + if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { + this.ajaxMsg("请填写完整信息", MSG_ERR) + } + if _, err := crons.Parse(task.CronSpec); err != nil { + this.ajaxMsg("cron表达式无效", MSG_ERR) + } + if _, err := models.TaskAdd(task); err != nil { + this.ajaxMsg(err.Error(), MSG_ERR) + } + + this.ajaxMsg("", MSG_OK) + } + + // 分组列表 + groups, _ := models.TaskGroupGetList(1, 100) + this.Data["groups"] = groups + //服务器分组 + servers, _ := models.TaskServerGetList(1, 100) + this.Data["servers"] = servers + this.Data["pageTitle"] = "添加任务" + this.display() +} + +// 编辑任务 +func (this *TaskController) Edit() { + id, _ := this.GetInt("id") + + task, err := models.TaskGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + if task.Status != 0 { + this.ajaxMsg("激活状态无法编辑任务,请先暂停任务", MSG_ERR) + } + + if this.isPost() { + task.TaskName = strings.TrimSpace(this.GetString("task_name")) + task.Description = strings.TrimSpace(this.GetString("description")) + task.GroupId, _ = this.GetInt("group_id") + task.Concurrent, _ = this.GetInt("concurrent") + task.ServerId, _ = this.GetInt("server_id") + task.CronSpec = strings.TrimSpace(this.GetString("cron_spec")) + task.Command = strings.TrimSpace(this.GetString("command")) + task.Timeout, _ = this.GetInt("timeout") + if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { + this.ajaxMsg("请填写完整信息", MSG_ERR) + } + if _, err := crons.Parse(task.CronSpec); err != nil { + this.ajaxMsg("cron表达式无效", MSG_ERR) + } + if err := task.Update(); err != nil { + this.ajaxMsg(err.Error(), MSG_ERR) + } + + this.ajaxMsg("", MSG_OK) + } + + // 分组列表 + groups, _ := models.TaskGroupGetList(1, 100) + this.Data["groups"] = groups + //服务器分组 + servers, _ := models.TaskServerGetList(1, 100) + this.Data["servers"] = servers + + this.Data["task"] = task + this.Data["pageTitle"] = "编辑任务" + this.display() +} + +//复制任务 +func (this *TaskController) Copy() { + + id, _ := this.GetInt("id") + task, err := models.TaskGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + // 分组列表 + groups, _ := models.TaskGroupGetList(1, 100) + this.Data["groups"] = groups + //服务器分组 + servers, _ := models.TaskServerGetList(1, 100) + this.Data["servers"] = servers + + this.Data["task"] = task + this.Data["pageTitle"] = "复制任务" + this.display() +} + +// 任务执行日志列表 +func (this *TaskController) Logs() { + taskId, _ := this.GetInt("id") + page, _ := this.GetInt("page") + if page < 1 { + page = 1 + } + + task, err := models.TaskGetById(taskId) + if err != nil { + this.showMsg(err.Error()) + } + + result, count := models.TaskLogGetList(page, this.pageSize, "task_id", task.Id) + + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["process_time"] = float64(v.ProcessTime) / 1000 + row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) + row["status"] = v.Status + list[k] = row + } + + this.Data["pageTitle"] = "任务执行日志" + this.Data["list"] = list + this.Data["task"] = task + this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("TaskController.Logs", "id", taskId), true).ToString() + this.display() +} + +// 查看日志详情 +func (this *TaskController) ViewLog() { + id, _ := this.GetInt("id") + + taskLog, err := models.TaskLogGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + task, err := models.TaskGetById(taskLog.TaskId) + if err != nil { + this.showMsg(err.Error()) + } + + data := make(map[string]interface{}) + data["id"] = taskLog.Id + data["output"] = taskLog.Output + data["error"] = taskLog.Error + data["start_time"] = beego.Date(time.Unix(taskLog.CreateTime, 0), "Y-m-d H:i:s") + data["process_time"] = float64(taskLog.ProcessTime) / 1000 + data["ouput_size"] = libs.SizeFormat(float64(len(taskLog.Output))) + data["status"] = taskLog.Status + + this.Data["task"] = task + this.Data["data"] = data + this.Data["pageTitle"] = "查看日志" + this.display() +} + +// 批量操作日志 +func (this *TaskController) LogBatch() { + action := this.GetString("action") + ids := this.GetStrings("ids") + if len(ids) < 1 { + this.ajaxMsg("请选择要操作的项目", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + switch action { + case "delete": + models.TaskLogDelById(id) + } + } + + this.ajaxMsg("", MSG_OK) +} + +// 批量操作 +func (this *TaskController) Batch() { + action := this.GetString("action") + ids := this.GetStrings("ids") + if len(ids) < 1 { + this.ajaxMsg("请选择要操作的项目", MSG_ERR) + } + + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + switch action { + case "active": + if task, err := models.TaskGetById(id); err == nil { + job, err := jobs.NewJobFromTask(task) + if err == nil { + jobs.AddJob(task.CronSpec, job) + task.Status = 1 + task.Update() + } + } + case "pause": + jobs.RemoveJob(id) + + if task, err := models.TaskGetById(id); err == nil { + task.Status = 0 + task.Update() + } + + case "delete": + models.TaskDel(id) + models.TaskLogDelByTaskId(id) + jobs.RemoveJob(id) + } + } + + this.ajaxMsg("", MSG_OK) +} + +// 启动任务 +func (this *TaskController) Start() { + id, _ := this.GetInt("id") + + task, err := models.TaskGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + job, err := jobs.NewJobFromTask(task) + if err != nil { + this.showMsg(err.Error()) + } + + if jobs.AddJob(task.CronSpec, job) { + task.Status = 1 + task.Update() + } + + refer := this.Ctx.Request.Referer() + if refer == "" { + refer = beego.URLFor("TaskController.List") + } + this.redirect(refer) +} + +// 暂停任务 +func (this *TaskController) Pause() { + id, _ := this.GetInt("id") + + task, err := models.TaskGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + jobs.RemoveJob(id) + task.Status = 0 + task.Update() + + refer := this.Ctx.Request.Referer() + if refer == "" { + refer = beego.URLFor("TaskController.List") + } + this.redirect(refer) +} + +// 立即执行 +func (this *TaskController) Run() { + id, _ := this.GetInt("id") + + task, err := models.TaskGetById(id) + if err != nil { + this.showMsg(err.Error()) + } + + job, err := jobs.NewJobFromTask(task) + if err != nil { + this.showMsg(err.Error()) + } + job.Run() + this.redirect(beego.URLFor("TaskController.ViewLog", "id", job.GetLogId())) +} diff --git a/V1/crons/LICENSE b/V1/crons/LICENSE new file mode 100644 index 0000000..3a0f627 --- /dev/null +++ b/V1/crons/LICENSE @@ -0,0 +1,21 @@ +Copyright (C) 2012 Rob Figueiredo +All Rights Reserved. + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/V1/crons/README.md b/V1/crons/README.md new file mode 100644 index 0000000..157ed08 --- /dev/null +++ b/V1/crons/README.md @@ -0,0 +1,2 @@ +[![GoDoc](http://godoc.org/github.com/robfig/cron?status.png)](http://godoc.org/github.com/robfig/cron) +[![Build Status](https://travis-ci.org/robfig/cron.svg?branch=master)](https://travis-ci.org/robfig/cron) diff --git a/V1/crons/constantdelay.go b/V1/crons/constantdelay.go new file mode 100644 index 0000000..cd6e7b1 --- /dev/null +++ b/V1/crons/constantdelay.go @@ -0,0 +1,27 @@ +package cron + +import "time" + +// ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes". +// It does not support jobs more frequent than once a second. +type ConstantDelaySchedule struct { + Delay time.Duration +} + +// Every returns a crontab Schedule that activates once every duration. +// Delays of less than a second are not supported (will round up to 1 second). +// Any fields less than a Second are truncated. +func Every(duration time.Duration) ConstantDelaySchedule { + if duration < time.Second { + duration = time.Second + } + return ConstantDelaySchedule{ + Delay: duration - time.Duration(duration.Nanoseconds())%time.Second, + } +} + +// Next returns the next time this should be run. +// This rounds so that the next activation time will be on the second. +func (schedule ConstantDelaySchedule) Next(t time.Time) time.Time { + return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond) +} diff --git a/V1/crons/constantdelay_test.go b/V1/crons/constantdelay_test.go new file mode 100644 index 0000000..f43a58a --- /dev/null +++ b/V1/crons/constantdelay_test.go @@ -0,0 +1,54 @@ +package cron + +import ( + "testing" + "time" +) + +func TestConstantDelayNext(t *testing.T) { + tests := []struct { + time string + delay time.Duration + expected string + }{ + // Simple cases + {"Mon Jul 9 14:45 2012", 15*time.Minute + 50*time.Nanosecond, "Mon Jul 9 15:00 2012"}, + {"Mon Jul 9 14:59 2012", 15 * time.Minute, "Mon Jul 9 15:14 2012"}, + {"Mon Jul 9 14:59:59 2012", 15 * time.Minute, "Mon Jul 9 15:14:59 2012"}, + + // Wrap around hours + {"Mon Jul 9 15:45 2012", 35 * time.Minute, "Mon Jul 9 16:20 2012"}, + + // Wrap around days + {"Mon Jul 9 23:46 2012", 14 * time.Minute, "Tue Jul 10 00:00 2012"}, + {"Mon Jul 9 23:45 2012", 35 * time.Minute, "Tue Jul 10 00:20 2012"}, + {"Mon Jul 9 23:35:51 2012", 44*time.Minute + 24*time.Second, "Tue Jul 10 00:20:15 2012"}, + {"Mon Jul 9 23:35:51 2012", 25*time.Hour + 44*time.Minute + 24*time.Second, "Thu Jul 11 01:20:15 2012"}, + + // Wrap around months + {"Mon Jul 9 23:35 2012", 91*24*time.Hour + 25*time.Minute, "Thu Oct 9 00:00 2012"}, + + // Wrap around minute, hour, day, month, and year + {"Mon Dec 31 23:59:45 2012", 15 * time.Second, "Tue Jan 1 00:00:00 2013"}, + + // Round to nearest second on the delay + {"Mon Jul 9 14:45 2012", 15*time.Minute + 50*time.Nanosecond, "Mon Jul 9 15:00 2012"}, + + // Round up to 1 second if the duration is less. + {"Mon Jul 9 14:45:00 2012", 15 * time.Millisecond, "Mon Jul 9 14:45:01 2012"}, + + // Round to nearest second when calculating the next time. + {"Mon Jul 9 14:45:00.005 2012", 15 * time.Minute, "Mon Jul 9 15:00 2012"}, + + // Round to nearest second for both. + {"Mon Jul 9 14:45:00.005 2012", 15*time.Minute + 50*time.Nanosecond, "Mon Jul 9 15:00 2012"}, + } + + for _, c := range tests { + actual := Every(c.delay).Next(getTime(c.time)) + expected := getTime(c.expected) + if actual != expected { + t.Errorf("%s, \"%s\": (expected) %v != %v (actual)", c.time, c.delay, expected, actual) + } + } +} diff --git a/V1/crons/cron.go b/V1/crons/cron.go new file mode 100644 index 0000000..c5cb065 --- /dev/null +++ b/V1/crons/cron.go @@ -0,0 +1,222 @@ +// This library implements a cron spec parser and runner. See the README for +// more details. +package cron + +import ( + "sort" + "time" +) + +// 删除job的检查函数,返回true则删除 +type RemoveCheckFunc func(e *Entry) bool + +// Cron keeps track of any number of entries, invoking the associated func as +// specified by the schedule. It may be started, stopped, and the entries may +// be inspected while running. +// Cron保持任意数量的条目的轨道,调用相关的func时间表指定。它可以被启动,停止和条目,可运行的同时进行检查。 +type Cron struct { + entries []*Entry //任务 + stop chan struct{} //停止的通道 + add chan *Entry //添加新任务的方式 + remove chan RemoveCheckFunc + snapshot chan []*Entry //请求获取任务快照的方式 + running bool +} + +// Job is an interface for submitted cron jobs. +type Job interface { + Run() +} + +// The Schedule describes a job's duty cycle. +type Schedule interface { + // Return the next activation time, later than the given time. + // Next is invoked initially, and then each time the job is run. + Next(time.Time) time.Time +} + +// Entry consists of a schedule and the func to execute on that schedule. +type Entry struct { + // The schedule on which this job should be run. + Schedule Schedule + + // The next time the job will run. This is the zero time if Cron has not been + // started or this entry's schedule is unsatisfiable + Next time.Time + + // The last time this job was run. This is the zero time if the job has never + // been run. + Prev time.Time + + // The Job to run. + Job Job +} + +// byTime is a wrapper for sorting the entry array by time +// (with zero time at the end). +type byTime []*Entry + +func (s byTime) Len() int { return len(s) } +func (s byTime) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s byTime) Less(i, j int) bool { + // Two zero times should return false. + // Otherwise, zero is "greater" than any other time. + // (To sort it at the end of the list.) + if s[i].Next.IsZero() { + return false + } + if s[j].Next.IsZero() { + return true + } + return s[i].Next.Before(s[j].Next) +} + +// New returns a new Cron job runner. +func New() *Cron { + return &Cron{ + entries: nil, + add: make(chan *Entry), + remove: make(chan RemoveCheckFunc), + stop: make(chan struct{}), + snapshot: make(chan []*Entry), + running: false, + } +} + +// A wrapper that turns a func() into a cron.Job +type FuncJob func() + +func (f FuncJob) Run() { f() } + +// AddFunc adds a func to the Cron to be run on the given schedule. +func (c *Cron) AddFunc(spec string, cmd func()) error { + return c.AddJob(spec, FuncJob(cmd)) +} + +// AddFunc adds a Job to the Cron to be run on the given schedule. +func (c *Cron) AddJob(spec string, cmd Job) error { + schedule, err := Parse(spec) + if err != nil { + return err + } + c.Schedule(schedule, cmd) + return nil +} + +func (c *Cron) RemoveJob(cb RemoveCheckFunc) { + c.remove <- cb +} + +// Schedule adds a Job to the Cron to be run on the given schedule. +func (c *Cron) Schedule(schedule Schedule, cmd Job) { + entry := &Entry{ + Schedule: schedule, + Job: cmd, + } + if !c.running { + c.entries = append(c.entries, entry) + return + } + + c.add <- entry +} + +// Entries returns a snapshot of the cron entries. +func (c *Cron) Entries() []*Entry { + if c.running { + c.snapshot <- nil + x := <-c.snapshot + return x + } + return c.entrySnapshot() +} + +// Start the cron scheduler in its own go-routine. +func (c *Cron) Start() { + c.running = true + + go c.run() +} + +// Run the scheduler.. this is private just due to the need to synchronize +// access to the 'running' state variable. +func (c *Cron) run() { + // Figure out the next activation times for each entry. + now := time.Now().Local() + for _, entry := range c.entries { + entry.Next = entry.Schedule.Next(now) + } + + for { + // Determine the next entry to run. + sort.Sort(byTime(c.entries)) + + var effective time.Time + if len(c.entries) == 0 || c.entries[0].Next.IsZero() { + // If there are no entries yet, just sleep - it still handles new entries + // and stop requests. + effective = now.AddDate(10, 0, 0) + } else { + effective = c.entries[0].Next + } + + select { + case now = <-time.After(effective.Sub(now)): + // Run every entry whose next time was this effective time. + for _, e := range c.entries { + if e.Next != effective { + break + } + go e.Job.Run() + e.Prev = e.Next + e.Next = e.Schedule.Next(effective) + } + continue + + case newEntry := <-c.add: + c.entries = append(c.entries, newEntry) + newEntry.Next = newEntry.Schedule.Next(now) + + case cb := <-c.remove: + newEntries := make([]*Entry, 0) + for _, e := range c.entries { + if !cb(e) { + newEntries = append(newEntries, e) + } + } + c.entries = newEntries + + case <-c.snapshot: + c.snapshot <- c.entrySnapshot() + + case <-c.stop: + return + } + + // 'now' should be updated after newEntry and snapshot cases. + now = time.Now().Local() + } +} + +// Stop stops the cron scheduler if it is running; otherwise it does nothing. +func (c *Cron) Stop() { + if !c.running { + return + } + c.stop <- struct{}{} + c.running = false +} + +// entrySnapshot returns a copy of the current cron entry list. +func (c *Cron) entrySnapshot() []*Entry { + entries := []*Entry{} + for _, e := range c.entries { + entries = append(entries, &Entry{ + Schedule: e.Schedule, + Next: e.Next, + Prev: e.Prev, + Job: e.Job, + }) + } + return entries +} diff --git a/V1/crons/cron_test.go b/V1/crons/cron_test.go new file mode 100644 index 0000000..78ac3cd --- /dev/null +++ b/V1/crons/cron_test.go @@ -0,0 +1,262 @@ +package cron + +import ( + "fmt" + "sync" + "testing" + "time" +) + +// Many tests schedule a job for every second, and then wait at most a second +// for it to run. This amount is just slightly larger than 1 second to +// compensate for a few milliseconds of runtime. +const ONE_SECOND = 1*time.Second + 10*time.Millisecond + +// Start and stop cron with no entries. +func TestNoEntries(t *testing.T) { + cron := New() + cron.Start() + + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-stop(cron): + } +} + +// Start, stop, then add an entry. Verify entry doesn't run. +func TestStopCausesJobsToNotRun(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + cron := New() + cron.Start() + cron.Stop() + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + + select { + case <-time.After(ONE_SECOND): + // No job ran! + case <-wait(wg): + t.FailNow() + } +} + +// Add a job, start cron, expect it runs. +func TestAddBeforeRunning(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + cron := New() + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + cron.Start() + defer cron.Stop() + + // Give cron 2 seconds to run our job (which is always activated). + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +// Start cron, add a job, expect it runs. +func TestAddWhileRunning(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + cron := New() + cron.Start() + defer cron.Stop() + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +// Test timing with Entries. +func TestSnapshotEntries(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + cron := New() + cron.AddFunc("@every 2s", func() { wg.Done() }) + cron.Start() + defer cron.Stop() + + // Cron should fire in 2 seconds. After 1 second, call Entries. + select { + case <-time.After(ONE_SECOND): + cron.Entries() + } + + // Even though Entries was called, the cron should fire at the 2 second mark. + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } + +} + +// Test that the entries are correctly sorted. +// Add a bunch of long-in-the-future entries, and an immediate entry, and ensure +// that the immediate entry runs immediately. +// Also: Test that multiple jobs run in the same instant. +func TestMultipleEntries(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(2) + + cron := New() + cron.AddFunc("0 0 0 1 1 ?", func() {}) + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + cron.AddFunc("0 0 0 31 12 ?", func() {}) + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + + cron.Start() + defer cron.Stop() + + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +// Test running the same job twice. +func TestRunningJobTwice(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(2) + + cron := New() + cron.AddFunc("0 0 0 1 1 ?", func() {}) + cron.AddFunc("0 0 0 31 12 ?", func() {}) + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + + cron.Start() + defer cron.Stop() + + select { + case <-time.After(2 * ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +func TestRunningMultipleSchedules(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(2) + + cron := New() + cron.AddFunc("0 0 0 1 1 ?", func() {}) + cron.AddFunc("0 0 0 31 12 ?", func() {}) + cron.AddFunc("* * * * * ?", func() { wg.Done() }) + cron.Schedule(Every(time.Minute), FuncJob(func() {})) + cron.Schedule(Every(time.Second), FuncJob(func() { wg.Done() })) + cron.Schedule(Every(time.Hour), FuncJob(func() {})) + + cron.Start() + defer cron.Stop() + + select { + case <-time.After(2 * ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +// Test that the cron is run in the local time zone (as opposed to UTC). +func TestLocalTimezone(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + now := time.Now().Local() + spec := fmt.Sprintf("%d %d %d %d %d ?", + now.Second()+1, now.Minute(), now.Hour(), now.Day(), now.Month()) + + cron := New() + cron.AddFunc(spec, func() { wg.Done() }) + cron.Start() + defer cron.Stop() + + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } +} + +// Test that calling stop before start silently returns without +// blocking the stop channel. +func TestStopWithoutStart(t *testing.T) { + cron := New() + cron.Stop() +} + +type testJob struct { + wg *sync.WaitGroup + name string +} + +func (t testJob) Run() { + t.wg.Done() +} + +// Simple test using Runnables. +func TestJob(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(1) + + cron := New() + cron.AddJob("0 0 0 30 Feb ?", testJob{wg, "job0"}) + cron.AddJob("0 0 0 1 1 ?", testJob{wg, "job1"}) + cron.AddJob("* * * * * ?", testJob{wg, "job2"}) + cron.AddJob("1 0 0 1 1 ?", testJob{wg, "job3"}) + cron.Schedule(Every(5*time.Second+5*time.Nanosecond), testJob{wg, "job4"}) + cron.Schedule(Every(5*time.Minute), testJob{wg, "job5"}) + + cron.Start() + defer cron.Stop() + + select { + case <-time.After(ONE_SECOND): + t.FailNow() + case <-wait(wg): + } + + // Ensure the entries are in the right order. + expecteds := []string{"job2", "job4", "job5", "job1", "job3", "job0"} + + var actuals []string + for _, entry := range cron.Entries() { + actuals = append(actuals, entry.Job.(testJob).name) + } + + for i, expected := range expecteds { + if actuals[i] != expected { + t.Errorf("Jobs not in the right order. (expected) %s != %s (actual)", expecteds, actuals) + t.FailNow() + } + } +} + +func wait(wg *sync.WaitGroup) chan bool { + ch := make(chan bool) + go func() { + wg.Wait() + ch <- true + }() + return ch +} + +func stop(cron *Cron) chan bool { + ch := make(chan bool) + go func() { + cron.Stop() + ch <- true + }() + return ch +} diff --git a/V1/crons/doc.go b/V1/crons/doc.go new file mode 100644 index 0000000..dbdf501 --- /dev/null +++ b/V1/crons/doc.go @@ -0,0 +1,129 @@ +/* +Package cron implements a cron spec parser and job runner. + +Usage + +Callers may register Funcs to be invoked on a given schedule. Cron will run +them in their own goroutines. + + c := cron.New() + c.AddFunc("0 30 * * * *", func() { fmt.Println("Every hour on the half hour") }) + c.AddFunc("@hourly", func() { fmt.Println("Every hour") }) + c.AddFunc("@every 1h30m", func() { fmt.Println("Every hour thirty") }) + c.Start() + .. + // Funcs are invoked in their own goroutine, asynchronously. + ... + // Funcs may also be added to a running Cron + c.AddFunc("@daily", func() { fmt.Println("Every day") }) + .. + // Inspect the cron job entries' next and previous run times. + inspect(c.Entries()) + .. + c.Stop() // Stop the scheduler (does not stop any jobs already running). + +CRON Expression Format + +A cron expression represents a set of times, using 6 space-separated fields. + + Field name | Mandatory? | Allowed values | Allowed special characters + ---------- | ---------- | -------------- | -------------------------- + Seconds | Yes | 0-59 | * / , - + Minutes | Yes | 0-59 | * / , - + Hours | Yes | 0-23 | * / , - + Day of month | Yes | 1-31 | * / , - ? + Month | Yes | 1-12 or JAN-DEC | * / , - + Day of week | Yes | 0-6 or SUN-SAT | * / , - ? + +Note: Month and Day-of-week field values are case insensitive. "SUN", "Sun", +and "sun" are equally accepted. + +Special Characters + +Asterisk ( * ) + +The asterisk indicates that the cron expression will match for all values of the +field; e.g., using an asterisk in the 5th field (month) would indicate every +month. + +Slash ( / ) + +Slashes are used to describe increments of ranges. For example 3-59/15 in the +1st field (minutes) would indicate the 3rd minute of the hour and every 15 +minutes thereafter. The form "*\/..." is equivalent to the form "first-last/...", +that is, an increment over the largest possible range of the field. The form +"N/..." is accepted as meaning "N-MAX/...", that is, starting at N, use the +increment until the end of that specific range. It does not wrap around. + +Comma ( , ) + +Commas are used to separate items of a list. For example, using "MON,WED,FRI" in +the 5th field (day of week) would mean Mondays, Wednesdays and Fridays. + +Hyphen ( - ) + +Hyphens are used to define ranges. For example, 9-17 would indicate every +hour between 9am and 5pm inclusive. + +Question mark ( ? ) + +Question mark may be used instead of '*' for leaving either day-of-month or +day-of-week blank. + +Predefined schedules + +You may use one of several pre-defined schedules in place of a cron expression. + + Entry | Description | Equivalent To + ----- | ----------- | ------------- + @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 * + @monthly | Run once a month, midnight, first of month | 0 0 0 1 * * + @weekly | Run once a week, midnight on Sunday | 0 0 0 * * 0 + @daily (or @midnight) | Run once a day, midnight | 0 0 0 * * * + @hourly | Run once an hour, beginning of hour | 0 0 * * * * + +Intervals + +You may also schedule a job to execute at fixed intervals. This is supported by +formatting the cron spec like this: + + @every + +where "duration" is a string accepted by time.ParseDuration +(http://golang.org/pkg/time/#ParseDuration). + +For example, "@every 1h30m10s" would indicate a schedule that activates every +1 hour, 30 minutes, 10 seconds. + +Note: The interval does not take the job runtime into account. For example, +if a job takes 3 minutes to run, and it is scheduled to run every 5 minutes, +it will have only 2 minutes of idle time between each run. + +Time zones + +All interpretation and scheduling is done in the machine's local time zone (as +provided by the Go time package (http://www.golang.org/pkg/time). + +Be aware that jobs scheduled during daylight-savings leap-ahead transitions will +not be run! + +Thread safety + +Since the Cron service runs concurrently with the calling code, some amount of +care must be taken to ensure proper synchronization. + +All cron methods are designed to be correctly synchronized as long as the caller +ensures that invocations have a clear happens-before ordering between them. + +Implementation + +Cron entries are stored in an array, sorted by their next activation time. Cron +sleeps until the next job is due to be run. + +Upon waking: + - it runs each entry that is active on that second + - it calculates the next run times for the jobs that were run + - it re-sorts the array of entries by next activation time. + - it goes to sleep until the soonest job. +*/ +package cron diff --git a/V1/crons/parser.go b/V1/crons/parser.go new file mode 100644 index 0000000..4224fa9 --- /dev/null +++ b/V1/crons/parser.go @@ -0,0 +1,231 @@ +package cron + +import ( + "fmt" + "log" + "math" + "strconv" + "strings" + "time" +) + +// Parse returns a new crontab schedule representing the given spec. +// It returns a descriptive error if the spec is not valid. +// +// It accepts +// - Full crontab specs, e.g. "* * * * * ?" +// - Descriptors, e.g. "@midnight", "@every 1h30m" +func Parse(spec string) (_ Schedule, err error) { + // Convert panics into errors + defer func() { + if recovered := recover(); recovered != nil { + err = fmt.Errorf("%v", recovered) + } + }() + + if spec[0] == '@' { + return parseDescriptor(spec), nil + } + + // Split on whitespace. We require 5 or 6 fields. + // (second) (minute) (hour) (day of month) (month) (day of week, optional) + fields := strings.Fields(spec) + if len(fields) != 5 && len(fields) != 6 { + log.Panicf("Expected 5 or 6 fields, found %d: %s", len(fields), spec) + } + + // If a sixth field is not provided (DayOfWeek), then it is equivalent to star. + if len(fields) == 5 { + fields = append(fields, "*") + } + + schedule := &SpecSchedule{ + Second: getField(fields[0], seconds), + Minute: getField(fields[1], minutes), + Hour: getField(fields[2], hours), + Dom: getField(fields[3], dom), + Month: getField(fields[4], months), + Dow: getField(fields[5], dow), + } + + return schedule, nil +} + +// getField returns an Int with the bits set representing all of the times that +// the field represents. A "field" is a comma-separated list of "ranges". +func getField(field string, r bounds) uint64 { + // list = range {"," range} + var bits uint64 + ranges := strings.FieldsFunc(field, func(r rune) bool { return r == ',' }) + for _, expr := range ranges { + bits |= getRange(expr, r) + } + return bits +} + +// getRange returns the bits indicated by the given expression: +// number | number "-" number [ "/" number ] +func getRange(expr string, r bounds) uint64 { + + var ( + start, end, step uint + rangeAndStep = strings.Split(expr, "/") + lowAndHigh = strings.Split(rangeAndStep[0], "-") + singleDigit = len(lowAndHigh) == 1 + ) + + var extra_star uint64 + if lowAndHigh[0] == "*" || lowAndHigh[0] == "?" { + start = r.min + end = r.max + extra_star = starBit + } else { + start = parseIntOrName(lowAndHigh[0], r.names) + switch len(lowAndHigh) { + case 1: + end = start + case 2: + end = parseIntOrName(lowAndHigh[1], r.names) + default: + log.Panicf("Too many hyphens: %s", expr) + } + } + + switch len(rangeAndStep) { + case 1: + step = 1 + case 2: + step = mustParseInt(rangeAndStep[1]) + + // Special handling: "N/step" means "N-max/step". + if singleDigit { + end = r.max + } + default: + log.Panicf("Too many slashes: %s", expr) + } + + if start < r.min { + log.Panicf("Beginning of range (%d) below minimum (%d): %s", start, r.min, expr) + } + if end > r.max { + log.Panicf("End of range (%d) above maximum (%d): %s", end, r.max, expr) + } + if start > end { + log.Panicf("Beginning of range (%d) beyond end of range (%d): %s", start, end, expr) + } + + return getBits(start, end, step) | extra_star +} + +// parseIntOrName returns the (possibly-named) integer contained in expr. +func parseIntOrName(expr string, names map[string]uint) uint { + if names != nil { + if namedInt, ok := names[strings.ToLower(expr)]; ok { + return namedInt + } + } + return mustParseInt(expr) +} + +// mustParseInt parses the given expression as an int or panics. +func mustParseInt(expr string) uint { + num, err := strconv.Atoi(expr) + if err != nil { + log.Panicf("Failed to parse int from %s: %s", expr, err) + } + if num < 0 { + log.Panicf("Negative number (%d) not allowed: %s", num, expr) + } + + return uint(num) +} + +// getBits sets all bits in the range [min, max], modulo the given step size. +func getBits(min, max, step uint) uint64 { + var bits uint64 + + // If step is 1, use shifts. + if step == 1 { + return ^(math.MaxUint64 << (max + 1)) & (math.MaxUint64 << min) + } + + // Else, use a simple loop. + for i := min; i <= max; i += step { + bits |= 1 << i + } + return bits +} + +// all returns all bits within the given bounds. (plus the star bit) +func all(r bounds) uint64 { + return getBits(r.min, r.max, 1) | starBit +} + +// parseDescriptor returns a pre-defined schedule for the expression, or panics +// if none matches. +func parseDescriptor(spec string) Schedule { + switch spec { + case "@yearly", "@annually": + return &SpecSchedule{ + Second: 1 << seconds.min, + Minute: 1 << minutes.min, + Hour: 1 << hours.min, + Dom: 1 << dom.min, + Month: 1 << months.min, + Dow: all(dow), + } + + case "@monthly": + return &SpecSchedule{ + Second: 1 << seconds.min, + Minute: 1 << minutes.min, + Hour: 1 << hours.min, + Dom: 1 << dom.min, + Month: all(months), + Dow: all(dow), + } + + case "@weekly": + return &SpecSchedule{ + Second: 1 << seconds.min, + Minute: 1 << minutes.min, + Hour: 1 << hours.min, + Dom: all(dom), + Month: all(months), + Dow: 1 << dow.min, + } + + case "@daily", "@midnight": + return &SpecSchedule{ + Second: 1 << seconds.min, + Minute: 1 << minutes.min, + Hour: 1 << hours.min, + Dom: all(dom), + Month: all(months), + Dow: all(dow), + } + + case "@hourly": + return &SpecSchedule{ + Second: 1 << seconds.min, + Minute: 1 << minutes.min, + Hour: all(hours), + Dom: all(dom), + Month: all(months), + Dow: all(dow), + } + } + + const every = "@every " + if strings.HasPrefix(spec, every) { + duration, err := time.ParseDuration(spec[len(every):]) + if err != nil { + log.Panicf("Failed to parse duration %s: %s", spec, err) + } + return Every(duration) + } + + log.Panicf("Unrecognized descriptor: %s", spec) + return nil +} diff --git a/V1/crons/parser_test.go b/V1/crons/parser_test.go new file mode 100644 index 0000000..9050cf7 --- /dev/null +++ b/V1/crons/parser_test.go @@ -0,0 +1,117 @@ +package cron + +import ( + "reflect" + "testing" + "time" +) + +func TestRange(t *testing.T) { + ranges := []struct { + expr string + min, max uint + expected uint64 + }{ + {"5", 0, 7, 1 << 5}, + {"0", 0, 7, 1 << 0}, + {"7", 0, 7, 1 << 7}, + + {"5-5", 0, 7, 1 << 5}, + {"5-6", 0, 7, 1<<5 | 1<<6}, + {"5-7", 0, 7, 1<<5 | 1<<6 | 1<<7}, + + {"5-6/2", 0, 7, 1 << 5}, + {"5-7/2", 0, 7, 1<<5 | 1<<7}, + {"5-7/1", 0, 7, 1<<5 | 1<<6 | 1<<7}, + + {"*", 1, 3, 1<<1 | 1<<2 | 1<<3 | starBit}, + {"*/2", 1, 3, 1<<1 | 1<<3 | starBit}, + } + + for _, c := range ranges { + actual := getRange(c.expr, bounds{c.min, c.max, nil}) + if actual != c.expected { + t.Errorf("%s => (expected) %d != %d (actual)", c.expr, c.expected, actual) + } + } +} + +func TestField(t *testing.T) { + fields := []struct { + expr string + min, max uint + expected uint64 + }{ + {"5", 1, 7, 1 << 5}, + {"5,6", 1, 7, 1<<5 | 1<<6}, + {"5,6,7", 1, 7, 1<<5 | 1<<6 | 1<<7}, + {"1,5-7/2,3", 1, 7, 1<<1 | 1<<5 | 1<<7 | 1<<3}, + } + + for _, c := range fields { + actual := getField(c.expr, bounds{c.min, c.max, nil}) + if actual != c.expected { + t.Errorf("%s => (expected) %d != %d (actual)", c.expr, c.expected, actual) + } + } +} + +func TestBits(t *testing.T) { + allBits := []struct { + r bounds + expected uint64 + }{ + {minutes, 0xfffffffffffffff}, // 0-59: 60 ones + {hours, 0xffffff}, // 0-23: 24 ones + {dom, 0xfffffffe}, // 1-31: 31 ones, 1 zero + {months, 0x1ffe}, // 1-12: 12 ones, 1 zero + {dow, 0x7f}, // 0-6: 7 ones + } + + for _, c := range allBits { + actual := all(c.r) // all() adds the starBit, so compensate for that.. + if c.expected|starBit != actual { + t.Errorf("%d-%d/%d => (expected) %b != %b (actual)", + c.r.min, c.r.max, 1, c.expected|starBit, actual) + } + } + + bits := []struct { + min, max, step uint + expected uint64 + }{ + + {0, 0, 1, 0x1}, + {1, 1, 1, 0x2}, + {1, 5, 2, 0x2a}, // 101010 + {1, 4, 2, 0xa}, // 1010 + } + + for _, c := range bits { + actual := getBits(c.min, c.max, c.step) + if c.expected != actual { + t.Errorf("%d-%d/%d => (expected) %b != %b (actual)", + c.min, c.max, c.step, c.expected, actual) + } + } +} + +func TestSpecSchedule(t *testing.T) { + entries := []struct { + expr string + expected Schedule + }{ + {"* 5 * * * *", &SpecSchedule{all(seconds), 1 << 5, all(hours), all(dom), all(months), all(dow)}}, + {"@every 5m", ConstantDelaySchedule{time.Duration(5) * time.Minute}}, + } + + for _, c := range entries { + actual, err := Parse(c.expr) + if err != nil { + t.Error(err) + } + if !reflect.DeepEqual(actual, c.expected) { + t.Errorf("%s => (expected) %b != %b (actual)", c.expr, c.expected, actual) + } + } +} diff --git a/V1/crons/spec.go b/V1/crons/spec.go new file mode 100644 index 0000000..afa5ac8 --- /dev/null +++ b/V1/crons/spec.go @@ -0,0 +1,159 @@ +package cron + +import "time" + +// SpecSchedule specifies a duty cycle (to the second granularity), based on a +// traditional crontab specification. It is computed initially and stored as bit sets. +type SpecSchedule struct { + Second, Minute, Hour, Dom, Month, Dow uint64 +} + +// bounds provides a range of acceptable values (plus a map of name to value). +type bounds struct { + min, max uint + names map[string]uint +} + +// The bounds for each field. +var ( + seconds = bounds{0, 59, nil} + minutes = bounds{0, 59, nil} + hours = bounds{0, 23, nil} + dom = bounds{1, 31, nil} + months = bounds{1, 12, map[string]uint{ + "jan": 1, + "feb": 2, + "mar": 3, + "apr": 4, + "may": 5, + "jun": 6, + "jul": 7, + "aug": 8, + "sep": 9, + "oct": 10, + "nov": 11, + "dec": 12, + }} + dow = bounds{0, 6, map[string]uint{ + "sun": 0, + "mon": 1, + "tue": 2, + "wed": 3, + "thu": 4, + "fri": 5, + "sat": 6, + }} +) + +const ( + // Set the top bit if a star was included in the expression. + starBit = 1 << 63 +) + +// Next returns the next time this schedule is activated, greater than the given +// time. If no time can be found to satisfy the schedule, return the zero time. +func (s *SpecSchedule) Next(t time.Time) time.Time { + // General approach: + // For Month, Day, Hour, Minute, Second: + // Check if the time value matches. If yes, continue to the next field. + // If the field doesn't match the schedule, then increment the field until it matches. + // While incrementing the field, a wrap-around brings it back to the beginning + // of the field list (since it is necessary to re-verify previous field + // values) + + // Start at the earliest possible time (the upcoming second). + t = t.Add(1*time.Second - time.Duration(t.Nanosecond())*time.Nanosecond) + + // This flag indicates whether a field has been incremented. + added := false + + // If no time is found within five years, return zero. + yearLimit := t.Year() + 5 + +WRAP: + if t.Year() > yearLimit { + return time.Time{} + } + + // Find the first applicable month. + // If it's this month, then do nothing. + for 1< 0 + dowMatch bool = 1< 0 + ) + + if s.Dom&starBit > 0 || s.Dow&starBit > 0 { + return domMatch && dowMatch + } + return domMatch || dowMatch +} diff --git a/V1/crons/spec_test.go b/V1/crons/spec_test.go new file mode 100644 index 0000000..41540bc --- /dev/null +++ b/V1/crons/spec_test.go @@ -0,0 +1,204 @@ +package cron + +import ( + "testing" + "time" +) + +func TestActivation(t *testing.T) { + tests := []struct { + time, spec string + expected bool + }{ + // Every fifteen minutes. + {"Mon Jul 9 15:00 2012", "0 0/15 * * *", true}, + {"Mon Jul 9 15:45 2012", "0 0/15 * * *", true}, + {"Mon Jul 9 15:40 2012", "0 0/15 * * *", false}, + + // Every fifteen minutes, starting at 5 minutes. + {"Mon Jul 9 15:05 2012", "0 5/15 * * *", true}, + {"Mon Jul 9 15:20 2012", "0 5/15 * * *", true}, + {"Mon Jul 9 15:50 2012", "0 5/15 * * *", true}, + + // Named months + {"Sun Jul 15 15:00 2012", "0 0/15 * * Jul", true}, + {"Sun Jul 15 15:00 2012", "0 0/15 * * Jun", false}, + + // Everything set. + {"Sun Jul 15 08:30 2012", "0 30 08 ? Jul Sun", true}, + {"Sun Jul 15 08:30 2012", "0 30 08 15 Jul ?", true}, + {"Mon Jul 16 08:30 2012", "0 30 08 ? Jul Sun", false}, + {"Mon Jul 16 08:30 2012", "0 30 08 15 Jul ?", false}, + + // Predefined schedules + {"Mon Jul 9 15:00 2012", "@hourly", true}, + {"Mon Jul 9 15:04 2012", "@hourly", false}, + {"Mon Jul 9 15:00 2012", "@daily", false}, + {"Mon Jul 9 00:00 2012", "@daily", true}, + {"Mon Jul 9 00:00 2012", "@weekly", false}, + {"Sun Jul 8 00:00 2012", "@weekly", true}, + {"Sun Jul 8 01:00 2012", "@weekly", false}, + {"Sun Jul 8 00:00 2012", "@monthly", false}, + {"Sun Jul 1 00:00 2012", "@monthly", true}, + + // Test interaction of DOW and DOM. + // If both are specified, then only one needs to match. + {"Sun Jul 15 00:00 2012", "0 * * 1,15 * Sun", true}, + {"Fri Jun 15 00:00 2012", "0 * * 1,15 * Sun", true}, + {"Wed Aug 1 00:00 2012", "0 * * 1,15 * Sun", true}, + + // However, if one has a star, then both need to match. + {"Sun Jul 15 00:00 2012", "0 * * * * Mon", false}, + {"Sun Jul 15 00:00 2012", "0 * * */10 * Sun", false}, + {"Mon Jul 9 00:00 2012", "0 * * 1,15 * *", false}, + {"Sun Jul 15 00:00 2012", "0 * * 1,15 * *", true}, + {"Sun Jul 15 00:00 2012", "0 * * */2 * Sun", true}, + } + + for _, test := range tests { + sched, err := Parse(test.spec) + if err != nil { + t.Error(err) + continue + } + actual := sched.Next(getTime(test.time).Add(-1 * time.Second)) + expected := getTime(test.time) + if test.expected && expected != actual || !test.expected && expected == actual { + t.Errorf("Fail evaluating %s on %s: (expected) %s != %s (actual)", + test.spec, test.time, expected, actual) + } + } +} + +func TestNext(t *testing.T) { + runs := []struct { + time, spec string + expected string + }{ + // Simple cases + {"Mon Jul 9 14:45 2012", "0 0/15 * * *", "Mon Jul 9 15:00 2012"}, + {"Mon Jul 9 14:59 2012", "0 0/15 * * *", "Mon Jul 9 15:00 2012"}, + {"Mon Jul 9 14:59:59 2012", "0 0/15 * * *", "Mon Jul 9 15:00 2012"}, + + // Wrap around hours + {"Mon Jul 9 15:45 2012", "0 20-35/15 * * *", "Mon Jul 9 16:20 2012"}, + + // Wrap around days + {"Mon Jul 9 23:46 2012", "0 */15 * * *", "Tue Jul 10 00:00 2012"}, + {"Mon Jul 9 23:45 2012", "0 20-35/15 * * *", "Tue Jul 10 00:20 2012"}, + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 * * *", "Tue Jul 10 00:20:15 2012"}, + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 1/2 * *", "Tue Jul 10 01:20:15 2012"}, + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 10-12 * *", "Tue Jul 10 10:20:15 2012"}, + + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 1/2 */2 * *", "Thu Jul 11 01:20:15 2012"}, + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 * 9-20 * *", "Wed Jul 10 00:20:15 2012"}, + {"Mon Jul 9 23:35:51 2012", "15/35 20-35/15 * 9-20 Jul *", "Wed Jul 10 00:20:15 2012"}, + + // Wrap around months + {"Mon Jul 9 23:35 2012", "0 0 0 9 Apr-Oct ?", "Thu Aug 9 00:00 2012"}, + {"Mon Jul 9 23:35 2012", "0 0 0 */5 Apr,Aug,Oct Mon", "Mon Aug 6 00:00 2012"}, + {"Mon Jul 9 23:35 2012", "0 0 0 */5 Oct Mon", "Mon Oct 1 00:00 2012"}, + + // Wrap around years + {"Mon Jul 9 23:35 2012", "0 0 0 * Feb Mon", "Mon Feb 4 00:00 2013"}, + {"Mon Jul 9 23:35 2012", "0 0 0 * Feb Mon/2", "Fri Feb 1 00:00 2013"}, + + // Wrap around minute, hour, day, month, and year + {"Mon Dec 31 23:59:45 2012", "0 * * * * *", "Tue Jan 1 00:00:00 2013"}, + + // Leap year + {"Mon Jul 9 23:35 2012", "0 0 0 29 Feb ?", "Mon Feb 29 00:00 2016"}, + + // Daylight savings time 2am EST (-5) -> 3am EDT (-4) + {"2012-03-11T00:00:00-0500", "0 30 2 11 Mar ?", "2013-03-11T02:30:00-0400"}, + + // hourly job + {"2012-03-11T00:00:00-0500", "0 0 * * * ?", "2012-03-11T01:00:00-0500"}, + {"2012-03-11T01:00:00-0500", "0 0 * * * ?", "2012-03-11T03:00:00-0400"}, + {"2012-03-11T03:00:00-0400", "0 0 * * * ?", "2012-03-11T04:00:00-0400"}, + {"2012-03-11T04:00:00-0400", "0 0 * * * ?", "2012-03-11T05:00:00-0400"}, + + // 1am nightly job + {"2012-03-11T00:00:00-0500", "0 0 1 * * ?", "2012-03-11T01:00:00-0500"}, + {"2012-03-11T01:00:00-0500", "0 0 1 * * ?", "2012-03-12T01:00:00-0400"}, + + // 2am nightly job (skipped) + {"2012-03-11T00:00:00-0500", "0 0 2 * * ?", "2012-03-12T02:00:00-0400"}, + + // Daylight savings time 2am EDT (-4) => 1am EST (-5) + {"2012-11-04T00:00:00-0400", "0 30 2 04 Nov ?", "2012-11-04T02:30:00-0500"}, + {"2012-11-04T01:45:00-0400", "0 30 1 04 Nov ?", "2012-11-04T01:30:00-0500"}, + + // hourly job + {"2012-11-04T00:00:00-0400", "0 0 * * * ?", "2012-11-04T01:00:00-0400"}, + {"2012-11-04T01:00:00-0400", "0 0 * * * ?", "2012-11-04T01:00:00-0500"}, + {"2012-11-04T01:00:00-0500", "0 0 * * * ?", "2012-11-04T02:00:00-0500"}, + + // 1am nightly job (runs twice) + {"2012-11-04T00:00:00-0400", "0 0 1 * * ?", "2012-11-04T01:00:00-0400"}, + {"2012-11-04T01:00:00-0400", "0 0 1 * * ?", "2012-11-04T01:00:00-0500"}, + {"2012-11-04T01:00:00-0500", "0 0 1 * * ?", "2012-11-05T01:00:00-0500"}, + + // 2am nightly job + {"2012-11-04T00:00:00-0400", "0 0 2 * * ?", "2012-11-04T02:00:00-0500"}, + {"2012-11-04T02:00:00-0500", "0 0 2 * * ?", "2012-11-05T02:00:00-0500"}, + + // 3am nightly job + {"2012-11-04T00:00:00-0400", "0 0 3 * * ?", "2012-11-04T03:00:00-0500"}, + {"2012-11-04T03:00:00-0500", "0 0 3 * * ?", "2012-11-05T03:00:00-0500"}, + + // Unsatisfiable + {"Mon Jul 9 23:35 2012", "0 0 0 30 Feb ?", ""}, + {"Mon Jul 9 23:35 2012", "0 0 0 31 Apr ?", ""}, + } + + for _, c := range runs { + sched, err := Parse(c.spec) + if err != nil { + t.Error(err) + continue + } + actual := sched.Next(getTime(c.time)) + expected := getTime(c.expected) + if !actual.Equal(expected) { + t.Errorf("%s, \"%s\": (expected) %v != %v (actual)", c.time, c.spec, expected, actual) + } + } +} + +func TestErrors(t *testing.T) { + invalidSpecs := []string{ + "xyz", + "60 0 * * *", + "0 60 * * *", + "0 0 * * XYZ", + } + for _, spec := range invalidSpecs { + _, err := Parse(spec) + if err == nil { + t.Error("expected an error parsing: ", spec) + } + } +} + +func getTime(value string) time.Time { + if value == "" { + return time.Time{} + } + t, err := time.Parse("Mon Jan 2 15:04 2006", value) + if err != nil { + t, err = time.Parse("Mon Jan 2 15:04:05 2006", value) + if err != nil { + t, err = time.Parse("2006-01-02T15:04:05-0700", value) + if err != nil { + panic(err) + } + // Daylight savings time tests require location + if ny, err := time.LoadLocation("America/New_York"); err == nil { + t = t.In(ny) + } + } + } + + return t +} diff --git a/info.log b/V1/info.log similarity index 100% rename from info.log rename to V1/info.log diff --git a/V1/jobs/cron.go b/V1/jobs/cron.go new file mode 100644 index 0000000..714a2da --- /dev/null +++ b/V1/jobs/cron.go @@ -0,0 +1,74 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:54:47 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-23 11:04:25 + */ + +package jobs + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/crons" + "sync" +) + +var ( + mainCron *cron.Cron + workPool chan bool + lock sync.Mutex +) + +func init() { + if size, _ := beego.AppConfig.Int("jobs.pool"); size > 0 { + workPool = make(chan bool, size) + } + mainCron = cron.New() + mainCron.Start() +} + +func AddJob(spec string, job *Job) bool { + lock.Lock() + defer lock.Unlock() + + if GetEntryById(job.id) != nil { + return false + } + err := mainCron.AddJob(spec, job) + if err != nil { + beego.Error("AddJob: ", err.Error()) + return false + } + return true +} + +func RemoveJob(id int) { + mainCron.RemoveJob(func(e *cron.Entry) bool { + if v, ok := e.Job.(*Job); ok { + if v.id == id { + return true + } + } + return false + }) +} + +func GetEntryById(id int) *cron.Entry { + entries := mainCron.Entries() + for _, e := range entries { + if v, ok := e.Job.(*Job); ok { + if v.id == id { + return e + } + } + } + return nil +} + +func GetEntries(size int) []*cron.Entry { + ret := mainCron.Entries() + if len(ret) > size { + return ret[:size] + } + return ret +} diff --git a/V1/jobs/init.go b/V1/jobs/init.go new file mode 100644 index 0000000..348bc03 --- /dev/null +++ b/V1/jobs/init.go @@ -0,0 +1,51 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:55:19 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-21 13:03:06 + */ + +package jobs + +import ( + "fmt" + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" + "os/exec" + "time" +) + +func InitJobs() { + list, _ := models.TaskGetList(1, 1000000, "status", 1) + for _, task := range list { + job, err := NewJobFromTask(task) + if err != nil { + beego.Error("InitJobs:", err.Error()) + continue + } + AddJob(task.CronSpec, job) + } +} + +func runCmdWithTimeout(cmd *exec.Cmd, timeout time.Duration) (error, bool) { + done := make(chan error) + go func() { + done <- cmd.Wait() + }() + + var err error + select { + case <-time.After(timeout): + beego.Warn(fmt.Sprintf("任务执行时间超过%d秒,进程将被强制杀掉: %d", int(timeout/time.Second), cmd.Process.Pid)) + go func() { + <-done // 读出上面的goroutine数据,避免阻塞导致无法退出 + }() + if err = cmd.Process.Kill(); err != nil { + beego.Error(fmt.Sprintf("进程无法杀掉: %d, 错误信息: %s", cmd.Process.Pid, err)) + } + return err, true + case err = <-done: + return err, false + } +} + diff --git a/V1/jobs/job.go b/V1/jobs/job.go new file mode 100644 index 0000000..15bc679 --- /dev/null +++ b/V1/jobs/job.go @@ -0,0 +1,272 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:56:08 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-21 13:05:57 + */ + +package jobs + +import ( + "bytes" + "fmt" + "io/ioutil" + "net" + "os/exec" + "runtime/debug" + "time" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" + "golang.org/x/crypto/ssh" +) + +type Job struct { + id int // 任务ID + logId int64 // 日志记录ID + name string // 任务名称 + task *models.Task // 任务对象 + runFunc func(time.Duration) (string, string, error, bool) // 执行函数 + status int // 任务状态,大于0表示正在执行中 + Concurrent bool // 同一个任务是否允许并行执行 +} + +func NewJobFromTask(task *models.Task) (*Job, error) { + if task.Id < 1 { + return nil, fmt.Errorf("ToJob: 缺少id") + } + //本地程序执行 + if task.ServerId == 0 { + job := NewCommandJob(task.Id, task.TaskName, task.Command) + job.task = task + job.Concurrent = task.Concurrent == 1 + return job, nil + } + + server, _ := models.TaskServerGetById(task.ServerId) + if server.Type == 0 { + //密码验证登录服务器 + job := RemoteCommandJobByPassword(task.Id, task.TaskName, task.Command, server) + job.task = task + job.Concurrent = task.Concurrent == 1 + return job, nil + } + + job := RemoteCommandJob(task.Id, task.TaskName, task.Command, server) + job.task = task + job.Concurrent = task.Concurrent == 1 + return job, nil + +} + +func NewCommandJob(id int, name string, command string) *Job { + job := &Job{ + id: id, + name: name, + } + job.runFunc = func(timeout time.Duration) (string, string, error, bool) { + bufOut := new(bytes.Buffer) + bufErr := new(bytes.Buffer) + //cmd := exec.Command("/bin/bash", "-c", command) + cmd := exec.Command("sh", "-c", command) + cmd.Stdout = bufOut + cmd.Stderr = bufErr + cmd.Start() + err, isTimeout := runCmdWithTimeout(cmd, timeout) + + return bufOut.String(), bufErr.String(), err, isTimeout + } + return job +} + +//远程执行任务 密钥验证 +func RemoteCommandJob(id int, name string, command string, servers *models.TaskServer) *Job { + job := &Job{ + id: id, + name: name, + } + job.runFunc = func(timeout time.Duration) (string, string, error, bool) { + + key, err := ioutil.ReadFile(servers.PrivateKeySrc) + if err != nil { + return "", "", err, false + } + // Create the Signer for this private key. + signer, err := ssh.ParsePrivateKey(key) + if err != nil { + return "", "", err, false + } + addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) + config := &ssh.ClientConfig{ + User: servers.ServerAccount, + Auth: []ssh.AuthMethod{ + // Use the PublicKeys method for remote authentication. + ssh.PublicKeys(signer), + }, + //HostKeyCallback: ssh.FixedHostKey(hostKey), + HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { + return nil + }, + } + // Connect to the remote server and perform the SSH handshake.47.93.220.5 + client, err := ssh.Dial("tcp", addr, config) + if err != nil { + return "", "", err, false + } + + defer client.Close() + + session, err := client.NewSession() + if err != nil { + return "", "", err, false + } + defer session.Close() + + // Once a Session is created, you can execute a single command on + // the remote side using the Run method. + + var b bytes.Buffer + var c bytes.Buffer + session.Stdout = &b + session.Stderr = &c + + //session.Output(command) + if err := session.Run(command); err != nil { + return "", "", err, false + } + isTimeout := false + return b.String(), c.String(), err, isTimeout + } + return job +} + +func RemoteCommandJobByPassword(id int, name string, command string, servers *models.TaskServer) *Job { + var ( + auth []ssh.AuthMethod + addr string + clientConfig *ssh.ClientConfig + client *ssh.Client + session *ssh.Session + err error + ) + + job := &Job{ + id: id, + name: name, + } + job.runFunc = func(timeout time.Duration) (string, string, error, bool) { + // get auth method + auth = make([]ssh.AuthMethod, 0) + auth = append(auth, ssh.Password(servers.Password)) + + clientConfig = &ssh.ClientConfig{ + User: servers.ServerAccount, + Auth: auth, + HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { + return nil + }, + //Timeout: 1000 * time.Second, + } + + // connet to ssh + addr = fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) + + if client, err = ssh.Dial("tcp", addr, clientConfig); err != nil { + return "", "", err, false + } + + defer client.Close() + + // create session + if session, err = client.NewSession(); err != nil { + return "", "", err, false + } + + var b bytes.Buffer + var c bytes.Buffer + session.Stdout = &b + session.Stderr = &c + + //session.Output(command) + if err := session.Run(command); err != nil { + return "", "", err, false + } + isTimeout := false + return b.String(), c.String(), err, isTimeout + } + + return job +} + +func (j *Job) Status() int { + return j.status +} + +func (j *Job) GetName() string { + return j.name +} + +func (j *Job) GetId() int { + return j.id +} + +func (j *Job) GetLogId() int64 { + return j.logId +} + +func (j *Job) Run() { + if !j.Concurrent && j.status > 0 { + beego.Warn(fmt.Sprintf("任务[%d]上一次执行尚未结束,本次被忽略。", j.id)) + return + } + + defer func() { + if err := recover(); err != nil { + beego.Error(err, "\n", string(debug.Stack())) + } + }() + + if workPool != nil { + workPool <- true + defer func() { + <-workPool + }() + } + + beego.Debug(fmt.Sprintf("开始执行任务: %d", j.id)) + + j.status++ + defer func() { + j.status-- + }() + + t := time.Now() + timeout := time.Duration(time.Hour * 24) + if j.task.Timeout > 0 { + timeout = time.Second * time.Duration(j.task.Timeout) + } + cmdOut, cmdErr, err, isTimeout := j.runFunc(timeout) + ut := time.Now().Sub(t) / time.Millisecond + + // 插入日志 + log := new(models.TaskLog) + log.TaskId = j.id + log.Output = cmdOut + log.Error = cmdErr + log.ProcessTime = int(ut) + log.CreateTime = t.Unix() + + if isTimeout { + log.Status = models.TASK_TIMEOUT + log.Error = fmt.Sprintf("任务执行超过 %d 秒\n----------------------\n%s\n", int(timeout/time.Second), cmdErr) + } else if err != nil { + log.Status = models.TASK_ERROR + log.Error = err.Error() + ":" + cmdErr + } + j.logId, _ = models.TaskLogAdd(log) + + // 更新上次执行时间 + j.task.PrevTime = t.Unix() + j.task.ExecuteTimes++ + j.task.Update("PrevTime", "ExecuteTimes") +} diff --git a/libs/pager.go b/V1/libs/pager.go similarity index 100% rename from libs/pager.go rename to V1/libs/pager.go diff --git a/V1/libs/string.go b/V1/libs/string.go new file mode 100644 index 0000000..c7b2a80 --- /dev/null +++ b/V1/libs/string.go @@ -0,0 +1,37 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-20 10:01:39 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-20 10:02:07 + */ + +package libs + +import ( + "crypto/md5" + "fmt" + "regexp" +) + +var emailPattern = regexp.MustCompile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-zA-Z0-9](?:[\\w-]*[\\w])?") + +func Md5(buf []byte) string { + hash := md5.New() + hash.Write(buf) + return fmt.Sprintf("%x", hash.Sum(nil)) +} + +func SizeFormat(size float64) string { + units := []string{"Byte", "KB", "MB", "GB", "TB"} + n := 0 + for size > 1024 { + size /= 1024 + n += 1 + } + + return fmt.Sprintf("%.2f %s", size, units[n]) +} + +func IsEmail(b []byte) bool { + return emailPattern.Match(b) +} diff --git a/V1/main.go b/V1/main.go new file mode 100644 index 0000000..fe71d1c --- /dev/null +++ b/V1/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" + _ "github.com/george518/PPGo_Job/routers" + "github.com/george518/PPGo_Job/jobs" +) + +const ( + VERSION = "1.0.0" +) + +func init() { + //初始化数据模型 + models.Init() + jobs.InitJobs() +} + +func main() { + beego.BConfig.WebConfig.Session.SessionOn = true + beego.Run() +} \ No newline at end of file diff --git a/main_run b/V1/main_run similarity index 100% rename from main_run rename to V1/main_run diff --git a/V1/models/init.go b/V1/models/init.go new file mode 100644 index 0000000..4241892 --- /dev/null +++ b/V1/models/init.go @@ -0,0 +1,45 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-20 09:44:44 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-21 12:21:37 + */ + +package models + +import ( + "net/url" + + "github.com/astaxie/beego" + "github.com/astaxie/beego/orm" + _ "github.com/go-sql-driver/mysql" + "github.com/gpmgo/gopm/modules/log" +) + +func Init() { + dbhost := beego.AppConfig.String("db.host") + dbport := beego.AppConfig.String("db.port") + dbuser := beego.AppConfig.String("db.user") + dbpassword := beego.AppConfig.String("db.password") + dbname := beego.AppConfig.String("db.name") + timezone := beego.AppConfig.String("db.timezone") + if dbport == "" { + dbport = "3306" + } + dsn := dbuser + ":" + dbpassword + "@tcp(" + dbhost + ":" + dbport + ")/" + dbname + "?charset=utf8" + log.Fatal(dsn) + + if timezone != "" { + dsn = dsn + "&loc=" + url.QueryEscape(timezone) + } + orm.RegisterDataBase("default", "mysql", dsn) + orm.RegisterModel(new(User), new(Task), new(TaskGroup), new(TaskLog), new(TaskServer)) + + if beego.AppConfig.String("runmode") == "dev" { + orm.Debug = true + } +} + +func TableName(name string) string { + return beego.AppConfig.String("db.prefix") + name +} diff --git a/V1/models/task.go b/V1/models/task.go new file mode 100644 index 0000000..c893c1c --- /dev/null +++ b/V1/models/task.go @@ -0,0 +1,107 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:22:00 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-21 12:22:10 + */ + +package models + +import ( + "fmt" + "github.com/astaxie/beego/orm" + "time" +) + +const ( + TASK_SUCCESS = 0 // 任务执行成功 + TASK_ERROR = -1 // 任务执行出错 + TASK_TIMEOUT = -2 // 任务执行超时 +) + +type Task struct { + Id int + UserId int + ServerId int + GroupId int + TaskName string + TaskType int + Description string + CronSpec string + Concurrent int + Command string + Status int + Timeout int + ExecuteTimes int + PrevTime int64 + CreateTime int64 +} + +func (t *Task) TableName() string { + return TableName("task") +} + +func (t *Task) Update(fields ...string) error { + if _, err := orm.NewOrm().Update(t, fields...); err != nil { + return err + } + return nil +} + +func TaskAdd(task *Task) (int64, error) { + if task.TaskName == "" { + return 0, fmt.Errorf("TaskName字段不能为空") + } + + if task.CronSpec == "" { + return 0, fmt.Errorf("CronSpec字段不能为空") + } + if task.Command == "" { + return 0, fmt.Errorf("Command字段不能为空") + } + if task.CreateTime == 0 { + task.CreateTime = time.Now().Unix() + } + return orm.NewOrm().Insert(task) +} + +func TaskGetList(page, pageSize int, filters ...interface{}) ([]*Task, int64) { + offset := (page - 1) * pageSize + + tasks := make([]*Task, 0) + + query := orm.NewOrm().QueryTable(TableName("task")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&tasks) + + return tasks, total +} + +func TaskResetGroupId(groupId int) (int64, error) { + return orm.NewOrm().QueryTable(TableName("task")).Filter("group_id", groupId).Update(orm.Params{ + "group_id": 0, + }) +} + +func TaskGetById(id int) (*Task, error) { + task := &Task{ + Id: id, + } + + err := orm.NewOrm().Read(task) + if err != nil { + return nil, err + } + return task, nil +} + +func TaskDel(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task")).Filter("id", id).Delete() + return err +} diff --git a/V1/models/task_group.go b/V1/models/task_group.go new file mode 100644 index 0000000..a5570df --- /dev/null +++ b/V1/models/task_group.go @@ -0,0 +1,69 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:22:37 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-21 12:22:55 + */ + +package models + +import ( + "fmt" + "github.com/astaxie/beego/orm" +) + +type TaskGroup struct { + Id int + UserId int + GroupName string + Description string + CreateTime int64 +} + +func (t *TaskGroup) TableName() string { + return TableName("task_group") +} + +func (t *TaskGroup) Update(fields ...string) error { + if t.GroupName == "" { + return fmt.Errorf("组名不能为空") + } + if _, err := orm.NewOrm().Update(t, fields...); err != nil { + return err + } + return nil +} + +func TaskGroupAdd(obj *TaskGroup) (int64, error) { + if obj.GroupName == "" { + return 0, fmt.Errorf("组名不能为空") + } + return orm.NewOrm().Insert(obj) +} + +func TaskGroupGetById(id int) (*TaskGroup, error) { + obj := &TaskGroup{ + Id: id, + } + + err := orm.NewOrm().Read(obj) + if err != nil { + return nil, err + } + return obj, nil +} + +func TaskGroupDelById(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task_group")).Filter("id", id).Delete() + return err +} + +func TaskGroupGetList(page, pageSize int) ([]*TaskGroup, int64) { + offset := (page - 1) * pageSize + list := make([]*TaskGroup, 0) + query := orm.NewOrm().QueryTable(TableName("task_group")) + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + + return list, total +} diff --git a/V1/models/task_log.go b/V1/models/task_log.go new file mode 100644 index 0000000..50e6f2e --- /dev/null +++ b/V1/models/task_log.go @@ -0,0 +1,76 @@ +/* +* @Author: haodaquan +* @Date: 2017-06-21 12:23:22 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-06-22 14:57:13 + */ + +package models + +import ( + "github.com/astaxie/beego/orm" +) + +type TaskLog struct { + Id int + TaskId int + Output string + Error string + Status int + ProcessTime int + CreateTime int64 +} + +func (t *TaskLog) TableName() string { + return TableName("task_log") +} + +func TaskLogAdd(t *TaskLog) (int64, error) { + return orm.NewOrm().Insert(t) +} + +func TaskLogGetList(page, pageSize int, filters ...interface{}) ([]*TaskLog, int64) { + offset := (page - 1) * pageSize + + logs := make([]*TaskLog, 0) + + query := orm.NewOrm().QueryTable(TableName("task_log")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&logs) + + return logs, total +} + +func TaskLogGetById(id int) (*TaskLog, error) { + obj := &TaskLog{ + Id: id, + } + + err := orm.NewOrm().Read(obj) + if err != nil { + return nil, err + } + return obj, nil +} + +func TaskLogDelById(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task_log")).Filter("id", id).Delete() + return err +} + +func TaskLogDelByTaskId(taskId int) (int64, error) { + return orm.NewOrm().QueryTable(TableName("task_log")).Filter("task_id", taskId).Delete() +} + +// func GetTodaySuccessNum() (num, error) { +// o := orm.NewOrm() +// var r RawSeter +// r = o.Raw("SELECT COUNT(*) AS num WHERE create_time>=? AND status<0", "") +// } diff --git a/models/task_server.go b/V1/models/task_server.go similarity index 100% rename from models/task_server.go rename to V1/models/task_server.go diff --git a/models/user.go b/V1/models/user.go similarity index 100% rename from models/user.go rename to V1/models/user.go diff --git a/ppgo_job.sql b/V1/ppgo_job.sql similarity index 100% rename from ppgo_job.sql rename to V1/ppgo_job.sql diff --git a/V1/routers/router.go b/V1/routers/router.go new file mode 100644 index 0000000..0b5f892 --- /dev/null +++ b/V1/routers/router.go @@ -0,0 +1,18 @@ +package routers + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/controllers" +) + +func init() { + beego.Router("/", &controllers.MainController{}, "*:Index") + beego.Router("/login", &controllers.MainController{}, "*:Login") + beego.Router("/logout", &controllers.MainController{}, "*:Logout") + beego.Router("/profile", &controllers.MainController{}, "*:Profile") + beego.Router("/gettime", &controllers.MainController{}, "*:GetTime") + beego.Router("/help", &controllers.HelpController{}, "*:Index") + beego.AutoRouter(&controllers.TaskController{}) + beego.AutoRouter(&controllers.GroupController{}) + beego.AutoRouter(&controllers.ServerController{}) +} diff --git a/run.sh b/V1/run.sh similarity index 100% rename from run.sh rename to V1/run.sh diff --git a/static/bootstrap/README.md b/V1/static/bootstrap/README.md similarity index 100% rename from static/bootstrap/README.md rename to V1/static/bootstrap/README.md diff --git a/static/bootstrap/css/bootstrap-theme.css b/V1/static/bootstrap/css/bootstrap-theme.css similarity index 100% rename from static/bootstrap/css/bootstrap-theme.css rename to V1/static/bootstrap/css/bootstrap-theme.css diff --git a/static/bootstrap/css/bootstrap-theme.css.map b/V1/static/bootstrap/css/bootstrap-theme.css.map similarity index 100% rename from static/bootstrap/css/bootstrap-theme.css.map rename to V1/static/bootstrap/css/bootstrap-theme.css.map diff --git a/static/bootstrap/css/bootstrap-theme.min.css b/V1/static/bootstrap/css/bootstrap-theme.min.css similarity index 100% rename from static/bootstrap/css/bootstrap-theme.min.css rename to V1/static/bootstrap/css/bootstrap-theme.min.css diff --git a/static/bootstrap/css/bootstrap.css b/V1/static/bootstrap/css/bootstrap.css similarity index 100% rename from static/bootstrap/css/bootstrap.css rename to V1/static/bootstrap/css/bootstrap.css diff --git a/static/bootstrap/css/bootstrap.css.map b/V1/static/bootstrap/css/bootstrap.css.map similarity index 100% rename from static/bootstrap/css/bootstrap.css.map rename to V1/static/bootstrap/css/bootstrap.css.map diff --git a/static/bootstrap/css/bootstrap.min.css b/V1/static/bootstrap/css/bootstrap.min.css similarity index 100% rename from static/bootstrap/css/bootstrap.min.css rename to V1/static/bootstrap/css/bootstrap.min.css diff --git a/static/bootstrap/fonts/glyphicons-halflings-regular.eot b/V1/static/bootstrap/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from static/bootstrap/fonts/glyphicons-halflings-regular.eot rename to V1/static/bootstrap/fonts/glyphicons-halflings-regular.eot diff --git a/static/bootstrap/fonts/glyphicons-halflings-regular.svg b/V1/static/bootstrap/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from static/bootstrap/fonts/glyphicons-halflings-regular.svg rename to V1/static/bootstrap/fonts/glyphicons-halflings-regular.svg diff --git a/static/bootstrap/fonts/glyphicons-halflings-regular.ttf b/V1/static/bootstrap/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from static/bootstrap/fonts/glyphicons-halflings-regular.ttf rename to V1/static/bootstrap/fonts/glyphicons-halflings-regular.ttf diff --git a/static/bootstrap/fonts/glyphicons-halflings-regular.woff b/V1/static/bootstrap/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from static/bootstrap/fonts/glyphicons-halflings-regular.woff rename to V1/static/bootstrap/fonts/glyphicons-halflings-regular.woff diff --git a/static/bootstrap/fonts/glyphicons-halflings-regular.woff2 b/V1/static/bootstrap/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from static/bootstrap/fonts/glyphicons-halflings-regular.woff2 rename to V1/static/bootstrap/fonts/glyphicons-halflings-regular.woff2 diff --git a/static/bootstrap/js/bootstrap.js b/V1/static/bootstrap/js/bootstrap.js similarity index 100% rename from static/bootstrap/js/bootstrap.js rename to V1/static/bootstrap/js/bootstrap.js diff --git a/static/bootstrap/js/bootstrap.min.js b/V1/static/bootstrap/js/bootstrap.min.js similarity index 100% rename from static/bootstrap/js/bootstrap.min.js rename to V1/static/bootstrap/js/bootstrap.min.js diff --git a/static/bootstrap/js/npm.js b/V1/static/bootstrap/js/npm.js similarity index 100% rename from static/bootstrap/js/npm.js rename to V1/static/bootstrap/js/npm.js diff --git a/static/css/dermadefault.css b/V1/static/css/dermadefault.css similarity index 100% rename from static/css/dermadefault.css rename to V1/static/css/dermadefault.css diff --git a/static/css/dermagreen.css b/V1/static/css/dermagreen.css similarity index 100% rename from static/css/dermagreen.css rename to V1/static/css/dermagreen.css diff --git a/static/css/dermaorange.css b/V1/static/css/dermaorange.css similarity index 100% rename from static/css/dermaorange.css rename to V1/static/css/dermaorange.css diff --git a/static/css/style.css b/V1/static/css/style.css similarity index 100% rename from static/css/style.css rename to V1/static/css/style.css diff --git a/static/css/templatecss.css b/V1/static/css/templatecss.css similarity index 100% rename from static/css/templatecss.css rename to V1/static/css/templatecss.css diff --git a/static/images/server.png b/V1/static/images/server.png similarity index 100% rename from static/images/server.png rename to V1/static/images/server.png diff --git a/static/images/task.png b/V1/static/images/task.png similarity index 100% rename from static/images/task.png rename to V1/static/images/task.png diff --git a/static/js/jquery-1.11.1.min.js b/V1/static/js/jquery-1.11.1.min.js similarity index 100% rename from static/js/jquery-1.11.1.min.js rename to V1/static/js/jquery-1.11.1.min.js diff --git a/static/js/jquery-ui.min.js b/V1/static/js/jquery-ui.min.js similarity index 100% rename from static/js/jquery-ui.min.js rename to V1/static/js/jquery-ui.min.js diff --git a/static/js/jquery.cookie.js b/V1/static/js/jquery.cookie.js similarity index 100% rename from static/js/jquery.cookie.js rename to V1/static/js/jquery.cookie.js diff --git a/static/js/reload.min.js b/V1/static/js/reload.min.js similarity index 100% rename from static/js/reload.min.js rename to V1/static/js/reload.min.js diff --git a/static/login/background.jpg b/V1/static/login/background.jpg similarity index 100% rename from static/login/background.jpg rename to V1/static/login/background.jpg diff --git a/static/login/custom_tips.js b/V1/static/login/custom_tips.js similarity index 100% rename from static/login/custom_tips.js rename to V1/static/login/custom_tips.js diff --git a/static/login/jquery-1.11.3.min.js b/V1/static/login/jquery-1.11.3.min.js similarity index 100% rename from static/login/jquery-1.11.3.min.js rename to V1/static/login/jquery-1.11.3.min.js diff --git a/static/login/logo.png b/V1/static/login/logo.png similarity index 100% rename from static/login/logo.png rename to V1/static/login/logo.png diff --git a/static/login/logo_login.psd b/V1/static/login/logo_login.psd similarity index 100% rename from static/login/logo_login.psd rename to V1/static/login/logo_login.psd diff --git a/static/login/style.css b/V1/static/login/style.css similarity index 100% rename from static/login/style.css rename to V1/static/login/style.css diff --git a/tests/default_test.go b/V1/tests/default_test.go similarity index 100% rename from tests/default_test.go rename to V1/tests/default_test.go diff --git a/V1/views/group/add.html b/V1/views/group/add.html new file mode 100644 index 0000000..1899873 --- /dev/null +++ b/V1/views/group/add.html @@ -0,0 +1,67 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/V1/views/group/edit.html b/V1/views/group/edit.html new file mode 100644 index 0000000..8800e60 --- /dev/null +++ b/V1/views/group/edit.html @@ -0,0 +1,67 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
+
+
+ + \ No newline at end of file diff --git a/V1/views/group/list.html b/V1/views/group/list.html new file mode 100644 index 0000000..59f551e --- /dev/null +++ b/V1/views/group/list.html @@ -0,0 +1,113 @@ + +
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ + + + + + + + + + + + {{range $k,$v := .list}} + + + + + + + + + {{end}} + + + + + + + +
ID分类名称描述操作
{{$v.Id}}{{$v.GroupName}}{{$v.Description}} + + + 编辑 + +
+
+ {{str2html .pageBar}} +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/views/help/index.html b/V1/views/help/index.html similarity index 100% rename from views/help/index.html rename to V1/views/help/index.html diff --git a/views/index.tpl b/V1/views/index.tpl similarity index 100% rename from views/index.tpl rename to V1/views/index.tpl diff --git a/views/main/index.html b/V1/views/main/index.html similarity index 100% rename from views/main/index.html rename to V1/views/main/index.html diff --git a/views/main/profile.html b/V1/views/main/profile.html similarity index 100% rename from views/main/profile.html rename to V1/views/main/profile.html diff --git a/V1/views/public/layout.html b/V1/views/public/layout.html new file mode 100644 index 0000000..8b7959a --- /dev/null +++ b/V1/views/public/layout.html @@ -0,0 +1,349 @@ + + + + + + 定时任务管理后台 + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ +
+ +
+ +
+ + {{.LayoutContent}} +
+
+ + + diff --git a/views/public/login.html b/V1/views/public/login.html similarity index 100% rename from views/public/login.html rename to V1/views/public/login.html diff --git a/V1/views/server/add.html b/V1/views/server/add.html new file mode 100644 index 0000000..1f4f6aa --- /dev/null +++ b/V1/views/server/add.html @@ -0,0 +1,158 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ + + +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+ 公钥和私钥地址请在本地服务器生成,命令:ssh-keygen -t rsa -f pp_rsa +
+
+ +
+ +
+ +
+
+ +
+
+ + + +
+ +
+
+
+ + \ No newline at end of file diff --git a/V1/views/server/edit.html b/V1/views/server/edit.html new file mode 100644 index 0000000..496f32c --- /dev/null +++ b/V1/views/server/edit.html @@ -0,0 +1,160 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ + + +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + + +
+ +
+
+
+ + \ No newline at end of file diff --git a/V1/views/server/list.html b/V1/views/server/list.html new file mode 100644 index 0000000..eb13f27 --- /dev/null +++ b/V1/views/server/list.html @@ -0,0 +1,121 @@ + +
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ + + + + + + + + + + + + + + + {{range $k,$v := .list}} + + + + + + + + + + + + + {{end}} + + + + + + + +
ID服务器名称IP地址端口号验证类型备注创建时间操作
{{$v.id}}{{$v.server_name}}{{$v.server_ip}}{{$v.port}}{{$v.type}}{{$v.detail}}{{$v.create_time}} + + + 编辑 + +
+
+ {{str2html .pageBar}} +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/V1/views/task/add.html b/V1/views/task/add.html new file mode 100644 index 0000000..d32d23e --- /dev/null +++ b/V1/views/task/add.html @@ -0,0 +1,143 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ * +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ + +
+
+ 设为“是”的话,如果该任务在上一个时间点还没执行完,则略过不执行 +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/V1/views/task/copy.html b/V1/views/task/copy.html new file mode 100644 index 0000000..e2ef477 --- /dev/null +++ b/V1/views/task/copy.html @@ -0,0 +1,144 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ + +
+
+ 设为“是”的话,如果该任务在上一个时间点还没执行完,则略过不执行 +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ 单位秒,不设置的话,默认超时时间为1天 +
+
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/V1/views/task/edit.html b/V1/views/task/edit.html new file mode 100644 index 0000000..af11955 --- /dev/null +++ b/V1/views/task/edit.html @@ -0,0 +1,145 @@ + +
+
+ +
+ +
+ +
+ + + +
+
+
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ + +
+
+ 设为“是”的话,如果该任务在上一个时间点还没执行完,则略过不执行 +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ + +
+ +
+ +
+
+ 单位秒,不设置的话,默认超时时间为1天 +
+
+ +
+ + +
+
+
+ + \ No newline at end of file diff --git a/V1/views/task/list.html b/V1/views/task/list.html new file mode 100644 index 0000000..16d7211 --- /dev/null +++ b/V1/views/task/list.html @@ -0,0 +1,170 @@ + +
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ + + + + + + + + + + + + + + {{range $k,$v := .list}} + + + + + + + + + + + + {{end}} + + + + + + + +
ID任务名称服务器任务说明上次执行时间下次执行时间操作
{{$v.id}} + {{if eq $v.running 0}} + + {{else}} + + {{end}} + {{$v.group_name}}-{{$v.name}} + {{$v.server_name}} {{$v.description}} {{$v.prev_time}} {{$v.next_time}} + {{if eq $v.status 0}} + + 激活 + + + 编辑 + + {{else}} + + 暂停 + + + 编辑 + + {{end}} + + 执行 + + + 日志 + + + + 复制 + +
+
+ {{str2html .pageBar}} +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/views/task/logs.html b/V1/views/task/logs.html similarity index 100% rename from views/task/logs.html rename to V1/views/task/logs.html diff --git a/views/task/viewlog.html b/V1/views/task/viewlog.html similarity index 100% rename from views/task/viewlog.html rename to V1/views/task/viewlog.html diff --git a/conf/app.conf b/conf/app.conf index 9affc4d..611fff7 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -1,18 +1,21 @@ -appname = PPGo_Job +appname = PPGo_Job2 httpport = 8080 runmode = dev +version= V2.0 + # 允许同时运行的任务数 jobs.pool = 1000 # 站点名称 site.name = 定时任务管理器 + # 数据库配置 db.host = 127.0.0.1 db.user = root db.password = "123456" db.port = 3306 -db.name = ppgo_job +db.name = ppgo_job2 db.prefix = pp_ db.timezone = Asia/Shanghai diff --git a/controllers/admin.go b/controllers/admin.go new file mode 100644 index 0000000..0d8a299 --- /dev/null +++ b/controllers/admin.go @@ -0,0 +1,215 @@ +/********************************************** +** @Des: 管理员 +** @Author: haodaquan +** @Date: 2017-09-16 14:17:37 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:14:07 +***********************************************/ +package controllers + +import ( + "fmt" + "strconv" + "strings" + "time" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" +) + +type AdminController struct { + BaseController +} + +func (self *AdminController) List() { + self.Data["pageTitle"] = "管理员管理" + self.display() + //self.TplName = "admin/list.html" +} + +func (self *AdminController) Add() { + self.Data["pageTitle"] = "新增管理员" + + // 角色 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + result, _ := models.RoleGetList(1, 1000, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["role_name"] = v.RoleName + list[k] = row + } + + self.Data["role"] = list + + self.display() +} + +func (self *AdminController) Edit() { + self.Data["pageTitle"] = "编辑管理员" + + id, _ := self.GetInt("id", 0) + Admin, _ := models.AdminGetById(id) + row := make(map[string]interface{}) + row["id"] = Admin.Id + row["login_name"] = Admin.LoginName + row["real_name"] = Admin.RealName + row["phone"] = Admin.Phone + row["email"] = Admin.Email + row["role_ids"] = Admin.RoleIds + self.Data["admin"] = row + + role_ids := strings.Split(Admin.RoleIds, ",") + + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + result, _ := models.RoleGetList(1, 1000, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["checked"] = 0 + for i := 0; i < len(role_ids); i++ { + role_id, _ := strconv.Atoi(role_ids[i]) + if role_id == v.Id { + row["checked"] = 1 + } + fmt.Println(role_ids[i]) + } + row["id"] = v.Id + row["role_name"] = v.RoleName + list[k] = row + } + self.Data["role"] = list + self.display() +} + +func (self *AdminController) AjaxSave() { + Admin_id, _ := self.GetInt("id") + if Admin_id == 0 { + Admin := new(models.Admin) + Admin.LoginName = strings.TrimSpace(self.GetString("login_name")) + Admin.RealName = strings.TrimSpace(self.GetString("real_name")) + Admin.Phone = strings.TrimSpace(self.GetString("phone")) + Admin.Email = strings.TrimSpace(self.GetString("email")) + Admin.RoleIds = strings.TrimSpace(self.GetString("roleids")) + Admin.UpdateTime = time.Now().Unix() + Admin.UpdateId = self.userId + Admin.Status = 1 + + // 检查登录名是否已经存在 + _, err := models.AdminGetByName(Admin.LoginName) + + if err == nil { + self.ajaxMsg("登录名已经存在", MSG_ERR) + } + //新增 + pwd, salt := libs.Password(4, "") + Admin.Password = pwd + Admin.Salt = salt + Admin.CreateTime = time.Now().Unix() + Admin.CreateId = self.userId + if _, err := models.AdminAdd(Admin); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) + } + + Admin, _ := models.AdminGetById(Admin_id) + //修改 + Admin.Id = Admin_id + Admin.UpdateTime = time.Now().Unix() + Admin.UpdateId = self.userId + Admin.LoginName = strings.TrimSpace(self.GetString("login_name")) + Admin.RealName = strings.TrimSpace(self.GetString("real_name")) + Admin.Phone = strings.TrimSpace(self.GetString("phone")) + Admin.Email = strings.TrimSpace(self.GetString("email")) + Admin.RoleIds = strings.TrimSpace(self.GetString("roleids")) + Admin.UpdateTime = time.Now().Unix() + Admin.UpdateId = self.userId + Admin.Status = 1 + + resetPwd, _ := self.GetInt("reset_pwd") + if resetPwd == 1 { + pwd, salt := libs.Password(4, "") + Admin.Password = pwd + Admin.Salt = salt + } + + //普通管理员不可修改超级管理员资料 + if self.userId != 1 && Admin.Id == 1 { + self.ajaxMsg("不可修改超级管理员资料", MSG_ERR) + } + if err := Admin.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg(strconv.Itoa(resetPwd), MSG_OK) +} + +func (self *AdminController) AjaxDel() { + + Admin_id, _ := self.GetInt("id") + status := strings.TrimSpace(self.GetString("status")) + if Admin_id == 1 { + self.ajaxMsg("超级管理员不允许操作", MSG_ERR) + } + + Admin_status := 0 + if status == "enable" { + Admin_status = 1 + } + Admin, _ := models.AdminGetById(Admin_id) + Admin.UpdateTime = time.Now().Unix() + Admin.Status = Admin_status + Admin.Id = Admin_id + + if err := Admin.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("操作成功", MSG_OK) +} + +func (self *AdminController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + realName := strings.TrimSpace(self.GetString("realName")) + + StatusText := make(map[int]string) + StatusText[0] = "禁用" + StatusText[1] = "正常" + + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + // + if realName != "" { + filters = append(filters, "real_name__icontains", realName) + } + result, count := models.AdminGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["login_name"] = v.LoginName + row["real_name"] = v.RealName + row["phone"] = v.Phone + row["email"] = v.Email + row["role_ids"] = v.RoleIds + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["update_time"] = beego.Date(time.Unix(v.UpdateTime, 0), "Y-m-d H:i:s") + row["status"] = v.Status + row["status_text"] = StatusText[v.Status] + list[k] = row + } + self.ajaxList("成功", MSG_OK, count, list) +} diff --git a/controllers/auth.go b/controllers/auth.go new file mode 100644 index 0000000..23d00c9 --- /dev/null +++ b/controllers/auth.go @@ -0,0 +1,118 @@ +/********************************************** +** @Des: 权限因子 +** @Author: haodaquan +** @Date: 2017-09-09 16:14:31 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:23:40 +***********************************************/ + +package controllers + +import ( + "fmt" + "strings" + "time" + + "github.com/george518/PPGo_Job/models" +) + +type AuthController struct { + BaseController +} + +func (self *AuthController) Index() { + + self.Data["pageTitle"] = "权限因子" + self.display() +} + +func (self *AuthController) List() { + self.Data["zTree"] = true //引入ztreecss + self.Data["pageTitle"] = "权限因子" + self.display() +} + +//获取全部节点 +func (self *AuthController) GetNodes() { + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + result, count := models.AuthGetList(1, 1000, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["pId"] = v.Pid + row["name"] = v.AuthName + row["open"] = true + list[k] = row + } + + self.ajaxList("成功", MSG_OK, count, list) +} + +//获取一个节点 +func (self *AuthController) GetNode() { + id, _ := self.GetInt("id") + result, _ := models.AuthGetById(id) + // if err == nil { + // self.ajaxMsg(err.Error(), MSG_ERR) + // } + row := make(map[string]interface{}) + row["id"] = result.Id + row["pid"] = result.Pid + row["auth_name"] = result.AuthName + row["auth_url"] = result.AuthUrl + row["sort"] = result.Sort + row["is_show"] = result.IsShow + row["icon"] = result.Icon + + fmt.Println(row) + + self.ajaxList("成功", MSG_OK, 0, row) +} + +//新增或修改 +func (self *AuthController) AjaxSave() { + auth := new(models.Auth) + auth.UserId = self.userId + auth.Pid, _ = self.GetInt("pid") + auth.AuthName = strings.TrimSpace(self.GetString("auth_name")) + auth.AuthUrl = strings.TrimSpace(self.GetString("auth_url")) + auth.Sort, _ = self.GetInt("sort") + auth.IsShow, _ = self.GetInt("is_show") + auth.Icon = strings.TrimSpace(self.GetString("icon")) + auth.UpdateTime = time.Now().Unix() + + auth.Status = 1 + + id, _ := self.GetInt("id") + if id == 0 { + //新增 + auth.CreateTime = time.Now().Unix() + auth.CreateId = self.userId + auth.UpdateId = self.userId + if _, err := models.AuthAdd(auth); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + } else { + auth.Id = id + auth.UpdateId = self.userId + if err := auth.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + } + + self.ajaxMsg("", MSG_OK) +} + +//删除 +func (self *AuthController) AjaxDel() { + id, _ := self.GetInt("id") + auth, _ := models.AuthGetById(id) + auth.Id = id + auth.Status = 0 + if err := auth.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} diff --git a/controllers/ban.go b/controllers/ban.go new file mode 100644 index 0000000..7d26714 --- /dev/null +++ b/controllers/ban.go @@ -0,0 +1,126 @@ +/************************************************************ +** @Description: controllers +** @Author: haodaquan +** @Date: 2018-06-10 19:50 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-10 19:50 +*************************************************************/ +package controllers + +import ( + "strings" + "time" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" +) + +type BanController struct { + BaseController +} + +func (self *BanController) List() { + self.Data["pageTitle"] = "禁用命令管理" + self.display() +} + +func (self *BanController) Add() { + self.Data["pageTitle"] = "新增禁用命令" + + // 角色 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + result, _ := models.RoleGetList(1, 1000, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["role_name"] = v.RoleName + list[k] = row + } + + self.Data["role"] = list + + self.display() +} + +func (self *BanController) Edit() { + self.Data["pageTitle"] = "编辑禁用命令" + + id, _ := self.GetInt("id", 0) + ban, _ := models.BanGetById(id) + row := make(map[string]interface{}) + row["id"] = ban.Id + row["code"] = ban.Code + self.Data["ban"] = row + self.display() +} + +func (self *BanController) AjaxSave() { + id, _ := self.GetInt("id") + if id == 0 { + ban := new(models.Ban) + ban.Code = strings.TrimSpace(self.GetString("code")) + ban.CreateTime = time.Now().Unix() + + if _, err := models.BanAdd(ban); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) + } + + ban, _ := models.BanGetById(id) + //修改 + ban.Id = id + ban.UpdateTime = time.Now().Unix() + ban.Code = strings.TrimSpace(self.GetString("code")) + + if err := ban.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *BanController) AjaxDel() { + id, _ := self.GetInt("id") + ban, _ := models.BanGetById(id) + ban.UpdateTime = time.Now().Unix() + ban.Status = 1 + + if err := ban.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("操作成功", MSG_OK) +} + +func (self *BanController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + code := strings.TrimSpace(self.GetString("code")) + + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 0) + if code != "" { + filters = append(filters, "code__icontains", code) + } + result, count := models.BanGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["code"] = v.Code + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + list[k] = row + } + self.ajaxList("成功", MSG_OK, count, list) +} diff --git a/controllers/common.go b/controllers/common.go index e9f225b..4f505d6 100644 --- a/controllers/common.go +++ b/controllers/common.go @@ -1,9 +1,10 @@ -/* -* @Author: haodaquan -* @Date: 2017-06-19 22:27:09 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-06-22 11:15:33 - */ +/********************************************** +** @Des: base controller +** @Author: haodaquan +** @Date: 2017-09-07 16:54:40 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-18 10:28:01 +***********************************************/ package controllers import ( @@ -23,106 +24,291 @@ type BaseController struct { beego.Controller controllerName string actionName string - user *models.User + user *models.Admin userId int userName string + loginName string pageSize int + allowUrl string + serverGroups string + taskGroups string } -func (this *BaseController) Prepare() { - this.pageSize = 20 - controllerName, actionName := this.GetControllerAndAction() - this.controllerName = strings.ToLower(controllerName[0 : len(controllerName)-10]) - this.actionName = strings.ToLower(actionName) - this.auth() +//前期准备 +func (self *BaseController) Prepare() { + self.pageSize = 20 + controllerName, actionName := self.GetControllerAndAction() + self.controllerName = strings.ToLower(controllerName[0 : len(controllerName)-10]) + self.actionName = strings.ToLower(actionName) + self.Data["version"] = beego.AppConfig.String("version") + self.Data["siteName"] = beego.AppConfig.String("site.name") + self.Data["curRoute"] = self.controllerName + "." + self.actionName + self.Data["curController"] = self.controllerName + self.Data["curAction"] = self.actionName + // noAuth := "ajaxsave/ajaxdel/table/loginin/loginout/getnodes/start" + // isNoAuth := strings.Contains(noAuth, self.actionName) + //fmt.Println(self.controllerName) + //if (strings.Compare(self.controllerName, "apidoc")) != 0 { + // + //} - this.Data["version"] = beego.AppConfig.String("version") - this.Data["siteName"] = beego.AppConfig.String("site.name") - this.Data["curRoute"] = this.controllerName + "." + this.actionName - this.Data["curController"] = this.controllerName - this.Data["curAction"] = this.actionName - this.Data["loginUserId"] = this.userId - this.Data["loginUserName"] = this.userName - this.Data["menuTag"] = this.controllerName + self.Auth() + self.Data["loginUserId"] = self.userId + self.Data["loginUserName"] = self.userName } -//登录状态验证 -func (this *BaseController) auth() { - arr := strings.Split(this.Ctx.GetCookie("auth"), "|") +//登录权限验证 +func (self *BaseController) Auth() { + arr := strings.Split(self.Ctx.GetCookie("auth"), "|") + self.userId = 0 if len(arr) == 2 { idstr, password := arr[0], arr[1] userId, _ := strconv.Atoi(idstr) if userId > 0 { - user, err := models.UserGetById(userId) - if err == nil && password == libs.Md5([]byte(this.getClientIp()+"|"+user.Password+user.Salt)) { - this.userId = user.Id - this.userName = user.UserName - this.user = user + user, err := models.AdminGetById(userId) + + if err == nil && password == libs.Md5([]byte(self.getClientIp()+"|"+user.Password+user.Salt)) { + self.userId = user.Id + self.loginName = user.LoginName + self.userName = user.RealName + self.user = user + self.AdminAuth() + self.dataAuth(user) + } + + isHasAuth := strings.Contains(self.allowUrl, self.controllerName+"/"+self.actionName) + noAuth := "ajaxsave/table/loginin/loginout/getnodes/start" + isNoAuth := strings.Contains(noAuth, self.actionName) + + if isHasAuth == false && isNoAuth == false { + if strings.Contains(self.actionName, "ajax") { + self.ajaxMsg("没有权限", MSG_ERR) + return + } + + flash := beego.NewFlash() + flash.Error("没有权限") + flash.Store(&self.Controller) + return } } } - if this.userId == 0 && (this.controllerName != "main" || - (this.controllerName == "main" && this.actionName != "logout" && this.actionName != "login")) { - this.redirect(beego.URLFor("MainController.Login")) + if self.userId == 0 && (self.controllerName != "login" && self.actionName != "loginin") { + self.redirect(beego.URLFor("LoginController.Login")) } } -//渲染模版 -func (this *BaseController) display(tpl ...string) { - var tplname string - if len(tpl) > 0 { - tplname = tpl[0] + ".html" - } else { - tplname = this.controllerName + "/" + this.actionName + ".html" +func (self *BaseController) dataAuth(user *models.Admin) { + if user.RoleIds == "0" || user.Id == 1 { + return } - this.Layout = "public/layout.html" - this.TplName = tplname + + Filters := make([]interface{}, 0) + Filters = append(Filters, "status", 1) + + RoleIdsArr := strings.Split(user.RoleIds, ",") + + RoleIds := make([]int, 0) + for _, v := range RoleIdsArr { + id, _ := strconv.Atoi(v) + RoleIds = append(RoleIds, id) + } + + Filters = append(Filters, "id__in", RoleIds) + + Result, _ := models.RoleGetList(1, 1000, Filters...) + serverGroups := "" + taskGroups := "" + for _, v := range Result { + serverGroups += v.ServerGroupIds + "," + taskGroups += v.TaskGroupIds + "," + } + + self.serverGroups = strings.Trim(serverGroups, ",") + self.taskGroups = strings.Trim(taskGroups, ",") } -// 重定向 -func (this *BaseController) redirect(url string) { - this.Redirect(url, 302) - this.StopRun() +func (self *BaseController) AdminAuth() { + // 左侧导航栏 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + if self.userId != 1 { + //普通管理员 + adminAuthIds, _ := models.RoleAuthGetByIds(self.user.RoleIds) + adminAuthIdArr := strings.Split(adminAuthIds, ",") + filters = append(filters, "id__in", adminAuthIdArr) + } + result, _ := models.AuthGetList(1, 1000, filters...) + list := make([]map[string]interface{}, len(result)) + list2 := make([]map[string]interface{}, len(result)) + allow_url := "" + i, j := 0, 0 + for _, v := range result { + if v.AuthUrl != " " || v.AuthUrl != "/" { + allow_url += v.AuthUrl + } + row := make(map[string]interface{}) + if v.Pid == 1 && v.IsShow == 1 { + row["Id"] = int(v.Id) + row["Sort"] = v.Sort + row["AuthName"] = v.AuthName + row["AuthUrl"] = v.AuthUrl + row["Icon"] = v.Icon + row["Pid"] = int(v.Pid) + list[i] = row + i++ + } + if v.Pid != 1 && v.IsShow == 1 { + row["Id"] = int(v.Id) + row["Sort"] = v.Sort + row["AuthName"] = v.AuthName + row["AuthUrl"] = v.AuthUrl + row["Icon"] = v.Icon + row["Pid"] = int(v.Pid) + list2[j] = row + j++ + } + } + + self.Data["SideMenu1"] = list[:i] //一级菜单 + self.Data["SideMenu2"] = list2[:j] //二级菜单 + + self.allowUrl = allow_url + "/home/index" } // 是否POST提交 -func (this *BaseController) isPost() bool { - return this.Ctx.Request.Method == "POST" -} - -// 显示错误信息 -func (this *BaseController) showMsg(args ...string) { - this.Data["message"] = args[0] - redirect := this.Ctx.Request.Referer() - if len(args) > 1 { - redirect = args[1] - } - - this.Data["redirect"] = redirect - this.Data["pageTitle"] = "系统提示" - this.display("error/message") - this.Render() - this.StopRun() -} - -// 输出json -func (this *BaseController) jsonResult(out interface{}) { - this.Data["json"] = out - this.ServeJSON() - this.StopRun() -} - -func (this *BaseController) ajaxMsg(msg interface{}, msgno int) { - out := make(map[string]interface{}) - out["status"] = msgno - out["msg"] = msg - - this.jsonResult(out) +func (self *BaseController) isPost() bool { + return self.Ctx.Request.Method == "POST" } //获取用户IP地址 -func (this *BaseController) getClientIp() string { - s := strings.Split(this.Ctx.Request.RemoteAddr, ":") +func (self *BaseController) getClientIp() string { + s := strings.Split(self.Ctx.Request.RemoteAddr, ":") return s[0] } + +// 重定向 +func (self *BaseController) redirect(url string) { + self.Redirect(url, 302) + self.StopRun() +} + +//加载模板 +func (self *BaseController) display(tpl ...string) { + var tplname string + if len(tpl) > 0 { + tplname = strings.Join([]string{tpl[0], "html"}, ".") + } else { + tplname = self.controllerName + "/" + self.actionName + ".html" + } + self.Layout = "public/layout.html" + self.TplName = tplname +} + +//ajax返回 +func (self *BaseController) ajaxMsg(msg interface{}, msgno int) { + out := make(map[string]interface{}) + out["status"] = msgno + out["message"] = msg + self.Data["json"] = out + self.ServeJSON() + self.StopRun() +} + +//ajax返回 列表 +func (self *BaseController) ajaxList(msg interface{}, msgno int, count int64, data interface{}) { + out := make(map[string]interface{}) + out["code"] = msgno + out["msg"] = msg + out["count"] = count + out["data"] = data + self.Data["json"] = out + self.ServeJSON() + self.StopRun() +} + +//资源分组信息 +func serverGroupLists(authStr string, adminId int) (sgl map[int]string) { + Filters := make([]interface{}, 0) + Filters = append(Filters, "status", 1) + if authStr != "0" && adminId != 1 { + serverGroupIdsArr := strings.Split(authStr, ",") + serverGroupIds := make([]int, 0) + for _, v := range serverGroupIdsArr { + id, _ := strconv.Atoi(v) + serverGroupIds = append(serverGroupIds, id) + } + Filters = append(Filters, "id__in", serverGroupIds) + } + + groupResult, n := models.ServerGroupGetList(1, 1000, Filters...) + sgl = make(map[int]string, n) + for _, gv := range groupResult { + sgl[gv.Id] = gv.GroupName + } + //sgl[0] = "默认分组" + return sgl +} + +func taskGroupLists(authStr string, adminId int) (gl map[int]string) { + groupFilters := make([]interface{}, 0) + groupFilters = append(groupFilters, "status", 1) + if authStr != "0" && adminId != 1 { + taskGroupIdsArr := strings.Split(authStr, ",") + taskGroupIds := make([]int, 0) + for _, v := range taskGroupIdsArr { + id, _ := strconv.Atoi(v) + taskGroupIds = append(taskGroupIds, id) + } + groupFilters = append(groupFilters, "id__in", taskGroupIds) + } + groupResult, n := models.GroupGetList(1, 1000, groupFilters...) + gl = make(map[int]string, n) + for _, gv := range groupResult { + gl[gv.Id] = gv.GroupName + } + return gl +} + +func serverListByGroupId(groupId int) []string { + Filters := make([]interface{}, 0) + Filters = append(Filters, "status", 1) + Filters = append(Filters, "group_id", groupId) + Result, _ := models.TaskServerGetList(1, 1000, Filters...) + + servers := make([]string, 0) + for _, v := range Result { + servers = append(servers, strconv.Itoa(v.Id), v.ServerName) + } + + return servers +} + +type serverList struct { + GroupId int + GroupName string + Servers map[int]string +} + +func serverLists(authStr string, adminId int) (sls []serverList) { + serverGroup := serverGroupLists(authStr, adminId) + Filters := make([]interface{}, 0) + Filters = append(Filters, "status", 0) + + Result, _ := models.TaskServerGetList(1, 1000, Filters...) + for k, v := range serverGroup { + sl := serverList{} + sl.GroupId = k + sl.GroupName = v + servers := make(map[int]string) + for _, sv := range Result { + if sv.GroupId == k { + servers[sv.Id] = sv.ServerName + } + } + sl.Servers = servers + sls = append(sls, sl) + } + return sls +} diff --git a/controllers/home.go b/controllers/home.go new file mode 100644 index 0000000..5015fa4 --- /dev/null +++ b/controllers/home.go @@ -0,0 +1,112 @@ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-08 10:21:13 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-09 18:04:41 +***********************************************/ +package controllers + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/jobs" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" + "runtime" + "time" +) + +type HomeController struct { + BaseController +} + +func (self *HomeController) Index() { + self.Data["pageTitle"] = "系统首页" + //self.display() + self.TplName = "public/main.html" +} + +func (self *HomeController) Start() { + groups_map := serverGroupLists(self.serverGroups, self.userId) + //计算总任务数量 + _, count := models.TaskGetList(1, 200) + // 即将执行的任务 + entries := jobs.GetEntries(30) + jobList := make([]map[string]interface{}, len(entries)) + startJob := 0 //即将执行的任务 + for k, v := range entries { + row := make(map[string]interface{}) + job := v.Job.(*jobs.Job) + task, _ := models.TaskGetById(job.GetId()) + row["task_id"] = job.GetId() + row["task_name"] = job.GetName() + row["task_group"] = groups_map[task.GroupId] + row["next_time"] = beego.Date(v.Next, "Y-m-d H:i:s") + jobList[k] = row + startJob++ + } + + // 最近执行的日志 + logs, _ := models.TaskLogGetList(1, 20) + recentLogs := make([]map[string]interface{}, len(logs)) + failJob := 0 //最近失败的数量 + okJob := 0 //最近成功的数量 + for k, v := range logs { + task, err := models.TaskGetById(v.TaskId) + taskName := "" + if err == nil { + taskName = task.TaskName + } + row := make(map[string]interface{}) + row["task_name"] = taskName + row["id"] = v.Id + row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["process_time"] = float64(v.ProcessTime) / 1000 + row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) + row["output"] = beego.Substr(v.Output, 0, 100) + row["status"] = v.Status + recentLogs[k] = row + if v.Status != 0 { + failJob++ + } else { + okJob++ + } + } + + // 最近执行失败的日志 + logs, _ = models.TaskLogGetList(1, 20, "status__lt", 0) + errLogs := make([]map[string]interface{}, len(logs)) + + for k, v := range logs { + task, err := models.TaskGetById(v.TaskId) + taskName := "" + if err == nil { + taskName = task.TaskName + } + + row := make(map[string]interface{}) + row["task_name"] = taskName + row["id"] = v.Id + row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["process_time"] = float64(v.ProcessTime) / 1000 + row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) + row["error"] = beego.Substr(v.Error, 0, 100) + row["status"] = v.Status + errLogs[k] = row + + } + + self.Data["startJob"] = startJob + self.Data["okJob"] = okJob + self.Data["failJob"] = failJob + self.Data["totalJob"] = count + + self.Data["recentLogs"] = recentLogs + // this.Data["errLogs"] = errLogs + self.Data["jobs"] = jobList + self.Data["cpuNum"] = runtime.NumCPU() + self.display() + + self.Data["pageTitle"] = "系统概况" + self.display() +} diff --git a/controllers/login.go b/controllers/login.go new file mode 100644 index 0000000..2e22cb8 --- /dev/null +++ b/controllers/login.go @@ -0,0 +1,73 @@ +/********************************************** +** @Des: login +** @Author: haodaquan +** @Date: 2017-09-07 16:30:10 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:55:21 +***********************************************/ +package controllers + +import ( + "fmt" + "strconv" + "time" + + "strings" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" +) + +type LoginController struct { + BaseController +} + +func (self *LoginController) Login() { + //if self.userId > 0 { + // self.redirect(beego.URLFor("HomeController.Index")) + //} + self.TplName = "login/login.html" +} + +//登录 TODO:XSRF过滤 +func (self *LoginController) LoginIn() { + + //self.ajaxMsg("登录成功", MSG_OK) + if self.userId > 0 { + self.ajaxMsg("登录成功", MSG_OK) + } + + if self.isPost() { + username := strings.TrimSpace(self.GetString("username")) + password := strings.TrimSpace(self.GetString("password")) + if username != "" && password != "" { + user, err := models.AdminGetByName(username) + fmt.Println(user) + if err != nil || user.Password != libs.Md5([]byte(password+user.Salt)) { + self.ajaxMsg("帐号或密码错误", MSG_ERR) + } else if user.Status == -1 { + self.ajaxMsg("该帐号已禁用", MSG_ERR) + } else { + user.LastIp = self.getClientIp() + user.LastLogin = time.Now().Unix() + user.Update() + authkey := libs.Md5([]byte(self.getClientIp() + "|" + user.Password + user.Salt)) + self.Ctx.SetCookie("auth", strconv.Itoa(user.Id)+"|"+authkey, 7*86400) + + self.ajaxMsg("登录成功", MSG_OK) + } + } + } + self.ajaxMsg("请求方式错误", MSG_ERR) +} + +//登出 +func (self *LoginController) LoginOut() { + self.Ctx.SetCookie("auth", "") + self.redirect(beego.URLFor("LoginController.Login")) +} + +func (self *LoginController) NoAuth() { + self.Ctx.WriteString("没有权限") +} diff --git a/controllers/role.go b/controllers/role.go new file mode 100644 index 0000000..ed29055 --- /dev/null +++ b/controllers/role.go @@ -0,0 +1,184 @@ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-14 14:23:32 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:31:13 +***********************************************/ +package controllers + +import ( + "strconv" + "strings" + "time" + + "fmt" + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" +) + +type RoleController struct { + BaseController +} + +func (self *RoleController) List() { + self.Data["pageTitle"] = "角色管理" + self.display() +} + +func (self *RoleController) Add() { + self.Data["zTree"] = true //引入ztreecss + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.Data["pageTitle"] = "新增角色" + self.display() +} +func (self *RoleController) Edit() { + self.Data["zTree"] = true //引入ztreecss + self.Data["pageTitle"] = "编辑角色" + + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + + id, _ := self.GetInt("id", 0) + role, _ := models.RoleGetById(id) + row := make(map[string]interface{}) + row["id"] = role.Id + row["role_name"] = role.RoleName + row["detail"] = role.Detail + row["detail"] = role.Detail + row["task_group_ids"] = role.TaskGroupIds + row["server_group_ids"] = role.ServerGroupIds + self.Data["role"] = row + + //获取选择的树节点 + roleAuth, _ := models.RoleAuthGetById(id) + authId := make([]int, 0) + for _, v := range roleAuth { + authId = append(authId, v.AuthId) + } + + taskGroupIdsArr := strings.Split(role.TaskGroupIds, ",") + taskGroupIds := make([]int, 0) + for _, v := range taskGroupIdsArr { + id, _ := strconv.Atoi(v) + taskGroupIds = append(taskGroupIds, id) + } + + serverGroupIdsArr := strings.Split(role.ServerGroupIds, ",") + serverGroupIds := make([]int, 0) + for _, v := range serverGroupIdsArr { + id, _ := strconv.Atoi(v) + serverGroupIds = append(serverGroupIds, id) + } + + self.Data["server_group_ids"] = serverGroupIds + self.Data["task_group_ids"] = taskGroupIds + + self.Data["auth"] = authId + self.display() +} + +func (self *RoleController) AjaxSave() { + role := new(models.Role) + role.RoleName = strings.TrimSpace(self.GetString("role_name")) + role.Detail = strings.TrimSpace(self.GetString("detail")) + role.ServerGroupIds = strings.TrimSpace(self.GetString("server_group_ids")) + role.TaskGroupIds = strings.TrimSpace(self.GetString("task_group_ids")) + role.CreateTime = time.Now().Unix() + role.UpdateTime = time.Now().Unix() + role.Status = 1 + + fmt.Println("=========", role) + auths := strings.TrimSpace(self.GetString("nodes_data")) + role_id, _ := self.GetInt("id") + if role_id == 0 { + //新增 + role.CreateTime = time.Now().Unix() + role.UpdateTime = time.Now().Unix() + role.CreateId = self.userId + role.UpdateId = self.userId + if id, err := models.RoleAdd(role); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } else { + ra := new(models.RoleAuth) + authsSlice := strings.Split(auths, ",") + for _, v := range authsSlice { + aid, _ := strconv.Atoi(v) + ra.AuthId = aid + ra.RoleId = id + models.RoleAuthAdd(ra) + } + } + self.ajaxMsg("", MSG_OK) + } + //修改 + role.Id = role_id + role.UpdateTime = time.Now().Unix() + role.UpdateId = self.userId + if err := role.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } else { + // 删除该角色权限 + models.RoleAuthDelete(role_id) + ra := new(models.RoleAuth) + authsSlice := strings.Split(auths, ",") + for _, v := range authsSlice { + aid, _ := strconv.Atoi(v) + ra.AuthId = aid + ra.RoleId = int64(role_id) + models.RoleAuthAdd(ra) + } + + } + self.ajaxMsg("", MSG_OK) +} + +func (self *RoleController) AjaxDel() { + + role_id, _ := self.GetInt("id") + role, _ := models.RoleGetById(role_id) + role.Status = 0 + role.Id = role_id + role.UpdateTime = time.Now().Unix() + + if err := role.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + // 删除该角色权限 + //models.RoleAuthDelete(role_id) + self.ajaxMsg("", MSG_OK) +} + +func (self *RoleController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + roleName := strings.TrimSpace(self.GetString("roleName")) + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + if roleName != "" { + filters = append(filters, "role_name__icontains", roleName) + } + result, count := models.RoleGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["role_name"] = v.RoleName + row["detail"] = v.Detail + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["update_time"] = beego.Date(time.Unix(v.UpdateTime, 0), "Y-m-d H:i:s") + list[k] = row + } + self.ajaxList("成功", MSG_OK, count, list) +} diff --git a/controllers/server.go b/controllers/server.go index f81ddb8..82e4268 100644 --- a/controllers/server.go +++ b/controllers/server.go @@ -1,16 +1,18 @@ -/* -* @Author: haodaquan -* @Date: 2017-08-16 10:27:40 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-08-16 09:17:22 - */ - +/************************************************************ +** @Description: controllers +** @Author: haodaquan +** @Date: 2018-06-09 16:11 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-09 16:11 +*************************************************************/ package controllers import ( - "github.com/astaxie/beego" - "github.com/george518/PPGo_Job/libs" + "fmt" "github.com/george518/PPGo_Job/models" + "golang.org/x/crypto/ssh" + "io/ioutil" + "net" "strconv" "strings" "time" @@ -20,118 +22,329 @@ type ServerController struct { BaseController } -func (this *ServerController) List() { - page, _ := this.GetInt("page") - if page < 1 { - page = 1 +func (self *ServerController) List() { + self.Data["pageTitle"] = "资源管理" + self.display() +} + +func (self *ServerController) Add() { + self.Data["pageTitle"] = "新增服务器资源" + self.Data["serverGroup"] = serverGroupLists(self.serverGroups, self.userId) + self.display() +} + +func (self *ServerController) GetServerByGroupId() { + gid, _ := self.GetInt("gid", 0) + if gid == 0 { + self.ajaxMsg("groupId is not exist", MSG_ERR) } - result, count := models.TaskServerGetList(page, this.pageSize) + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + //serverName := strings.TrimSpace(self.GetString("serverName")) + StatusText := []string{ + "正常", + "禁用", + } + + loginType := [2]string{ + "密码", + "密钥", + } + + serverGroup := serverGroupLists(self.serverGroups, self.userId) + + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 0) + filters = append(filters, "group_id", gid) + + result, count := models.TaskServerGetList(page, self.pageSize, filters...) list := make([]map[string]interface{}, len(result)) for k, v := range result { row := make(map[string]interface{}) row["id"] = v.Id - if(v.Type==0){ - row["type"] = "密码" - }else { - row["type"] = "密钥" - } row["server_name"] = v.ServerName - row["server_ip"] = v.ServerIp row["detail"] = v.Detail - row["port"] = v.Port - row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + if serverGroup[v.GroupId] == "" { + v.GroupId = 0 + } + row["group_name"] = serverGroup[v.GroupId] + row["type"] = loginType[v.Type] + row["status"] = v.Status + row["status_text"] = StatusText[v.Status] list[k] = row } - this.Data["pageTitle"] = "服务器列表" - this.Data["list"] = list - this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("ServerController.List"), true).ToString() - this.display() + + self.ajaxList("成功", MSG_OK, count, list) } -func (this *ServerController) Add() { - if this.isPost() { +func (self *ServerController) Edit() { + self.Data["pageTitle"] = "编辑服务器资源" + + id, _ := self.GetInt("id", 0) + server, _ := models.TaskServerGetById(id) + row := make(map[string]interface{}) + row["id"] = server.Id + row["server_name"] = server.ServerName + row["group_id"] = server.GroupId + row["server_ip"] = server.ServerIp + row["server_account"] = server.ServerAccount + row["server_outer_ip"] = server.ServerOuterIp + row["port"] = server.Port + row["type"] = server.Type + row["password"] = server.Password + row["public_key_src"] = server.PublicKeySrc + row["private_key_src"] = server.PrivateKeySrc + row["detail"] = server.Detail + self.Data["server"] = row + self.Data["serverGroup"] = serverGroupLists(self.serverGroups, self.userId) + self.display() +} + +func (self *ServerController) AjaxTestServer() { + + server := new(models.TaskServer) + server.ServerName = strings.TrimSpace(self.GetString("server_name")) + server.ServerAccount = strings.TrimSpace(self.GetString("server_account")) + server.ServerOuterIp = strings.TrimSpace(self.GetString("server_outer_ip")) + server.ServerIp = strings.TrimSpace(self.GetString("server_ip")) + server.PrivateKeySrc = strings.TrimSpace(self.GetString("private_key_src")) + server.PublicKeySrc = strings.TrimSpace(self.GetString("public_key_src")) + server.Password = strings.TrimSpace(self.GetString("password")) + server.Detail = strings.TrimSpace(self.GetString("detail")) + server.Type, _ = self.GetInt("type") + server.Port, _ = self.GetInt("port") + server.GroupId, _ = self.GetInt("group_id") + + var err error + if server.Type == 0 { + //密码登录 + err = RemoteCommandByPassword(server) + } + + if server.Type == 1 { + //密钥登录 + err = RemoteCommandByKey(server) + } + + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("Success", MSG_OK) + +} + +func RemoteCommandByPassword(servers *models.TaskServer) error { + var ( + auth []ssh.AuthMethod + addr string + clientConfig *ssh.ClientConfig + ) + + auth = make([]ssh.AuthMethod, 0) + auth = append(auth, ssh.Password(servers.Password)) + + clientConfig = &ssh.ClientConfig{ + User: servers.ServerAccount, + Auth: auth, + HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { + return nil + }, + Timeout: 5 * time.Second, + } + + addr = fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) + client, err := ssh.Dial("tcp", addr, clientConfig) + if err == nil { + defer client.Close() + } + return err +} + +func RemoteCommandByKey(servers *models.TaskServer) error { + key, err := ioutil.ReadFile(servers.PrivateKeySrc) + if err != nil { + return err + } + + signer, err := ssh.ParsePrivateKey(key) + if err != nil { + return err + } + addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) + config := &ssh.ClientConfig{ + User: servers.ServerAccount, + Auth: []ssh.AuthMethod{ + // Use the PublicKeys method for remote authentication. + ssh.PublicKeys(signer), + }, + //HostKeyCallback: ssh.FixedHostKey(hostKey), + HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { + return nil + }, + Timeout: 5 * time.Second, + } + + client, err := ssh.Dial("tcp", addr, config) + if err == nil { + client.Close() + } + return err +} + +func (self *ServerController) Copy() { + self.Data["pageTitle"] = "复制服务器资源" + + id, _ := self.GetInt("id", 0) + server, _ := models.TaskServerGetById(id) + row := make(map[string]interface{}) + row["id"] = server.Id + row["server_name"] = server.ServerName + row["group_id"] = server.GroupId + row["server_ip"] = server.ServerIp + row["server_account"] = server.ServerAccount + row["server_outer_ip"] = server.ServerOuterIp + row["port"] = server.Port + row["type"] = server.Type + row["password"] = server.Password + row["public_key_src"] = server.PublicKeySrc + row["private_key_src"] = server.PrivateKeySrc + row["detail"] = server.Detail + self.Data["server"] = row + self.Data["serverGroup"] = serverGroupLists(self.serverGroups, self.userId) + self.display() +} + +func (self *ServerController) AjaxSave() { + server_id, _ := self.GetInt("id") + if server_id == 0 { server := new(models.TaskServer) - server.ServerName = strings.TrimSpace(this.GetString("server_name")) - server.ServerAccount = strings.TrimSpace(this.GetString("server_account")) - server.ServerIp = strings.TrimSpace(this.GetString("server_ip")) - server.Port,_= strconv.Atoi(this.GetString("port")) - server.Type,_ = strconv.Atoi(this.GetString("type")) - server.PrivateKeySrc = strings.TrimSpace(this.GetString("private_key_src")) - server.PublicKeySrc = strings.TrimSpace(this.GetString("public_key_src")) - server.Password = strings.TrimSpace(this.GetString("password")) - server.Detail = strings.TrimSpace(this.GetString("detail")) + server.ServerName = strings.TrimSpace(self.GetString("server_name")) + server.ServerAccount = strings.TrimSpace(self.GetString("server_account")) + server.ServerOuterIp = strings.TrimSpace(self.GetString("server_outer_ip")) + server.ServerIp = strings.TrimSpace(self.GetString("server_ip")) + server.PrivateKeySrc = strings.TrimSpace(self.GetString("private_key_src")) + server.PublicKeySrc = strings.TrimSpace(self.GetString("public_key_src")) + server.Password = strings.TrimSpace(self.GetString("password")) + + server.Detail = strings.TrimSpace(self.GetString("detail")) + server.Type, _ = self.GetInt("type") + server.Port, _ = self.GetInt("port") + server.GroupId, _ = self.GetInt("group_id") + server.CreateTime = time.Now().Unix() server.UpdateTime = time.Now().Unix() server.Status = 0 - _, err := models.TaskServerAdd(server) - if err != nil { - this.ajaxMsg(err.Error(), MSG_ERR) + + if _, err := models.TaskServerAdd(server); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) } - this.ajaxMsg("", MSG_OK) + self.ajaxMsg("", MSG_OK) } - this.Data["pageTitle"] = "添加服务器" - this.display() + + server, _ := models.TaskServerGetById(server_id) + //修改 + server.Id = server_id + server.UpdateTime = time.Now().Unix() + + server.ServerName = strings.TrimSpace(self.GetString("server_name")) + server.ServerAccount = strings.TrimSpace(self.GetString("server_account")) + server.ServerOuterIp = strings.TrimSpace(self.GetString("server_outer_ip")) + server.ServerIp = strings.TrimSpace(self.GetString("server_ip")) + server.PrivateKeySrc = strings.TrimSpace(self.GetString("private_key_src")) + server.PublicKeySrc = strings.TrimSpace(self.GetString("public_key_src")) + server.Detail = strings.TrimSpace(self.GetString("detail")) + server.Password = strings.TrimSpace(self.GetString("password")) + + server.Type, _ = self.GetInt("type") + server.Port, _ = self.GetInt("port") + server.GroupId, _ = self.GetInt("group_id") + + if err := server.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) } -func (this *ServerController) Edit() { - id, _ := this.GetInt("id") - server, err := models.TaskServerGetById(id) +func (self *ServerController) AjaxDel() { + id, _ := self.GetInt("id") + server, _ := models.TaskServerGetById(id) + server.UpdateTime = time.Now().Unix() + server.Status = 1 + server.Id = id + + //TODO 查询服务器是否用于定时任务 + if err := server.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("操作成功", MSG_OK) +} + +func (self *ServerController) Table() { + //列表 + page, err := self.GetInt("page") if err != nil { - this.showMsg(err.Error()) + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + serverName := strings.TrimSpace(self.GetString("serverName")) + StatusText := []string{ + "正常", + "禁用", } - if this.isPost() { - server.ServerName = strings.TrimSpace(this.GetString("server_name")) - server.ServerAccount = strings.TrimSpace(this.GetString("server_account")) - server.ServerIp = strings.TrimSpace(this.GetString("server_ip")) - server.Port,_ = strconv.Atoi(this.GetString("port")) - server.Type,_ = strconv.Atoi(this.GetString("type")) - server.Id,_ = strconv.Atoi(this.GetString("id")) - server.PrivateKeySrc = strings.TrimSpace(this.GetString("private_key_src")) - server.PublicKeySrc = strings.TrimSpace(this.GetString("public_key_src")) - server.Password = strings.TrimSpace(this.GetString("password")) - server.Detail = strings.TrimSpace(this.GetString("detail")) - server.UpdateTime = time.Now().Unix() - server.Status = 0 - err := server.Update() - if err != nil { - this.ajaxMsg(err.Error(), MSG_ERR) + loginType := [2]string{ + "密码", + "密钥", + } + + serverGroup := serverGroupLists(self.serverGroups, self.userId) + + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 0) + if self.userId != 1 { + groups := strings.Split(self.serverGroups, ",") + + groupsIds := make([]int, 0) + for _, v := range groups { + id, _ := strconv.Atoi(v) + groupsIds = append(groupsIds, id) } - this.ajaxMsg("", MSG_OK) + filters = append(filters, "group_id__in", groupsIds) + } + if serverName != "" { + filters = append(filters, "server_name__icontains", serverName) + } + result, count := models.TaskServerGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["server_name"] = v.ServerName + row["detail"] = v.Detail + if serverGroup[v.GroupId] == "" { + v.GroupId = 0 + } + row["group_name"] = serverGroup[v.GroupId] + row["type"] = loginType[v.Type] + row["status"] = v.Status + row["status_text"] = StatusText[v.Status] + list[k] = row } - this.Data["pageTitle"] = "编辑服务器" - this.Data["server"] = server - this.display() -} - -//TODO删除更新 -func (this *ServerController) Batch() { - action := this.GetString("action") - ids := this.GetStrings("ids") - if len(ids) < 1 { - this.ajaxMsg("请选择要操作的项目", MSG_ERR) - } - - for _, v := range ids { - id, _ := strconv.Atoi(v) - if id < 1 { - continue - } - switch action { - case "delete": - //查询服务器是否被占用 - filters := make([]interface{}, 0) - filters = append(filters, "server_id", id) - _, count := models.TaskGetList(1, 1000, filters...) - if count > 0 { - this.ajaxMsg("请先解除该服务器的任务占用", MSG_ERR) - }else{ - models.TaskServerDelById(id) - } - } - } - - this.ajaxMsg("", MSG_OK) + self.ajaxList("成功", MSG_OK, count, list) } diff --git a/controllers/server_group.go b/controllers/server_group.go new file mode 100644 index 0000000..9667e01 --- /dev/null +++ b/controllers/server_group.go @@ -0,0 +1,140 @@ +/************************************************************ +** @Description: controllers +** @Author: haodaquan +** @Date: 2018-06-08 21:57 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-08 21:57 +*************************************************************/ +package controllers + +import ( + "strings" + "time" + + "fmt" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" + "strconv" +) + +type ServerGroupController struct { + BaseController +} + +func (self *ServerGroupController) List() { + self.Data["pageTitle"] = "资源分组管理" + self.display() +} + +func (self *ServerGroupController) Add() { + self.Data["pageTitle"] = "新增分组" + self.display() +} +func (self *ServerGroupController) Edit() { + self.Data["pageTitle"] = "编辑分组" + + id, _ := self.GetInt("id", 0) + group, _ := models.TaskGroupGetById(id) + row := make(map[string]interface{}) + row["id"] = group.Id + row["group_name"] = group.GroupName + row["description"] = group.Description + self.Data["group"] = row + self.display() +} + +func (self *ServerGroupController) AjaxSave() { + servergroup := new(models.ServerGroup) + servergroup.GroupName = strings.TrimSpace(self.GetString("group_name")) + servergroup.Description = strings.TrimSpace(self.GetString("description")) + servergroup.Status = 1 + + servergroup_id, _ := self.GetInt("id") + + fmt.Println(servergroup_id) + if servergroup_id == 0 { + //新增 + servergroup.CreateTime = time.Now().Unix() + servergroup.UpdateTime = time.Now().Unix() + servergroup.CreateId = self.userId + servergroup.UpdateId = self.userId + if _, err := models.ServerGroupAdd(servergroup); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) + } + //修改 + servergroup.Id = servergroup_id + servergroup.UpdateTime = time.Now().Unix() + servergroup.UpdateId = self.userId + if err := servergroup.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *ServerGroupController) AjaxDel() { + + group_id, _ := self.GetInt("id") + group, _ := models.TaskGroupGetById(group_id) + group.Status = 0 + group.Id = group_id + group.UpdateTime = time.Now().Unix() + //TODO 如果分组下有服务器 需要处理 + filters := make([]interface{}, 0) + filters = append(filters, "group_id", group_id) + filters = append(filters, "status", 0) + _, n := models.TaskServerGetList(1, 1, filters...) + if n > 0 { + self.ajaxMsg("分组下有服务器资源,请先处理", MSG_ERR) + } + if err := group.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *ServerGroupController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + groupName := strings.TrimSpace(self.GetString("groupName")) + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + + if self.userId != 1 { + groups := strings.Split(self.serverGroups, ",") + + groupsIds := make([]int, 0) + for _, v := range groups { + id, _ := strconv.Atoi(v) + groupsIds = append(groupsIds, id) + } + filters = append(filters, "id__in", groupsIds) + } + if groupName != "" { + filters = append(filters, "group_name__contains", groupName) + } + result, count := models.ServerGroupGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["group_name"] = v.GroupName + row["description"] = v.Description + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["update_time"] = beego.Date(time.Unix(v.UpdateTime, 0), "Y-m-d H:i:s") + list[k] = row + } + self.ajaxList("成功", MSG_OK, count, list) +} diff --git a/controllers/task.go b/controllers/task.go index 1c748b8..e24b34d 100644 --- a/controllers/task.go +++ b/controllers/task.go @@ -1,76 +1,477 @@ -/* -* @Author: haodaquan -* @Date: 2017-06-21 10:22:29 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-06-23 11:04:54 - */ - +/************************************************************ +** @Description: controllers +** @Author: haodaquan +** @Date: 2018-06-11 21:11 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-11 21:11 +*************************************************************/ package controllers import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/jobs" + "github.com/george518/PPGo_Job/models" + "github.com/robfig/cron" "strconv" "strings" "time" - - "github.com/astaxie/beego" - crons "github.com/george518/PPGo_Job/crons" - "github.com/george518/PPGo_Job/jobs" - "github.com/george518/PPGo_Job/libs" - "github.com/george518/PPGo_Job/models" ) type TaskController struct { BaseController } -// 任务列表 -func (this *TaskController) List() { - page, _ := this.GetInt("page") - if page < 1 { - page = 1 - } - groupId, _ := this.GetInt("groupid") - if groupId > 0 { - this.Ctx.SetCookie("groupid", strconv.Itoa(groupId)+"|job") - } else { - arr := strings.Split(this.Ctx.GetCookie("groupid"), "|") - groupId, _ = strconv.Atoi(arr[0]) +func (self *TaskController) List() { + self.Data["pageTitle"] = "任务管理" + self.display() +} + +func (self *TaskController) AuditList() { + self.Data["pageTitle"] = "任务审核" + self.display() +} + +func (self *TaskController) Add() { + self.Data["pageTitle"] = "新增任务" + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.display() +} + +func (self *TaskController) Edit() { + self.Data["pageTitle"] = "编辑任务" + + id, _ := self.GetInt("id") + task, err := models.TaskGetById(id) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) } - filters := make([]interface{}, 0) - if groupId > 0 && groupId != 99 { - filters = append(filters, "group_id", groupId) + if task.Status == 1 { + self.ajaxMsg("运行状态无法编辑任务,请先暂停任务", MSG_ERR) } - result, count := models.TaskGetList(page, this.pageSize, filters...) + self.Data["task"] = task + + // 分组列表 + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.display() +} + +func (self *TaskController) Copy() { + self.Data["pageTitle"] = "复制任务" + + id, _ := self.GetInt("id") + task, err := models.TaskGetById(id) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.Data["task"] = task + + // 分组列表 + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.display() +} + +func (self *TaskController) Detail() { + self.Data["pageTitle"] = "任务详细" + + id, _ := self.GetInt("id") + task, err := models.TaskGetById(id) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + + TextStatus := []string{ + " 暂停", + " 运行中", + " 待审核", + " 审核失败", + } + + self.Data["TextStatus"] = TextStatus[task.Status] + self.Data["CreateTime"] = beego.Date(time.Unix(task.CreateTime, 0), "Y-m-d H:i:s") + self.Data["UpdateTime"] = beego.Date(time.Unix(task.UpdateTime, 0), "Y-m-d H:i:s") + self.Data["task"] = task + // 分组列表 + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + + serverName := "本地服务器" + if task.ServerId == 0 { + serverName = "本地服务器" + } else { + server, err := models.TaskServerGetById(task.ServerId) + if err == nil { + serverName = server.ServerName + } + } + self.Data["serverName"] = serverName + self.display() +} + +func (self *TaskController) AjaxSave() { + task_id, _ := self.GetInt("id") + if task_id == 0 { + task := new(models.Task) + task.CreateId = self.userId + task.GroupId, _ = self.GetInt("group_id") + task.TaskName = strings.TrimSpace(self.GetString("task_name")) + task.Description = strings.TrimSpace(self.GetString("description")) + task.Concurrent, _ = self.GetInt("concurrent") + task.ServerId, _ = self.GetInt("server_id") + task.CronSpec = strings.TrimSpace(self.GetString("cron_spec")) + task.Command = strings.TrimSpace(self.GetString("command")) + task.Timeout, _ = self.GetInt("timeout") + + msg, isBan := checkCommand(task.Command) + if !isBan { + self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR) + } + + task.CreateTime = time.Now().Unix() + task.UpdateTime = time.Now().Unix() + task.Status = 2 //审核中 + + if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { + self.ajaxMsg("请填写完整信息", MSG_ERR) + } + if _, err := cron.Parse(task.CronSpec); err != nil { + self.ajaxMsg("cron表达式无效", MSG_ERR) + } + if _, err := models.TaskAdd(task); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + + self.ajaxMsg("", MSG_OK) + } + + task, _ := models.TaskGetById(task_id) + //修改 + task.Id = task_id + task.UpdateTime = time.Now().Unix() + task.TaskName = strings.TrimSpace(self.GetString("task_name")) + task.Description = strings.TrimSpace(self.GetString("description")) + task.GroupId, _ = self.GetInt("group_id") + task.Concurrent, _ = self.GetInt("concurrent") + task.ServerId, _ = self.GetInt("server_id") + task.CronSpec = strings.TrimSpace(self.GetString("cron_spec")) + task.Command = strings.TrimSpace(self.GetString("command")) + task.Timeout, _ = self.GetInt("timeout") + task.UpdateId = self.userId + task.Status = 2 //审核中 + + msg, isBan := checkCommand(task.Command) + if !isBan { + self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR) + } + + if err := task.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +//检查是否含有禁用命令 +func checkCommand(command string) (string, bool) { + + filters := make([]interface{}, 0) + filters = append(filters, "status", 0) + ban, _ := models.BanGetList(1, 1000, filters...) + for _, v := range ban { + if strings.Contains(command, v.Code) { + return v.Code, false + } + } + return "", true +} + +func (self *TaskController) AjaxAudit() { + + taskId, _ := self.GetInt("id") + if taskId == 0 { + self.ajaxMsg("任务不存在", MSG_ERR) + } + res := changeStatus(taskId, 0, self.userId) + if !res { + self.ajaxMsg("审核失败", MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxNopass() { + taskId, _ := self.GetInt("id") + if taskId == 0 { + self.ajaxMsg("任务不存在", MSG_ERR) + } + res := changeStatus(taskId, 3, self.userId) + if !res { + self.ajaxMsg("操作失败", MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxStart() { + taskId, _ := self.GetInt("id") + if taskId == 0 { + self.ajaxMsg("任务不存在", MSG_ERR) + } + + task, err := models.TaskGetById(taskId) + if err != nil { + self.ajaxMsg("查不到该任务", MSG_ERR) + } + + if task.Status != 0 { + self.ajaxMsg("任务状态有误", MSG_ERR) + } + + job, err := jobs.NewJobFromTask(task) + if err != nil { + self.ajaxMsg("创建任务失败", MSG_ERR) + } + + if jobs.AddJob(task.CronSpec, job) { + task.Status = 1 + task.Update() + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxPause() { + taskId, _ := self.GetInt("id") + if taskId == 0 { + self.ajaxMsg("任务不存在", MSG_ERR) + } + + task, err := models.TaskGetById(taskId) + if err != nil { + self.ajaxMsg("查不到该任务", MSG_ERR) + } + + jobs.RemoveJob(taskId) + task.Status = 0 + task.Update() + self.ajaxMsg("", MSG_OK) + +} + +// 立即执行 +func (self *TaskController) AjaxRun() { + id, _ := self.GetInt("id") + task, err := models.TaskGetById(id) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + + job, err := jobs.NewJobFromTask(task) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + job.Run() + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxBatchStart() { + idArr := self.GetStrings("ids") + ids := strings.Split(idArr[0], ",") + if len(ids) < 1 { + self.ajaxMsg("请选择要操作的任务", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + + if task, err := models.TaskGetById(id); err == nil { + job, err := jobs.NewJobFromTask(task) + if err == nil { + jobs.AddJob(task.CronSpec, job) + task.Status = 1 + task.Update() + } + } + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxBatchPause() { + idArr := self.GetStrings("ids") + ids := strings.Split(idArr[0], ",") + if len(ids) < 1 { + self.ajaxMsg("请选择要操作的任务", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + jobs.RemoveJob(id) + + if task, err := models.TaskGetById(id); err == nil { + task.Status = 0 + task.Update() + } + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxBatchDel() { + idArr := self.GetStrings("ids") + ids := strings.Split(idArr[0], ",") + if len(ids) < 1 { + self.ajaxMsg("请选择要操作的任务", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + models.TaskDel(id) + models.TaskLogDelByTaskId(id) + jobs.RemoveJob(id) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxBatchAudit() { + idArr := self.GetStrings("ids") + ids := strings.Split(idArr[0], ",") + if len(ids) < 1 { + self.ajaxMsg("请选择要操作的任务", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + changeStatus(id, 0, self.userId) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *TaskController) AjaxBatchNoPass() { + idArr := self.GetStrings("ids") + ids := strings.Split(idArr[0], ",") + if len(ids) < 1 { + self.ajaxMsg("请选择要操作的任务", MSG_ERR) + } + for _, v := range ids { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + changeStatus(id, 3, self.userId) + } + self.ajaxMsg("", MSG_OK) +} + +func changeStatus(taskId, status, userId int) bool { + + if taskId == 0 { + return false + } + task, _ := models.TaskGetById(taskId) + //修改 + task.Id = taskId + task.UpdateTime = time.Now().Unix() + task.UpdateId = userId + task.Status = status //0,1,2,3,9 + + if err := task.Update(); err != nil { + return false + } + return true +} + +func (self *TaskController) AjaxDel() { + id, _ := self.GetInt("id") + task, _ := models.TaskGetById(id) + + task.UpdateTime = time.Now().Unix() + task.UpdateId = self.userId + task.Status = -1 + task.Id = id + + //TODO 查询服务器是否用于定时任务 + if err := task.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("操作成功", MSG_OK) +} + +func (self *TaskController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + status, _ := self.GetInt("status") + + taskName := strings.TrimSpace(self.GetString("taskName")) + StatusText := []string{ + "", + "", + "", + "", + } + + taskGroup := taskGroupLists(self.taskGroups, self.userId) + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + + if status == 2 { + //审核中,审核失败 + ids := []int{2, 3} + filters = append(filters, "status__in", ids) + } else { + ids := []int{0, 1} + filters = append(filters, "status__in", ids) + } + + if self.userId != 1 { + groups := strings.Split(self.taskGroups, ",") + + groupsIds := make([]int, 0) + for _, v := range groups { + id, _ := strconv.Atoi(v) + groupsIds = append(groupsIds, id) + } + filters = append(filters, "group_id__in", groupsIds) + } + + if taskName != "" { + filters = append(filters, "task_name__icontains", taskName) + } + result, count := models.TaskGetList(page, self.pageSize, filters...) list := make([]map[string]interface{}, len(result)) - // 分组列表 - groups, _ := models.TaskGroupGetList(1, 100) - groups_map := make(map[int]string) - for _, gname := range groups { - groups_map[gname.Id] = gname.GroupName - } - - //服务器列表 - servers, _ := models.TaskServerGetList(1, 100) - - server_map := make(map[int]string) - for _, sname := range servers { - server_map[sname.Id] = sname.ServerName - } - server_map[0] = "本地" for k, v := range result { row := make(map[string]interface{}) row["id"] = v.Id - row["name"] = v.TaskName - row["cron_spec"] = v.CronSpec - row["status"] = v.Status + + groupName := "默认分组" + + if name, ok := taskGroup[v.GroupId]; ok { + groupName = name + } + + row["group_name"] = groupName + row["task_name"] = StatusText[v.Status] + " " + groupName + "-" + " " + v.TaskName row["description"] = v.Description - row["group_id"] = v.GroupId - row["group_name"] = groups_map[v.GroupId] - row["server_name"] = server_map[v.ServerId] - row["is_odd"] = k % 2 + + //row["status_text"] = StatusText[v.Status] + row["status"] = v.Status + row["pre_time"] = beego.Date(time.Unix(v.PrevTime, 0), "Y-m-d H:i:s") + row["execute_times"] = v.ExecuteTimes e := jobs.GetEntryById(v.Id) if e != nil { @@ -91,305 +492,9 @@ func (this *TaskController) List() { } row["running"] = 0 } + list[k] = row } - this.Data["pageTitle"] = "任务列表" - this.Data["list"] = list - this.Data["groups"] = groups - this.Data["groupid"] = groupId - this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("TaskController.List", "groupid", groupId), true).ToString() - this.display() -} - -// 添加任务 -func (this *TaskController) Add() { - - if this.isPost() { - task := new(models.Task) - task.UserId = this.userId - task.GroupId, _ = this.GetInt("group_id") - task.TaskName = strings.TrimSpace(this.GetString("task_name")) - task.Description = strings.TrimSpace(this.GetString("description")) - task.Concurrent, _ = this.GetInt("concurrent") - task.ServerId, _ = this.GetInt("server_id") - task.CronSpec = strings.TrimSpace(this.GetString("cron_spec")) - task.Command = strings.TrimSpace(this.GetString("command")) - task.Timeout, _ = this.GetInt("timeout") - - if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { - this.ajaxMsg("请填写完整信息", MSG_ERR) - } - if _, err := crons.Parse(task.CronSpec); err != nil { - this.ajaxMsg("cron表达式无效", MSG_ERR) - } - if _, err := models.TaskAdd(task); err != nil { - this.ajaxMsg(err.Error(), MSG_ERR) - } - - this.ajaxMsg("", MSG_OK) - } - - // 分组列表 - groups, _ := models.TaskGroupGetList(1, 100) - this.Data["groups"] = groups - //服务器分组 - servers, _ := models.TaskServerGetList(1, 100) - this.Data["servers"] = servers - this.Data["pageTitle"] = "添加任务" - this.display() -} - -// 编辑任务 -func (this *TaskController) Edit() { - id, _ := this.GetInt("id") - - task, err := models.TaskGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - - if task.Status != 0 { - this.ajaxMsg("激活状态无法编辑任务,请先暂停任务", MSG_ERR) - } - - if this.isPost() { - task.TaskName = strings.TrimSpace(this.GetString("task_name")) - task.Description = strings.TrimSpace(this.GetString("description")) - task.GroupId, _ = this.GetInt("group_id") - task.Concurrent, _ = this.GetInt("concurrent") - task.ServerId, _ = this.GetInt("server_id") - task.CronSpec = strings.TrimSpace(this.GetString("cron_spec")) - task.Command = strings.TrimSpace(this.GetString("command")) - task.Timeout, _ = this.GetInt("timeout") - if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { - this.ajaxMsg("请填写完整信息", MSG_ERR) - } - if _, err := crons.Parse(task.CronSpec); err != nil { - this.ajaxMsg("cron表达式无效", MSG_ERR) - } - if err := task.Update(); err != nil { - this.ajaxMsg(err.Error(), MSG_ERR) - } - - this.ajaxMsg("", MSG_OK) - } - - // 分组列表 - groups, _ := models.TaskGroupGetList(1, 100) - this.Data["groups"] = groups - //服务器分组 - servers, _ := models.TaskServerGetList(1, 100) - this.Data["servers"] = servers - - this.Data["task"] = task - this.Data["pageTitle"] = "编辑任务" - this.display() -} - -//复制任务 -func (this *TaskController) Copy() { - - id, _ := this.GetInt("id") - task, err := models.TaskGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - // 分组列表 - groups, _ := models.TaskGroupGetList(1, 100) - this.Data["groups"] = groups - //服务器分组 - servers, _ := models.TaskServerGetList(1, 100) - this.Data["servers"] = servers - - this.Data["task"] = task - this.Data["pageTitle"] = "复制任务" - this.display() -} - -// 任务执行日志列表 -func (this *TaskController) Logs() { - taskId, _ := this.GetInt("id") - page, _ := this.GetInt("page") - if page < 1 { - page = 1 - } - - task, err := models.TaskGetById(taskId) - if err != nil { - this.showMsg(err.Error()) - } - - result, count := models.TaskLogGetList(page, this.pageSize, "task_id", task.Id) - - list := make([]map[string]interface{}, len(result)) - for k, v := range result { - row := make(map[string]interface{}) - row["id"] = v.Id - row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") - row["process_time"] = float64(v.ProcessTime) / 1000 - row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) - row["status"] = v.Status - list[k] = row - } - - this.Data["pageTitle"] = "任务执行日志" - this.Data["list"] = list - this.Data["task"] = task - this.Data["pageBar"] = libs.NewPager(page, int(count), this.pageSize, beego.URLFor("TaskController.Logs", "id", taskId), true).ToString() - this.display() -} - -// 查看日志详情 -func (this *TaskController) ViewLog() { - id, _ := this.GetInt("id") - - taskLog, err := models.TaskLogGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - - task, err := models.TaskGetById(taskLog.TaskId) - if err != nil { - this.showMsg(err.Error()) - } - - data := make(map[string]interface{}) - data["id"] = taskLog.Id - data["output"] = taskLog.Output - data["error"] = taskLog.Error - data["start_time"] = beego.Date(time.Unix(taskLog.CreateTime, 0), "Y-m-d H:i:s") - data["process_time"] = float64(taskLog.ProcessTime) / 1000 - data["ouput_size"] = libs.SizeFormat(float64(len(taskLog.Output))) - data["status"] = taskLog.Status - - this.Data["task"] = task - this.Data["data"] = data - this.Data["pageTitle"] = "查看日志" - this.display() -} - -// 批量操作日志 -func (this *TaskController) LogBatch() { - action := this.GetString("action") - ids := this.GetStrings("ids") - if len(ids) < 1 { - this.ajaxMsg("请选择要操作的项目", MSG_ERR) - } - for _, v := range ids { - id, _ := strconv.Atoi(v) - if id < 1 { - continue - } - switch action { - case "delete": - models.TaskLogDelById(id) - } - } - - this.ajaxMsg("", MSG_OK) -} - -// 批量操作 -func (this *TaskController) Batch() { - action := this.GetString("action") - ids := this.GetStrings("ids") - if len(ids) < 1 { - this.ajaxMsg("请选择要操作的项目", MSG_ERR) - } - - for _, v := range ids { - id, _ := strconv.Atoi(v) - if id < 1 { - continue - } - switch action { - case "active": - if task, err := models.TaskGetById(id); err == nil { - job, err := jobs.NewJobFromTask(task) - if err == nil { - jobs.AddJob(task.CronSpec, job) - task.Status = 1 - task.Update() - } - } - case "pause": - jobs.RemoveJob(id) - - if task, err := models.TaskGetById(id); err == nil { - task.Status = 0 - task.Update() - } - - case "delete": - models.TaskDel(id) - models.TaskLogDelByTaskId(id) - jobs.RemoveJob(id) - } - } - - this.ajaxMsg("", MSG_OK) -} - -// 启动任务 -func (this *TaskController) Start() { - id, _ := this.GetInt("id") - - task, err := models.TaskGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - - job, err := jobs.NewJobFromTask(task) - if err != nil { - this.showMsg(err.Error()) - } - - if jobs.AddJob(task.CronSpec, job) { - task.Status = 1 - task.Update() - } - - refer := this.Ctx.Request.Referer() - if refer == "" { - refer = beego.URLFor("TaskController.List") - } - this.redirect(refer) -} - -// 暂停任务 -func (this *TaskController) Pause() { - id, _ := this.GetInt("id") - - task, err := models.TaskGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - - jobs.RemoveJob(id) - task.Status = 0 - task.Update() - - refer := this.Ctx.Request.Referer() - if refer == "" { - refer = beego.URLFor("TaskController.List") - } - this.redirect(refer) -} - -// 立即执行 -func (this *TaskController) Run() { - id, _ := this.GetInt("id") - - task, err := models.TaskGetById(id) - if err != nil { - this.showMsg(err.Error()) - } - - job, err := jobs.NewJobFromTask(task) - if err != nil { - this.showMsg(err.Error()) - } - job.Run() - this.redirect(beego.URLFor("TaskController.ViewLog", "id", job.GetLogId())) + self.ajaxList("成功", MSG_OK, count, list) } diff --git a/controllers/task_group.go b/controllers/task_group.go new file mode 100644 index 0000000..994029e --- /dev/null +++ b/controllers/task_group.go @@ -0,0 +1,140 @@ +/************************************************************ +** @Description: controllers +** @Author: haodaquan +** @Date: 2018-06-10 22:24 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-10 22:24 +*************************************************************/ +package controllers + +import ( + "strings" + "time" + + "fmt" + + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/models" + "strconv" +) + +type GroupController struct { + BaseController +} + +func (self *GroupController) List() { + self.Data["pageTitle"] = "任务分组管理" + self.display() +} + +func (self *GroupController) Add() { + self.Data["pageTitle"] = "新增分组" + self.display() +} +func (self *GroupController) Edit() { + self.Data["pageTitle"] = "编辑分组" + + id, _ := self.GetInt("id", 0) + group, _ := models.GroupGetById(id) + row := make(map[string]interface{}) + row["id"] = group.Id + row["group_name"] = group.GroupName + row["description"] = group.Description + self.Data["group"] = row + self.display() +} + +func (self *GroupController) AjaxSave() { + group := new(models.Group) + group.GroupName = strings.TrimSpace(self.GetString("group_name")) + group.Description = strings.TrimSpace(self.GetString("description")) + group.Status = 1 + + group_id, _ := self.GetInt("id") + + fmt.Println(group_id) + if group_id == 0 { + //新增 + group.CreateTime = time.Now().Unix() + group.UpdateTime = time.Now().Unix() + group.CreateId = self.userId + group.UpdateId = self.userId + if _, err := models.GroupAdd(group); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) + } + //修改 + group.Id = group_id + group.UpdateTime = time.Now().Unix() + group.UpdateId = self.userId + if err := group.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *GroupController) AjaxDel() { + + group_id, _ := self.GetInt("id") + group, _ := models.GroupGetById(group_id) + group.Status = 0 + group.Id = group_id + group.UpdateTime = time.Now().Unix() + //TODO 如果分组下有任务 不处理 + //filters := make([]interface{}, 0) + //filters = append(filters, "group_id", group_id) + //filters = append(filters, "status", 0) + //_, n := models.TaskServerGetList(1, 1, filters...) + //if n > 0 { + // self.ajaxMsg("分组下有服务器资源,请先处理", MSG_ERR) + //} + if err := group.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} + +func (self *GroupController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + groupName := strings.TrimSpace(self.GetString("groupName")) + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + filters = append(filters, "status", 1) + + if self.userId != 1 { + groups := strings.Split(self.taskGroups, ",") + + groupsIds := make([]int, 0) + for _, v := range groups { + id, _ := strconv.Atoi(v) + groupsIds = append(groupsIds, id) + } + filters = append(filters, "id__in", groupsIds) + } + if groupName != "" { + filters = append(filters, "group_name__contains", groupName) + } + result, count := models.GroupGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["group_name"] = v.GroupName + row["description"] = v.Description + row["create_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["update_time"] = beego.Date(time.Unix(v.UpdateTime, 0), "Y-m-d H:i:s") + list[k] = row + } + self.ajaxList("成功", MSG_OK, count, list) +} diff --git a/controllers/task_log.go b/controllers/task_log.go new file mode 100644 index 0000000..709070f --- /dev/null +++ b/controllers/task_log.go @@ -0,0 +1,168 @@ +/************************************************************ +** @Description: controllers +** @Author: george hao +** @Date: 2018-07-05 16:43 +** @Last Modified by: george hao +** @Last Modified time: 2018-07-05 16:43 +*************************************************************/ +package controllers + +import ( + "github.com/astaxie/beego" + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" + "strconv" + + "strings" + "time" +) + +type TaskLogController struct { + BaseController +} + +func (self *TaskLogController) List() { + taskId, err := self.GetInt("task_id") + if err != nil { + taskId = 1 + } + + task, err := models.TaskGetById(taskId) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.Data["pageTitle"] = "日志管理 - " + task.TaskName + "(#" + strconv.Itoa(task.Id) + ")" + self.Data["task_id"] = task.Id + self.display() +} + +func (self *TaskLogController) Table() { + //列表 + page, err := self.GetInt("page") + if err != nil { + page = 1 + } + limit, err := self.GetInt("limit") + if err != nil { + limit = 30 + } + + self.pageSize = limit + //查询条件 + filters := make([]interface{}, 0) + taskId, err := self.GetInt("task_id") + if err != nil { + taskId = 1 + } + + TextStatus := []string{ + " 错误", + " 正常", + } + + Status, err := self.GetInt("status") + + if err == nil && Status != 9 { + status := Status + 1 + filters = append(filters, "status", status) + } + filters = append(filters, "task_id", taskId) + + result, count := models.TaskLogGetList(page, self.pageSize, filters...) + list := make([]map[string]interface{}, len(result)) + + for k, v := range result { + row := make(map[string]interface{}) + row["id"] = v.Id + row["task_id"] = v.TaskId + row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") + row["process_time"] = float64(v.ProcessTime) / 1000 + row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) + index := v.Status + 1 + row["status"] = TextStatus[index] + + list[k] = row + } + + self.ajaxList("成功", MSG_OK, count, list) +} + +func (self *TaskLogController) Detail() { + + //日志内容 + id, _ := self.GetInt("id") + tasklog, err := models.TaskLogGetById(id) + if err != nil { + self.Ctx.WriteString("日志不存在") + return + } + LogTextStatus := []string{ + " 错误", + " 正常", + } + row := make(map[string]interface{}) + row["id"] = tasklog.Id + row["task_id"] = tasklog.TaskId + row["start_time"] = beego.Date(time.Unix(tasklog.CreateTime, 0), "Y-m-d H:i:s") + row["process_time"] = float64(tasklog.ProcessTime) / 1000 + row["ouput_size"] = libs.SizeFormat(float64(len(tasklog.Output))) + row["ouput"] = tasklog.Output + row["error"] = tasklog.Error + + index := tasklog.Status + 1 + row["status"] = LogTextStatus[index] + + self.Data["taskLog"] = row + + //任务详情 + task, err := models.TaskGetById(tasklog.TaskId) + if err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + TextStatus := []string{ + " 暂停", + " 运行中", + " 待审核", + " 审核失败", + } + + self.Data["TextStatus"] = TextStatus[task.Status] + self.Data["CreateTime"] = beego.Date(time.Unix(task.CreateTime, 0), "Y-m-d H:i:s") + self.Data["UpdateTime"] = beego.Date(time.Unix(task.UpdateTime, 0), "Y-m-d H:i:s") + self.Data["task"] = task + // 分组列表 + self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) + + serverName := "本地服务器" + if task.ServerId == 0 { + serverName = "本地服务器" + } else { + server, err := models.TaskServerGetById(task.ServerId) + if err == nil { + serverName = server.ServerName + } + } + self.Data["serverName"] = serverName + self.Data["pageTitle"] = "日志详细" + "(#" + strconv.Itoa(id) + ")" + self.display() +} + +// 批量操作日志 +func (self *TaskLogController) AjaxDel() { + ids := self.GetStrings("ids") + idArr := strings.Split(ids[0], ",") + + if len(idArr) < 1 { + self.ajaxMsg("请选择要操作的项目", MSG_ERR) + } + + for _, v := range idArr { + id, _ := strconv.Atoi(v) + if id < 1 { + continue + } + models.TaskLogDelById(id) + } + + self.ajaxMsg("", MSG_OK) +} diff --git a/controllers/user.go b/controllers/user.go new file mode 100644 index 0000000..8f42576 --- /dev/null +++ b/controllers/user.go @@ -0,0 +1,78 @@ +/********************************************** +** @Des: 用户 +** @Author: haodaquan +** @Date: 2017-09-16 14:17:37 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:14:07 +***********************************************/ +package controllers + +import ( + "strings" + "time" + + "github.com/george518/PPGo_Job/libs" + "github.com/george518/PPGo_Job/models" +) + +type UserController struct { + BaseController +} + +func (self *UserController) Edit() { + self.Data["pageTitle"] = "资料修改" + id := self.userId + Admin, _ := models.AdminGetById(id) + row := make(map[string]interface{}) + row["id"] = Admin.Id + row["login_name"] = Admin.LoginName + row["real_name"] = Admin.RealName + row["phone"] = Admin.Phone + row["email"] = Admin.Email + self.Data["admin"] = row + self.display() +} + +func (self *UserController) AjaxSave() { + Admin_id, _ := self.GetInt("id") + Admin, _ := models.AdminGetById(Admin_id) + //修改 + Admin.Id = Admin_id + Admin.UpdateTime = time.Now().Unix() + Admin.UpdateId = self.userId + Admin.LoginName = strings.TrimSpace(self.GetString("login_name")) + Admin.RealName = strings.TrimSpace(self.GetString("real_name")) + Admin.Phone = strings.TrimSpace(self.GetString("phone")) + Admin.Email = strings.TrimSpace(self.GetString("email")) + + resetPwd := self.GetString("reset_pwd") + if resetPwd == "1" { + pwdOld := strings.TrimSpace(self.GetString("password_old")) + pwdOldMd5 := libs.Md5([]byte(pwdOld + Admin.Salt)) + if Admin.Password != pwdOldMd5 { + self.ajaxMsg("旧密码错误", MSG_ERR) + } + + pwdNew1 := strings.TrimSpace(self.GetString("password_new1")) + pwdNew2 := strings.TrimSpace(self.GetString("password_new2")) + + if len(pwdNew1) < 6 { + self.ajaxMsg("密码长度需要六位以上", MSG_ERR) + } + if pwdNew1 != pwdNew2 { + self.ajaxMsg("两次密码不一致", MSG_ERR) + } + + pwd, salt := libs.Password(4, pwdNew1) + Admin.Password = pwd + Admin.Salt = salt + } + Admin.UpdateTime = time.Now().Unix() + Admin.UpdateId = self.userId + Admin.Status = 1 + + if err := Admin.Update(); err != nil { + self.ajaxMsg(err.Error(), MSG_ERR) + } + self.ajaxMsg("", MSG_OK) +} diff --git a/jobs/init.go b/jobs/init.go index 348bc03..54850cb 100644 --- a/jobs/init.go +++ b/jobs/init.go @@ -48,4 +48,3 @@ func runCmdWithTimeout(cmd *exec.Cmd, timeout time.Duration) (error, bool) { return err, false } } - diff --git a/jobs/job.go b/jobs/job.go index 15bc679..6a39a2e 100644 --- a/jobs/job.go +++ b/jobs/job.go @@ -35,6 +35,7 @@ func NewJobFromTask(task *models.Task) (*Job, error) { if task.Id < 1 { return nil, fmt.Errorf("ToJob: 缺少id") } + //本地程序执行 if task.ServerId == 0 { job := NewCommandJob(task.Id, task.TaskName, task.Command) diff --git a/libs/string.go b/libs/string.go index c7b2a80..6df5a7d 100644 --- a/libs/string.go +++ b/libs/string.go @@ -1,16 +1,19 @@ -/* -* @Author: haodaquan -* @Date: 2017-06-20 10:01:39 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-06-20 10:02:07 - */ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-08 00:24:25 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 10:12:06 +***********************************************/ package libs import ( "crypto/md5" "fmt" + "math/rand" "regexp" + "time" ) var emailPattern = regexp.MustCompile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-zA-Z0-9](?:[\\w-]*[\\w])?") @@ -35,3 +38,32 @@ func SizeFormat(size float64) string { func IsEmail(b []byte) bool { return emailPattern.Match(b) } + +func Password(len int, pwdO string) (pwd string, salt string) { + salt = GetRandomString(4) + defaultPwd := "george518" + if pwdO != "" { + defaultPwd = pwdO + } + pwd = Md5([]byte(defaultPwd + salt)) + return pwd, salt +} + +// 生成32位MD5 +// func MD5(text string) string{ +// ctx := md5.New() +// ctx.Write([]byte(text)) +// return hex.EncodeToString(ctx.Sum(nil)) +// } + +//生成随机字符串 +func GetRandomString(lens int) string { + str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + bytes := []byte(str) + result := []byte{} + r := rand.New(rand.NewSource(time.Now().UnixNano())) + for i := 0; i < lens; i++ { + result = append(result, bytes[r.Intn(len(bytes))]) + } + return string(result) +} diff --git a/main.go b/main.go index fe71d1c..e855c2f 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,17 @@ +/************************************************************ +** @Description: PPGo_Job2 +** @Author: haodaquan +** @Date: 2018-06-05 22:24 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-05 22:24 +*************************************************************/ package main import ( "github.com/astaxie/beego" - "github.com/george518/PPGo_Job/models" - _ "github.com/george518/PPGo_Job/routers" - "github.com/george518/PPGo_Job/jobs" + "github.com/george518/PPGo_Job2/jobs" + "github.com/george518/PPGo_Job2/models" + _ "github.com/george518/PPGo_Job2/routers" ) const ( @@ -20,4 +27,4 @@ func init() { func main() { beego.BConfig.WebConfig.Session.SessionOn = true beego.Run() -} \ No newline at end of file +} diff --git a/models/admin.go b/models/admin.go new file mode 100644 index 0000000..1e514cb --- /dev/null +++ b/models/admin.go @@ -0,0 +1,96 @@ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-16 15:42:43 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:48:17 +***********************************************/ +package models + +import ( + "github.com/astaxie/beego/orm" +) + +type Admin struct { + Id int + LoginName string + RealName string + Password string + RoleIds string + Phone string + Email string + Salt string + LastLogin int64 + LastIp string + Status int + CreateId int + UpdateId int + CreateTime int64 + UpdateTime int64 +} + +func (a *Admin) TableName() string { + return TableName("uc_admin") +} + +func AdminAdd(a *Admin) (int64, error) { + return orm.NewOrm().Insert(a) +} + +func AdminGetByName(loginName string) (*Admin, error) { + a := new(Admin) + err := orm.NewOrm().QueryTable(TableName("uc_admin")).Filter("login_name", loginName).One(a) + if err != nil { + return nil, err + } + return a, nil +} + +func AdminGetList(page, pageSize int, filters ...interface{}) ([]*Admin, int64) { + offset := (page - 1) * pageSize + list := make([]*Admin, 0) + query := orm.NewOrm().QueryTable(TableName("uc_admin")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + return list, total +} + +func AdminGetById(id int) (*Admin, error) { + r := new(Admin) + err := orm.NewOrm().QueryTable(TableName("uc_admin")).Filter("id", id).One(r) + if err != nil { + return nil, err + } + return r, nil +} + +func (a *Admin) Update(fields ...string) error { + if _, err := orm.NewOrm().Update(a, fields...); err != nil { + return err + } + return nil +} + +// func RoleAuthDelete(id int) (int64, error) { +// query := orm.NewOrm().QueryTable(TableName("role_auth")) +// return query.Filter("role_id", id).Delete() +// } + +// func RoleAuthMultiAdd(ras []*RoleAuth) (n int, err error) { +// query := orm.NewOrm().QueryTable(TableName("role_auth")) +// i, _ := query.PrepareInsert() +// for _, ra := range ras { +// _, err := i.Insert(ra) +// if err == nil { +// n = n + 1 +// } +// } +// i.Close() // 别忘记关闭 statement +// return n, err +// } diff --git a/models/auth.go b/models/auth.go new file mode 100644 index 0000000..e33defb --- /dev/null +++ b/models/auth.go @@ -0,0 +1,92 @@ +/********************************************** +** @Des: 权限因子 +** @Author: haodaquan +** @Date: 2017-09-09 20:50:36 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 21:42:08 +***********************************************/ +package models + +import ( + "fmt" + + "github.com/astaxie/beego/orm" +) + +type Auth struct { + Id int + AuthName string + AuthUrl string + UserId int + Pid int + Sort int + Icon string + IsShow int + Status int + CreateId int + UpdateId int + CreateTime int64 + UpdateTime int64 +} + +func (a *Auth) TableName() string { + return TableName("uc_auth") +} + +func AuthGetList(page, pageSize int, filters ...interface{}) ([]*Auth, int64) { + offset := (page - 1) * pageSize + list := make([]*Auth, 0) + query := orm.NewOrm().QueryTable(TableName("uc_auth")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("pid", "sort").Limit(pageSize, offset).All(&list) + + return list, total +} + +func AuthGetListByIds(authIds string, userId int) ([]*Auth, error) { + + list1 := make([]*Auth, 0) + var list []orm.Params + //list:=[]orm.Params + var err error + if userId == 1 { + //超级管理员 + _, err = orm.NewOrm().Raw("select id,auth_name,auth_url,pid,icon,is_show from pp_uc_auth where status=? order by pid asc,sort asc", 1).Values(&list) + } else { + _, err = orm.NewOrm().Raw("select id,auth_name,auth_url,pid,icon,is_show from pp_uc_auth where status=1 and id in("+authIds+") order by pid asc,sort asc", authIds).Values(&list) + } + + for k, v := range list { + fmt.Println(k, v) + } + + fmt.Println(list) + return list1, err +} + +func AuthAdd(auth *Auth) (int64, error) { + return orm.NewOrm().Insert(auth) +} + +func AuthGetById(id int) (*Auth, error) { + a := new(Auth) + + err := orm.NewOrm().QueryTable(TableName("uc_auth")).Filter("id", id).One(a) + if err != nil { + return nil, err + } + return a, nil +} + +func (a *Auth) Update(fields ...string) error { + if _, err := orm.NewOrm().Update(a, fields...); err != nil { + return err + } + return nil +} diff --git a/models/ban.go b/models/ban.go new file mode 100644 index 0000000..a1e98fa --- /dev/null +++ b/models/ban.go @@ -0,0 +1,74 @@ +/************************************************************ +** @Description: models +** @Author: haodaquan +** @Date: 2018-06-10 19:51 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-10 19:51 +*************************************************************/ +package models + +import ( + "fmt" + + "github.com/astaxie/beego/orm" +) + +type Ban struct { + Id int + Code string + CreateTime int64 + UpdateTime int64 + Status int +} + +func (t *Ban) TableName() string { + return TableName("task_ban") +} + +func (t *Ban) Update(fields ...string) error { + if t.Code == "" { + return fmt.Errorf("命令不能为空") + } + if _, err := orm.NewOrm().Update(t, fields...); err != nil { + return err + } + return nil +} + +func BanAdd(obj *Ban) (int64, error) { + if obj.Code == "" { + return 0, fmt.Errorf("命令不能为空") + } + return orm.NewOrm().Insert(obj) +} + +func BanGetById(id int) (*Ban, error) { + obj := &Ban{ + Id: id, + } + err := orm.NewOrm().Read(obj) + if err != nil { + return nil, err + } + return obj, nil +} + +func BanDelById(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task_ban")).Filter("id", id).Delete() + return err +} + +func BanGetList(page, pageSize int, filters ...interface{}) ([]*Ban, int64) { + offset := (page - 1) * pageSize + list := make([]*Ban, 0) + query := orm.NewOrm().QueryTable(TableName("task_ban")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + return list, total +} diff --git a/models/init.go b/models/init.go index 4241892..be05a18 100644 --- a/models/init.go +++ b/models/init.go @@ -10,10 +10,11 @@ package models import ( "net/url" + "fmt" + "github.com/astaxie/beego" "github.com/astaxie/beego/orm" _ "github.com/go-sql-driver/mysql" - "github.com/gpmgo/gopm/modules/log" ) func Init() { @@ -27,13 +28,23 @@ func Init() { dbport = "3306" } dsn := dbuser + ":" + dbpassword + "@tcp(" + dbhost + ":" + dbport + ")/" + dbname + "?charset=utf8" - log.Fatal(dsn) - + fmt.Println(dsn) if timezone != "" { dsn = dsn + "&loc=" + url.QueryEscape(timezone) } orm.RegisterDataBase("default", "mysql", dsn) - orm.RegisterModel(new(User), new(Task), new(TaskGroup), new(TaskLog), new(TaskServer)) + orm.RegisterModel( + new(Admin), + new(Auth), + new(Role), + new(RoleAuth), + new(ServerGroup), + new(TaskServer), + new(Ban), + new(Group), + new(Task), + new(TaskLog), + ) if beego.AppConfig.String("runmode") == "dev" { orm.Debug = true diff --git a/models/role.go b/models/role.go new file mode 100644 index 0000000..1527a5a --- /dev/null +++ b/models/role.go @@ -0,0 +1,68 @@ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-14 15:24:51 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:48:52 +***********************************************/ +package models + +import ( + "github.com/astaxie/beego/orm" +) + +type Role struct { + Id int + RoleName string + Detail string + ServerGroupIds string + TaskGroupIds string + Status int + CreateId int + UpdateId int + CreateTime int64 + UpdateTime int64 +} + +func (a *Role) TableName() string { + return TableName("uc_role") +} + +func RoleGetList(page, pageSize int, filters ...interface{}) ([]*Role, int64) { + offset := (page - 1) * pageSize + list := make([]*Role, 0) + query := orm.NewOrm().QueryTable(TableName("uc_role")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + return list, total +} + +func RoleAdd(role *Role) (int64, error) { + id, err := orm.NewOrm().Insert(role) + if err != nil { + return 0, err + } + return id, nil +} + +func RoleGetById(id int) (*Role, error) { + r := new(Role) + err := orm.NewOrm().QueryTable(TableName("uc_role")).Filter("id", id).One(r) + if err != nil { + return nil, err + } + return r, nil +} + +func (r *Role) Update(fields ...string) error { + if _, err := orm.NewOrm().Update(r, fields...); err != nil { + return err + } + return nil +} diff --git a/models/role_auth.go b/models/role_auth.go new file mode 100644 index 0000000..c240f99 --- /dev/null +++ b/models/role_auth.go @@ -0,0 +1,77 @@ +/********************************************** +** @Des: This file ... +** @Author: haodaquan +** @Date: 2017-09-15 11:44:13 +** @Last Modified by: haodaquan +** @Last Modified time: 2017-09-17 11:49:13 +***********************************************/ +package models + +import ( + "bytes" + "strconv" + "strings" + + "github.com/astaxie/beego/orm" +) + +type RoleAuth struct { + AuthId int `orm:"pk"` + RoleId int64 +} + +func (ra *RoleAuth) TableName() string { + return TableName("uc_role_auth") +} + +func RoleAuthAdd(ra *RoleAuth) (int64, error) { + return orm.NewOrm().Insert(ra) +} + +func RoleAuthGetById(id int) ([]*RoleAuth, error) { + list := make([]*RoleAuth, 0) + query := orm.NewOrm().QueryTable(TableName("uc_role_auth")) + _, err := query.Filter("role_id", id).All(&list, "AuthId") + if err != nil { + return nil, err + } + return list, nil +} + +func RoleAuthDelete(id int) (int64, error) { + query := orm.NewOrm().QueryTable(TableName("uc_role_auth")) + return query.Filter("role_id", id).Delete() +} + +//获取多个 +func RoleAuthGetByIds(RoleIds string) (Authids string, err error) { + list := make([]*RoleAuth, 0) + query := orm.NewOrm().QueryTable(TableName("uc_role_auth")) + ids := strings.Split(RoleIds, ",") + _, err = query.Filter("role_id__in", ids).All(&list, "AuthId") + if err != nil { + return "", err + } + b := bytes.Buffer{} + for _, v := range list { + if v.AuthId != 0 && v.AuthId != 1 { + b.WriteString(strconv.Itoa(v.AuthId)) + b.WriteString(",") + } + } + Authids = strings.TrimRight(b.String(), ",") + return Authids, nil +} + +func RoleAuthMultiAdd(ras []*RoleAuth) (n int, err error) { + query := orm.NewOrm().QueryTable(TableName("uc_role_auth")) + i, _ := query.PrepareInsert() + for _, ra := range ras { + _, err := i.Insert(ra) + if err == nil { + n = n + 1 + } + } + i.Close() // 别忘记关闭 statement + return n, err +} diff --git a/models/server.go b/models/server.go new file mode 100644 index 0000000..bf10b93 --- /dev/null +++ b/models/server.go @@ -0,0 +1,116 @@ +/************************************************************ +** @Description: models +** @Author: haodaquan +** @Date: 2018-06-09 16:11 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-09 16:11 +*************************************************************/ +package models + +import ( + "fmt" + + "github.com/astaxie/beego/orm" +) + +type TaskServer struct { + Id int + GroupId int + ServerName string + ServerAccount string + ServerOuterIp string + ServerIp string + Port int + Password string + PrivateKeySrc string + PublicKeySrc string + Type int + Detail string + CreateTime int64 + UpdateTime int64 + Status int +} + +func (t *TaskServer) TableName() string { + return TableName("task_server") +} + +func (t *TaskServer) Update(fields ...string) error { + if t.ServerName == "" { + return fmt.Errorf("服务器名不能为空") + } + if t.ServerIp == "" { + return fmt.Errorf("服务器IP不能为空") + } + + if t.ServerAccount == "" { + return fmt.Errorf("登录账户不能为空") + } + + if t.Type == 0 && t.Password == "" { + return fmt.Errorf("服务器密码不能为空") + } + + if t.Type == 1 && t.PrivateKeySrc == "" { + return fmt.Errorf("私钥不能为空") + } + + if _, err := orm.NewOrm().Update(t, fields...); err != nil { + return err + } + return nil +} + +func TaskServerAdd(obj *TaskServer) (int64, error) { + if obj.ServerName == "" { + return 0, fmt.Errorf("服务器名不能为空") + } + if obj.ServerIp == "" { + return 0, fmt.Errorf("服务器IP不能为空") + } + + if obj.ServerAccount == "" { + return 0, fmt.Errorf("登录账户不能为空") + } + + if obj.Type == 0 && obj.Password == "" { + return 0, fmt.Errorf("服务器密码不能为空") + } + + if obj.Type == 1 && obj.PrivateKeySrc == "" { + return 0, fmt.Errorf("私钥不能为空") + } + return orm.NewOrm().Insert(obj) +} + +func TaskServerGetById(id int) (*TaskServer, error) { + obj := &TaskServer{ + Id: id, + } + err := orm.NewOrm().Read(obj) + if err != nil { + return nil, err + } + return obj, nil +} + +func TaskServerDelById(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task_server")).Filter("id", id).Delete() + return err +} + +func TaskServerGetList(page, pageSize int, filters ...interface{}) ([]*TaskServer, int64) { + + offset := (page - 1) * pageSize + list := make([]*TaskServer, 0) + query := orm.NewOrm().QueryTable(TableName("task_server")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + return list, total +} diff --git a/models/server_group.go b/models/server_group.go new file mode 100644 index 0000000..064ffbe --- /dev/null +++ b/models/server_group.go @@ -0,0 +1,77 @@ +/************************************************************ +** @Description: models +** @Author: haodaquan +** @Date: 2018-06-08 21:49 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-08 21:49 +*************************************************************/ +package models + +import ( + "fmt" + + "github.com/astaxie/beego/orm" +) + +type ServerGroup struct { + Id int + CreateId int + UpdateId int + GroupName string + Description string + CreateTime int64 + UpdateTime int64 + Status int +} + +func (t *ServerGroup) TableName() string { + return TableName("task_server_group") +} + +func (t *ServerGroup) Update(fields ...string) error { + if t.GroupName == "" { + return fmt.Errorf("组名不能为空") + } + if _, err := orm.NewOrm().Update(t, fields...); err != nil { + return err + } + return nil +} + +func ServerGroupAdd(obj *ServerGroup) (int64, error) { + if obj.GroupName == "" { + return 0, fmt.Errorf("组名不能为空") + } + return orm.NewOrm().Insert(obj) +} + +func TaskGroupGetById(id int) (*ServerGroup, error) { + obj := &ServerGroup{ + Id: id, + } + err := orm.NewOrm().Read(obj) + if err != nil { + return nil, err + } + return obj, nil +} + +func ServerGroupDelById(id int) error { + _, err := orm.NewOrm().QueryTable(TableName("task_server_group")).Filter("id", id).Delete() + return err +} + +func ServerGroupGetList(page, pageSize int, filters ...interface{}) ([]*ServerGroup, int64) { + offset := (page - 1) * pageSize + list := make([]*ServerGroup, 0) + query := orm.NewOrm().QueryTable(TableName("task_server_group")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } + total, _ := query.Count() + query.OrderBy("-id").Limit(pageSize, offset).All(&list) + return list, total +} diff --git a/models/task.go b/models/task.go index c893c1c..a6dcf60 100644 --- a/models/task.go +++ b/models/task.go @@ -1,16 +1,17 @@ -/* -* @Author: haodaquan -* @Date: 2017-06-21 12:22:00 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-06-21 12:22:10 - */ - +/************************************************************ +** @Description: models +** @Author: haodaquan +** @Date: 2018-06-11 21:26 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-11 21:26 +*************************************************************/ package models import ( "fmt" - "github.com/astaxie/beego/orm" "time" + + "github.com/astaxie/beego/orm" ) const ( @@ -21,20 +22,21 @@ const ( type Task struct { Id int - UserId int - ServerId int GroupId int + ServerId int TaskName string - TaskType int Description string CronSpec string Concurrent int Command string - Status int Timeout int ExecuteTimes int PrevTime int64 + Status int + CreateId int + UpdateId int CreateTime int64 + UpdateTime int64 } func (t *Task) TableName() string { @@ -50,14 +52,14 @@ func (t *Task) Update(fields ...string) error { func TaskAdd(task *Task) (int64, error) { if task.TaskName == "" { - return 0, fmt.Errorf("TaskName字段不能为空") + return 0, fmt.Errorf("任务名称不能为空") } if task.CronSpec == "" { - return 0, fmt.Errorf("CronSpec字段不能为空") + return 0, fmt.Errorf("时间表达式不能为空") } if task.Command == "" { - return 0, fmt.Errorf("Command字段不能为空") + return 0, fmt.Errorf("命令内容不能为空") } if task.CreateTime == 0 { task.CreateTime = time.Now().Unix() diff --git a/models/task_group.go b/models/task_group.go index a5570df..0b33602 100644 --- a/models/task_group.go +++ b/models/task_group.go @@ -1,30 +1,35 @@ -/* -* @Author: haodaquan -* @Date: 2017-06-21 12:22:37 -* @Last Modified by: haodaquan -* @Last Modified time: 2017-06-21 12:22:55 - */ +/************************************************************ +** @Description: models +** @Author: haodaquan +** @Date: 2018-06-10 22:24 +** @Last Modified by: haodaquan +** @Last Modified time: 2018-06-10 22:24 +*************************************************************/ package models import ( "fmt" + "github.com/astaxie/beego/orm" ) -type TaskGroup struct { +type Group struct { Id int - UserId int + CreateId int + UpdateId int GroupName string Description string CreateTime int64 + UpdateTime int64 + Status int } -func (t *TaskGroup) TableName() string { +func (t *Group) TableName() string { return TableName("task_group") } -func (t *TaskGroup) Update(fields ...string) error { +func (t *Group) Update(fields ...string) error { if t.GroupName == "" { return fmt.Errorf("组名不能为空") } @@ -34,18 +39,17 @@ func (t *TaskGroup) Update(fields ...string) error { return nil } -func TaskGroupAdd(obj *TaskGroup) (int64, error) { +func GroupAdd(obj *Group) (int64, error) { if obj.GroupName == "" { return 0, fmt.Errorf("组名不能为空") } return orm.NewOrm().Insert(obj) } -func TaskGroupGetById(id int) (*TaskGroup, error) { - obj := &TaskGroup{ +func GroupGetById(id int) (*Group, error) { + obj := &Group{ Id: id, } - err := orm.NewOrm().Read(obj) if err != nil { return nil, err @@ -53,17 +57,22 @@ func TaskGroupGetById(id int) (*TaskGroup, error) { return obj, nil } -func TaskGroupDelById(id int) error { +func GroupDelById(id int) error { _, err := orm.NewOrm().QueryTable(TableName("task_group")).Filter("id", id).Delete() return err } -func TaskGroupGetList(page, pageSize int) ([]*TaskGroup, int64) { +func GroupGetList(page, pageSize int, filters ...interface{}) ([]*Group, int64) { offset := (page - 1) * pageSize - list := make([]*TaskGroup, 0) + list := make([]*Group, 0) query := orm.NewOrm().QueryTable(TableName("task_group")) + if len(filters) > 0 { + l := len(filters) + for k := 0; k < l; k += 2 { + query = query.Filter(filters[k].(string), filters[k+1]) + } + } total, _ := query.Count() query.OrderBy("-id").Limit(pageSize, offset).All(&list) - return list, total } diff --git a/ppgo_job2.sql b/ppgo_job2.sql new file mode 100644 index 0000000..96be382 --- /dev/null +++ b/ppgo_job2.sql @@ -0,0 +1,320 @@ +/* + Navicat MySQL Data Transfer + + Source Server : localhost + Source Server Version : 50639 + Source Host : localhost + Source Database : ppgo_job2 + + Target Server Version : 50639 + File Encoding : utf-8 + + Date: 07/13/2018 17:40:58 PM +*/ + +SET NAMES utf8; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for `default` +-- ---------------------------- +DROP TABLE IF EXISTS `default`; +CREATE TABLE `default` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名', + `email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱', + `password` char(32) NOT NULL DEFAULT '' COMMENT '密码', + `salt` char(10) NOT NULL DEFAULT '' COMMENT '密码盐', + `last_login` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间', + `last_ip` char(15) NOT NULL DEFAULT '' COMMENT '最后登录IP', + `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0正常 -1禁用', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_user_name` (`user_name`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `default` +-- ---------------------------- +BEGIN; +INSERT INTO `default` VALUES ('1', 'admin', 'admin@example.com', '7fef6171469e80d32c0559f88b377245', '', '0', '', '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task`; +CREATE TABLE `pp_task` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分组ID', + `server_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器id', + `task_name` varchar(50) NOT NULL DEFAULT '' COMMENT '任务名称', + `description` varchar(200) NOT NULL DEFAULT '' COMMENT '任务描述', + `cron_spec` varchar(100) NOT NULL DEFAULT '' COMMENT '时间表达式', + `concurrent` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '是否只允许一个实例', + `command` text NOT NULL COMMENT '命令详情', + `timeout` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '超时设置 s', + `execute_times` int(11) NOT NULL DEFAULT '0' COMMENT '累计执行次数', + `prev_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上次执行时间', + `status` tinyint(4) NOT NULL DEFAULT '2' COMMENT '-1删除,0停用 1启用 2审核中,3不通过', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `create_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建者ID', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后一次编辑时间', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后一次编辑者ID', + PRIMARY KEY (`id`), + KEY `idx_group_id` (`group_id`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `pp_task` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task` VALUES ('1', '2', '1', '蜜月任务名称', '测试任务说明', '*/2 * * * *', '0', 'echo \"hello\\n\" >> /tmp/test.log', '0', '193', '1531462016', '0', '1497855526', '0', '1530776943', '1'), ('2', '2', '4', '外部测试服务器', '一分钟一次2', '*/2 * * * * *', '0', 'echo \"testeee\\n\" >> /tmp/ppgo.log', '0', '151', '1531462016', '0', '1502876155', '0', '1530774680', '1'), ('3', '1', '1', '重要测试任务222', '2s执行一次', '*/2 * * * *', '0', '/webroot/server/php/bin/php /webroot/www/default/test2.php', '0', '26', '1531275962', '2', '1502936077', '0', '1531274971', '1'), ('9', '6', '8', '密码验证任务23', '5秒执行一次', '*/5 * * * *', '0', '/webroot/server/php/bin/php /webroot/www/default/test2.php', '0', '12', '1502958585', '2', '1502945973', '0', '1531275044', '1'), ('10', '4', '9', '密码验证任务112', '5秒执行一次', '*/5 * * * *', '0', '/webroot/server/php/bin/php /webroot/www/default/test2.php', '0', '29', '1531468808', '3', '1503991581', '0', '1531275153', '1'), ('11', '4', '0', 'sdfsd', 'sdfsd', '* * * * * ?', '0', 'echo \"hello ppgo_job\\n\" >> /tmp/test_ppgo.log', '0', '139', '1531469404', '0', '1530599445', '1', '1531444040', '1'), ('12', '2', '0', '本地服务器测试', '5秒一次', '*/5 * * * * *', '0', 'echo \"hello ppgo\\n\" >> /tmp/ppgo.log', '0', '49', '1531462015', '0', '1530761019', '1', '1530761837', '1'), ('13', '2', '0', '本地服务器测试', '5秒一次', '*/5 * * * * *', '0', 'echo \"hello ppgo\\n\" >> /tmp/ppgo.log', '0', '0', '0', '2', '1531468119', '1', '1531468119', '0'), ('14', '2', '0', '本地服务器测试', '5秒一次', '*/5 * * * * *', '0', 'echo \"hello ppgo\\n\" >> /tmp/ppgo.log', '0', '0', '0', '2', '1531468712', '1', '1531468712', '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task_ban` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task_ban`; +CREATE TABLE `pp_task_ban` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(64) NOT NULL DEFAULT '0' COMMENT '命令', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='权限和角色关系表'; + +-- ---------------------------- +-- Records of `pp_task_ban` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task_ban` VALUES ('1', 'rm -rf', '0', '1528639692', '1'), ('2', 'dd if=/dev/random of=/dev/sda', '1528639322', '1528639588', '0'), ('3', 'mkfs.ext3 /dev/sda', '1528639445', '0', '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task_group` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task_group`; +CREATE TABLE `pp_task_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `group_name` varchar(50) NOT NULL DEFAULT '' COMMENT '组名', + `description` varchar(255) NOT NULL DEFAULT '' COMMENT '说明', + `create_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改者Id', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态:1-正常,0-删除', + PRIMARY KEY (`id`), + KEY `idx_user_id` (`create_id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `pp_task_group` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task_group` VALUES ('1', '抓取任务', '定时抓取网页', '1', '0', '0', '0', '0'), ('2', '测试任务组', '任务分组测试', '0', '0', '1', '1531297875', '1'), ('3', 'dddfsdf', 'ddsdfds', '0', '0', '1', '1528644000', '0'), ('4', '商品任务组', '商品组', '0', '0', '1', '1530760471', '1'), ('5', '另一个任务分组', '另一个任务分组', '1', '1528644075', '1', '1528644096', '0'), ('6', '订单任务组', '订单任务组', '0', '0', '1', '1530760457', '1'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task_log` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task_log`; +CREATE TABLE `pp_task_log` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `task_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务ID', + `output` mediumtext NOT NULL COMMENT '任务输出', + `error` text NOT NULL COMMENT '错误信息', + `status` tinyint(4) NOT NULL COMMENT '状态', + `process_time` int(11) NOT NULL DEFAULT '0' COMMENT '消耗时间/毫秒', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + PRIMARY KEY (`id`), + KEY `idx_task_id` (`task_id`,`create_time`) +) ENGINE=InnoDB AUTO_INCREMENT=465 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `pp_task_log` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task_log` VALUES ('1', '7', '等待10秒\nphp执行完毕', '', '0', '20484', '1502940420'), ('2', '7', '等待10秒\nphp执行完毕', '', '0', '20367', '1502940480'), ('3', '8', '等待11秒\nphp执行完毕', '', '0', '121487', '1502940420'), ('4', '7', '等待10秒\nphp执行完毕', '', '0', '20317', '1502940540'), ('5', '7', '等待10秒\nphp执行完毕', '', '0', '20629', '1502940600'), ('6', '7', '等待10秒\nphp执行完毕', '', '0', '20387', '1502940660'), ('7', '8', '等待11秒\nphp执行完毕', '', '0', '121626', '1502940600'), ('8', '7', '等待10秒\nphp执行完毕', '', '0', '20486', '1502940720'), ('9', '7', '等待10秒\nphp执行完毕', '', '0', '20416', '1502940780'), ('10', '7', '等待10秒\nphp执行完毕', '', '0', '20378', '1502940840'), ('11', '8', '等待11秒\nphp执行完毕', '', '0', '121432', '1502940780'), ('12', '7', '等待10秒\nphp执行完毕', '', '0', '21313', '1502940900'), ('13', '7', '等待10秒\nphp执行完毕', '', '0', '20420', '1502940960'), ('14', '7', '等待10秒\nphp执行完毕', '', '0', '21271', '1502941020'), ('15', '8', '等待11秒\nphp执行完毕', '', '0', '121418', '1502940960'), ('16', '7', '等待10秒\nphp执行完毕', '', '0', '20355', '1502941080'), ('17', '3', '等待11秒\nphp执行完毕', '', '0', '121437', '1502941260'), ('18', '3', '等待11秒\nphp执行完毕', '', '0', '121343', '1502941383'), ('19', '1', '', '', '0', '56', '1502941758'), ('20', '9', '等待11秒\nphp执行完毕', '', '0', '121481', '1502946004'), ('21', '9', '等待11秒\nphp执行完毕', '', '0', '121344', '1502946350'), ('22', '9', '等待11秒\nphp执行完毕', '', '0', '121401', '1502946475'), ('23', '9', '等待11秒\nphp执行完毕', '', '0', '121379', '1502946600'), ('24', '9', '等待11秒\nphp执行完毕', '', '0', '121341', '1502946725'), ('25', '9', '等待11秒\nphp执行完毕', '', '0', '121448', '1502957835'), ('26', '9', '等待11秒\nphp执行完毕', '', '0', '121549', '1502957960'), ('27', '9', '等待11秒\nphp执行完毕', '', '0', '121795', '1502958085'), ('28', '9', '等待11秒\nphp执行完毕', '', '0', '121433', '1502958210'), ('29', '9', '等待11秒\nphp执行完毕', '', '0', '121379', '1502958335'), ('30', '9', '等待11秒\nphp执行完毕', '', '0', '121507', '1502958460'), ('31', '9', '等待11秒\nphp执行完毕', '', '0', '121423', '1502958585'), ('32', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75249', '1504834495'), ('33', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75128', '1504834575'), ('34', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75157', '1504834655'), ('35', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75162', '1504834955'), ('36', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75424', '1504835035'), ('37', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75277', '1504835115'), ('38', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75210', '1504835195'), ('39', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75414', '1504835275'), ('40', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75345', '1504835355'), ('41', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75444', '1504835435'), ('42', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75261', '1504835515'), ('43', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75233', '1504835595'), ('44', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75249', '1504835675'), ('45', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75228', '1504835755'), ('46', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75306', '1504835835'), ('47', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75262', '1504835915'), ('48', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75312', '1504835995'), ('49', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75256', '1504836075'), ('50', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75227', '1504836155'), ('51', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75253', '1504836235'), ('52', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75332', '1504836315'), ('53', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75320', '1504836395'), ('54', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75504', '1504836475'), ('55', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75248', '1504836555'), ('56', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75179', '1504836635'), ('57', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75194', '1504836715'), ('58', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75467', '1512095325'), ('59', '10', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75382', '1512095405'), ('61', '2', '', 'dial tcp 172.16.210.157:22: getsockopt: operation timed out:', '-1', '75535', '1512097500'), ('79', '1', '', 'open /Users/haodaquan/.ssh/pp_rsa: no such file or directory:', '-1', '0', '1530775156'), ('80', '1', '', 'open /Users/haodaquan/.ssh/pp_rsa: no such file or directory:', '-1', '0', '1530775195'), ('81', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530775349'), ('82', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776632'), ('83', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776634'), ('84', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776636'), ('85', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776638'), ('86', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776640'), ('87', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776642'), ('88', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776644'), ('89', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776646'), ('90', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776648'), ('91', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776650'), ('92', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776652'), ('93', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776654'), ('94', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776656'), ('95', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776658'), ('96', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776660'), ('97', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776662'), ('98', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776664'), ('99', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776666'), ('100', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776668'), ('101', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776670'), ('102', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776672'), ('103', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776674'), ('104', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776676'), ('105', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776678'), ('106', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776680'), ('107', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776682'), ('108', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776724'), ('109', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776726'), ('110', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776728'), ('111', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776730'), ('112', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776732'), ('113', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776734'), ('114', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776736'), ('115', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776738'), ('116', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776740'), ('117', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776742'), ('118', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776744'), ('119', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776746'), ('120', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776748'), ('121', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776750'), ('122', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776752'), ('123', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776754'), ('124', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776756'), ('125', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776758'), ('126', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776760'), ('127', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776762'), ('128', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776764'), ('129', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776766'), ('130', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776768'), ('131', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776770'), ('132', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776772'), ('133', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776774'), ('134', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776776'), ('135', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776778'), ('136', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776780'), ('137', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776782'), ('138', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776784'), ('139', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776786'), ('140', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776788'), ('141', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776790'), ('142', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776792'), ('143', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776794'), ('144', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776796'), ('145', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776798'), ('146', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776800'), ('147', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776802'), ('148', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776804'), ('149', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776806'), ('150', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776808'), ('151', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776810'), ('152', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776812'), ('153', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776814'), ('154', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776816'), ('155', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776818'), ('156', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776820'), ('157', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776822'), ('158', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776824'), ('159', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776826'), ('160', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776828'), ('161', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776830'), ('162', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776832'), ('163', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776834'), ('164', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776836'), ('165', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776838'), ('166', '1', '', 'open /Users/haodaquan/.ssh/george_service: no such file or directory:', '-1', '0', '1530776840'), ('167', '1', '', '', '0', '84', '1530776960'), ('168', '1', '', '', '0', '59', '1530776962'), ('169', '1', '', '', '0', '81', '1530776964'), ('170', '1', '', '', '0', '61', '1530776966'), ('171', '1', '', '', '0', '71', '1530776968'), ('172', '1', '', '', '0', '64', '1530776970'), ('173', '1', '', '', '0', '65', '1530776972'), ('174', '1', '', '', '0', '83', '1530776974'), ('175', '1', '', '', '0', '63', '1530776976'), ('176', '1', '', '', '0', '69', '1530776978'), ('177', '1', '', '', '0', '71', '1530776980'), ('178', '1', '', '', '0', '98', '1530776982'), ('179', '1', '', '', '0', '71', '1530776984'), ('180', '1', '', '', '0', '65', '1530776986'), ('181', '1', '', '', '0', '71', '1530776988'), ('182', '1', '', '', '0', '72', '1530776990'), ('183', '1', '', '', '0', '76', '1530776992'), ('184', '1', '', '', '0', '77', '1530777000'), ('185', '1', '', '', '0', '81', '1530777005'), ('186', '1', '', '', '0', '96', '1530777009'), ('187', '2', '', '', '0', '72', '1531207858'), ('188', '2', '', '', '0', '76', '1531207869'), ('189', '2', '', '', '0', '72', '1531207958'), ('190', '12', '', '', '0', '12', '1531207964'), ('191', '12', '', '', '0', '6', '1531207986'), ('192', '12', '', '', '0', '6', '1531208038'), ('193', '12', '', '', '0', '7', '1531208048'), ('194', '12', '', '', '0', '7', '1531208670'), ('195', '12', '', '', '0', '5', '1531208679'), ('196', '12', '', '', '0', '15', '1531209005'), ('197', '12', '', '', '0', '9', '1531210801'), ('198', '12', '', '', '0', '9', '1531210808'), ('199', '12', '', '', '0', '10', '1531211025'), ('200', '2', '', '', '0', '86', '1531211026'), ('201', '2', '', '', '0', '92', '1531211028'), ('202', '12', '', '', '0', '7', '1531211030'), ('203', '2', '', '', '0', '65', '1531211030'), ('204', '2', '', '', '0', '66', '1531211032'), ('205', '2', '', '', '0', '64', '1531211034'), ('206', '12', '', '', '0', '6', '1531211035'), ('207', '2', '', '', '0', '61', '1531211036'), ('208', '2', '', '', '0', '72', '1531211038'), ('209', '12', '', '', '0', '8', '1531211040'), ('210', '2', '', '', '0', '84', '1531211040'), ('211', '2', '', '', '0', '66', '1531211042'), ('212', '2', '', '', '0', '65', '1531211044'), ('213', '12', '', '', '0', '6', '1531211045'), ('214', '2', '', '', '0', '67', '1531211046'), ('215', '2', '', '', '0', '68', '1531211048'), ('216', '12', '', '', '0', '11', '1531211050'), ('217', '2', '', '', '0', '108', '1531211050'), ('218', '2', '', '', '0', '68', '1531211052'), ('219', '12', '', '', '0', '6', '1531211140'), ('220', '12', '', '', '0', '6', '1531211145'), ('221', '12', '', '', '0', '6', '1531211150'), ('222', '12', '', '', '0', '8', '1531211220'), ('223', '12', '', '', '0', '8', '1531211225'), ('224', '12', '', '', '0', '7', '1531211230'), ('225', '1', '', '', '0', '63', '1531211252'), ('226', '1', '', '', '0', '59', '1531211254'), ('227', '1', '', '', '0', '75', '1531211256'), ('228', '1', '', '', '0', '70', '1531211258'), ('229', '1', '', '', '0', '54', '1531211260'), ('230', '1', '', '', '0', '58', '1531211262'), ('231', '12', '', '', '0', '41', '1531271840'), ('232', '12', '', '', '0', '7', '1531271845'), ('233', '12', '', '', '0', '7', '1531271850'), ('234', '12', '', '', '0', '14', '1531271855'), ('235', '12', '', '', '0', '10', '1531271860'), ('236', '12', '', '', '0', '8', '1531271865'), ('237', '3', '', 'Process exited with status 127:', '-1', '60', '1531272684'), ('238', '3', '', 'Process exited with status 127:', '-1', '60', '1531275962'), ('239', '12', '', '', '0', '17', '1531276005'), ('240', '12', '', '', '0', '13', '1531276010'), ('241', '12', '', '', '0', '11', '1531276015'), ('242', '12', '', '', '0', '13', '1531276020'), ('243', '12', '', '', '0', '17', '1531276156'), ('244', '12', '', '', '0', '17', '1531276254'), ('245', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531276361'), ('246', '12', '', '', '0', '19', '1531276528'), ('247', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298874'), ('248', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298875'), ('249', '12', '', '', '0', '25', '1531298875'), ('250', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298876'), ('251', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298877'), ('252', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298878'), ('253', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298879'), ('254', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298880'), ('255', '12', '', '', '0', '9', '1531298880'), ('256', '11', '', 'open ddd: no such file or directory:', '-1', '0', '1531298881'), ('257', '11', 'anaconda-ks.cfg\ngolang.org\ninstall.log\ninstall.log.syslog\nsoft\ntest\ntmall.sh\n公共的\n模板\n视频\n图片\n文档\n下载\n音乐\n桌面\n', '', '0', '762', '1531389132'), ('258', '11', 'anaconda-ks.cfg\ngolang.org\ninstall.log\ninstall.log.syslog\nsoft\ntest\ntmall.sh\n公共的\n模板\n视频\n图片\n文档\n下载\n音乐\n桌面\n', '', '0', '64', '1531389133'), ('259', '11', 'anaconda-ks.cfg\ngolang.org\ninstall.log\ninstall.log.syslog\nsoft\ntest\ntmall.sh\n公共的\n模板\n视频\n图片\n文档\n下载\n音乐\n桌面\n', '', '0', '62', '1531389134'), ('260', '11', 'anaconda-ks.cfg\ngolang.org\ninstall.log\ninstall.log.syslog\nsoft\ntest\ntmall.sh\n公共的\n模板\n视频\n图片\n文档\n下载\n音乐\n桌面\n', '', '0', '1093', '1531389135'), ('261', '11', 'anaconda-ks.cfg\ngolang.org\ninstall.log\ninstall.log.syslog\nsoft\ntest\ntmall.sh\n公共的\n模板\n视频\n图片\n文档\n下载\n音乐\n桌面\n', '', '0', '76', '1531389137'), ('264', '11', '', '', '0', '52', '1531444065'), ('265', '11', '', '', '0', '7', '1531444066'), ('266', '11', '', '', '0', '7', '1531444067'), ('267', '11', '', '', '0', '9', '1531444068'), ('268', '11', '', '', '0', '7', '1531444069'), ('269', '11', '', '', '0', '9', '1531444070'), ('270', '11', '', '', '0', '7', '1531444071'), ('271', '11', '', '', '0', '7', '1531444072'), ('272', '11', '', '', '0', '6', '1531444073'), ('273', '11', '', '', '0', '8', '1531444074'), ('274', '11', '', '', '0', '7', '1531444075'), ('275', '11', '', '', '0', '8', '1531444076'), ('276', '11', '', '', '0', '9', '1531444080'), ('277', '11', '', '', '0', '9', '1531444081'), ('278', '11', '', '', '0', '7', '1531444082'), ('279', '11', '', '', '0', '8', '1531444083'), ('280', '11', '', '', '0', '7', '1531444084'), ('281', '11', '', '', '0', '8', '1531444085'), ('282', '11', '', '', '0', '8', '1531444086'), ('283', '11', '', '', '0', '7', '1531444087'), ('284', '11', '', '', '0', '11', '1531444129'), ('285', '11', '', '', '0', '9', '1531444130'), ('286', '11', '', '', '0', '7', '1531444131'), ('287', '11', '', '', '0', '6', '1531444132'), ('288', '11', '', '', '0', '7', '1531444133'), ('289', '11', '', '', '0', '15', '1531444134'), ('290', '11', '', '', '0', '9', '1531444135'), ('291', '11', '', '', '0', '7', '1531444136'), ('292', '11', '', '', '0', '8', '1531444137'), ('293', '11', '', '', '0', '8', '1531444138'), ('294', '11', '', '', '0', '6', '1531444139'), ('295', '11', '', '', '0', '12', '1531444140'), ('296', '11', '', '', '0', '8', '1531444141'), ('297', '11', '', '', '0', '7', '1531444142'), ('298', '11', '', '', '0', '7', '1531444143'), ('299', '11', '', '', '0', '8', '1531444473'), ('300', '11', '', '', '0', '7', '1531444474'), ('301', '11', '', '', '0', '7', '1531444475'), ('302', '11', '', '', '0', '7', '1531444476'), ('303', '11', '', '', '0', '7', '1531444477'), ('304', '11', '', '', '0', '7', '1531444478'), ('305', '11', '', '', '0', '6', '1531444479'), ('306', '11', '', '', '0', '7', '1531444480'), ('307', '11', '', '', '0', '8', '1531444481'), ('308', '11', '', '', '0', '6', '1531444482'), ('309', '11', '', '', '0', '13', '1531444483'), ('310', '11', '', '', '0', '8', '1531444484'), ('311', '11', '', '', '0', '8', '1531444485'), ('312', '11', '', '', '0', '6', '1531444486'), ('313', '11', '', '', '0', '7', '1531444487'), ('314', '11', '', '', '0', '7', '1531444488'), ('315', '11', '', '', '0', '6', '1531444489'), ('316', '11', '', '', '0', '25', '1531461954'), ('317', '1', '', '', '0', '67', '1531461954'), ('318', '2', '', '', '0', '71', '1531461954'), ('319', '11', '', '', '0', '11', '1531461955'), ('320', '12', '', '', '0', '16', '1531461955'), ('321', '11', '', '', '0', '9', '1531461956'), ('322', '1', '', '', '0', '53', '1531461956'), ('323', '2', '', '', '0', '73', '1531461956'), ('324', '11', '', '', '0', '9', '1531461957'), ('325', '11', '', '', '0', '11', '1531461958'), ('326', '1', '', '', '0', '68', '1531461958'), ('327', '2', '', '', '0', '121', '1531461958'), ('328', '11', '', '', '0', '8', '1531461959'), ('329', '12', '', '', '0', '11', '1531461960'), ('330', '11', '', '', '0', '10', '1531461960'), ('331', '1', '', '', '0', '60', '1531461960'), ('332', '2', '', '', '0', '65', '1531461960'), ('333', '11', '', '', '0', '7', '1531461961'), ('334', '11', '', '', '0', '8', '1531461962'), ('335', '1', '', '', '0', '56', '1531461962'), ('336', '2', '', '', '0', '62', '1531461962'), ('337', '11', '', '', '0', '7', '1531461963'), ('338', '11', '', '', '0', '10', '1531461964'), ('339', '1', '', '', '0', '67', '1531461964'), ('340', '2', '', '', '0', '70', '1531461964'), ('341', '11', '', '', '0', '12', '1531461965'), ('342', '12', '', '', '0', '14', '1531461965'), ('343', '11', '', '', '0', '8', '1531461966'), ('344', '1', '', '', '0', '57', '1531461966'), ('345', '2', '', '', '0', '68', '1531461966'), ('346', '11', '', '', '0', '24', '1531461967'), ('347', '11', '', '', '0', '12', '1531461968'), ('348', '1', '', '', '0', '68', '1531461968'), ('349', '2', '', '', '0', '110', '1531461968'), ('350', '11', '', '', '0', '8', '1531461969'), ('351', '12', '', '', '0', '18', '1531461970'), ('352', '11', '', '', '0', '16', '1531461970'), ('353', '1', '', '', '0', '72', '1531461970'), ('354', '2', '', '', '0', '123', '1531461970'), ('355', '11', '', '', '0', '9', '1531461971'), ('356', '11', '', '', '0', '9', '1531461972'), ('357', '1', '', '', '0', '68', '1531461972'), ('358', '2', '', '', '0', '76', '1531461972'), ('359', '11', '', '', '0', '9', '1531461973'), ('360', '11', '', '', '0', '8', '1531461974'), ('361', '1', '', '', '0', '62', '1531461974'), ('362', '2', '', '', '0', '69', '1531461974'), ('363', '12', '', '', '0', '35', '1531461975'), ('364', '11', '', '', '0', '35', '1531461975'), ('365', '11', '', '', '0', '12', '1531461976'), ('366', '1', '', '', '0', '60', '1531461976'), ('367', '2', '', '', '0', '64', '1531461976'), ('368', '11', '', '', '0', '11', '1531461977'), ('369', '11', '', '', '0', '22', '1531461978'), ('370', '1', '', '', '0', '67', '1531461978'), ('371', '2', '', '', '0', '86', '1531461978'), ('372', '11', '', '', '0', '10', '1531461979'), ('373', '12', '', '', '0', '11', '1531461980'), ('374', '11', '', '', '0', '17', '1531461980'), ('375', '1', '', '', '0', '67', '1531461980'), ('376', '2', '', '', '0', '87', '1531461980'), ('377', '11', '', '', '0', '10', '1531461981'), ('378', '11', '', '', '0', '11', '1531461982'), ('379', '1', '', '', '0', '69', '1531461982'), ('380', '2', '', '', '0', '79', '1531461982'), ('381', '11', '', '', '0', '8', '1531461983'), ('382', '11', '', '', '0', '10', '1531461984'), ('383', '2', '', '', '0', '75', '1531461984'), ('384', '1', '', '', '0', '77', '1531461984'), ('385', '12', '', '', '0', '9', '1531461985'), ('386', '11', '', '', '0', '10', '1531461985'), ('387', '11', '', '', '0', '10', '1531461986'), ('388', '1', '', '', '0', '65', '1531461986'), ('389', '2', '', '', '0', '71', '1531461986'), ('390', '11', '', '', '0', '8', '1531461987'), ('391', '11', '', '', '0', '8', '1531461988'), ('392', '1', '', '', '0', '68', '1531461988'), ('393', '2', '', '', '0', '68', '1531461988'), ('394', '11', '', '', '0', '8', '1531461989'), ('395', '12', '', '', '0', '15', '1531461990'), ('396', '11', '', '', '0', '20', '1531461990'), ('397', '2', '', '', '0', '74', '1531461990'), ('398', '1', '', '', '0', '77', '1531461990'), ('399', '11', '', '', '0', '8', '1531461991'), ('400', '11', '', '', '0', '9', '1531461992'), ('401', '1', '', '', '0', '63', '1531461992'), ('402', '2', '', '', '0', '110', '1531461992'), ('403', '11', '', '', '0', '8', '1531461993'), ('404', '11', '', '', '0', '20', '1531461994'), ('405', '1', '', '', '0', '116', '1531461994'), ('406', '2', '', '', '0', '112', '1531461994'), ('407', '12', '', '', '0', '12', '1531461995'), ('408', '11', '', '', '0', '15', '1531461995'), ('409', '11', '', '', '0', '9', '1531461996'), ('410', '1', '', '', '0', '64', '1531461996'), ('411', '2', '', '', '0', '73', '1531461996'), ('412', '11', '', '', '0', '8', '1531461997'), ('413', '11', '', '', '0', '15', '1531461998'), ('414', '1', '', '', '0', '64', '1531461998'), ('415', '2', '', '', '0', '80', '1531461998'), ('416', '11', '', '', '0', '10', '1531461999'), ('417', '12', '', '', '0', '19', '1531462000'), ('418', '11', '', '', '0', '21', '1531462000'), ('419', '1', '', '', '0', '113', '1531462000'), ('420', '2', '', '', '0', '113', '1531462000'), ('421', '11', '', '', '0', '7', '1531462001'), ('422', '11', '', '', '0', '18', '1531462002'), ('423', '1', '', '', '0', '68', '1531462002'), ('424', '2', '', '', '0', '121', '1531462002'), ('425', '11', '', '', '0', '8', '1531462003'), ('426', '11', '', '', '0', '8', '1531462004'), ('427', '1', '', '', '0', '69', '1531462004'), ('428', '2', '', '', '0', '82', '1531462004'), ('429', '12', '', '', '0', '11', '1531462005'), ('430', '11', '', '', '0', '15', '1531462005'), ('431', '11', '', '', '0', '8', '1531462006'), ('432', '1', '', '', '0', '68', '1531462006'), ('433', '2', '', '', '0', '69', '1531462006'), ('434', '11', '', '', '0', '9', '1531462007'), ('435', '11', '', '', '0', '11', '1531462008'), ('436', '1', '', '', '0', '67', '1531462008'), ('437', '2', '', '', '0', '86', '1531462008'), ('438', '11', '', '', '0', '9', '1531462009'), ('439', '12', '', '', '0', '13', '1531462010'), ('440', '11', '', '', '0', '15', '1531462010'), ('441', '1', '', '', '0', '72', '1531462010'), ('442', '2', '', '', '0', '74', '1531462010'), ('443', '11', '', '', '0', '10', '1531462011'), ('444', '11', '', '', '0', '13', '1531462012'), ('445', '1', '', '', '0', '67', '1531462012'), ('446', '2', '', '', '0', '82', '1531462012'), ('447', '11', '', '', '0', '6', '1531462013'), ('448', '11', '', '', '0', '9', '1531462014'), ('449', '1', '', '', '0', '67', '1531462014'), ('450', '2', '', '', '0', '66', '1531462014'), ('451', '12', '', '', '0', '11', '1531462015'), ('452', '11', '', '', '0', '13', '1531462015'), ('453', '11', '', '', '0', '9', '1531462016'), ('454', '1', '', '', '0', '63', '1531462016'), ('455', '2', '', '', '0', '76', '1531462016'), ('456', '10', '', 'Process exited with status 1:', '-1', '395', '1531468808'), ('457', '11', '', '', '0', '39', '1531469379'), ('458', '11', '', '', '0', '9', '1531469380'), ('459', '11', '', '', '0', '9', '1531469381'), ('460', '11', '', '', '0', '7', '1531469382'), ('461', '11', '', '', '0', '7', '1531469383'), ('462', '11', '', '', '0', '8', '1531469384'), ('463', '11', '', '', '0', '8', '1531469385'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task_server` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task_server`; +CREATE TABLE `pp_task_server` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID', + `group_id` int(64) NOT NULL, + `server_name` varchar(64) NOT NULL DEFAULT '0' COMMENT '服务器名称', + `server_account` varchar(32) NOT NULL DEFAULT 'root' COMMENT '账户名称', + `server_outer_ip` varchar(20) NOT NULL DEFAULT '0' COMMENT '外网IP', + `server_ip` varchar(20) NOT NULL DEFAULT '0' COMMENT '服务器内网IP', + `port` int(4) unsigned NOT NULL DEFAULT '22' COMMENT '服务器端口', + `password` varchar(64) NOT NULL DEFAULT '0' COMMENT '服务器密码', + `private_key_src` varchar(128) NOT NULL DEFAULT '0' COMMENT '私钥文件地址', + `public_key_src` varchar(128) NOT NULL DEFAULT '0' COMMENT '公钥地址', + `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '登录类型:0-密码登录,1-私钥登录', + `detail` varchar(255) NOT NULL DEFAULT '0' COMMENT '备注', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态:0-正常,1-删除', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COMMENT='服务器列表'; + +-- ---------------------------- +-- Records of `pp_task_server` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task_server` VALUES ('1', '2', '密钥验证服务器', 'root', '0', '10.32.33.27', '22', '', '/Users/georgehao/.ssh/george_service', '/Users/georgehao/.ssh/george_service.pub', '1', '远程服务器示例', '1502862723', '1530776931', '0'), ('4', '1', '密码验证服务器', 'root', '0', '10.32.33.27', '22', '123456', '', '', '0', '这是密码验证服务器', '1502945869', '1530774374', '0'), ('5', '5', '改革名字吧', 'sddsss', '1212', '111', '12', '11111111111', '', '', '0', '是法师打发', '1528595874', '1528602429', '1'), ('6', '3', '对对是的发送到方式', 'sddsss', '1212', '111', '22', '123456', '', '', '0', '是法师打发', '1528595887', '1528599948', '1'), ('7', '3', '是的发送到sd', 'dd', '1212', '1121', '22', '', 'sdfdss', 'dfsdf', '1', '的发生的范德萨', '1528598520', '1528602362', '1'), ('8', '1', '服务器名称11', 'root', '11', '11', '22', '121212121', '', '', '0', '12121', '1528991161', '1528991161', '0'), ('9', '1', '服务器22', 'root', '0', '10.32.33.54', '22', '123456', 'ddd', 'dd', '0', '测试', '1528991244', '1531386562', '0'), ('10', '10', '资源分组11的服务器', 'root', '192.11.11.11', '192.168.1.1', '22', '111232', '', '', '0', 'sdfssdfsdf', '1530587951', '1531359684', '0'), ('11', '9', '服务器分组3的服务器', 'root', '192.11.11.11', '192.168.1.1', '22', '111232', '', '', '0', 'sdfssdfsdf', '1531383433', '1531383433', '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_task_server_group` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_task_server_group`; +CREATE TABLE `pp_task_server_group` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `group_name` varchar(50) NOT NULL DEFAULT '0' COMMENT '组名', + `description` varchar(255) NOT NULL DEFAULT '' COMMENT '说明', + `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1-正常,0-删除', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + `create_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新id', + PRIMARY KEY (`id`), + KEY `idx_user_id` (`create_id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `pp_task_server_group` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_task_server_group` VALUES ('1', '南方机房', '南方机房组', '1', '0', '1530760598', '0', '1'), ('2', '北方机房', '北方机房的机器', '1', '0', '1530760568', '0', '1'), ('3', '测试删除分组', '测试删除分组', '0', '0', '1528643885', '1', '1'), ('4', '对对对', '对对对ddd', '0', '1528530609', '1528531447', '1', '1'), ('5', '对对对', '对对对ddd', '0', '1528530704', '1528602442', '1', '1'), ('6', '对对对dd', '对对对ddd', '0', '1528530765', '1528531433', '1', '1'), ('7', '对对对dddd', '对对对ddd', '0', '0', '1528531443', '0', '1'), ('8', 'dd', 'dfdf', '0', '1528531006', '1528531438', '1', '1'), ('9', '服务器分组3', '资源分组3', '1', '0', '1531383057', '0', '1'), ('10', '服务器分组4', '资源分组4', '1', '0', '1531383072', '0', '1'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_uc_admin` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_uc_admin`; +CREATE TABLE `pp_uc_admin` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `login_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名', + `real_name` varchar(32) NOT NULL DEFAULT '0' COMMENT '真实姓名', + `password` char(32) NOT NULL DEFAULT '' COMMENT '密码', + `role_ids` varchar(255) NOT NULL DEFAULT '0' COMMENT '角色id字符串,如:2,3,4', + `phone` varchar(20) NOT NULL DEFAULT '0' COMMENT '手机号码', + `email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱', + `salt` char(10) NOT NULL DEFAULT '' COMMENT '密码盐', + `last_login` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间', + `last_ip` char(15) NOT NULL DEFAULT '' COMMENT '最后登录IP', + `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,1-正常 0禁用', + `create_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建者ID', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改者ID', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_user_name` (`login_name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='管理员表'; + +-- ---------------------------- +-- Records of `pp_uc_admin` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_uc_admin` VALUES ('1', 'admin', '超级管理员', 'abfcf6dcedfb4b5b1505d41a8b4c77e8', '0', '13811551087', 'haodaquan2008@163.com', 'aYk4Q1P83v', '1531469426', '[', '1', '0', '1', '0', '1528462051'), ('2', 'test_1', 'pipi', 'b937149452da9f7a36f304dc00149edc', '1', '13811551000', 'haodaquan@123.com', '1Uep', '1531469465', '[', '1', '1', '1', '1528459479', '1531469623'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_uc_auth` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_uc_auth`; +CREATE TABLE `pp_uc_auth` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID', + `pid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级ID,0为顶级', + `auth_name` varchar(64) NOT NULL DEFAULT '0' COMMENT '权限名称', + `auth_url` varchar(255) NOT NULL DEFAULT '0' COMMENT 'URL地址', + `sort` int(1) unsigned NOT NULL DEFAULT '999' COMMENT '排序,越小越前', + `icon` varchar(255) NOT NULL, + `is_show` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否显示,0-隐藏,1-显示', + `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', + `create_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建者ID', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改者ID', + `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1-正常,0-删除', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8mb4 COMMENT='权限因子'; + +-- ---------------------------- +-- Records of `pp_uc_auth` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_uc_auth` VALUES ('1', '0', '所有权限', '/', '1', '', '0', '1', '1', '1', '1', '1505620970', '1505620970'), ('2', '1', '权限管理', '/', '999', 'fa-id-card', '1', '1', '0', '1', '1', '0', '1505622360'), ('3', '2', '用户管理', '/admin/list', '1', 'fa-user-o', '1', '0', '0', '0', '1', '0', '1528385411'), ('4', '2', '角色管理', '/role/list', '2', 'fa-user-circle-o', '1', '1', '0', '1', '1', '0', '1505621852'), ('5', '3', '新增', '/admin/add', '1', '', '0', '1', '0', '1', '1', '0', '1505621685'), ('6', '3', '修改', '/admin/edit', '2', '', '0', '1', '0', '1', '1', '0', '1505621697'), ('7', '3', '删除', '/admin/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1505621756', '1505621756'), ('8', '4', '新增', '/role/add', '1', '', '1', '1', '0', '1', '1', '0', '1505698716'), ('9', '4', '修改', '/role/edit', '2', '', '0', '1', '1', '1', '1', '1505621912', '1505621912'), ('10', '4', '删除', '/role/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1505621951', '1505621951'), ('11', '2', '权限因子', '/auth/list', '3', 'fa-list', '1', '1', '1', '1', '1', '1505621986', '1505621986'), ('12', '11', '新增', '/auth/add', '1', '', '0', '1', '1', '1', '1', '1505622009', '1505622009'), ('13', '11', '修改', '/auth/edit', '2', '', '0', '1', '1', '1', '1', '1505622047', '1505622047'), ('14', '11', '删除', '/auth/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1505622111', '1505622111'), ('15', '1', '个人中心', 'profile/edit', '1001', 'fa-user-circle-o', '1', '1', '0', '1', '1', '0', '1506001114'), ('16', '15', '资料修改', '/user/edit', '1', 'fa-edit', '1', '0', '0', '0', '1', '1528385551', '1528385551'), ('17', '1', '基本设置', '/', '2', 'fa-cogs', '1', '1', '0', '1', '1', '0', '1528464467'), ('18', '17', '资源分组', '/servergroup/list', '2', 'fa-cubes', '1', '1', '0', '1', '1', '0', '1528466663'), ('19', '17', '资源管理', '/server/list', '1', 'fa-cube', '1', '1', '0', '1', '1', '0', '1528464498'), ('20', '17', '禁用命令', '/ban/list', '3', 'fa-exclamation-triangle', '1', '1', '0', '1', '1', '0', '1528464656'), ('21', '18', '新增', '/servergroup/add', '1', '', '0', '1', '0', '1', '1', '0', '1528466669'), ('22', '18', '修改', '/servergroup/edit', '2', '', '0', '1', '0', '1', '1', '0', '1528466675'), ('23', '18', '删除', '/servergroup/ajaxdel', '3', '', '0', '1', '0', '1', '1', '0', '1528466684'), ('24', '19', '新增', '/server/add', '1', '', '0', '1', '1', '1', '1', '1528464882', '1528464882'), ('25', '19', '修改', '/server/edit', '2', '', '0', '1', '1', '1', '1', '1528464904', '1528464904'), ('26', '19', '删除', '/server/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1528464937', '1528464937'), ('27', '20', '新增', '/ban/add', '1', '', '0', '1', '1', '1', '1', '1528464977', '1528464977'), ('28', '20', '修改', '/ban/edit', '2', '', '0', '1', '1', '1', '1', '1528465005', '1528465005'), ('29', '20', '删除', '/ban/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1528465036', '1528465036'), ('30', '1', '任务管理', '/job/list', '1', 'fa-tasks', '1', '1', '1', '1', '1', '1528639988', '1528639988'), ('31', '30', '任务列表', '/task/list', '1', 'fa-object-ungroup', '1', '1', '0', '1', '1', '0', '1531212830'), ('32', '30', '任务分组', '/group/list', '3', 'fa-object-group', '1', '1', '0', '1', '1', '0', '1531212219'), ('33', '32', '新增', '/group/add', '1', '', '0', '1', '1', '1', '1', '1528640546', '1528640546'), ('34', '32', '编辑', '/group/edit', '2', '', '0', '1', '1', '1', '1', '1528640572', '1528640572'), ('35', '32', '删除', '/group/ajaxdel', '3', '', '0', '1', '1', '1', '1', '1528640604', '1528640604'), ('36', '31', '新增', '/task/add', '1', '', '0', '1', '1', '1', '1', '1528728220', '1528728220'), ('37', '31', '编辑', '/task/edit', '2', '', '0', '1', '1', '1', '1', '1528728251', '1528728251'), ('38', '42', '删除', '/task/ajaxdel', '3', '', '0', '1', '0', '1', '1', '0', '1531279999'), ('39', '31', '查看', '/task/detail', '3', '', '0', '1', '0', '1', '1', '0', '1531279407'), ('40', '42', '审核通过', '/task/ajaxaudit', '5', '', '0', '1', '0', '1', '1', '0', '1531466535'), ('41', '31', '复制', '/task/copy', '5', '', '0', '1', '0', '1', '1', '0', '1531286150'), ('42', '30', '任务审核', '/task/auditlist', '2', 'fa-gavel', '1', '1', '0', '1', '1', '0', '1531212806'), ('43', '42', '批量审核通过', '/task/ajaxbatchaudit', '1', '', '0', '1', '0', '1', '1', '0', '1531466506'), ('44', '42', '批量审核不通过', '/task/ajaxbatchnopass', '2', '', '0', '1', '0', '1', '1', '0', '1531466513'), ('45', '31', '测试执行', '/task/ajaxrun', '4', '', '0', '1', '0', '1', '1', '0', '1531446085'), ('46', '31', '批量暂停', '/task/ajaxbatchpause', '9', '', '0', '1', '0', '1', '1', '0', '1531466394'), ('47', '31', '批量开启', '/task/ajaxbatchstart', '6', '', '0', '1', '0', '1', '1', '0', '1531466385'), ('48', '31', '开启', '/task/ajaxstart', '7', '', '0', '1', '0', '1', '1', '0', '1531466404'), ('49', '31', '暂停', '/task/ajaxpause', '8', '', '0', '1', '0', '1', '1', '0', '1531466411'), ('50', '42', '审核不通过', '/task/ajaxnopass', '6', '', '0', '1', '0', '1', '1', '0', '1531466546'), ('51', '42', '批量删除', '/task/ajaxbatchdel', '4', '', '0', '1', '0', '1', '1', '0', '1531466528'), ('52', '19', '复制', '/server/copy', '3', '', '0', '1', '1', '1', '1', '1531383393', '1531383393'), ('53', '19', '测试', '/server/ajaxtestserver', '5', '', '0', '1', '0', '1', '1', '0', '1531466851'), ('54', '1', '日志管理', '/tasklog/list', '10', 'fa-file-text-o', '0', '1', '1', '1', '1', '1531389296', '1531389296'), ('55', '54', '详情', '/tasklog/detail', '1', '', '0', '1', '1', '1', '1', '1531389347', '1531389347'), ('56', '54', '删除', '/tasklog/ajaxdel', '2', '', '0', '1', '0', '1', '1', '0', '1531466707'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_uc_role` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_uc_role`; +CREATE TABLE `pp_uc_role` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `role_name` varchar(32) NOT NULL DEFAULT '0' COMMENT '角色名称', + `detail` varchar(255) NOT NULL DEFAULT '0' COMMENT '备注', + `server_group_ids` varchar(255) NOT NULL DEFAULT '0' COMMENT '服务器分组权限ids,1,2,3', + `task_group_ids` varchar(255) NOT NULL DEFAULT '0' COMMENT '任务分组权限ids ,1,2,32', + `create_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建者ID', + `update_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改这ID', + `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态1-正常,0-删除', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间', + `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; + +-- ---------------------------- +-- Records of `pp_uc_role` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_uc_role` VALUES ('1', '普通管理员', '可以运行和关闭任务', '10,1,2', '4', '0', '1', '1', '1531469741', '1531469741'), ('2', '高级管理员', '可以批量操作任务,创建任务,创建任务分组,审核任务等', ',10', '4,6', '0', '1', '1', '1531388927', '1531388927'), ('3', '资深管理员', '系统配置,任务管理等', '1,2', '2', '0', '1', '1', '1531298767', '1531298767'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_uc_role_auth` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_uc_role_auth`; +CREATE TABLE `pp_uc_role_auth` ( + `role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色ID', + `auth_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '权限ID', + PRIMARY KEY (`role_id`,`auth_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限和角色关系表'; + +-- ---------------------------- +-- Records of `pp_uc_role_auth` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_uc_role_auth` VALUES ('1', '0'), ('1', '1'), ('1', '15'), ('1', '16'), ('1', '30'), ('1', '31'), ('1', '36'), ('1', '37'), ('1', '41'), ('1', '46'), ('1', '47'), ('1', '49'), ('2', '17'), ('2', '18'), ('2', '19'), ('2', '21'), ('2', '22'), ('2', '23'), ('2', '24'), ('2', '25'), ('2', '26'), ('2', '32'), ('2', '33'), ('2', '34'), ('2', '35'), ('2', '45'), ('2', '52'), ('2', '53'), ('3', '2'), ('3', '3'), ('3', '5'), ('3', '6'), ('3', '7'), ('3', '20'), ('3', '27'), ('3', '28'), ('3', '29'), ('3', '38'), ('3', '40'), ('3', '42'), ('3', '43'), ('3', '44'), ('3', '50'), ('3', '51'); +COMMIT; + +-- ---------------------------- +-- Table structure for `pp_user` +-- ---------------------------- +DROP TABLE IF EXISTS `pp_user`; +CREATE TABLE `pp_user` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名', + `email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱', + `password` char(32) NOT NULL DEFAULT '' COMMENT '密码', + `salt` char(10) NOT NULL DEFAULT '' COMMENT '密码盐', + `last_login` int(11) NOT NULL DEFAULT '0' COMMENT '最后登录时间', + `last_ip` char(15) NOT NULL DEFAULT '' COMMENT '最后登录IP', + `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态,0正常 -1禁用', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_user_name` (`user_name`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of `pp_user` +-- ---------------------------- +BEGIN; +INSERT INTO `pp_user` VALUES ('1', 'admin', 'haodaquan@shoplinq.cn', 'abfcf6dcedfb4b5b1505d41a8b4c77e8', 'aYk4Q1P83v', '1528124357', '[', '0'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/routers/router.go b/routers/router.go index 0b5f892..812b015 100644 --- a/routers/router.go +++ b/routers/router.go @@ -6,13 +6,26 @@ import ( ) func init() { - beego.Router("/", &controllers.MainController{}, "*:Index") - beego.Router("/login", &controllers.MainController{}, "*:Login") - beego.Router("/logout", &controllers.MainController{}, "*:Logout") - beego.Router("/profile", &controllers.MainController{}, "*:Profile") - beego.Router("/gettime", &controllers.MainController{}, "*:GetTime") - beego.Router("/help", &controllers.HelpController{}, "*:Index") + // 默认登录 + beego.Router("/", &controllers.LoginController{}, "*:Login") + beego.Router("/login_in", &controllers.LoginController{}, "*:LoginIn") + beego.Router("/login_out", &controllers.LoginController{}, "*:LoginOut") + //beego.Router("/no_auth", &controllers.LoginController{}, "*:NoAuth") + beego.Router("/home", &controllers.HomeController{}, "*:Index") + beego.Router("/home/start", &controllers.HomeController{}, "*:Start") + beego.AutoRouter(&controllers.TaskController{}) beego.AutoRouter(&controllers.GroupController{}) + beego.AutoRouter(&controllers.TaskLogController{}) + //资源分组管理 + beego.AutoRouter(&controllers.ServerGroupController{}) beego.AutoRouter(&controllers.ServerController{}) + beego.AutoRouter(&controllers.BanController{}) + + //权限用户相关 + beego.AutoRouter(&controllers.AuthController{}) + beego.AutoRouter(&controllers.RoleController{}) + beego.AutoRouter(&controllers.AdminController{}) + beego.AutoRouter(&controllers.UserController{}) + } diff --git a/static/admin/css/app.css b/static/admin/css/app.css new file mode 100644 index 0000000..3c0da6c --- /dev/null +++ b/static/admin/css/app.css @@ -0,0 +1,97 @@ +/* +* @Author: georgehao +* @Date: 2018-04-08 09:50:56 +* @Last Modified by: george +* @Last Modified time: 2018-04-10 15:47:52 +*/ + +.nav-title{ + height: 45px; + border: #e4e4e4 1px solid; + line-height: 45px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 10px; +} + +.tl{ + text-align: left; +} +.tr{ + text-align: right; +} + +.fl{ + float: left; +} +.fr{ + float: right; +} + +.ml20{ + margin-left: 20px; +} + +.pp-main{ + padding-left: 20px; + padding-right: 20px; +} + + +.pp-form .width20{ + width: 20%; +} +.pp-form .width40{ + width: 40%; +} + +.pp-form .width60{ + width: 60%; +} + +.pp-form .width90{ + width: 90%; +} +/*pre.prettyprinted,pre.prettyprinted ol li{ + background: #393D49 !important; +}*/ + + +/*上传框*/ +.input-file{ + display: inline-block; + position: relative; + overflow: hidden; +} +.input-file input[type="file"] { + position: absolute; + top: 0; + right: 0; + font-size: 14px; + background-color: #fff; + transform: translate(-300px, 0px) scale(4); + height: 40px; + opacity: 0; + filter: alpha(opacity=0); + } + +.search_text{ + text-align: right;padding-right: 10px; +} + +.mw400{ + min-width: 400px; +} +.mw200{ + min-width: 200px; +} +.c66{ + color:#666666; +} +.c33{ + color:#333333; +} + +.lh36{ + line-height: 36px; +} \ No newline at end of file diff --git a/static/admin/css/main.css b/static/admin/css/main.css new file mode 100644 index 0000000..2fad7c5 --- /dev/null +++ b/static/admin/css/main.css @@ -0,0 +1,106 @@ +/* +* @Author: georgehao +* @Date: 2018-04-08 09:50:56 +* @Last Modified by: haodaquan +* @Last Modified time: 2018-04-08 22:33:36 +*/ + +.layui-header{ + height:50px; +} + +.layui-layout-admin .layui-logo{ + line-height:50px; + height:50px; + font-size:20px; +} +.layui-nav layui-layout-right{ + line-height:50px; + height: 50px; +} + +.layui-layout-admin .layui-side{ + top:50px; +} + +.layui-layout-admin .layui-body{ + top:50px; +} + +.pp-nav-item{ + line-height: 50px !important; + height: 50px !important; +} + +.pp-nav-child a{ + line-height: 30px!important; + height: 30px!important; +} + +.pp-nav-item a{ + line-height: 50px; + height: 50px; +} + +.layui-nav .layui-nav-item .layui-nav-itemed{ + line-height: 50px; + height: 50px; +} + +.layui-nav-child{ + top:50px; +} + + + + + +.layui-layout-admin .layui-footer{ + line-height: 35px; + height: 35px; +} +.pp-side-fold { + height: 30px; + background-color: #4A5064; + color: #aeb9c2; + line-height: 30px; + text-align: center; + cursor: pointer +} + +.back_space1{ + margin-right: 5px; +} + +a.pointer{ + cursor: pointer; +} + +.pp-ddsided{ + width: 50px; +} + +a.pp-pointer{ + padding-right: 0px !important; +} + +.pp-sided{ + width: 50px; +} + +.pp-main{ + left: 50px !important; +} + +.pp-tab{ + margin-top:0px; +} +.pp-tab-title{ + background: #000; +} +.layui-this{ + background: #fff; +} +.layui-tab-title li.pp-tab-li{ + border: 0px; +} \ No newline at end of file diff --git a/static/admin/images/default.png b/static/admin/images/default.png new file mode 100644 index 0000000..85c4433 Binary files /dev/null and b/static/admin/images/default.png differ diff --git a/static/admin/images/header.jpg b/static/admin/images/header.jpg new file mode 100644 index 0000000..1b234a3 Binary files /dev/null and b/static/admin/images/header.jpg differ diff --git a/static/admin/js/jquery.min.js b/static/admin/js/jquery.min.js new file mode 100644 index 0000000..0cc3c4d --- /dev/null +++ b/static/admin/js/jquery.min.js @@ -0,0 +1,10 @@ +/* +* @Author: haodaquan +* @Date: 2017-09-08 23:42:15 +* @Last Modified by: haodaquan +* @Last Modified time: 2017-09-08 23:43:15 +*/ +/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; +if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("',"",""].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

"),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

"),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

    ','
  • ','','
    ','',"
    ","
  • ",'
  • ','','
    ','",'","
    ","
  • ",'
  • ','','',"
  • ","
"].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
  • '+e+'
  • ')}),'
      '+t.join("")+"
    "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
      ','
    • ','','
      ','","
      ","
    • ",'
    • ','','
      ','',"
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)}); \ No newline at end of file diff --git a/static/layui/lay/modules/layer.js b/static/layui/lay/modules/layer.js new file mode 100755 index 0000000..18bf440 --- /dev/null +++ b/static/layui/lay/modules/layer.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
    '+(f?r.title[0]:r.title)+"
    ":"";return r.zIndex=s,t([r.shade?'
    ':"",'
    '+(e&&2!=r.type?"":u)+'
    '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
    '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
    '+e+"
    "}():"")+(r.resize?'':"")+"
    "],u,i('
    ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
      '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
    • '+(t[0].content||"no content")+"
    • ";i'+(t[i].content||"no content")+"";return a}()+"
    ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
    '+(u.length>1?'':"")+'
    '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
    ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file diff --git a/static/layui/lay/modules/laypage.js b/static/layui/lay/modules/laypage.js new file mode 100755 index 0000000..5b3b09b --- /dev/null +++ b/static/layui/lay/modules/laypage.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); \ No newline at end of file diff --git a/static/layui/lay/modules/laytpl.js b/static/layui/lay/modules/laytpl.js new file mode 100755 index 0000000..e19885e --- /dev/null +++ b/static/layui/lay/modules/laytpl.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); \ No newline at end of file diff --git a/static/layui/lay/modules/mobile.js b/static/layui/lay/modules/mobile.js new file mode 100755 index 0000000..1f292ac --- /dev/null +++ b/static/layui/lay/modules/mobile.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define(function(i){i("layui.mobile",layui.v)});layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var t=(window,document),i="querySelectorAll",n="getElementsByClassName",a=function(e){return t[i](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var i in e)t[i]=e[i];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var o=0,r=["layui-m-layer"],d=function(e){var t=this;t.config=l.extend(e),t.view()};d.prototype.view=function(){var e=this,i=e.config,s=t.createElement("div");e.id=s.id=r[0]+o,s.setAttribute("class",r[0]+" "+r[0]+(i.type||0)),s.setAttribute("index",o);var l=function(){var e="object"==typeof i.title;return i.title?'

    '+(e?i.title[0]:i.title)+"

    ":""}(),d=function(){"string"==typeof i.btn&&(i.btn=[i.btn]);var e,t=(i.btn||[]).length;return 0!==t&&i.btn?(e=''+i.btn[0]+"",2===t&&(e=''+i.btn[1]+""+e),'
    '+e+"
    "):""}();if(i.fixed||(i.top=i.hasOwnProperty("top")?i.top:100,i.style=i.style||"",i.style+=" top:"+(t.body.scrollTop+i.top)+"px"),2===i.type&&(i.content='

    '+(i.content||"")+"

    "),i.skin&&(i.anim="up"),"msg"===i.skin&&(i.shade=!1),s.innerHTML=(i.shade?"
    ':"")+'
    "+l+'
    '+i.content+"
    "+d+"
    ",!i.type||2===i.type){var y=t[n](r[0]+i.type),u=y.length;u>=1&&c.close(y[0].getAttribute("index"))}document.body.appendChild(s);var m=e.elem=a("#"+e.id)[0];i.success&&i.success(m),e.index=o++,e.action(i,m)},d.prototype.action=function(e,t){var i=this;e.time&&(l.timer[i.index]=setTimeout(function(){c.close(i.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),c.close(i.index)):e.yes?e.yes(i.index):c.close(i.index)};if(e.btn)for(var s=t[n]("layui-m-layerbtn")[0].children,o=s.length,r=0;r0&&e-1 in t)}function s(t){return A.call(t,function(t){return null!=t})}function u(t){return t.length>0?T.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||k[c(t)]?e:e+"px"}function h(t){var e,n;return $[t]||(e=L.createElement(t),L.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),$[t]=n),$[t]}function p(t){return"children"in t?D.call(t.children):T.map(t.childNodes,function(t){if(1==t.nodeType)return t})}function d(t,e){var n,r=t?t.length:0;for(n=0;n]*>/,R=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Z=/^(?:body|html)$/i,q=/([A-Z])/g,H=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],V=L.createElement("table"),_=L.createElement("tr"),B={tr:L.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:_,th:_,"*":L.createElement("div")},U=/complete|loaded|interactive/,X=/^[\w-]*$/,J={},W=J.toString,Y={},G=L.createElement("div"),K={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return Y.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=G).appendChild(t),r=~Y.qsa(i,e).indexOf(t),o&&G.removeChild(t),r},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return A.call(t,function(e,n){return t.indexOf(e)==n})},Y.fragment=function(t,e,n){var r,i,a;return R.test(t)&&(r=T(L.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(z,"<$1>")),e===E&&(e=M.test(t)&&RegExp.$1),e in B||(e="*"),a=B[e],a.innerHTML=""+t,r=T.each(D.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=T(r),T.each(n,function(t,e){H.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},Y.Z=function(t,e){return new d(t,e)},Y.isZ=function(t){return t instanceof Y.Z},Y.init=function(t,n){var r;if(!t)return Y.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=Y.fragment(t,RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}else{if(e(t))return T(L).ready(t);if(Y.isZ(t))return t;if(Q(t))r=s(t);else if(i(t))r=[t],t=null;else if(M.test(t))r=Y.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}}return Y.Z(r,t)},T=function(t,e){return Y.init(t,e)},T.extend=function(t){var e,n=D.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){m(t,n,e)}),t},Y.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=X.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:D.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},T.contains=L.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},T.type=t,T.isFunction=e,T.isWindow=n,T.isArray=Q,T.isPlainObject=o,T.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},T.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},T.inArray=function(t,e,n){return O.indexOf.call(e,t,n)},T.camelCase=C,T.trim=function(t){return null==t?"":String.prototype.trim.call(t)},T.uuid=0,T.support={},T.expr={},T.noop=function(){},T.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return O.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):T(A.call(this,function(e){return Y.matches(e,t)}))},add:function(t,e){return T(N(this.concat(T(t,e))))},is:function(t){return this.length>0&&Y.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==E)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?D.call(t):T(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return T(n)},has:function(t){return this.filter(function(){return i(t)?T.contains(this,t):T(this).find(t).size()})},eq:function(t){return t===-1?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:T(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:T(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?T(t).filter(function(){var t=this;return O.some.call(n,function(e){return T.contains(e,t)})}):1==this.length?T(Y.qsa(this[0],t)):this.map(function(){return Y.qsa(this,t)}):T()},closest:function(t,e){var n=[],i="object"==typeof t&&T(t);return this.each(function(o,a){for(;a&&!(i?i.indexOf(a)>=0:Y.matches(a,t));)a=a!==e&&!r(a)&&a.parentNode;a&&n.indexOf(a)<0&&n.push(a)}),T(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=T.map(n,function(t){if((t=t.parentNode)&&!r(t)&&e.indexOf(t)<0)return e.push(t),t});return v(e,t)},parent:function(t){return v(N(this.pluck("parentNode")),t)},children:function(t){return v(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||D.call(this.childNodes)})},siblings:function(t){return v(this.map(function(t,e){return A.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return T.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=T(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){T(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){T(this[0]).before(t=T(t));for(var e;(e=t.children()).length;)t=e.first();T(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=T(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){T(this).replaceWith(T(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=T(this);(t===E?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return T(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return T(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;T(this).empty().append(g(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=g(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(j in t)y(this,j,t[j]);else y(this,t,g(this,e,n,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(n=this[0].getAttribute(t))?n:E},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){y(this,t)},this)})},prop:function(t,e){return t=K[t]||t,1 in arguments?this.each(function(n){this[t]=g(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=K[t]||t,this.each(function(){delete this[t]})},data:function(t,e){var n="data-"+t.replace(q,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?b(r):E},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=g(this,t,e,this.value)})):this[0]&&(this[0].multiple?T(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=T(this),r=g(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;if(L.documentElement!==this[0]&&!T.contains(L.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r=this[0];if("string"==typeof e){if(!r)return;return r.style[C(e)]||getComputedStyle(r,"").getPropertyValue(e)}if(Q(e)){if(!r)return;var i={},o=getComputedStyle(r,"");return T.each(e,function(t,e){i[e]=r.style[C(e)]||o.getPropertyValue(e)}),i}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(j in e)e[j]||0===e[j]?a+=c(j)+":"+f(j,e[j])+";":this.each(function(){this.style.removeProperty(c(j))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(T(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&O.some.call(this,function(t){return this.test(x(t))},l(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){S=[];var n=x(this),r=g(this,t,e,n);r.split(/\s+/g).forEach(function(t){T(this).hasClass(t)||S.push(t)},this),S.length&&x(this,n+(n?" ":"")+S.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===E)return x(this,"");S=x(this),g(this,t,e,S).split(/\s+/g).forEach(function(t){S=S.replace(l(t)," ")}),x(this,S.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=T(this),i=g(this,t,n,x(this));i.split(/\s+/g).forEach(function(t){(e===E?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===E?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===E?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=Z.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(T(t).css("margin-top"))||0,n.left-=parseFloat(T(t).css("margin-left"))||0,r.top+=parseFloat(T(e[0]).css("border-top-width"))||0,r.left+=parseFloat(T(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||L.body;t&&!Z.test(t.nodeName)&&"static"==T(t).css("position");)t=t.offsetParent;return t})}},T.fn.detach=T.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});T.fn[t]=function(i){var o,a=this[0];return i===E?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=T(this),a.css(t,g(this,i,e,a[t]()))})}}),I.forEach(function(e,n){var r=n%2;T.fn[e]=function(){var e,i,o=T.map(arguments,function(n){var r=[];return e=t(n),"array"==e?(n.forEach(function(t){return t.nodeType!==E?r.push(t):T.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(Y.fragment(t)))}),r):"object"==e||null==n?n:Y.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=T.contains(L.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return T(t).remove();i.insertBefore(t,e),s&&w(t,function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var e=t.ownerDocument?t.ownerDocument.defaultView:window;e.eval.call(e,t.innerHTML)}})})})},T.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return T(t)[e](this),this}}),Y.Z.prototype=d.prototype=T.fn,Y.uniq=N,Y.deserializeValue=b,T.zepto=Y,T}();!function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).filter(function(t){return t&&(!n.e||t.e==n.e)&&(!n.ns||s.test(t.ns))&&(!o||e(t.fn)===e(o))&&(!a||t.sel==a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return b[t]||y&&x[t]||t}function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=l,i.e in b&&(s=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return i.fn.apply(this,arguments)}),i.del=h;var d=h||s;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,p))})}function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete v[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(T,function(t,r){var i=n[t];e[t]=function(){return this[r]=w,i&&i.apply(n,arguments)},e[r]=E}),e.timeStamp||(e.timeStamp=Date.now()),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},b={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,r){var i=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(r,i?i.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,T={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||d(i)||i===!1||(i=r,r=n,n=f),i!==f&&r!==!1||(i=r,r=f),i===!1&&(i=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);if(o&&o!==h)return r=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||i).apply(o,[r].concat(p.call(arguments,1)))}),s(h,e,i,r,n,c||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||d(r)||r===!1||(r=n,n=f),r===!1&&(r=E),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in x&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=l(m(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){if(o=e.proxy(i),i.isImmediatePropagationStopped())return!1})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(e),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){if(t.global)return e(n||x,r,i)}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(e,r,"ajaxBeforeSend",[t,e])!==!1&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(t,e,n){if(n.dataFilter==l)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function l(){}function f(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==j?"json":w.test(t)?"script":E.test(t)&&"xml")||"text"}function h(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()&&"jsonp"!=e.dataType||(e.url=h(e.url,e.data),e.data=void 0)}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function m(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(u.name,u.value):"array"==o||!r&&"object"==o?m(e,u,r,n):e.add(n,u)})}var v,g,y=+new Date,x=window.document,b=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,E=/^(?:text|application)\/xml/i,j="application/json",T="text/html",S=/^\s*$/,C=x.createElement("a");C.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"Zepto"+y++,l=x.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?a(r[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),x.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:j,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:l},t.ajax=function(e){var n,i,u=t.extend({},e||{}),d=t.Deferred&&t.Deferred();for(v in t.ajaxSettings)void 0===u[v]&&(u[v]=t.ajaxSettings[v]);r(u),u.crossDomain||(n=x.createElement("a"),n.href=u.url,n.href=n.href,u.crossDomain=C.protocol+"//"+C.host!=n.protocol+"//"+n.host),u.url||(u.url=window.location.toString()),(i=u.url.indexOf("#"))>-1&&(u.url=u.url.slice(0,i)),p(u);var m=u.dataType,y=/\?.+=\?/.test(u.url);if(y&&(m="jsonp"),u.cache!==!1&&(e&&e.cache===!0||"script"!=m&&"jsonp"!=m)||(u.url=h(u.url,"_="+Date.now())),"jsonp"==m)return y||(u.url=h(u.url,u.jsonp?u.jsonp+"=?":u.jsonp===!1?"":"callback=?")),t.ajaxJSONP(u,d);var b,w=u.accepts[m],E={},j=function(t,e){E[t.toLowerCase()]=[t,e]},T=/^([\w-]+:)\/\//.test(u.url)?RegExp.$1:window.location.protocol,N=u.xhr(),O=N.setRequestHeader;if(d&&d.promise(N),u.crossDomain||j("X-Requested-With","XMLHttpRequest"),j("Accept",w||"*/*"),(w=u.mimeType||w)&&(w.indexOf(",")>-1&&(w=w.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(w)),(u.contentType||u.contentType!==!1&&u.data&&"GET"!=u.type.toUpperCase())&&j("Content-Type",u.contentType||"application/x-www-form-urlencoded"),u.headers)for(g in u.headers)j(g,u.headers[g]);if(N.setRequestHeader=j,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=l,clearTimeout(b);var e,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==T){if(m=m||f(u.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)e=N.response;else{e=N.responseText;try{e=c(e,m,u),"script"==m?(0,eval)(e):"xml"==m?e=N.responseXML:"json"==m&&(e=S.test(e)?null:t.parseJSON(e))}catch(r){n=r}if(n)return s(n,"parsererror",N,u,d)}a(e,N,u,d)}else s(N.statusText||null,N.status?"error":"abort",N,u,d)}},o(N,u)===!1)return N.abort(),s(null,"abort",N,u,d),N;var P=!("async"in u)||u.async;if(N.open(u.type,u.url,P,u.username,u.password),u.xhrFields)for(g in u.xhrFields)N[g]=u.xhrFields[g];for(g in E)O.apply(N,E[g]);return u.timeout>0&&(b=setTimeout(function(){N.onreadystatechange=l,N.abort(),s(null,"timeout",N,u,d)},u.timeout)),N.send(u.data?u.data:null),N},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=d(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("
    ").html(e.replace(b,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var N=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(e)+"="+N(n))},m(r,e,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(r){return null}}}}(),t("zepto",e)});layui.define(["layer-mobile","zepto"],function(e){"use strict";var t=layui.zepto,a=layui["layer-mobile"],i=(layui.device(),"layui-upload-enter"),n="layui-upload-iframe",r={icon:2,shift:6},o={file:"文件",video:"视频",audio:"音频"};a.msg=function(e){return a.open({content:e||"",skin:"msg",time:2})};var s=function(e){this.options=e};s.prototype.init=function(){var e=this,a=e.options,r=t("body"),s=t(a.elem||".layui-upload-file"),u=t('');return t("#"+n)[0]||r.append(u),s.each(function(r,s){s=t(s);var u='
    ',l=s.attr("lay-type")||a.type;a.unwrap||(u='
    '+u+''+(s.attr("lay-title")||a.title||"上传"+(o[l]||"图片"))+"
    "),u=t(u),a.unwrap||u.on("dragover",function(e){e.preventDefault(),t(this).addClass(i)}).on("dragleave",function(){t(this).removeClass(i)}).on("drop",function(){t(this).removeClass(i)}),s.parent("form").attr("target")===n&&(a.unwrap?s.unwrap():(s.parent().next().remove(),s.unwrap().unwrap())),s.wrap(u),s.off("change").on("change",function(){e.action(this,l)})})},s.prototype.action=function(e,i){var o=this,s=o.options,u=e.value,l=t(e),p=l.attr("lay-ext")||s.ext||"";if(u){switch(i){case"file":if(p&&!RegExp("\\w\\.("+p+")$","i").test(escape(u)))return a.msg("不支持该文件格式",r),e.value="";break;case"video":if(!RegExp("\\w\\.("+(p||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(u)))return a.msg("不支持该视频格式",r),e.value="";break;case"audio":if(!RegExp("\\w\\.("+(p||"mp3|wav|mid")+")$","i").test(escape(u)))return a.msg("不支持该音频格式",r),e.value="";break;default:if(!RegExp("\\w\\.("+(p||"jpg|png|gif|bmp|jpeg")+")$","i").test(escape(u)))return a.msg("不支持该图片格式",r),e.value=""}s.before&&s.before(e),l.parent().submit();var c=t("#"+n),f=setInterval(function(){var t;try{t=c.contents().find("body").text()}catch(i){a.msg("上传接口存在跨域",r),clearInterval(f)}if(t){clearInterval(f),c.contents().find("body").html("");try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回JSON字符",r)}"function"==typeof s.success&&s.success(t,e)}},30);e.value=""}},e("upload-mobile",function(e){var t=new s(e=e||{});t.init()})});layui.define(function(i){i("layim-mobile",layui.v)});layui["layui.mobile"]||layui.config({base:layui.cache.dir+"lay/modules/mobile/"}).extend({"layer-mobile":"layer-mobile",zepto:"zepto","upload-mobile":"upload-mobile","layim-mobile":"layim-mobile"}),layui.define(["layer-mobile","zepto","layim-mobile"],function(l){l("mobile",{layer:layui["layer-mobile"],layim:layui["layim-mobile"]})}); \ No newline at end of file diff --git a/static/layui/lay/modules/table.js b/static/layui/lay/modules/table.js new file mode 100755 index 0000000..9e76e10 --- /dev/null +++ b/static/layui/lay/modules/table.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define(["laytpl","laypage","layer","form"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=layui.hint(),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,s,e,t)}},c=function(){var e=this,t=e.config,i=t.id;return i&&(c.config[i]=t),{reload:function(t){e.reload.call(e,t)},config:t}},s="table",u=".layui-table",h="layui-hide",f="layui-none",y="layui-table-view",p=".layui-table-header",m=".layui-table-body",v=".layui-table-main",g=".layui-table-fixed",x=".layui-table-fixed-l",b=".layui-table-fixed-r",k=".layui-table-tool",C=".layui-table-page",w=".layui-table-sort",N="layui-table-edit",T="layui-table-hover",F=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['
    ',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
    ','
    1){ }}","group","{{# } else { }}","{{d.index}}-{{item2.field || i2}}",'{{# if(item2.type !== "normal"){ }}'," laytable-cell-{{ item2.type }}","{{# } }}","{{# } }}",'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{item2.title||""}}',"{{# if(!(item2.colspan > 1) && item2.sort){ }}",'',"{{# } }}","{{# } }}","
    ","
    "].join("")},W=['',"","
    "].join(""),z=['
    ',"{{# if(d.data.toolbar){ }}",'
    ',"{{# } }}",'
    ',"{{# var left, right; }}",'
    ',F(),"
    ",'
    ',W,"
    ","{{# if(left){ }}",'
    ','
    ',F({fixed:!0}),"
    ",'
    ',W,"
    ","
    ","{{# }; }}","{{# if(right){ }}",'
    ','
    ',F({fixed:"right"}),'
    ',"
    ",'
    ',W,"
    ","
    ","{{# }; }}","
    ","{{# if(d.data.page){ }}",'
    ','
    ',"
    ","{{# } }}","","
    "].join(""),A=t(window),S=t(document),M=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};M.prototype.config={limit:10,loading:!0,cellMinWidth:60,text:{none:"无数据"}},M.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id"),a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;e.setArea();var l=a.elem,n=l.next("."+y),o=e.elem=t(i(z).render({VIEW_CLASS:y,data:a,index:e.index}));if(a.index=e.index,n[0]&&n.remove(),l.after(o),e.layHeader=o.find(p),e.layMain=o.find(v),e.layBody=o.find(m),e.layFixed=o.find(g),e.layFixLeft=o.find(x),e.layFixRight=o.find(b),e.layTool=o.find(k),e.layPage=o.find(C),e.layTool.html(i(t(a.toolbar).html()||"").render(a)),a.height&&e.fullSize(),a.cols.length>1){var r=e.layFixed.find(p).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},M.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},M.prototype.setArea=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=t.width||function(){var e=function(i){var a,l;i=i||t.elem.parent(),a=i.width();try{l="none"===i.css("display")}catch(n){}return!i[0]||a&&!l?a:e(i.parent())};return e()}();e.eachCols(function(){i++}),o-=function(){return"line"===t.skin||"nob"===t.skin?2:i+1}(),layui.each(t.cols,function(t,i){layui.each(i,function(t,l){var r;return l?(e.initOpts(l),r=l.width||0,void(l.colspan>1||(/\d+%$/.test(r)?l.width=r=Math.floor(parseFloat(r)/100*o):r||(l.width=r=0,a++),n+=r))):void i.splice(t,1)})}),e.autoColNums=a,o>n&&a&&(l=(o-n)/a),layui.each(t.cols,function(e,i){layui.each(i,function(e,i){var a=i.minWidth||t.cellMinWidth;i.colspan>1||0===i.width&&(i.width=Math.floor(l>=a?l:a))})}),t.height&&/^full-\d+$/.test(t.height)&&(e.fullHeightGap=t.height.split("-")[1],t.height=A.height()-e.fullHeightGap)},M.prototype.reload=function(e){var i=this;i.config.data&&i.config.data.constructor===Array&&delete i.config.data,i.config=t.extend({},i.config,e),i.render()},M.prototype.page=1,M.prototype.pullData=function(e,i){var a=this,n=a.config,o=n.request,r=n.response,d=function(){"object"==typeof n.initSort&&a.sort(n.initSort.field,n.initSort.type)};if(a.startTime=(new Date).getTime(),n.url){var c={};c[o.pageName]=e,c[o.limitName]=n.limit;var s=t.extend(c,n.where);n.contentType&&0==n.contentType.indexOf("application/json")&&(s=JSON.stringify(s)),t.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:s,dataType:"json",headers:n.headers||{},success:function(t){t[r.statusName]!=r.statusCode?(a.renderForm(),a.layMain.html('
    '+(t[r.msgName]||"返回的数据状态异常")+"
    ")):(a.renderData(t,e,t[r.countName]),d(),n.time=(new Date).getTime()-a.startTime+" ms"),i&&l.close(i),"function"==typeof n.done&&n.done(t,e,t[r.countName])},error:function(e,t){a.layMain.html('
    数据接口请求异常
    '),a.renderForm(),i&&l.close(i)}})}else if(n.data&&n.data.constructor===Array){var u={},h=e*n.limit-n.limit;u[r.dataName]=n.data.concat().splice(h,n.limit),u[r.countName]=n.data.length,a.renderData(u,e,n.data.length),d(),"function"==typeof n.done&&n.done(u,e,u[r.countName])}},M.prototype.eachCols=function(e){var i=t.extend(!0,[],this.config.cols),a=[],l=0;layui.each(i,function(e,t){layui.each(t,function(t,n){if(n.colspan>1){var o=0;l++,n.CHILD_COLS=[],layui.each(i[e+1],function(e,t){t.PARENT_COL||o==n.colspan||(t.PARENT_COL=l,n.CHILD_COLS.push(t),o+=t.colspan>1?t.colspan:1)})}n.PARENT_COL||a.push(n)})});var n=function(t){layui.each(t||a,function(t,i){return i.CHILD_COLS?n(i.CHILD_COLS):void e(t,i)})};n()},M.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,u=e[s.response.dataName]||[],y=[],p=[],m=[],v=function(){return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(u,function(e,a){var l=[],o=[],u=[],h=e+s.limit*(n-1)+1;0!==a.length&&(r||(a[d.config.indexName]=e),c.eachCols(function(e,n){var r=n.field||e,f=a[r];c.getColElem(c.layHeader,r);if(void 0!==f&&null!==f||(f=""),!(n.colspan>1)){var y=['",'
    '+function(){var e=t.extend(!0,{LAY_INDEX:h},a);return"checkbox"===n.type?'":"numbers"===n.type?h:n.toolbar?i(t(n.toolbar).html()||"").render(e):n.templet?function(){return"function"==typeof n.templet?n.templet(e):i(t(n.templet).html()||String(f)).render(e)}():f}(),"
    "].join("");l.push(y),n.fixed&&"right"!==n.fixed&&o.push(y),"right"===n.fixed&&u.push(y)}}),y.push(''+l.join("")+""),p.push(''+o.join("")+""),m.push(''+u.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+f).remove(),c.layMain.find("tbody").html(y.join("")),c.layFixLeft.find("tbody").html(p.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,void l.close(c.tipsIndex))};return c.key=s.id||s.index,d.cache[c.key]=u,c.layPage[0===u.length&&1==n?"addClass":"removeClass"](h),r?v():0===u.length?(c.renderForm(),c.layFixed.remove(),c.layMain.find("tbody").html(""),c.layMain.find("."+f).remove(),c.layMain.append('
    '+s.text.none+"
    ")):(v(),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr,c.loading()))}},s.page),s.page.count=o,a.render(s.page))))},M.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},M.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},M.prototype.sort=function(e,i,a,l){var n,r,c=this,u={},h=c.config,f=h.elem.attr("lay-filter"),y=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var p=c.layHeader.find("th .laytable-cell-"+h.index+"-"+n).find(w);c.layHeader.find("th").find(w).removeAttr("lay-sort"),p.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},"asc"===i?r=layui.sort(y,n):"desc"===i?r=layui.sort(y,n,!0):(r=layui.sort(y,d.config.indexName),delete c.sortKey),u[h.response.dataName]=r,c.renderData(u,c.page,c.count,!0),l&&layui.event.call(e,s,"sort("+f+")",{field:n,type:i})},M.prototype.loading=function(){var e=this,t=e.config;if(t.loading&&t.url)return l.msg("数据请求中",{icon:16,offset:[e.elem.offset().top+e.elem.height()/2-35-A.scrollTop()+"px",e.elem.offset().left+e.elem.width()/2-90-A.scrollLeft()+"px"],time:-1,anim:-1,fixed:!1})},M.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},M.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},M.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(a,l){if(l.selectorText===".laytable-cell-"+i.index+"-"+e)return t(l),!0})},M.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=A.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),e=parseFloat(a)-parseFloat(t.layHeader.height())-1,i.toolbar&&(e-=t.layTool.outerHeight()),i.page&&(e=e-t.layPage.outerHeight()-1),t.layMain.css("height",e)},M.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},M.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=e.getScrollWidth(e.layMain[0]),o=i.outerWidth()-e.layMain.width();if(e.autoColNums&&o<5&&!e.scrollPatchWStatus){var r=e.layHeader.eq(0).find("thead th:last-child"),d=r.data("field");e.getCssRule(d,function(t){var i=t.style.width||r.outerWidth();t.style.width=parseFloat(i)-n-o+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px"),e.scrollPatchWStatus=!0})}if(a&&l){if(!e.elem.find(".layui-table-patch")[0]){var c=t('
    ');c.find("div").css({width:a}),e.layHeader.eq(0).find("thead tr").append(c)}}else e.layHeader.eq(0).find(".layui-table-patch").remove();var s=e.layMain.height(),u=s-l;e.layFixed.find(m).css("height",i.height()>u?u:"auto"),e.layFixRight[o>0?"removeClass":"addClass"](h),e.layFixRight.css("right",a-1)},M.prototype.events=function(){var e,a=this,n=a.config,o=t("body"),c={},u=a.layHeader.find("th"),h=".layui-table-cell",f=n.elem.attr("lay-filter");u.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.attr("colspan")>1||i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var i=t(this);if(c.allowResize){var l=i.data("field");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],a.getCssRule(l,function(e){var t=e.style.width||i.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=i.data("minwidth")||n.cellMinWidth})}}),S.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var i=c.ruleWidth+t.clientX-c.offset[0];i');d[0].value=e.data("content")||o.text(),e.find("."+N)[0]||e.append(d),d.focus()}else o.find(".layui-form-switch,.layui-form-checkbox")[0]||Math.round(o.prop("scrollWidth"))>Math.round(o.outerWidth())&&(a.tipsIndex=l.tips(['
    ',o.html(),"
    ",''].join(""),o[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:600,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}))}),a.layBody.on("click","*[lay-event]",function(){var e=t(this),l=e.parents("tr").eq(0).data("index"),n=a.layBody.find('tr[data-index="'+l+'"]'),o="layui-table-click",r=d.cache[a.key][l];layui.event.call(this,s,"tool("+f+")",{data:d.clearCacheKey(r),event:e.attr("lay-event"),tr:n,del:function(){d.cache[a.key][l]=[],n.remove(),a.scrollPatch()},update:function(e){e=e||{},layui.each(e,function(e,l){if(e in r){var o,d=n.children('td[data-field="'+e+'"]');r[e]=l,a.eachCols(function(t,i){i.field==e&&i.templet&&(o=i.templet)}),d.children(h).html(o?i(t(o).html()||l).render(r):l),d.data("content",l)}})}}),n.addClass(o).siblings("tr").removeClass(o)}),a.layMain.on("scroll",function(){var e=t(this),i=e.scrollLeft(),n=e.scrollTop();a.layHeader.scrollLeft(i),a.layFixed.find(m).scrollTop(n),l.close(a.tipsIndex)}),A.on("resize",function(){a.fullSize(),a.scrollPatch()})},d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':u+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},c.config={},d.reload=function(e,i){var a=c.config[e];return i=i||{},a?(i.data&&i.data.constructor===Array&&delete a.data,d.render(t.extend(!0,{},a,i))):o.error("The ID option was not found in the table instance")},d.render=function(e){var t=new M(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(s,d)}); \ No newline at end of file diff --git a/static/layui/lay/modules/tree.js b/static/layui/lay/modules/tree.js new file mode 100755 index 0000000..2c3dd22 --- /dev/null +++ b/static/layui/lay/modules/tree.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
      '),s=o(["
    • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
    • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
      '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})}); \ No newline at end of file diff --git a/static/layui/lay/modules/upload.js b/static/layui/lay/modules/upload.js new file mode 100755 index 0000000..795f613 --- /dev/null +++ b/static/layui/lay/modules/upload.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,o.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),o=i.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&i.elem.wrap('
      '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),a=t(['
      ',"
      "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(f)||(e.elemFile.wrap(a),i.elem.next("."+f).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var i=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&i+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:i,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)}),t.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=t("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||o.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){o.preview(e)},upload:function(e,t){var i={};i[e]=t,o.upload(i)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,t){o.files[e]=t}),o.files}},y=function(){return"choose"===i?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var t=0,i=e||o.files||o.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?Math.floor(i)+(i%1>0?i.toFixed(1):0)+"MB":l.size+"KB",r.value="",F=i}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,i=e.config,o=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var a=e.elemFile,o=t.length>1?t.length+"个文件":(t[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||a.after(''+o+"")};i.elem.off("upload.start").on("upload.start",function(){var a=t(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=t.extend({},i,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=t(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];o(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},o.render=function(e){var t=new p(e);return l.call(t)},e(r,o)}); \ No newline at end of file diff --git a/static/layui/lay/modules/util.js b/static/layui/lay/modules/util.js new file mode 100755 index 0000000..d492cd4 --- /dev/null +++ b/static/layui/lay/modules/util.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,o,a="layui-fixbar",r="layui-fixbar-top",n=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['
        ',e.bar1?'
      • '+c[0]+"
      • ":"",e.bar2?'
      • '+c[1]+"
      • ":"",'
      • '+c[2]+"
      • ","
      "].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;o0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",util:"modules/util",flow:"modules/flow",carousel:"modules/carousel",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void(n.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?y.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var y=this,p=n.dir=n.dir?n.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],n.host=n.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),y;if(n.modules[f])!function g(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void("string"==typeof n.modules[f]&&n.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?p+"lay/":/^\{\/\}/.test(y.modules[f])?"":n.base||"")+(y.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[f]=h}return y},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function p(){return++y>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(p,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link(n.dir+"css/"+e,t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,t(o)},void(o.onerror=function(e){o.onerror=null,n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:r/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),skip:function(){return['到第','','页',""].join("")}()};return['
      ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
      "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,a=n;a>0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
      建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3)},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
      "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
      已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

      "+r.time[e]+"

        "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
      ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}), +l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2],d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
      a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
      ","
      "],area:[1,"",""],param:[1,"",""],thead:[1,"","
      "],tr:[2,"","
      "],col:[2,"","
      "],td:[3,"","
      "],_default:fe.htmlSerialize?[0,"",""]:[1,"X
      ","
      "]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
      a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
      ").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){ +for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe});!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
      '+(f?r.title[0]:r.title)+"
      ":"";return r.zIndex=s,t([r.shade?'
      ':"",'
      '+(e&&2!=r.type?"":u)+'
      '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
      '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
      '+e+"
      "}():"")+(r.resize?'':"")+"
      "],u,i('
      ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
        '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
      • '+(t[0].content||"no content")+"
      • ";i'+(t[i].content||"no content")+"";return a}()+"
      ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
      '+(u.length>1?'':"")+'
      '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
      ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
      是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
    • "+(i.title||"unnaming")+"
    • ";return s[0]?s.before(r):n.append(r),o.append('
      '+(i.content||"")+"
      "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,o.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),o=i.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&i.elem.wrap('
      '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),a=t(['
      ',"
      "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(f)||(e.elemFile.wrap(a),i.elem.next("."+f).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var i=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&i+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:i,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)}),t.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=t("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||o.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){o.preview(e)},upload:function(e,t){var i={};i[e]=t,o.upload(i)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,t){o.files[e]=t}),o.files}},y=function(){return"choose"===i?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var t=0,i=e||o.files||o.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?Math.floor(i)+(i%1>0?i.toFixed(1):0)+"MB":l.size+"KB",r.value="",F=i}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,i=e.config,o=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var a=e.elemFile,o=t.length>1?t.length+"个文件":(t[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||a.after(''+o+"")};i.elem.off("upload.start").on("upload.start",function(){var a=t(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=t.extend({},i,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=t(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];o(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},o.render=function(e){var t=new p(e);return l.call(t)},e(r,o)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",u="layui-disabled",c=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};c.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},c.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},c.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},c.prototype.render=function(e,i){var n=this,c=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),d={select:function(){var e,i="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=c.find("select"),y=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},h=function(i,c,f){var h=t(this),p=i.find("."+n),m=p.find("input"),k=i.find("dl"),g=k.children("dd");if(!c){var x=function(){var e=i.offset().top+i.outerHeight()+5-v.scrollTop(),t=k.outerHeight();i.addClass(a+"ed"),g.removeClass(o),e+t>v.height()&&e>=t&&i.addClass(a+"up")},b=function(e){i.removeClass(a+"ed "+a+"up"),m.blur(),e||C(m.val(),function(e){e&&(d=k.find("."+s).html(),m&&m.val(d))})};p.on("click",function(e){i.hasClass(a+"ed")?b():(y(e,!0),x()),k.find("."+r).remove()}),p.find(".layui-edge").on("click",function(){m.focus()}),m.on("keyup",function(e){var t=e.keyCode;9===t&&x()}).on("keydown",function(e){var t=e.keyCode;9===t?b():13===t&&e.preventDefault()});var C=function(e,i,a){var n=0;layui.each(g,function(){var i=t(this),l=i.text(),r=l.indexOf(e)===-1;(""===e||"blur"===a?e!==l:r)&&n++,"keyup"===a&&i[r?"addClass":"removeClass"](o)});var l=n===g.length;return i(l),l},w=function(e){var t=this.value,i=e.keyCode;return 9!==i&&13!==i&&37!==i&&38!==i&&39!==i&&40!==i&&(C(t,function(e){e?k.find("."+r)[0]||k.append('

      无匹配项

      '):k.find("."+r).remove()},"keyup"),void(""===t&&k.find("."+r).remove()))};f&&m.on("keyup",w).on("blur",function(t){e=m,d=k.find("."+s).html(),setTimeout(function(){C(m.val(),function(e){d||m.val("")},"blur")},200)}),g.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=h.attr("lay-filter");return!e.hasClass(u)&&(e.hasClass("layui-select-tips")?m.val(""):(m.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),h.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:h[0],value:a,othis:i}),b(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",y).on("click",y)}};f.each(function(e,l){var r=t(this),o=r.next("."+a),c=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),y=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var v="string"==typeof r.attr("lay-search"),p=y?y.value?i:y.innerHTML||i:i,m=t(['
      ','
      ','
      ','
      '+function(e){var t=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?t.push("
      "+a.label+"
      "):t.push('
      '+a.innerHTML+"
      "):t.push('
      '+(a.innerHTML||i)+"
      ")}),0===t.length&&t.push('
      没有选项
      '),t.join("")}(r.find("*"))+"
      ","
      "].join(""));o[0]&&o.remove(),r.after(m),h.call(this,m,c,v)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=c.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var c=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+c[0]),f=t(['
      ',{_switch:""+((n.checked?s[0]:s[1])||"")+""}[r]||(n.title.replace(/\s/g,"")?""+n.title+"":"")+''+(r?"":"")+"","
      "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,c)})},radio:function(){var e="layui-form-radio",i=["",""],a=c.find("input[type=radio]"),n=function(a){var n=t(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,u=n.parents(r),c=n.attr("lay-filter"),d=u.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(i[0]),layui.event.call(n[0],l,"radio("+c+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var c=t(['
      ',''+i[l.checked?0:1]+"","
      "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
      ","
      "].join(""));r.after(c),n.call(this,c)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,t){t()}),n};var d=function(){var e=t(this),a=f.config.verify,s=null,o="layui-form-danger",u={},c=e.parents(r),d=c.find("*[lay-verify]"),y=e.parents("form")[0],v=c.find("input,select,textarea"),h=e.attr("lay-filter");if(layui.each(d,function(e,l){var r=t(this),u=r.attr("lay-verify").split("|"),c=r.attr("lay-verType"),d=r.val();if(r.removeClass(o),layui.each(u,function(e,t){var u,f="",y="function"==typeof a[t];if(a[t]){var u=y?f=a[t](d,l):!a[t][0].test(d);if(f=f||a[t][1],u)return"tips"===c?i.tips(f,function(){return"string"==typeof r.attr("lay-ignore")||"select"!==l.tagName.toLowerCase()&&!/^checkbox|radio$/.test(l.type)?r:r.next()}(),{tips:1}):"alert"===c?i.alert(f,{title:"提示",shadeClose:!0}):i.msg(f,{icon:5,shift:6}),n.android||n.ios||l.focus(),r.addClass(o),s=!0}}),s)return s}),s)return!1;var p={};return layui.each(v,function(e,t){if(t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name){if(/^.*\[\]$/.test(t.name)){var i=t.name.match(/^(.*)\[\]$/g)[0];p[i]=0|p[i],t.name=t.name.replace(/^(.*)\[\]$/,"$1["+p[i]++ +"]")}/^checkbox|radio$/.test(t.type)&&!t.checked||(u[t.name]=t.value)}}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:y,field:u})},f=new c,y=t(document),v=t(window);f.render(),y.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),y.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
        '),s=o(["
      • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
      • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
        '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});layui.define(["laytpl","laypage","layer","form"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=layui.hint(),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,s,e,t)}},c=function(){var e=this,t=e.config,i=t.id;return i&&(c.config[i]=t),{reload:function(t){e.reload.call(e,t)},config:t}},s="table",u=".layui-table",h="layui-hide",f="layui-none",y="layui-table-view",p=".layui-table-header",m=".layui-table-body",v=".layui-table-main",g=".layui-table-fixed",x=".layui-table-fixed-l",b=".layui-table-fixed-r",k=".layui-table-tool",C=".layui-table-page",w=".layui-table-sort",N="layui-table-edit",T="layui-table-hover",F=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
        ','
        1){ }}","group","{{# } else { }}","{{d.index}}-{{item2.field || i2}}",'{{# if(item2.type !== "normal"){ }}'," laytable-cell-{{ item2.type }}","{{# } }}","{{# } }}",'" {{#if(item2.align){}}align="{{item2.align}}"{{#}}}>','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{item2.title||""}}',"{{# if(!(item2.colspan > 1) && item2.sort){ }}",'',"{{# } }}","{{# } }}","
        ","
        "].join("")},W=['',"","
        "].join(""),z=['
        ',"{{# if(d.data.toolbar){ }}",'
        ',"{{# } }}",'
        ',"{{# var left, right; }}",'
        ',F(),"
        ",'
        ',W,"
        ","{{# if(left){ }}",'
        ','
        ',F({fixed:!0}),"
        ",'
        ',W,"
        ","
        ","{{# }; }}","{{# if(right){ }}",'
        ','
        ',F({fixed:"right"}),'
        ',"
        ",'
        ',W,"
        ","
        ","{{# }; }}","
        ","{{# if(d.data.page){ }}",'
        ','
        ',"
        ","{{# } }}","","
        "].join(""),A=t(window),S=t(document),M=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};M.prototype.config={limit:10,loading:!0,cellMinWidth:60,text:{none:"无数据"}},M.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id"),a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;e.setArea();var l=a.elem,n=l.next("."+y),o=e.elem=t(i(z).render({VIEW_CLASS:y,data:a,index:e.index}));if(a.index=e.index,n[0]&&n.remove(),l.after(o),e.layHeader=o.find(p),e.layMain=o.find(v),e.layBody=o.find(m),e.layFixed=o.find(g),e.layFixLeft=o.find(x),e.layFixRight=o.find(b),e.layTool=o.find(k),e.layPage=o.find(C),e.layTool.html(i(t(a.toolbar).html()||"").render(a)),a.height&&e.fullSize(),a.cols.length>1){var r=e.layFixed.find(p).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},M.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},M.prototype.setArea=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=t.width||function(){var e=function(i){var a,l;i=i||t.elem.parent(),a=i.width();try{l="none"===i.css("display")}catch(n){}return!i[0]||a&&!l?a:e(i.parent())};return e()}();e.eachCols(function(){i++}),o-=function(){return"line"===t.skin||"nob"===t.skin?2:i+1}(),layui.each(t.cols,function(t,i){layui.each(i,function(t,l){var r;return l?(e.initOpts(l),r=l.width||0,void(l.colspan>1||(/\d+%$/.test(r)?l.width=r=Math.floor(parseFloat(r)/100*o):r||(l.width=r=0,a++),n+=r))):void i.splice(t,1)})}),e.autoColNums=a,o>n&&a&&(l=(o-n)/a),layui.each(t.cols,function(e,i){layui.each(i,function(e,i){var a=i.minWidth||t.cellMinWidth;i.colspan>1||0===i.width&&(i.width=Math.floor(l>=a?l:a))})}),t.height&&/^full-\d+$/.test(t.height)&&(e.fullHeightGap=t.height.split("-")[1],t.height=A.height()-e.fullHeightGap)},M.prototype.reload=function(e){var i=this;i.config.data&&i.config.data.constructor===Array&&delete i.config.data,i.config=t.extend({},i.config,e),i.render()},M.prototype.page=1,M.prototype.pullData=function(e,i){var a=this,n=a.config,o=n.request,r=n.response,d=function(){"object"==typeof n.initSort&&a.sort(n.initSort.field,n.initSort.type)};if(a.startTime=(new Date).getTime(),n.url){var c={};c[o.pageName]=e,c[o.limitName]=n.limit;var s=t.extend(c,n.where);n.contentType&&0==n.contentType.indexOf("application/json")&&(s=JSON.stringify(s)),t.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:s,dataType:"json",headers:n.headers||{},success:function(t){t[r.statusName]!=r.statusCode?(a.renderForm(),a.layMain.html('
        '+(t[r.msgName]||"返回的数据状态异常")+"
        ")):(a.renderData(t,e,t[r.countName]),d(),n.time=(new Date).getTime()-a.startTime+" ms"),i&&l.close(i),"function"==typeof n.done&&n.done(t,e,t[r.countName])},error:function(e,t){a.layMain.html('
        数据接口请求异常
        '),a.renderForm(),i&&l.close(i)}})}else if(n.data&&n.data.constructor===Array){var u={},h=e*n.limit-n.limit;u[r.dataName]=n.data.concat().splice(h,n.limit),u[r.countName]=n.data.length,a.renderData(u,e,n.data.length),d(),"function"==typeof n.done&&n.done(u,e,u[r.countName])}},M.prototype.eachCols=function(e){var i=t.extend(!0,[],this.config.cols),a=[],l=0;layui.each(i,function(e,t){layui.each(t,function(t,n){if(n.colspan>1){var o=0;l++,n.CHILD_COLS=[],layui.each(i[e+1],function(e,t){t.PARENT_COL||o==n.colspan||(t.PARENT_COL=l,n.CHILD_COLS.push(t),o+=t.colspan>1?t.colspan:1)})}n.PARENT_COL||a.push(n)})});var n=function(t){layui.each(t||a,function(t,i){return i.CHILD_COLS?n(i.CHILD_COLS):void e(t,i)})};n()},M.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,u=e[s.response.dataName]||[],y=[],p=[],m=[],v=function(){return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(u,function(e,a){var l=[],o=[],u=[],h=e+s.limit*(n-1)+1;0!==a.length&&(r||(a[d.config.indexName]=e),c.eachCols(function(e,n){var r=n.field||e,f=a[r];c.getColElem(c.layHeader,r);if(void 0!==f&&null!==f||(f=""),!(n.colspan>1)){var y=['",'
        '+function(){var e=t.extend(!0,{LAY_INDEX:h},a);return"checkbox"===n.type?'":"numbers"===n.type?h:n.toolbar?i(t(n.toolbar).html()||"").render(e):n.templet?function(){return"function"==typeof n.templet?n.templet(e):i(t(n.templet).html()||String(f)).render(e)}():f}(),"
        "].join("");l.push(y),n.fixed&&"right"!==n.fixed&&o.push(y),"right"===n.fixed&&u.push(y)}}),y.push(''+l.join("")+""),p.push(''+o.join("")+""),m.push(''+u.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+f).remove(),c.layMain.find("tbody").html(y.join("")),c.layFixLeft.find("tbody").html(p.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,void l.close(c.tipsIndex))};return c.key=s.id||s.index,d.cache[c.key]=u,c.layPage[0===u.length&&1==n?"addClass":"removeClass"](h),r?v():0===u.length?(c.renderForm(),c.layFixed.remove(),c.layMain.find("tbody").html(""),c.layMain.find("."+f).remove(),c.layMain.append('
        '+s.text.none+"
        ")):(v(),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr,c.loading()))}},s.page),s.page.count=o,a.render(s.page))))},M.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},M.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},M.prototype.sort=function(e,i,a,l){var n,r,c=this,u={},h=c.config,f=h.elem.attr("lay-filter"),y=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var p=c.layHeader.find("th .laytable-cell-"+h.index+"-"+n).find(w);c.layHeader.find("th").find(w).removeAttr("lay-sort"),p.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},"asc"===i?r=layui.sort(y,n):"desc"===i?r=layui.sort(y,n,!0):(r=layui.sort(y,d.config.indexName),delete c.sortKey),u[h.response.dataName]=r,c.renderData(u,c.page,c.count,!0),l&&layui.event.call(e,s,"sort("+f+")",{field:n,type:i})},M.prototype.loading=function(){var e=this,t=e.config;if(t.loading&&t.url)return l.msg("数据请求中",{icon:16,offset:[e.elem.offset().top+e.elem.height()/2-35-A.scrollTop()+"px",e.elem.offset().left+e.elem.width()/2-90-A.scrollLeft()+"px"],time:-1,anim:-1,fixed:!1})},M.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},M.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},M.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(a,l){if(l.selectorText===".laytable-cell-"+i.index+"-"+e)return t(l),!0})},M.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=A.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),e=parseFloat(a)-parseFloat(t.layHeader.height())-1,i.toolbar&&(e-=t.layTool.outerHeight()),i.page&&(e=e-t.layPage.outerHeight()-1),t.layMain.css("height",e)},M.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},M.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=e.getScrollWidth(e.layMain[0]),o=i.outerWidth()-e.layMain.width();if(e.autoColNums&&o<5&&!e.scrollPatchWStatus){var r=e.layHeader.eq(0).find("thead th:last-child"),d=r.data("field");e.getCssRule(d,function(t){var i=t.style.width||r.outerWidth();t.style.width=parseFloat(i)-n-o+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px"),e.scrollPatchWStatus=!0})}if(a&&l){if(!e.elem.find(".layui-table-patch")[0]){var c=t('
        ');c.find("div").css({width:a}),e.layHeader.eq(0).find("thead tr").append(c)}}else e.layHeader.eq(0).find(".layui-table-patch").remove();var s=e.layMain.height(),u=s-l;e.layFixed.find(m).css("height",i.height()>u?u:"auto"),e.layFixRight[o>0?"removeClass":"addClass"](h),e.layFixRight.css("right",a-1)},M.prototype.events=function(){var e,a=this,n=a.config,o=t("body"),c={},u=a.layHeader.find("th"),h=".layui-table-cell",f=n.elem.attr("lay-filter");u.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.attr("colspan")>1||i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var i=t(this);if(c.allowResize){var l=i.data("field");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],a.getCssRule(l,function(e){var t=e.style.width||i.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=i.data("minwidth")||n.cellMinWidth})}}),S.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var i=c.ruleWidth+t.clientX-c.offset[0];i');d[0].value=e.data("content")||o.text(),e.find("."+N)[0]||e.append(d),d.focus()}else o.find(".layui-form-switch,.layui-form-checkbox")[0]||Math.round(o.prop("scrollWidth"))>Math.round(o.outerWidth())&&(a.tipsIndex=l.tips(['
        ',o.html(),"
        ",''].join(""),o[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:600,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}))}),a.layBody.on("click","*[lay-event]",function(){var e=t(this),l=e.parents("tr").eq(0).data("index"),n=a.layBody.find('tr[data-index="'+l+'"]'),o="layui-table-click",r=d.cache[a.key][l];layui.event.call(this,s,"tool("+f+")",{data:d.clearCacheKey(r),event:e.attr("lay-event"),tr:n,del:function(){d.cache[a.key][l]=[],n.remove(),a.scrollPatch()},update:function(e){e=e||{},layui.each(e,function(e,l){if(e in r){var o,d=n.children('td[data-field="'+e+'"]');r[e]=l,a.eachCols(function(t,i){i.field==e&&i.templet&&(o=i.templet)}),d.children(h).html(o?i(t(o).html()||l).render(r):l),d.data("content",l)}})}}),n.addClass(o).siblings("tr").removeClass(o)}),a.layMain.on("scroll",function(){var e=t(this),i=e.scrollLeft(),n=e.scrollTop();a.layHeader.scrollLeft(i),a.layFixed.find(m).scrollTop(n),l.close(a.tipsIndex)}),A.on("resize",function(){a.fullSize(),a.scrollPatch()})},d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':u+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},c.config={},d.reload=function(e,i){var a=c.config[e];return i=i||{},a?(i.data&&i.data.constructor===Array&&delete a.data,d.render(t.extend(!0,{},a,i))):o.error("The ID option was not found in the table instance")},d.render=function(e){var t=new M(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(s,d)});layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
          ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
        "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a',e.bar1?'
      • '+c[0]+"
      • ":"",e.bar2?'
      • '+c[1]+"
      • ":"",'
      • '+c[2]+"
      • ",""].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;o';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
        ','
        '+f+"
        ",'
        ','',"
        ","
        "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

        ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

        "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

        "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

          ','
        • ','','
          ','',"
          ","
        • ",'
        • ','','
          ','",'","
          ","
        • ",'
        • ','','',"
        • ","
        "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
      • '+e+'
      • ')}),'
          '+t.join("")+"
        "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
          ','
        • ','','
          ','","
          ","
        • ",'
        • ','','
          ','',"
          ","
        • ",'
        • ','','',"
        • ","
        "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)});layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
        1. '+o.replace(/[\r\t\n]+/g,"
        2. ")+"
        "),c.find(">.layui-code-h3")[0]||c.prepend('

        '+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

        ");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); \ No newline at end of file diff --git a/static/layui/layui.js b/static/layui/layui.js new file mode 100755 index 0000000..35f63b8 --- /dev/null +++ b/static/layui/layui.js @@ -0,0 +1,2 @@ +/** layui-v2.2.6 MIT License By https://www.layui.com */ + ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.2.6"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,o=n.length-1,r=o;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",util:"modules/util",flow:"modules/flow",carousel:"modules/carousel",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void(n.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?y.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var y=this,p=n.dir=n.dir?n.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],n.host=n.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),y;if(n.modules[f])!function g(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void("string"==typeof n.modules[f]&&n.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?p+"lay/":/^\{\/\}/.test(y.modules[f])?"":n.base||"")+(y.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[f]=h}return y},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function p(){return++y>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(p,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link(n.dir+"css/"+e,t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,t(o)},void(o.onerror=function(e){o.onerror=null,n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),n.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;na?1:r + + + + API 文档 [zTree -- jQuery 树插件] + + + + + +
        + +
        +
        +
        + + +
        +
        +
        +
        • setting 配置详解
        +
          +
          +
          +
          • zTree 方法详解
          +
            +
            • treeNode 节点数据详解
            +
              +
              +
              +
              +
              +
              +
              + + +
              +
              +
              + + + +
              + +
              +
              +
              +
              + + + + + + \ No newline at end of file diff --git a/static/zTree3/api/API_en.html b/static/zTree3/api/API_en.html new file mode 100644 index 0000000..76f2310 --- /dev/null +++ b/static/zTree3/api/API_en.html @@ -0,0 +1,102 @@ + + + + + API Document [zTree -- jQuery tree plug-ins.] + + + + + +
              + +
              +
              +
              + + +
              +
              +
              +
              • setting details
              +
                +
                +
                +
                • zTree method details
                +
                  +
                  • treeNode data details
                  +
                    +
                    +
                    +
                    +
                    +
                    +
                    + + +
                    +
                    +
                    + + + +
                    + +
                    +
                    +
                    +
                    + + + + + + \ No newline at end of file diff --git a/static/zTree3/api/apiCss/api.js b/static/zTree3/api/apiCss/api.js new file mode 100644 index 0000000..b8c70fa --- /dev/null +++ b/static/zTree3/api/apiCss/api.js @@ -0,0 +1,594 @@ +var apiContent = { + zTree_Setting: null, + zTree_Node: null, + zTree_Function: null, + overlayDiv : null, + overlayContent : null, + overlayDetailDiv : null, + overlayCloseBtn: null, + overlayArrow: null, + contentBoxDiv : null, + settingDiv : null, + functionDiv : null, + overlaySearch: null, + searchKey: null, + searchResultInput: null, + searchPrevBtn: null, + searchNextBtn: null, + apiCache: {}, + lastValue: "", + searchNodes: [], + searchNodesCur: 0, + + _init: function() { + this.overlayDiv = $("#overlayDiv"); + this.overlayContent = $("#overlayContent"); + this.overlayDetailDiv = $("#overlayDetailDiv"); + this.overlayCloseBtn = $("#overlayDivCloseBtn"); + this.overlayArrow = $("#overlayDivArrow"); + this.contentBoxDiv = $("#contentBox"); + this.settingDiv = $("#api_setting"); + this.functionDiv = $("#api_function"); + this.searchKey = $(".searchKey"); + this.overlaySearch = $(".overlaySearch"); + this.searchResultInput = $(".searchResult"); + this.searchPrevBtn = $(".searchPrev"); + this.searchNextBtn = $(".searchNext"); + var setting = { + view: { + fontCss: this.getFontCss, + showLine: false, + showIcon: this.showIcon, + showTitle: this.getTitle, + selectedMulti: false, + dblClickExpand: false + }, + data: { + key: { + title: "tt" + }, + simpleData: { + enable:true, + idKey: "id", + pIdKey: "pId", + rootPId: "" + } + }, + callback: { + onNodeCreated: this.onNodeCreated, + beforeClick: this.beforeClick + } + }; + var setting_nodes =[ + {id:1, pId:0, t:"setting", name:"var setting = {", open:true}, + {id:11, pId:1, t:"treeId", name:"treeId : \"\",", iconSkin:"core", showAPI:true}, + {id:12, pId:1, t:"treeObj", name:"treeObj : null,", iconSkin:"core", showAPI:true}, + {id:121, pId:1, name:""}, + + {id:20, pId:1, t:"async", name:"async : {", open:true}, + {id:201, pId:20, t:"autoParam", name:"autoParam : [],", iconSkin:"core", showAPI:true}, + {id:208, pId:20, t:"contentType", name:"contentType : \"application...\",", iconSkin:"core", showAPI:true}, + {id:202, pId:20, t:"dataFilter", name:"dataFilter : null,", iconSkin:"core", showAPI:true}, + {id:203, pId:20, t:"dataType", name:"dataType : \"text\",", iconSkin:"core", showAPI:true}, + {id:204, pId:20, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true}, + {id:205, pId:20, t:"otherParam", name:"otherParam : [],", iconSkin:"core", showAPI:true}, + {id:206, pId:20, t:"type", name:"type : \"post\",", iconSkin:"core", showAPI:true}, + {id:207, pId:20, t:"url", name:"url : \"\"", iconSkin:"core", showAPI:true}, + {id:21, pId:1, name:"},"}, + {id:22, pId:1, name:""}, + + {id:30, pId:1, t:"callback", name:"callback : {", open:true}, + {id:3001, pId:30, t:"beforeAsync", name:"beforeAsync : null,", iconSkin:"core", showAPI:true}, + {id:3002, pId:30, t:"beforeCheck", name:"beforeCheck : null,", iconSkin:"check", showAPI:true}, + {id:3003, pId:30, t:"beforeClick", name:"beforeClick : null,", iconSkin:"core", showAPI:true}, + {id:3004, pId:30, t:"beforeCollapse", name:"beforeCollapse : null,", iconSkin:"core", showAPI:true}, + {id:3004, pId:30, t:"beforeDblClick", name:"beforeDblClick : null,", iconSkin:"core", showAPI:true}, + {id:3005, pId:30, t:"beforeDrag", name:"beforeDrag : null,", iconSkin:"edit", showAPI:true}, + {id:3006, pId:30, t:"beforeDragOpen", name:"beforeDragOpen : null,", iconSkin:"edit", showAPI:true}, + {id:3007, pId:30, t:"beforeDrop", name:"beforeDrop : null,", iconSkin:"edit", showAPI:true}, + {id:3029, pId:30, t:"beforeEditName", name:"beforeEditName : null,", iconSkin:"edit", showAPI:true}, + {id:3008, pId:30, t:"beforeExpand", name:"beforeExpand : null,", iconSkin:"core", showAPI:true}, + {id:3009, pId:30, t:"beforeMouseDown", name:"beforeMouseDown : null,", iconSkin:"core", showAPI:true}, + {id:3010, pId:30, t:"beforeMouseUp", name:"beforeMouseUp : null,", iconSkin:"core", showAPI:true}, + {id:3011, pId:30, t:"beforeRemove", name:"beforeRemove : null,", iconSkin:"edit", showAPI:true}, + {id:3012, pId:30, t:"beforeRename", name:"beforeRename : null,", iconSkin:"edit", showAPI:true}, + {id:3013, pId:30, t:"beforeRightClick", name:"beforeRightClick : null,", iconSkin:"core", showAPI:true}, + {id:3014, pId:30, name:""}, + {id:3015, pId:30, t:"onAsyncError", name:"onAsyncError : null,", iconSkin:"core", showAPI:true}, + {id:3016, pId:30, t:"onAsyncSuccess", name:"onAsyncSuccess : null,", iconSkin:"core", showAPI:true}, + {id:3017, pId:30, t:"onCheck", name:"onCheck : null,", iconSkin:"check", showAPI:true}, + {id:3018, pId:30, t:"onClick", name:"onClick : null,", iconSkin:"core", showAPI:true}, + {id:3019, pId:30, t:"onCollapse", name:"onCollapse : null,", iconSkin:"core", showAPI:true}, + {id:3029, pId:30, t:"onDblClick", name:"onDblClick : null,", iconSkin:"core", showAPI:true}, + {id:3020, pId:30, t:"onDrag", name:"onDrag : null,", iconSkin:"edit", showAPI:true}, + {id:3030, pId:30, t:"onDragMove", name:"onDragMove : null,", iconSkin:"edit", showAPI:true}, + {id:3021, pId:30, t:"onDrop", name:"onDrop : null,", iconSkin:"edit", showAPI:true}, + {id:3022, pId:30, t:"onExpand", name:"onExpand : null,", iconSkin:"core", showAPI:true}, + {id:3023, pId:30, t:"onMouseDown", name:"onMouseDown : null,", iconSkin:"core", showAPI:true}, + {id:3024, pId:30, t:"onMouseUp", name:"onMouseUp : null,", iconSkin:"core", showAPI:true}, + {id:3025, pId:30, t:"onNodeCreated", name:"onNodeCreated : null,", iconSkin:"core", showAPI:true}, + {id:3026, pId:30, t:"onRemove", name:"onRemove : null,", iconSkin:"edit", showAPI:true}, + {id:3027, pId:30, t:"onRename", name:"onRename : null,", iconSkin:"edit", showAPI:true}, + {id:3028, pId:30, t:"onRightClick", name:"onRightClick : null", iconSkin:"core", showAPI:true}, + {id:31, pId:1, name:"},"}, + {id:32, pId:1, name:""}, + + {id:40, pId:1, t:"check", name:"check : {", open:true}, + {id:405, pId:40, t:"autoCheckTrigger", name:"autoCheckTrigger : false,", iconSkin:"check", showAPI:true}, + {id:401, pId:40, t:"chkboxType", name:"chkboxType : {\"Y\": \"ps\", \"N\": \"ps\"},", iconSkin:"check", showAPI:true}, + {id:402, pId:40, t:"chkStyle", name:"chkStyle : \"checkbox\",", iconSkin:"check", showAPI:true}, + {id:403, pId:40, t:"enable", name:"enable : false,", iconSkin:"check", showAPI:true}, + {id:406, pId:40, t:"nocheckInherit", name:"nocheckInherit : false", iconSkin:"check", showAPI:true}, + {id:407, pId:40, t:"chkDisabledInherit", name:"chkDisabledInherit : false", iconSkin:"check", showAPI:true}, + {id:404, pId:40, t:"radioType", name:"radioType : \"level\"", iconSkin:"check", showAPI:true}, + {id:41, pId:1, name:"},"}, + {id:42, pId:1, name:""}, + + {id:50, pId:1, t:"data", name:"data : {", open:true}, + {id:500, pId:50, t:"keep", name:"keep : {", open:true}, + {id:5001, pId:500, t:"leaf", name:"leaf : false,", iconSkin:"core", showAPI:true}, + {id:5002, pId:500, t:"parent", name:"parent : false", iconSkin:"core", showAPI:true}, + {id:501, pId:50, name:"},"}, + + {id:510, pId:50, t:"key", name:"key : {", open:true}, + {id:5101, pId:510, t:"checked", name:"checked : \"checked\",", iconSkin:"check", showAPI:true}, + {id:5102, pId:510, t:"children", name:"children : \"children\",", iconSkin:"core", showAPI:true}, + {id:5103, pId:510, t:"name", name:"name : \"name\",", iconSkin:"core", showAPI:true}, + {id:5104, pId:510, t:"title", name:"title : \"\"", iconSkin:"core", showAPI:true}, + {id:5105, pId:510, t:"url", name:"url : \"url\"", iconSkin:"core", showAPI:true}, + {id:511, pId:50, name:"},"}, + + {id:520, pId:50, t:"simpleData", name:"simpleData : {", open:true}, + {id:5201, pId:520, t:"enable", name:"enable : false,", iconSkin:"core", showAPI:true}, + {id:5202, pId:520, t:"idKey", name:"idKey : \"id\",", iconSkin:"core", showAPI:true}, + {id:5203, pId:520, t:"pIdKey", name:"pIdKey : \"pId\",", iconSkin:"core", showAPI:true}, + {id:5204, pId:520, t:"rootPId", name:"rootPId : null", iconSkin:"core", showAPI:true}, + {id:521, pId:50, name:"}"}, + {id:51, pId:1, name:"},"}, + {id:52, pId:1, name:""}, + + {id:60, pId:1, t:"edit", name:"edit : {", open:true}, + {id:601, pId:60, t:"drag", name:"drag : {", open:true}, + {id:60111, pId:601, t:"autoExpandTrigger", name:"autoExpandTrigger : true,", iconSkin:"edit", showAPI:true}, + {id:60101, pId:601, t:"isCopy", name:"isCopy : true,", iconSkin:"edit", showAPI:true}, + {id:60102, pId:601, t:"isMove", name:"isMove : true,", iconSkin:"edit", showAPI:true}, + {id:60103, pId:601, t:"prev", name:"prev : true,", iconSkin:"edit", showAPI:true}, + {id:60104, pId:601, t:"next", name:"next : true,", iconSkin:"edit", showAPI:true}, + {id:60105, pId:601, t:"inner", name:"inner : true,", iconSkin:"edit", showAPI:true}, + {id:60107, pId:601, t:"borderMax", name:"borderMax : 10,", iconSkin:"edit", showAPI:true}, + {id:60108, pId:601, t:"borderMin", name:"borderMin : -5,", iconSkin:"edit", showAPI:true}, + {id:60106, pId:601, t:"minMoveSize", name:"minMoveSize : 5,", iconSkin:"edit", showAPI:true}, + {id:60109, pId:601, t:"maxShowNodeNum", name:"maxShowNodeNum : 5,", iconSkin:"edit", showAPI:true}, + {id:60110, pId:601, t:"autoOpenTime", name:"autoOpenTime : 500", iconSkin:"edit", showAPI:true}, + {id:602, pId:60, name:"},"}, + {id:608, pId:60, t:"editNameSelectAll", name:"editNameSelectAll : false,", iconSkin:"edit", showAPI:true}, + {id:603, pId:60, t:"enable", name:"enable : false,", iconSkin:"edit", showAPI:true}, + {id:604, pId:60, t:"removeTitle", name:"removeTitle : \"remove\",", iconSkin:"edit", showAPI:true}, + {id:605, pId:60, t:"renameTitle", name:"renameTitle : \"rename\",", iconSkin:"edit", showAPI:true}, + {id:606, pId:60, t:"showRemoveBtn", name:"showRemoveBtn : true,", iconSkin:"edit", showAPI:true}, + {id:607, pId:60, t:"showRenameBtn", name:"showRenameBtn : true", iconSkin:"edit", showAPI:true}, + {id:61, pId:1, name:"},"}, + {id:62, pId:1, name:""}, + + {id:70, pId:1, t:"view", name:"view : {", open:true}, + {id:7001, pId:70, t:"addDiyDom", name:"addDiyDom : null,", iconSkin:"core", showAPI:true}, + {id:7002, pId:70, t:"addHoverDom", name:"addHoverDom : null,", iconSkin:"edit", showAPI:true}, + {id:7003, pId:70, t:"autoCancelSelected", name:"autoCancelSelected : true,", iconSkin:"core", showAPI:true}, + {id:7004, pId:70, t:"dblClickExpand", name:"dblClickExpand : true,", iconSkin:"core", showAPI:true}, + {id:7005, pId:70, t:"expandSpeed", name:"expandSpeed : \"fast\",", iconSkin:"core", showAPI:true}, + {id:7006, pId:70, t:"fontCss", name:"fontCss : {},", iconSkin:"core", showAPI:true}, + {id:7012, pId:70, t:"nameIsHTML", name:"nameIsHTML : false,", iconSkin:"core", showAPI:true}, + {id:7007, pId:70, t:"removeHoverDom", name:"removeHoverDom : null,", iconSkin:"edit", showAPI:true}, + {id:7008, pId:70, t:"selectedMulti", name:"selectedMulti : true,", iconSkin:"core", showAPI:true}, + {id:7009, pId:70, t:"showIcon", name:"showIcon : true,", iconSkin:"core", showAPI:true}, + {id:7010, pId:70, t:"showLine", name:"showLine : true,", iconSkin:"core", showAPI:true}, + {id:7011, pId:70, t:"showTitle", name:"showTitle : true,", iconSkin:"core", showAPI:true}, + {id:7012, pId:70, t:"txtSelectedEnable", name:"txtSelectedEnable : false", iconSkin:"core", showAPI:true}, + {id:71, pId:1, name:"}"}, + + {id:2, pId:0, name:"}"} + ]; + + var treenode_nodes =[ + {id:1, pId:0, t:"treeNode", name:"treeNode : {", open:true}, + {id:101, pId:1, t:"checked", name:"checked", iconSkin:"check", showAPI:true}, + {id:102, pId:1, t:"children", name:"children", iconSkin:"core", showAPI:true}, + {id:128, pId:1, t:"chkDisabled", name:"chkDisabled", iconSkin:"check", showAPI:true}, + {id:127, pId:1, t:"click", name:"click", iconSkin:"core", showAPI:true}, + {id:103, pId:1, t:"getCheckStatus", name:"getCheckStatus ()", iconSkin:"check", showAPI:true}, + {id:135, pId:1, t:"getIndex", name:"getIndex ()", iconSkin:"core", showAPI:true}, + {id:104, pId:1, t:"getNextNode", name:"getNextNode ()", iconSkin:"core", showAPI:true}, + {id:105, pId:1, t:"getParentNode", name:"getParentNode ()", iconSkin:"core", showAPI:true}, + {id:136, pId:1, t:"getPath", name:"getPath ()", iconSkin:"core", showAPI:true}, + {id:106, pId:1, t:"getPreNode", name:"getPreNode ()", iconSkin:"core", showAPI:true}, + {id:129, pId:1, t:"halfCheck", name:"halfCheck", iconSkin:"check", showAPI:true}, + {id:107, pId:1, t:"icon", name:"icon", iconSkin:"core", showAPI:true}, + {id:108, pId:1, t:"iconClose", name:"iconClose", iconSkin:"core", showAPI:true}, + {id:109, pId:1, t:"iconOpen", name:"iconOpen", iconSkin:"core", showAPI:true}, + {id:110, pId:1, t:"iconSkin", name:"iconSkin", iconSkin:"core", showAPI:true}, + {id:131, pId:1, t:"isHidden", name:"isHidden", iconSkin:"hide", showAPI:true}, + {id:111, pId:1, t:"isParent", name:"isParent", iconSkin:"core", showAPI:true}, + {id:132, pId:1, t:"name", name:"name", iconSkin:"core", showAPI:true}, + {id:112, pId:1, t:"nocheck", name:"nocheck", iconSkin:"check", showAPI:true}, + {id:113, pId:1, t:"open", name:"open", iconSkin:"core", showAPI:true}, + {id:133, pId:1, t:"target", name:"target", iconSkin:"core", showAPI:true}, + {id:134, pId:1, t:"url", name:"url", iconSkin:"core", showAPI:true}, + {id:114, pId:1, t:"diy", name:"*DIY*", iconSkin:"core", showAPI:true}, + {id:115, pId:1, name:""}, + {id:116, pId:1, t:"check_Child_State", name:"[check_Child_State]", iconSkin:"check", showAPI:true}, + {id:117, pId:1, t:"check_Focus", name:"[check_Focus]", iconSkin:"check", showAPI:true}, + {id:118, pId:1, t:"checkedOld", name:"[checkedOld]", iconSkin:"check", showAPI:true}, + {id:119, pId:1, t:"editNameFlag", name:"[editNameFlag]", iconSkin:"edit", showAPI:true}, + {id:120, pId:1, t:"isAjaxing", name:"[isAjaxing]", iconSkin:"core", showAPI:true}, + {id:121, pId:1, t:"isFirstNode", name:"[isFirstNode]", iconSkin:"core", showAPI:true}, + {id:122, pId:1, t:"isHover", name:"[isHover]", iconSkin:"edit", showAPI:true}, + {id:123, pId:1, t:"isLastNode", name:"[isLastNode]", iconSkin:"core", showAPI:true}, + {id:124, pId:1, t:"level", name:"[level]", iconSkin:"core", showAPI:true}, + {id:125, pId:1, t:"parentTId", name:"[parentTId]", iconSkin:"core", showAPI:true}, + {id:126, pId:1, t:"tId", name:"[tId]", iconSkin:"core", showAPI:true}, + {id:130, pId:1, t:"zAsync", name:"[zAsync]", iconSkin:"core", showAPI:true}, + {id:2, pId:0, name:"}"} + ]; + + var function_nodes =[ + {id:1, pId:0, t:"$.fn.zTree", name:"$.fn.zTree : {", open:true}, + {id:11, pId:1, t:"init", name:"init (obj, zSetting, zNodes)", iconSkin:"core", showAPI:true}, + {id:12, pId:1, t:"getZTreeObj", name:"getZTreeObj (treeId)", iconSkin:"core", showAPI:true}, + {id:14, pId:1, t:"destroy", name:"destroy (treeId)", iconSkin:"core", showAPI:true}, + {id:13, pId:1, t:"_z", name:"_z : {tools, view, event, data}", iconSkin:"core", showAPI:true}, + {id:2, pId:0, name:"}"}, + {id:3, pId:0, name:""}, + {id:4, pId:0, t:"zTreeObj", name:"zTreeObj : {", open:true}, + {id:401, pId:4, t:"setting", name:"setting", iconSkin:"core", showAPI:true}, + {id:402, pId:4, t:"addNodes", name:"addNodes (parentNode, index, newNodes, isSilent)", iconSkin:"core", showAPI:true}, + {id:403, pId:4, t:"cancelEditName", name:"cancelEditName (newName)", iconSkin:"edit", showAPI:true}, + {id:404, pId:4, t:"cancelSelectedNode", name:"cancelSelectedNode (node)", iconSkin:"core", showAPI:true}, + {id:405, pId:4, t:"checkAllNodes", name:"checkAllNodes (checked)", iconSkin:"check", showAPI:true}, + {id:406, pId:4, t:"checkNode", name:"checkNode (node, checked, checkTypeFlag, callbackFlag)", iconSkin:"check", showAPI:true}, + {id:407, pId:4, t:"copyNode", name:"copyNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true}, + {id:436, pId:4, t:"destroy", name:"destroy ()", iconSkin:"core", showAPI:true}, + {id:408, pId:4, t:"editName", name:"editName (node)", iconSkin:"edit", showAPI:true}, + {id:409, pId:4, t:"expandAll", name:"expandAll (expandFlag)", iconSkin:"core", showAPI:true}, + {id:410, pId:4, t:"expandNode", name:"expandNode (node, expandFlag, sonSign, focus, callbackFlag)", iconSkin:"core", showAPI:true}, + {id:411, pId:4, t:"getChangeCheckedNodes", name:"getChangeCheckedNodes ()", iconSkin:"check", showAPI:true}, + {id:412, pId:4, t:"getCheckedNodes", name:"getCheckedNodes (checked)", iconSkin:"check", showAPI:true}, + {id:413, pId:4, t:"getNodeByParam", name:"getNodeByParam (key, value, parentNode)", iconSkin:"core", showAPI:true}, + {id:414, pId:4, t:"getNodeByTId", name:"getNodeByTId (tId)", iconSkin:"core", showAPI:true}, + {id:415, pId:4, t:"getNodeIndex", name:"getNodeIndex (node)", iconSkin:"core", showAPI:true}, + {id:416, pId:4, t:"getNodes", name:"getNodes ()", iconSkin:"core", showAPI:true}, + {id:431, pId:4, t:"getNodesByFilter", name:"getNodesByFilter (filter, isSingle, parentNode, invokeParam)", iconSkin:"core", showAPI:true}, + {id:417, pId:4, t:"getNodesByParam", name:"getNodesByParam (key, value, parentNode)", iconSkin:"core", showAPI:true}, + {id:418, pId:4, t:"getNodesByParamFuzzy", name:"getNodesByParamFuzzy (key, value, parentNode)", iconSkin:"core", showAPI:true}, + {id:419, pId:4, t:"getSelectedNodes", name:"getSelectedNodes ()", iconSkin:"core", showAPI:true}, + {id:432, pId:4, t:"hideNode", name:"hideNode (node)", iconSkin:"hide", showAPI:true}, + {id:433, pId:4, t:"hideNodes", name:"hideNodes (nodes)", iconSkin:"hide", showAPI:true}, + {id:420, pId:4, t:"moveNode", name:"moveNode (targetNode, node, moveType, isSilent)", iconSkin:"edit", showAPI:true}, + {id:421, pId:4, t:"reAsyncChildNodes", name:"reAsyncChildNodes (parentNode, reloadType, isSilent)", iconSkin:"core", showAPI:true}, + {id:422, pId:4, t:"refresh", name:"refresh ()", iconSkin:"core", showAPI:true}, + {id:423, pId:4, t:"removeChildNodes", name:"removeChildNodes (parentNode)", iconSkin:"core", showAPI:true}, + {id:424, pId:4, t:"removeNode", name:"removeNode (node, callbackFlag)", iconSkin:"core", showAPI:true}, + {id:425, pId:4, t:"selectNode", name:"selectNode (node, addFlag, isSilent)", iconSkin:"core", showAPI:true}, + {id:430, pId:4, t:"setChkDisabled", name:"setChkDisabled (node, disabled, inheritParent, inheritChildren)", iconSkin:"check", showAPI:true}, + {id:426, pId:4, t:"setEditable", name:"setEditable (editable)", iconSkin:"edit", showAPI:true}, + {id:434, pId:4, t:"showNode", name:"showNode (node)", iconSkin:"hide", showAPI:true}, + {id:435, pId:4, t:"showNodes", name:"showNodes (nodes)", iconSkin:"hide", showAPI:true}, + {id:427, pId:4, t:"transformToArray", name:"transformToArray (nodes)", iconSkin:"core", showAPI:true}, + {id:428, pId:4, t:"transformTozTreeNodes", name:"transformTozTreeNodes (simpleNodes)", iconSkin:"core", showAPI:true}, + {id:429, pId:4, t:"updateNode", name:"updateNode (node, checkTypeFlag)", iconSkin:"core", showAPI:true}, + {id:5, pId:0, name:"}"} + ]; + + apiContent.zTree_Setting = $.fn.zTree.init($("#settingTree"), $.fn.zTree._z.tools.clone(setting), setting_nodes); + apiContent.zTree_Node = $.fn.zTree.init($("#treenodeTree"), $.fn.zTree._z.tools.clone(setting), treenode_nodes); + apiContent.zTree_Function = $.fn.zTree.init($("#functionTree"), $.fn.zTree._z.tools.clone(setting), function_nodes); + this.bindEvent(); + + }, + bindEvent: function() { + $(document).bind("keydown", this.listenKeyDown) + this.overlayCloseBtn.bind("click", apiContent.overlayClose); + this.searchResultInput.bind("click", function(e) { + $(this).prev().get(0).focus(); + this.blur(); + }).bind("focus", function(e) { + this.blur(); + }); + this.searchKey.bind("focus", this.focusKey) + .bind("blur", this.blurKey) + .bind("propertychange", this.searchNode) + .bind("input", this.searchNode); + this.searchPrevBtn.bind("click", this.searchPrev); + this.searchNextBtn.bind("click", this.searchNext); + }, + setSameKey: function(value) { + apiContent.searchKey.attr("value", value); + }, + focusKey: function(e) { + if (apiContent.searchKey.hasClass("empty")) { + apiContent.searchKey.removeClass("empty"); + } + }, + blurKey: function(e) { + apiContent.setSameKey(e.target.value); + if (e.target.value === "") { + apiContent.searchKey.addClass("empty"); + } + }, + listenKeyDown: function(e) { + if (e.keyCode=="13" && apiContent.overlayDiv.is(":hidden")) { + apiContent.openAPI(); + } else if (e.keyCode=="37") { + apiContent.searchPrev(); + } else if (e.keyCode=="13" || e.keyCode=="39") { + apiContent.searchNext(); + } + }, + openAPI: function() { + if (apiContent.searchNodes.length > 0) { + var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"), + treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"), + function_zTree = $.fn.zTree.getZTreeObj("functionTree"); + if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) { + apiContent.searchNodesCur = 0; + } + var node = apiContent.searchNodes[apiContent.searchNodesCur]; + + if (node.tId.indexOf("setting") > -1) { + setting_zTree.selectNode(node); + } else if (node.tId.indexOf("treenode") > -1) { + treenode_zTree.selectNode(node); + } else { + function_zTree.selectNode(node); + } + apiContent.beforeClick(node.tId.substring(0, node.tId.indexOf("_")), node, true); + apiContent.searchCur(); + } + }, + searchNode: function(e) { + var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"), + treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"), + function_zTree = $.fn.zTree.getZTreeObj("functionTree"); + if (apiContent.curKey == e.target.value) return; + apiContent.curKey = e.target.value; + var value = $.trim(apiContent.curKey); + apiContent.setSameKey(apiContent.curKey); + if (apiContent.searchKey.hasClass("empty")) { + value = ""; + apiContent.searchResultInput.removeClass("noResult").attr("value",""); + } + if (apiContent.lastValue === value) return; + + apiContent.updateNodes(false); + apiContent.lastValue = value; + if (value === "" || value.length < 2) { + apiContent.searchNodes = []; + apiContent.searchNodesCur = -1; + apiContent.searchCur(true); + return; + } + + var settingNodeList = setting_zTree.getNodesByFilter(apiContent.searchFilter); + var functionNodeList = function_zTree.getNodesByFilter(apiContent.searchFilter); + var treenodeNodeList = treenode_zTree.getNodesByFilter(apiContent.searchFilter); + apiContent.searchNodes = settingNodeList.concat(functionNodeList).concat(treenodeNodeList); + apiContent.searchNodesCur = -1; + apiContent.searchCur(); + apiContent.updateNodes(true); + }, + searchFilter: function(node) { + var value = $.trim(apiContent.searchKey.get(0).value).toLowerCase(); + return (node.showAPI && node.name.toLowerCase().indexOf(value) > -1); + }, + searchPrev: function(e) { + if (apiContent.searchPrevBtn.hasClass("disabled")) return; + apiContent.searchNodesCur--; + if (apiContent.searchNodesCur < 0 || apiContent.searchNodesCur > apiContent.searchNodes.length -1) { + apiContent.searchNodesCur = apiContent.searchNodes.length -1; + } + apiContent.openAPI(); + }, + searchNext: function(e) { + if (apiContent.searchNextBtn.hasClass("disabled")) return; + apiContent.searchNodesCur++; + apiContent.openAPI(); + }, + searchCur: function(init) { + var result = apiContent.searchNodes; + if (init) { + apiContent.searchResultInput.removeClass("noResult").attr("value",""); + } else if (result.length == 0) { + apiContent.searchResultInput.addClass("noResult").attr("value"," [ 0 / 0 ] "); + } else { + apiContent.searchResultInput.removeClass("noResult").attr("value"," [ " + (apiContent.searchNodesCur > -1 ? apiContent.searchNodesCur+1 : "?")+ " / " + result.length + " ] "); + } + if (result.length > 0) { + apiContent.searchPrevBtn.removeClass("disabled"); + apiContent.searchNextBtn.removeClass("disabled"); + } else { + apiContent.searchPrevBtn.addClass("disabled"); + apiContent.searchNextBtn.addClass("disabled"); + } + }, + updateNodes: function(highlight) { + var setting_zTree = $.fn.zTree.getZTreeObj("settingTree"), + treenode_zTree = $.fn.zTree.getZTreeObj("treenodeTree"), + function_zTree = $.fn.zTree.getZTreeObj("functionTree"), + node = null; + for( var i=0, l=apiContent.searchNodes.length; i 0) { + node.highlight = highlight; + if (node.tId.indexOf("setting") > -1) { + setting_zTree.updateNode(node); + } else if (node.tId.indexOf("treenode") > -1) { + treenode_zTree.updateNode(node); + } else { + function_zTree.updateNode(node); + } + } + } + }, + getFontCss: function(treeId, treeNode) { + return (!!treeNode.highlight) ? {color:"#A60000", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"}; + }, + getTitle: function(treeId, node) { + var t = [], n = node; + while (n && !!n.t) { + t.push(n.t); + n = n.getParentNode(); + } + t = t.reverse(); + node.tt = t.join('.'); + return true; + }, + showIcon: function(treeId, node) { + return (!!node.iconSkin); + }, + onNodeCreated: function (e, treeId, node) { + var a = $("#" + node.tId + "_a"); + if (node.showAPI) { + a.attr("rel", "#overlayDiv"); + } else { + a.css({cursor: "default"}); + } + }, + beforeClick: function (treeId, node, noClear) { + if (!node.showAPI) return false; + var o = $("#" + node.tId + "_a"); + if (!!apiContent.apiCache[node.tId]) { + apiContent.tmpDiv.html(apiContent.apiCache[node.tId]); + apiContent.overlayShow(o, (apiContent.lastNode === node)); + } else { + apiContent.overlayAjax(treeId, node); + } + apiContent.lastNode = node; + if (node.tId.indexOf("settingTree")>-1) { + apiContent.settingDiv.removeClass("right").addClass("left"); + apiContent.functionDiv.removeClass("left").addClass("right"); + } else { + apiContent.settingDiv.removeClass("left").addClass("right"); + apiContent.functionDiv.removeClass("right").addClass("left"); + } + + if (!noClear) { + apiContent.clearSelectedNode(); + } + return true; + }, + clearSelectedNode: function() { + apiContent.zTree_Setting.cancelSelectedNode(); + apiContent.zTree_Node.cancelSelectedNode(); + apiContent.zTree_Function.cancelSelectedNode(); + }, + overlayAutoClose: function(e) { + var eId = e.target.id, eRel = e.target.getAttribute("rel"), eClass = e.target.className; + if (eId === "overlayDiv" || eId === "overlayDivArrow" || eClass.indexOf("searchPrev") > -1 || eClass.indexOf("searchNext") > -1 || !!eRel) return; + if (!$(e.target).parents("[rel]").length && !$(e.target).parents("#overlayDiv").length) { + apiContent.overlayClose(); + } + }, + overlayClose: function() { + var o = apiContent.overlayDiv; + o.stop(); + apiContent.clearSelectedNode(); + if (ie) { + o.hide(); + } else { + setTimeout(function() {o.fadeTo("fast", 0, function(){o.hide();})}, 200); + } + $(document).unbind("click", apiContent.overlayAutoClose); + }, + overlayShow: function(target, isSameNode) { + var w = $(window), o = apiContent.overlayDiv, a = apiContent.overlayArrow, + oc = apiContent.overlayContent, c = apiContent.contentBoxDiv, + t = target.offset().top - 30, + cMaxLeft = c.offset().left + c.outerWidth({margin:true}) - o.outerWidth({margin:true}) - 10, + l = Math.min(cMaxLeft, target.offset().left + target.width() + 40), + arrowT = target.offset().top + 16, + wMinTop = 100, footerHeight = 50, onlyFade = false, + wHeight = w.height(), wScrollTop=w.scrollTop(), wMaxTop = wHeight + wScrollTop - footerHeight; + if (!apiContent.overlayMaxTop) { + apiContent.overlayMaxTop = apiContent.contentBoxDiv.offset().top + apiContent.contentBoxDiv.height(); + } + o.stop(); + if (o.css("display") !== "block") { + o.css({top: t, left: l}); + a.css({top:arrowT - t}); + $(document).bind("click", apiContent.overlayAutoClose); + } + if (ie) { + onlyFade = true; + o.show(); + } else { + o.fadeTo("fast", 1); + } + + var h = apiContent.tmpDiv.outerHeight({margin:true}) + apiContent.overlaySearch.outerHeight(); + if ((t + h) > wMaxTop) { + t = wMaxTop - h; + } + if ((t + h) > apiContent.overlayMaxTop) { + t = apiContent.overlayMaxTop - h; + } + t = Math.max(t, wScrollTop, wMinTop); + if ((t + h) > ($("body").height()-footerHeight-20)) { + o.css("padding-bottom", footerHeight + "px"); + } else { + o.css("padding-bottom", "0"); + } + apiContent.overlayDetailDiv.empty(); + apiContent.overlayDetailDiv.append(apiContent.tmpDiv.children()); + if (!onlyFade) { + onlyFade = (isSameNode && t === parseInt(o.css("top").replace("px", ""))); + } + + a.removeClass("reverse"); + if ( (arrowT - t) > (h-55) ) { + a.addClass("reverse"); + arrowT -= 55; + } + + if (onlyFade) { + o.css({top: t, left: l}); + oc.css({height: h}); + a.css({top:arrowT - t}); + } else { + o.animate({top: t, left: l}, {duration: "normal",easing: "swing", complete:null}); + oc.animate({height: h}, {duration: "fast",easing: "swing", complete:null}); + a.animate({top:arrowT - t}, {duration: "normal",easing: "linear", complete:null}); + } + }, + overlayAjax: function(treeId, node) { + var o = $("#" + node.tId + "_a"); + if (node.isAjax) return; + node.isAjax = true; + $.ajax({ + type: "get", + url: "" + lang + "/" + node.tt.replace("$.", "") + ".html", + data: null, + dataType: "text", + success: function(msg) { + if (!apiContent.tmpDiv) { + var tmpDiv = $(document.createElement("div")); + tmpDiv.addClass("baby_overlay_tmp"); + $("body").append(tmpDiv) + apiContent.tmpDiv = $(document.createElement("div")); + apiContent.tmpDiv.addClass("details"); + tmpDiv.append(apiContent.tmpDiv); + + } else { + apiContent.tmpDiv.empty(); + } + apiContent.tmpDiv.html(msg); + apiContent.overlayShow(o, false); + apiContent.apiCache[node.tId] = msg; + node.isAjax = false; + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + alert(ajaxMsg) + if (apiContent.tmpDiv) apiContent.tmpDiv.empty(); + node.isAjax = false; + } + }); + } +} \ No newline at end of file diff --git a/static/zTree3/api/apiCss/common.css b/static/zTree3/api/apiCss/common.css new file mode 100644 index 0000000..78f910c --- /dev/null +++ b/static/zTree3/api/apiCss/common.css @@ -0,0 +1,219 @@ +/* Resets */ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;} +:focus {outline: 0;} +body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #528036 url(img/background.jpg) no-repeat fixed 0 0;} +p {padding-bottom: 20px;} +ol, ul {list-style: none;} +table {border-collapse: separate;border-spacing: 0;} +caption, th, td {text-align: left;font-weight: normal;} +strong {font-weight: bold;} +em {font-style: italic;} +hr {display: none;} +.font1 {color: white;background-color: #528036;} +.right {float: right;} +.left {float: left;} +.hide {display: none;} +.round {-moz-border-radius: 15px;-webkit-border-radius: 15px;-khtml-border-radius: 15px;border-radius: 15px;} +.clear {clear: both;} +.clearfix {display: block;} +.clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;} +html[xmlns] .clearfix {display: block;} +* html .clearfix {height: 1%;} + +/* Link Styles */ +a {color: #528036;} +a:link, a:visited {text-decoration: none;} +a:hover {color: #000;text-decoration: none;} +a:active {text-decoration: none;} + +/* Headings */ +h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;} +h1 {font-size: 36px;line-height: 44px;} +h2 {font-size: 20px;line-height: 20px;} +h3 {font-size: 14px;line-height: 14px;} +h4 {font-size: 14px;font-weight: normal;line-height: 25px;} + +/* Wraps */ +.header_wrap {position: relative;min-width: 940px;padding: 100px 30px 0 30px;} +.content_wrap {position: relative;min-width: 940px;padding: 0 30px 50px 30px;} +.footer_wrap {bottom: 0;height: 47px;width: 100%;background-color: #1b1b1b;border-top: 1px solid #749e58;} + +/* Header */ +.header {position: relative;width: 940px;margin: 0 auto;height: 160px;border: 1px solid white;background: transparent url(img/header-bg.png) repeat-x 0 -50px;} +.header-text {padding: 40px 25px 15px 120px;font-size: 18px;line-height: 24px;color: #747d67;font-family: Helvetica, sans-serif;} +.header-text img {padding-bottom: 5px;} +.shortcuts {white-space: nowrap;text-align: right;position: absolute;top: -45px;right: 5px;} +.shortcuts.language {top: -85px;right:0px;} +.shortcuts li {display: inline;font-size: 18px;line-height: 28px;font-family: Helvetica, Arial, simsun, sans-serif;padding-bottom: 5px;margin-left: 30px;cursor: pointer;} +.shortcuts li button {cursor: pointer;} +.shortcuts li span {border-bottom: 1px dotted white;} +.shortcuts li span.selected {padding: 2px;background-color: #528036;} +.shortcuts li a {color: #fff;} +.ieSuggest {display:none;font-size: 12px;color: silver;position: absolute;left: 10px;top: 2px;} +.google_plus {position: absolute;right: 10px; top:10px;} +.light-bulb {position: absolute;left: -20px;bottom: -35px;width:116px;height:180px;background-image:url(img/lightbulb.png);background-repeat: no-repeat;} + +/* Content */ +.content {position: relative;width: 940px;margin: 0 auto;} +.nav_section {position: relative;height: 20px;font-family: "Myriad Pro", "Trebuchet MS", sans-serif;font-size: 15px;color: #253;padding: 20px 0;} +.nav_section ul {position: absolute;right: 10px;} +.nav_section ul li {display: inline;line-height: 20px;margin: 0 5px 0 20px;border-bottom: 1px dotted white;} +.nav_section ul li.noline {border-bottom: 0;} +.nav_section ul li a {color: #fff;} +.nav_section ul li a.selected {padding: 2px;background-color: #528036;} +.nav_section ul li.first {border: none;} +.content .title {margin: 50px 30px 20px 70px;} +.content li {margin-bottom: 5px;} +.contentBox {position: relative;overflow: hidden;border: 1px solid white;min-height: 200px;line-height: 25px;background: transparent url(img/contact-bg.png) repeat-x 0 0;} + +.zTreeInfo {display:none;width: 940px;position: absolute;} +.zTreeInfo p {padding-bottom: 50px;} +.zTreeInfo-left {float: left;width: 280px;height:300px;padding: 0 50px 60px 75px;background:url(img/zTreeIntroduction.jpg) no-repeat 30px 30px;} +.zTreeInfo-right {position: relative;float: right;width: 475px;padding: 0 50px 60px 0;} +.zTreeInfo-right li {font-size: 12px;list-style-type: disc;} + +.license {display:none;width: 940px;position: absolute;} + +.donateInfo {display:block;width: 940px;position: absolute;} + +.links {display:none;width: 940px;position: absolute;} +.links .content {float: left;width: 160px;height:200px;padding: 0 10px 10px 2px;text-align: center;} +.links .content.first {margin-left: 30px;} + +.contact {display:none;width: 940px;position: absolute;} +.contact .myhome { position: absolute; top:10px; left:620px; width:300px; height:266px; background: transparent url(img/myhome.gif) scroll no-repeat 0 0;} + +.siteTag {position: absolute;left: -16px;top: 109px;z-index: 10;width: 65px;height: 46px;padding:0;margin:0 10px 0 0; + vertical-align:middle;border:0 none;background: transparent url(img/siteTag.png) scroll no-repeat 0 0;} +.siteTag.tag_zTreeInfo {background-position: 0 0} +.siteTag.tag_license {background-position: 0 -46px} +.siteTag.tag_donate {background-position: 0 -92px} +.siteTag.tag_contact {background-position: 0 -138px} + +.apiContent {width: 940px;} +.apiContent .right {float: right;padding-right: 100px;} +.apiContent .left {float: left;padding-right: 20px;border-right: 1px dotted silver;} +.api_setting {position: relative;margin:20px 0 20px 20px;} +.api_function {position: relative;margin:20px 0 20px 30px;padding-right: 10px;} +.api_content_title {text-align: center;font-weight: bold;} + +.demoContent {width: 940px;} +.demoContent .right {float: right;padding: 20px;width: 600px;} +.demoContent .left {float: left;padding: 20px;} +.demoContent iframe {width:600px;min-height: 530px;} + +.faqContent {width: 940px;} +.faqContent .right {float: right;padding: 20px;width: 600px;} +.faqContent .left {float: left;padding: 20px;} +.faqContent iframe {width:600px;min-height: 300px;} + +.baby_overlay_tmp {position: absolute;top:0; left:-5000px;display:block;visibility: hidden;width:640px;font-size:11px;} +.baby_overlay_tmp .details {padding: 20px;} +.baby_overlay {display:none;position:absolute;z-index:99;left:0; top:0;width:640px;color:#fff;font-size:11px;} +.baby_overlay .content {width:100%; height:100px;overflow: hidden;background: transparent url(img/overlay_bg.png) scroll repeat 0 0;} +.baby_overlay .details {padding:0 20px 20px 20px;} +.baby_overlay .close {background-image:url(img/close.png);position:absolute; right:5px; top:5px;cursor:pointer;height:36px;width:36px;} +.baby_overlay_arrow {background-image:url(img/overlay_arrow.png);background-position:0 0;position:absolute;height:40px;width:40px;left: -40px;} +.baby_overlay_arrow.reverse {background-position:0 -40px;} + +/* Footer */ +.footer {position: relative;min-width: 1000px;font: 14px/24px arial, helvetica, sans-serif;} +.footer ul {position:absolute;left: 0px;border:1px solid #393939;background:#262626;padding:12px 0px;line-height: 18px;display: none;list-style: none;} +.footer ul li a {display:block;padding: 2px 15px;color: #9c9c9c;text-indent: 0;} +.footer ul li a:hover {text-decoration:none;color: #fff;} +.footer-logo {position:absolute;margin: 10px 0 0 30px;width:122px; height:24px;top:0; left:0;background: transparent url(img/footer-logo.png) no-repeat 0 0;} +.footer_mii {position: absolute;right: 558px;top: 8px;z-index: 10;padding: 4px 0;} +.footer_mii a {font-size:10px;color:#649140} +.footer_mii a:hover {color:#B6D76F} +.footer_siteMap {position: absolute;right: 358px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;} +.footer_siteMap .footer_siteMap_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_siteMap.gif) no-repeat 0 0;} +.footer_siteMap ul {top:-202px;width:180px;} +.footer_siteMap:hover ul {left: 0} +.footer_contact {position: absolute;right: 193px;top: 8px;width: 155px;z-index: 10;padding: 4px 0;} +.footer_contact .footer_contact_header {width:155px;text-indent: -9999px;background: transparent url(img/footer_contact.gif) no-repeat 0px 0px;} +.footer_contact ul {top:-113px;width:153px;} +.footer_contact:hover ul {left: 0} +.footer_download {position: absolute;right: 60px;top: 8px;width: 123px;z-index: 10;padding: 4px 0;} +.footer_download .footer_download_header {width:123px;text-indent: -9999px;background: transparent url(img/footer_download.png) no-repeat 0px 0px;} +.footer_download ul {top:-113px;width:140px;} +.footer_download:hover ul {left: 0} + +/* button icon */ +button {vertical-align:middle;border:0 none;background: transparent no-repeat 0 0 scroll;} + +.shortcuts button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/menuIcon.png)} +.shortcuts button.home {background-position: 0 0} +.shortcuts button.demo {background-position: 0 -24px} +.shortcuts button.api {background-position: 0 -48px} +.shortcuts button.faq {background-position: 0 -72px} +.shortcuts button.donate {background-position: 0 -144px} +.shortcuts button.download {background-position: 0 -96px} +.shortcuts button.face {background-position: 0 -120px} +.shortcuts button.cn {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/chinese.png)} +.shortcuts button.en {width:48px; height:24px;padding:0; margin:0 10px 0 0;background-image:url(img/english.png)} + +.content button.ico {width:24px; height:24px;padding:0; margin:0 10px 0 0;} + +.content button.ico16 {width:16px; height:16px;padding:0; margin:0 5px 0 0;background-image:url("img/apiMenu.png");} +button.z_core {margin-top: -4px;background-position:0 0;} +button.z_check {margin-top: -4px;background-position:0 -16px;} +button.z_edit {margin-top: -4px;background-position:0 -32px;} +button.z_hide {margin-top: -4px;background-position:0 -64px;} +button.z_search {margin-top: -4px;background-position:0 -48px;} +button.searchPrev {margin-top: -4px;background-position:-16px 0;cursor:pointer} +button.searchNext {margin-top: -4px;background-position:-16px -16px;cursor:pointer} +button.searchPrev.disabled {margin-top: -4px;background-position:-16px -32px;cursor:auto} +button.searchNext.disabled {margin-top: -4px;background-position:-16px -48px;cursor:auto} +input.search {margin:0;padding:2px 0; border:0;} +input.searchKey {width:150px;} +input.searchResult {margin-left:-3px;width:65px;text-align:right;background-color:white;color:#707070} +input.searchResult.noResult {background-color:#ff6666;color:black} +.baby_overlay div.overlaySearch {text-align:right;padding-right:50px;padding-top:12px;} + +/* api overlay*/ +.apiDetail .topLine {border-top: 1px dashed #376B29;margin-top: 5px;padding-top: 5px;} +.apiDetail .highlight_red {color:#A60000;} +.apiDetail .highlight_green {color:#A7F43D;} +.apiDetail h1, .apiDetail h2, .apiDetail h3, .apiDetail h4, .apiDetail h5, .apiDetail h6 {color: white;padding: 0;} +.apiDetail h2 {color: #A7F43D;margin: 5px auto;padding: 5px;font-size: 20px;} +.apiDetail h2 span {font-size: 14px;float: right;font-weight: normal;margin: 2px 20px 0 0;vertical-align: bottom;} +.apiDetail h2 span.path {float: left;margin: 2px 0 0 0;vertical-align: bottom;} +.apiDetail h3 {margin: 5px auto;padding: 5px;font-size: 14px;font-weight: normal;} +.apiDetail h3 span.h3_info {margin-left: 20px;font-size: 12px;} +.apiDetail h4 {margin: 0 auto;padding: 0 5px;font-size: 12px;font-weight: normal;line-height: 16px;} +.apiDetail .desc h4 {color: black;} +.apiDetail h4 b{width: 150px;display:inline-block;} +.apiDetail h4 span{width: 230px;display:inline-block;} + +.apiDetail pre, .apiDetail .desc {background: #E8FCD6;color: black;margin: 10px;padding: 10px;display: block;} +.apiDetail pre {word-wrap: break-word;} +.apiDetail p{margin-left: 5px;padding: 0;} +.apiDetail .longdesc {margin-top: 5px;} +.apiDetail .longdesc p{font-size: 12px;line-height:1.5;margin:3px 0;} +.apiDetail .longdesc b{font-size: 14px;} +.apiDetail table {border-collapse:collapse;} +.apiDetail table td {border:1px solid silver;text-align: center;vertical-align: middle;} +.apiDetail table thead td {font-weight: bold} + +.apiDetail button {width:16px; height:16px; vertical-align:middle; border:0 none; cursor: pointer; + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; + background-image:url("zTreeStyle/img/zTreeStandard.png");} + +.apiDetail button.chk {width:13px; height:13px; margin:0 3px 2px 0; cursor: auto} +.apiDetail button.chk.checkbox_false_full {background-position:0 0} +.apiDetail button.chk.checkbox_false_full_focus {background-position:0 -14px} +.apiDetail button.chk.checkbox_false_part {background-position:0 -28px} +.apiDetail button.chk.checkbox_false_part_focus {background-position:0 -42px} +.apiDetail button.chk.checkbox_true_full {background-position:-14px 0} +.apiDetail button.chk.checkbox_true_full_focus {background-position:-14px -14px} +.apiDetail button.chk.checkbox_true_part {background-position:-14px -28px} +.apiDetail button.chk.checkbox_true_part_focus {background-position:-14px -42px} +.apiDetail button.chk.radio_false_full {background-position:-28px 0} +.apiDetail button.chk.radio_false_full_focus {background-position:-28px -14px} +.apiDetail button.chk.radio_false_part {background-position:-28px -28px} +.apiDetail button.chk.radio_false_part_focus {background-position:-28px -42px} +.apiDetail button.chk.radio_true_full {background-position:-42px 0} +.apiDetail button.chk.radio_true_full_focus {background-position:-42px -14px} +.apiDetail button.chk.radio_true_part {background-position:-42px -28px} +.apiDetail button.chk.radio_true_part_focus {background-position:-42px -42px} \ No newline at end of file diff --git a/static/zTree3/api/apiCss/common_ie6.css b/static/zTree3/api/apiCss/common_ie6.css new file mode 100644 index 0000000..aacaf59 --- /dev/null +++ b/static/zTree3/api/apiCss/common_ie6.css @@ -0,0 +1,23 @@ +* html{ +/* background-image:url(about:blank);*/ + background-attachment:fixed; +} +html pre {word-wrap: break-word} +.header {background-image: none;background-color: #F0F6E4;} + +.ieSuggest {display:block;} +.shortcuts button.cn {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/chinese.png');background-image: none;} +.shortcuts button.en {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/english.png');background-image: none;} + +.light-bulb {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/lightbulb.png');background-image: none;} +.contentBox {background-image: none;background-color: #F0F6E4;} +.zTreeInfo {background-image: none;background-color: #F0F6E4;} + +.content button.ico16 {*background-image:url("img/apiMenu.gif")} +.siteTag {background-image: none;} +.apiContent .right {float: right;padding-right: 50px;} + +div.baby_overlay {background-color: #3C6E31;background-image:none;color:#fff;} +div.baby_overlay .close {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='apiCss/img/overlay_close_IE6.gif');background-image: none;} +.baby_overlay_arrow {background-image:url(img/overlay_arrow.gif);} +.apiDetail button {background-image:url("img/zTreeStandard.gif")} \ No newline at end of file diff --git a/static/zTree3/api/apiCss/img/apiMenu.gif b/static/zTree3/api/apiCss/img/apiMenu.gif new file mode 100644 index 0000000..066fc8e Binary files /dev/null and b/static/zTree3/api/apiCss/img/apiMenu.gif differ diff --git a/static/zTree3/api/apiCss/img/apiMenu.png b/static/zTree3/api/apiCss/img/apiMenu.png new file mode 100644 index 0000000..9acec50 Binary files /dev/null and b/static/zTree3/api/apiCss/img/apiMenu.png differ diff --git a/static/zTree3/api/apiCss/img/background.jpg b/static/zTree3/api/apiCss/img/background.jpg new file mode 100644 index 0000000..003375f Binary files /dev/null and b/static/zTree3/api/apiCss/img/background.jpg differ diff --git a/static/zTree3/api/apiCss/img/chinese.png b/static/zTree3/api/apiCss/img/chinese.png new file mode 100644 index 0000000..d3b57fc Binary files /dev/null and b/static/zTree3/api/apiCss/img/chinese.png differ diff --git a/static/zTree3/api/apiCss/img/close.png b/static/zTree3/api/apiCss/img/close.png new file mode 100644 index 0000000..69e41e3 Binary files /dev/null and b/static/zTree3/api/apiCss/img/close.png differ diff --git a/static/zTree3/api/apiCss/img/contact-bg.png b/static/zTree3/api/apiCss/img/contact-bg.png new file mode 100644 index 0000000..a3d7a5f Binary files /dev/null and b/static/zTree3/api/apiCss/img/contact-bg.png differ diff --git a/static/zTree3/api/apiCss/img/english.png b/static/zTree3/api/apiCss/img/english.png new file mode 100644 index 0000000..2ad2d7d Binary files /dev/null and b/static/zTree3/api/apiCss/img/english.png differ diff --git a/static/zTree3/api/apiCss/img/header-bg.png b/static/zTree3/api/apiCss/img/header-bg.png new file mode 100644 index 0000000..a2baacf Binary files /dev/null and b/static/zTree3/api/apiCss/img/header-bg.png differ diff --git a/static/zTree3/api/apiCss/img/lightbulb.png b/static/zTree3/api/apiCss/img/lightbulb.png new file mode 100644 index 0000000..c99357a Binary files /dev/null and b/static/zTree3/api/apiCss/img/lightbulb.png differ diff --git a/static/zTree3/api/apiCss/img/overlay_arrow.gif b/static/zTree3/api/apiCss/img/overlay_arrow.gif new file mode 100644 index 0000000..e7c3e6d Binary files /dev/null and b/static/zTree3/api/apiCss/img/overlay_arrow.gif differ diff --git a/static/zTree3/api/apiCss/img/overlay_arrow.png b/static/zTree3/api/apiCss/img/overlay_arrow.png new file mode 100644 index 0000000..d790a11 Binary files /dev/null and b/static/zTree3/api/apiCss/img/overlay_arrow.png differ diff --git a/static/zTree3/api/apiCss/img/overlay_bg.png b/static/zTree3/api/apiCss/img/overlay_bg.png new file mode 100644 index 0000000..5f81ee6 Binary files /dev/null and b/static/zTree3/api/apiCss/img/overlay_bg.png differ diff --git a/static/zTree3/api/apiCss/img/overlay_close_IE6.gif b/static/zTree3/api/apiCss/img/overlay_close_IE6.gif new file mode 100644 index 0000000..42cb8d8 Binary files /dev/null and b/static/zTree3/api/apiCss/img/overlay_close_IE6.gif differ diff --git a/static/zTree3/api/apiCss/img/zTreeStandard.gif b/static/zTree3/api/apiCss/img/zTreeStandard.gif new file mode 100644 index 0000000..3f69a5b Binary files /dev/null and b/static/zTree3/api/apiCss/img/zTreeStandard.gif differ diff --git a/static/zTree3/api/apiCss/img/zTreeStandard.png b/static/zTree3/api/apiCss/img/zTreeStandard.png new file mode 100644 index 0000000..33c9e84 Binary files /dev/null and b/static/zTree3/api/apiCss/img/zTreeStandard.png differ diff --git a/static/zTree3/api/apiCss/jquery-1.6.2.min.js b/static/zTree3/api/apiCss/jquery-1.6.2.min.js new file mode 100644 index 0000000..8cdc80e --- /dev/null +++ b/static/zTree3/api/apiCss/jquery-1.6.2.min.js @@ -0,0 +1,18 @@ +/*! + * jQuery JavaScript Library v1.6.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Jun 30 14:16:56 2011 -0400 + */ +(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
                    a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
                    ",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
                    t
                    ",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i. +shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

                    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
                    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/",""],legend:[1,"
                    ","
                    "],thead:[1,"","
                    "],tr:[2,"","
                    "],td:[3,"","
                    "],col:[2,"","
                    "],area:[1,"",""],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div
                    ","
                    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j +)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
                    ").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
                    ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/static/zTree3/api/apiCss/jquery.ztree.core.js b/static/zTree3/api/apiCss/jquery.ztree.core.js new file mode 100644 index 0000000..4980f03 --- /dev/null +++ b/static/zTree3/api/apiCss/jquery.ztree.core.js @@ -0,0 +1,74 @@ +/* + * 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-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;i0)},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&&d0},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;s0&&(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&&e1&&(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 +-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,">");b.push("",d,"")},makeDOMNodeLine:function(b,a,c){b.push("")},makeDOMNodeMainAfter:function(b){b.push("")},makeDOMNodeMainBefore:function(b,a,c){b.push("
                  • ")},makeDOMNodeNameAfter:function(b){b.push("")}, +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("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, +">"),"'");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("
                      ");c.push(d);c.push("
                    ")},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;e0)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;g0){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;f0?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); diff --git a/static/zTree3/api/apiCss/zTreeStyleForApi.css b/static/zTree3/api/apiCss/zTreeStyleForApi.css new file mode 100644 index 0000000..bb4717b --- /dev/null +++ b/static/zTree3/api/apiCss/zTreeStyleForApi.css @@ -0,0 +1,49 @@ +/*------------------------------------- +zTree Style + +version: 3.0 +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} +.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; color:#333; height:17px; text-decoration:none; vertical-align:top; display: inline-block} +.ztree li a:hover {text-decoration:none} +.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid;} +.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8; filter:alpha(opacity=80)} +.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; + 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.switch {width:1px; height:18px; visibility: hidden} + +.zTreeDragUL {margin:0; padding:0; position:absolute; 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 等级样式*/ +/*.ztree li button.level0 { + display:none; +} +.ztree li ul.level0 { + padding:0; + background:none; +}*/ + +.ztree li span.button.core_ico_docu{margin-right:2px; background-position:-126px 0; vertical-align:top; *vertical-align:middle} +.ztree li span.button.check_ico_docu{margin-right:2px; background-position:-126px -16px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.edit_ico_docu{margin-right:2px; background-position:-126px -32px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.hide_ico_docu{margin-right:2px; background-position:-160px 0; vertical-align:top; *vertical-align:middle} diff --git a/static/zTree3/api/cn/fn.zTree._z.html b/static/zTree3/api/cn/fn.zTree._z.html new file mode 100644 index 0000000..7af3e40 --- /dev/null +++ b/static/zTree3/api/cn/fn.zTree._z.html @@ -0,0 +1,13 @@ +
                    +
                    +

                    JSON$.fn.zTree._z

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree v3.x 内部的全部方法都可以通过 $.fn.zTree._z 进行调用,开放出来是为了更便于大家开发制作自己的 zTree 插件。

                    +

                    如无特殊需求请勿使用此对象,以及修改此对象内部的各个函数。

                    +
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/fn.zTree.destroy.html b/static/zTree3/api/cn/fn.zTree.destroy.html new file mode 100644 index 0000000..7105807 --- /dev/null +++ b/static/zTree3/api/cn/fn.zTree.destroy.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Function(treeId)$.fn.zTree.destroy

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    从 zTree v3.4 开始提供销毁 zTree 的方法。

                    +

                    1、用此方法可以销毁指定 treeId 的 zTree,也可以销毁当前页面全部的 zTree。

                    +

                    2、销毁指定 treeId 的 zTree 也可以使用 zTreeObj.destroy() 方法。

                    +

                    3、重新使用已经被销毁的树,必须要使用 init 方法进行初始化。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    zTree 的 DOM 容器的 id

                    +

                    省略 treeId,表示销毁当前页面全部的 zTree

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 销毁 id 为 "treeDemo" 的 zTree

                    +
                    $.fn.zTree.destroy("treeDemo");
                    +

                    2. 销毁全部 的 zTree

                    +
                    $.fn.zTree.destroy();
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/fn.zTree.getZTreeObj.html b/static/zTree3/api/cn/fn.zTree.getZTreeObj.html new file mode 100644 index 0000000..b1d1db4 --- /dev/null +++ b/static/zTree3/api/cn/fn.zTree.getZTreeObj.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Function(treeId)$.fn.zTree.getZTreeObj

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree v3.x 专门提供的根据 treeId 获取 zTree 对象的方法。

                    +

                    必须在初始化 zTree 以后才可以使用此方法。

                    +

                    有了这个方法,用户不再需要自己设定全局变量来保存 zTree 初始化后得到的对象了,而且在所有回调函数中全都会返回 treeId 属性,用户可以随时使用此方法获取需要进行操作的 zTree 对象

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    zTree 的 DOM 容器的 id

                    +

                    返回值JSON

                    +

                    zTree 对象,提供操作 zTree 的各种方法,对于通过 js 操作 zTree 来说必须通过此对象

                    +
                    +

                    function 举例

                    +

                    1. 获取 id 为 tree 的 zTree 对象

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/fn.zTree.init.html b/static/zTree3/api/cn/fn.zTree.init.html new file mode 100644 index 0000000..61da41a --- /dev/null +++ b/static/zTree3/api/cn/fn.zTree.init.html @@ -0,0 +1,74 @@ +
                    +
                    +

                    Function(obj, zSetting, zNodes)$.fn.zTree.init

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 初始化方法,创建 zTree 必须使用此方法

                    +

                    1、页面需要进行 W3C 申明,例如:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">。

                    +

                    2、需要首先加载 jquery-1.4.2.js 或其他更高版本的 jQuery 。

                    +

                    3、需要加载 jquery-ztree.core-3.0.js,如果需要用到 编辑功能 或 checkbox / radio 还需要分别加载 jquery-ztree.exedit-3.0.js 和 jquery-ztree.excheck-3.0.js 。

                    +

                    4、需要加载 zTreeStyle.css 以及 zTreeStyle 目录下的 img 文件。

                    +

                    5、如果需要使用自定义图标请参考相应的Demo。

                    +

                    6、请注意设置 zTree 的容器样式 class="ztree",其中 "ztree" 这个 className,可以根据需要随意修改,别忘了修改 css 中对应名字就是了,对于容器如果需要增加其他特殊样式,可根据自己的需要进行修改。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    objjQuery Object

                    +

                    用于展现 zTree 的 DOM 容器

                    +

                    zSettingJSON

                    +

                    zTree 的配置数据,具体请参考 “setting 配置详解”中的各个属性详细说明

                    +

                    zNodesArray(JSON) / JSON

                    +

                    zTree 的节点数据,具体请参考 “treeNode 节点数据详解”中的各个属性详细说明

                    +

                    1、v3.x 支持单独添加一个节点,即如果只新增一个节点,不用必须包在数组中

                    +

                    2、如果需要异步加载根节点,可以设置为 null 或 [ ]

                    +

                    3、使用简单数据模式,请参考 setting.data.simpleData 内的属性说明

                    +

                    返回值JSON

                    +

                    zTree 对象,提供操作 zTree 的各种方法,对于通过 js 操作 zTree 来说必须通过此对象

                    +

                    如果不需要自行设定全局变量保存,可以利用 $.fn.zTree.getZTreeObj 方法随时获取

                    +
                    +

                    setting & function 举例

                    +

                    1. 简单创建 zTree 演示

                    +
                    <!DOCTYPE html>
                    +<HTML>
                    + <HEAD>
                    +  <TITLE> ZTREE DEMO </TITLE>
                    +  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
                    +  <link rel="stylesheet" href="zTreeStyle/zTreeStyle.css" type="text/css">
                    +  <script type="text/javascript" src="jquery-1.4.2.js"></script>
                    +  <script type="text/javascript" src="jquery.ztree.core.js"></script>
                    +<!--
                    +  <script type="text/javascript" src="jquery.ztree.excheck.js"></script>
                    +  <script type="text/javascript" src="jquery.ztree.exedit.js"></script>
                    +-->
                    +  <SCRIPT type="text/javascript" >
                    +	var zTreeObj,
                    +	setting = {
                    +		view: {
                    +			selectedMulti: false
                    +		}
                    +	},
                    +	zTreeNodes = [
                    +		{"name":"网站导航", open:true, children: [
                    +			{ "name":"google", "url":"http://g.cn", "target":"_blank"},
                    +			{ "name":"baidu", "url":"http://baidu.com", "target":"_blank"},
                    +			{ "name":"sina", "url":"http://www.sina.com.cn", "target":"_blank"}
                    +			]
                    +		}
                    +	];
                    +
                    +	$(document).ready(function(){
                    +		zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
                    +
                    +	});
                    +  </SCRIPT>
                    + </HEAD>
                    +
                    +<BODY>
                    +<ul id="tree" class="ztree" style="width:230px; overflow:auto;"></ul>
                    + </BODY>
                    +</HTML>
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.autoParam.html b/static/zTree3/api/cn/setting.async.autoParam.html new file mode 100644 index 0000000..cf0f4d2 --- /dev/null +++ b/static/zTree3/api/cn/setting.async.autoParam.html @@ -0,0 +1,39 @@ +
                    +
                    +

                    Array(String)setting.async.autoParam

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    异步加载时需要自动提交父节点属性的参数。[setting.async.enable = true 时生效]

                    +

                    默认值:[ ]

                    +
                    +
                    +

                    Array(String) 格式说明

                    +
                    +

                    1、将需要作为参数提交的属性名称,制作成 Array 即可,例如:["id", "name"]

                    +

                    2、可以设置提交时的参数名称,例如 server 只接受 zId : ["id=zId"]

                    +
                    +

                    setting 举例

                    +

                    1. 设置 id 属性为自动提交的参数

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id"]
                    +	}
                    +};
                    +假设 异步加载 父节点(node = {id:1, name:"test"}) 的子节点时,将提交参数 id=1
                    +......
                    +

                    2. 设置 id 属性作为 zId 成为自动提交的参数

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id=zId"]
                    +	}
                    +};
                    +假设 对父节点 node = {id:1, name:"test"},进行异步加载时,将提交参数 zId=1
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.contentType.html b/static/zTree3/api/cn/setting.async.contentType.html new file mode 100644 index 0000000..db0c92f --- /dev/null +++ b/static/zTree3/api/cn/setting.async.contentType.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Stringsetting.async.contentType

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    Ajax 提交参数的数据类型。[setting.async.enable = true 时生效]

                    +

                    默认值:"application/x-www-form-urlencoded"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    contentType = "application/x-www-form-urlencoded" 可以满足绝大部分请求,按照标准的 Form 格式提交参数

                    +

                    contentType = "application/json" 可以满足 .Net 的编程需要,按照 JSON 格式提交参数

                    +
                    +

                    setting 举例

                    +

                    1. 设置 Ajax 提交参数的数据类型为 JSON 格式

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		contentType: "application/json",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.dataFilter.html b/static/zTree3/api/cn/setting.async.dataFilter.html new file mode 100644 index 0000000..f174bf0 --- /dev/null +++ b/static/zTree3/api/cn/setting.async.dataFilter.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, parentNode, responseData)setting.async.dataFilter

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于对 Ajax 返回数据进行预处理的函数。[setting.async.enable = true 时生效]

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    parentNodeJSON

                    +

                    进行异步加载的父节点 JSON 数据对象

                    +

                    对根进行异步加载时,parentNode = null

                    +

                    responseDataArray(JSON) / JSON / String

                    +

                    异步加载获取到的数据转换后的 Array(JSON) / JSON / String 数据对象

                    +

                    v3.4开始 支持 XML 数据格式的 String

                    +

                    返回值Array(JSON) / JSON

                    +

                    返回值是 zTree 支持的JSON 数据结构即可。

                    +

                    v3.x 支持单个 JSON 节点数据进行加载

                    +
                    +

                    setting & function 举例

                    +

                    1. 修改异步获取到的节点name属性

                    +
                    function ajaxDataFilter(treeId, parentNode, responseData) {
                    +    if (responseData) {
                    +      for(var i =0; i < responseData.length; i++) {
                    +        responseData[i].name += "_filter";
                    +      }
                    +    }
                    +    return responseData;
                    +};
                    +var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		dataFilter: ajaxDataFilter
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.dataType.html b/static/zTree3/api/cn/setting.async.dataType.html new file mode 100644 index 0000000..6d639b7 --- /dev/null +++ b/static/zTree3/api/cn/setting.async.dataType.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Stringsetting.async.dataType

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    Ajax 获取的数据类型。[setting.async.enable = true 时生效]

                    +

                    默认值:"text"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    dataType = "text" 可以满足绝大部分请求

                    +

                    其余 dataType 类型请参考 jQuery ajax 中的 dataType 参数

                    +
                    +

                    setting 举例

                    +

                    1. 设置 Ajax 获取的数据类型为 纯文本

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		dataType: "text",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.enable.html b/static/zTree3/api/cn/setting.async.enable.html new file mode 100644 index 0000000..9079ae1 --- /dev/null +++ b/static/zTree3/api/cn/setting.async.enable.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Booleansetting.async.enable

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否开启异步加载模式

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示 开启 异步加载模式

                    +

                    false 表示 关闭 异步加载模式

                    +

                    如果设置为 true,请务必设置 setting.async 内的其它参数。

                    +

                    如果需要根节点也异步加载,初始化时 treeNodes 参数设置为 null 即可。

                    +
                    +

                    setting 举例

                    +

                    1. 需要开启异步加载模式

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.otherParam.html b/static/zTree3/api/cn/setting.async.otherParam.html new file mode 100644 index 0000000..981715f --- /dev/null +++ b/static/zTree3/api/cn/setting.async.otherParam.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Array(String) / JSONsetting.async.otherParam

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    Ajax 请求提交的静态参数键值对。[setting.async.enable = true 时生效]

                    +

                    默认值:[ ]

                    +
                    +
                    +

                    Array(String) 格式说明

                    +
                    +

                    可以为空[ ],如果有 key,则必须存在 value。 例如:[key, value]

                    +
                    +

                    JSON 格式说明

                    +
                    +

                    直接用 JSON 格式制作键值对,例如:{ key1:value1, key2:value2 }

                    +
                    +

                    setting 举例

                    +

                    1. 设置 Array(String) 格式的参数

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		otherParam: ["id", "1", "name", "test"]
                    +	}
                    +};
                    +进行异步加载时,将提交参数 id=1&name=test
                    +

                    2. 设置 JSON 格式的参数

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		otherParam: { "id":"1", "name":"test"}
                    +	}
                    +};
                    +进行异步加载时,将提交参数 id=1&name=test
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.type.html b/static/zTree3/api/cn/setting.async.type.html new file mode 100644 index 0000000..20d9a6b --- /dev/null +++ b/static/zTree3/api/cn/setting.async.type.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Stringsetting.async.type

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    Ajax 的 http 请求模式。[setting.async.enable = true 时生效]

                    +

                    默认值:"post"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    type = "post" 表示异步加载采用 post 方法请求

                    +

                    type = "get" 表示异步加载采用 get 方法请求

                    +

                    对应于 jQuery ajax 中的 type 参数

                    +
                    +

                    setting 举例

                    +

                    1. 设置使用 get 方式请求数据

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		type: "get",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.async.url.html b/static/zTree3/api/cn/setting.async.url.html new file mode 100644 index 0000000..a5209af --- /dev/null +++ b/static/zTree3/api/cn/setting.async.url.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.async.url

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    Ajax 获取数据的 URL 地址。[setting.async.enable = true 时生效]

                    +

                    默认值:""

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    设置固定的异步加载 url 字符串,请注意地址的路径,确保页面能正常加载

                    +

                    url 内也可以带参数,这些参数就只能是通过 get 方式提交了,并且请注意进行转码

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要异步加载子节点的的父节点 JSON 数据对象

                    +

                    针对根进行异步加载时,treeNode = null

                    +

                    返回值String

                    +

                    返回值同 String 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置异步获取节点的 URL 为 nodes.php

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "nodes.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +

                    2. 设置异步获取节点的 URL 为 function 动态获取

                    +
                    function getAsyncUrl(treeId, treeNode) {
                    +    return treeNode.isParent ? "nodes1.php" : "nodes2.php";
                    +};
                    +var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: getAsyncUrl,
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeAsync.html b/static/zTree3/api/cn/setting.callback.beforeAsync.html new file mode 100644 index 0000000..70ba0fc --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeAsync.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeAsync

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获异步加载之前的事件回调函数,zTree 根据返回值确定是否允许进行异步加载

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    进行异步加载的父节点 JSON 数据对象

                    +

                    针对根进行异步加载时,treeNode = null

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将不进行异步加载,也无法触发 onAsyncSuccess / onAsyncError 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止 id 为 1 的父节点进行异步加载操作

                    +
                    function zTreeBeforeAsync(treeId, treeNode) {
                    +    return (treeNode.id !== 1);
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeAsync: zTreeBeforeAsync
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeCheck.html b/static/zTree3/api/cn/setting.callback.beforeCheck.html new file mode 100644 index 0000000..a0e1f42 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeCheck.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeCheck

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获 勾选 或 取消勾选 之前的事件回调函数,并且根据返回值确定是否允许 勾选 或 取消勾选

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    进行 勾选 或 取消勾选 的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,将不会改变勾选状态,并且无法触发 onCheck 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止所有勾选操作,保持初始化的勾选状态

                    +
                    function zTreeBeforeCheck(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeCheck: zTreeBeforeCheck
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeClick.html b/static/zTree3/api/cn/setting.callback.beforeClick.html new file mode 100644 index 0000000..6efe928 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeClick.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Function(treeId, treeNode, clickFlag)setting.callback.beforeClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获单击节点之前的事件回调函数,并且根据返回值确定是否允许单击操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被单击的节点 JSON 数据对象

                    +

                    clickFlagNumber

                    +

                    节点被点击后的选中操作类型,详细看下表

                    + + + + + + + + + + + + +
                    clickFlagselectedMultiautoCancelSelected
                    &&
                    event.ctrlKey / metaKey
                    isSelected选中操作
                    1truefalsefalse普通选中
                    1truefalsetrue普通选中
                    2truetruefalse追加选中
                    0truetruetrue取消选中
                    1falsefalsefalse普通选中
                    1falsefalsetrue普通选中
                    1falsetruefalse普通选中
                    0falsetruetrue取消选中
                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将不会选中节点,也无法触发 onClick 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止节点被选中

                    +
                    function zTreeBeforeClick(treeId, treeNode, clickFlag) {
                    +    return (treeNode.id !== 1);
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeClick: zTreeBeforeClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeCollapse.html b/static/zTree3/api/cn/setting.callback.beforeCollapse.html new file mode 100644 index 0000000..d778e9c --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeCollapse.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeCollapse

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获父节点折叠之前的事件回调函数,并且根据返回值确定是否允许折叠操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    要折叠的父节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将不会折叠节点,也无法触发 onCollapse 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止所有已展开的父节点折叠

                    +
                    function zTreeBeforeCollapse(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeCollapse: zTreeBeforeCollapse
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeDblClick.html b/static/zTree3/api/cn/setting.callback.beforeDblClick.html new file mode 100644 index 0000000..ed7e4dc --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeDblClick.html @@ -0,0 +1,36 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeDblClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标双击之前的事件回调函数,并且根据返回值确定触发 onDblClick 事件回调函数

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标双击时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,将仅仅无法触发 onDblClick 事件回调函数,对其他操作无任何影响

                    +

                    此事件回调函数对双击节点展开功能无任何影响,如果需要设置请参考 setting.view.dblClickExpand 属性

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止 onDblClick 事件

                    +
                    function zTreeBeforeDblClick(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeDblClick: zTreeBeforeDblClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeDrag.html b/static/zTree3/api/cn/setting.callback.beforeDrag.html new file mode 100644 index 0000000..1e783a3 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeDrag.html @@ -0,0 +1,39 @@ +
                    +
                    +

                    Function(treeId, treeNodes)setting.callback.beforeDrag

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被拖拽之前的事件回调函数,并且根据返回值确定是否允许开启拖拽操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    被拖拽的节点 treeNodes 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodesArray(JSON)

                    +

                    要被拖拽的节点 JSON 数据集合

                    +

                    v3.x 允许多个同级节点同时被拖拽,因此将此参数修改为 Array(JSON)

                    +

                    如果拖拽时多个被选择的节点不是同级关系,则只能拖拽鼠标当前所在位置的节点

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将终止拖拽,也无法触发 onDrag / beforeDrop / onDrop 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止全部拖拽操作

                    +
                    function zTreeBeforeDrag(treeId, treeNodes) {
                    +    return false;
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDrag: zTreeBeforeDrag
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeDragOpen.html b/static/zTree3/api/cn/setting.callback.beforeDragOpen.html new file mode 100644 index 0000000..ceab2d3 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeDragOpen.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeDragOpen

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获拖拽节点移动到折叠状态的父节点后,即将自动展开该父节点之前的事件回调函数,并且根据返回值确定是否允许自动展开操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    需要被展开的父节点 treeNode 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    要被自动展开的父节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将无法进行自动展开操作

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止全部拖拽时的自动展开操作

                    +
                    function zTreeBeforeDragOpen(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDragOpen: zTreeBeforeDragOpen
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeDrop.html b/static/zTree3/api/cn/setting.callback.beforeDrop.html new file mode 100644 index 0000000..4123743 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeDrop.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    Function(treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.beforeDrop

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点拖拽操作结束之前的事件回调函数,并且根据返回值确定是否允许此拖拽操作

                    +

                    默认值:null

                    +

                    如未拖拽到有效位置,则不触发此回调函数,直接将节点恢复原位置

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    目标节点 targetNode 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodesArray(JSON)

                    +

                    被拖拽的节点 JSON 数据集合

                    +

                    无论拖拽操作为 复制 还是 移动,treeNodes 都是当前被拖拽节点的数据集合。

                    +

                    targetNodeJSON

                    +

                    treeNodes 被拖拽放开的目标节点 JSON 数据对象。

                    +

                    如果拖拽成为根节点,则 targetNode = null

                    +

                    moveTypeString

                    +

                    指定移动到目标节点的相对位置

                    +

                    "inner":成为子节点,"prev":成为同级前一个节点,"next":成为同级后一个节点

                    +

                    isCopyBoolean

                    +

                    拖拽节点操作是 复制 或 移动

                    +

                    true:复制;false:移动

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将恢复被拖拽的节点,也无法触发 onDrop 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止将节点拖拽成为根节点

                    +
                    function zTreeBeforeDrop(treeId, treeNodes, targetNode, moveType) {
                    +    return !(targetNode == null || (moveType != "inner" && !targetNode.parentTId));
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDrop: zTreeBeforeDrop
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeEditName.html b/static/zTree3/api/cn/setting.callback.beforeEditName.html new file mode 100644 index 0000000..9df3ca2 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeEditName.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeEditName

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点编辑按钮的 click 事件,并且根据返回值确定是否允许进入名称编辑状态

                    +

                    此事件回调函数最主要是用于捕获编辑按钮的点击事件,然后触发自定义的编辑界面操作。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    将要进入编辑名称状态的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,节点将无法进入 zTree 默认的编辑名称状态

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止修改父节点的名称

                    +
                    function zTreeBeforeEditName(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeEditName: zTreeBeforeEditName
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeExpand.html b/static/zTree3/api/cn/setting.callback.beforeExpand.html new file mode 100644 index 0000000..350972b --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeExpand.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeExpand

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获父节点展开之前的事件回调函数,并且根据返回值确定是否允许展开操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    要展开的父节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将不会展开节点,也无法触发 onExpand 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止所有已折叠的父节点展开

                    +
                    function zTreeBeforeExpand(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeExpand: zTreeBeforeExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeMouseDown.html b/static/zTree3/api/cn/setting.callback.beforeMouseDown.html new file mode 100644 index 0000000..2c3f28d --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeMouseDown.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeMouseDown

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标按键按下之前的事件回调函数,并且根据返回值确定触发 onMouseDown 事件回调函数

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标按键按下时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,将仅仅无法触发 onMouseDown 事件回调函数,对其他操作无任何影响

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止 onMouseDown 事件

                    +
                    function zTreeBeforeMouseDown(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeMouseDown: zTreeBeforeMouseDown
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeMouseUp.html b/static/zTree3/api/cn/setting.callback.beforeMouseUp.html new file mode 100644 index 0000000..f0b01b9 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeMouseUp.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeMouseUp

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标按键松开之前的事件回调函数,并且根据返回值确定触发 onMouseUp 事件回调函数

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标按键松开时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,将仅仅无法触发 onMouseUp 事件回调函数,对其他操作无任何影响

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止 onMouseUp 事件

                    +
                    function zTreeBeforeMouseUp(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeMouseUp: zTreeBeforeMouseUp
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeRemove.html b/static/zTree3/api/cn/setting.callback.beforeRemove.html new file mode 100644 index 0000000..0edb3fd --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeRemove.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeRemove

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被删除之前的事件回调函数,并且根据返回值确定是否允许删除操作

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    将要删除的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将不删除节点,也无法触发 onRemove 事件回调函数

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止全部删除操作

                    +
                    function zTreeBeforeRemove(treeId, treeNode) {
                    +	return false;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeRemove: zTreeBeforeRemove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeRename.html b/static/zTree3/api/cn/setting.callback.beforeRename.html new file mode 100644 index 0000000..0709961 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeRename.html @@ -0,0 +1,46 @@ +
                    +
                    +

                    Function(treeId, treeNode, newName, isCancel)setting.callback.beforeRename

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点编辑名称结束(Input 失去焦点 或 按下 Enter 键)之后,更新节点名称数据之前的事件回调函数,并且根据返回值确定是否允许更改名称的操作

                    +

                    节点进入编辑名称状态后,按 ESC 键可以放弃当前修改,恢复原名称,取消编辑名称状态

                    +

                    从 v3.5.13 开始,取消编辑状态也会触发此回调,根据 isCancel 参数判断

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    将要更改名称的节点 JSON 数据对象

                    +

                    newNameString

                    +

                    修改后的新名称

                    +

                    isCancelBoolean

                    +

                    是否取消操作 (v3.5.13+)

                    +

                    isCancel = true 表示取消编辑操作(按下 ESC 或 使用 cancelEditName 方法)

                    +

                    isCancel = false 表示确认修改操作

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,zTree 将保持名称编辑状态,无法触发 onRename 事件回调函数,并且会导致屏蔽其它事件,直到修改名称使得 beforeRename 返回 true

                    +

                    如果返回 false,不会让 input 输入框获取焦点,避免由于警告信息而导致反复触发 beforeRename。 请在关闭提示警告信息后,利用 editName 方法让 input 重新获取焦点。

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止修改的名称的长度小于 5

                    +
                    function zTreeBeforeRename(treeId, treeNode, newName, isCancel) {
                    +	return newName.length > 5;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeRename: zTreeBeforeRename
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.beforeRightClick.html b/static/zTree3/api/cn/setting.callback.beforeRightClick.html new file mode 100644 index 0000000..1a5bdaa --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.beforeRightClick.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeRightClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标右键点击之前的事件回调函数,并且根据返回值确定触发 onRightClick 事件回调函数

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标右键点击时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +

                    返回值Boolean

                    +

                    返回值是 true / false

                    +

                    如果返回 false,将仅仅无法触发 onRightClick 事件回调函数,对其他操作无任何影响

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止 onRightClick 事件

                    +
                    function zTreeBeforeRightClick(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeRightClick: zTreeBeforeRightClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onAsyncError.html b/static/zTree3/api/cn/setting.callback.onAsyncError.html new file mode 100644 index 0000000..c469e11 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onAsyncError.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    setting.callback.onAsyncError

                    +

                    Function(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) 

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获异步加载出现异常错误的事件回调函数

                    +

                    如果设置了 setting.callback.beforeAsync 方法,且返回 false,将无法触发 onAsyncSuccess / onAsyncError 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    进行异步加载的父节点 JSON 数据对象

                    +

                    针对根进行异步加载时,treeNode = null

                    +

                    XMLHttpRequestString

                    +

                    标准 XMLHttpRequest 对象,请参考 JQuery API 文档。

                    +

                    textStatusString

                    +

                    请求状态:success,error,请参考 JQuery API 文档。

                    +

                    errorThrownString

                    +

                    errorThrown 只有当异常发生时才会被传递,请参考 JQuery API 文档。

                    +
                    +

                    setting & function 举例

                    +

                    1. 异步加载出现异常后,弹出错误信息

                    +
                    function zTreeOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
                    +    alert(XMLHttpRequest);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onAsyncError: zTreeOnAsyncError
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onAsyncSuccess.html b/static/zTree3/api/cn/setting.callback.onAsyncSuccess.html new file mode 100644 index 0000000..081e9d7 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onAsyncSuccess.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, msg)setting.callback.onAsyncSuccess

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获异步加载正常结束的事件回调函数

                    +

                    如果设置了 setting.callback.beforeAsync 方法,且返回 false,将无法触发 onAsyncSuccess / onAsyncError 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    进行异步加载的父节点 JSON 数据对象

                    +

                    针对根进行异步加载时,treeNode = null

                    +

                    msgString / Object

                    +

                    异步获取的节点数据字符串,主要便于用户调试使用。

                    +

                    实际数据类型会受 setting.async.dataType 的设置影响,请参考 JQuery API 文档。

                    +
                    +

                    setting & function 举例

                    +

                    1. 异步加载成功后,弹出提示信息

                    +
                    function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
                    +    alert(msg);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onAsyncSuccess: zTreeOnAsyncSuccess
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onCheck.html b/static/zTree3/api/cn/setting.callback.onCheck.html new file mode 100644 index 0000000..113eee9 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onCheck.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onCheck

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获 checkbox / radio 被勾选 或 取消勾选的事件回调函数

                    +

                    如果设置了 setting.callback.beforeCheck 方法,且返回 false,将无法触发 onCheck 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被勾选 或 取消勾选的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次点击 checkbox 或 radio 后, 弹出该节点的 tId、name 以及当前勾选状态的信息

                    +
                    function zTreeOnCheck(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name + "," + treeNode.checked);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onCheck: zTreeOnCheck
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onClick.html b/static/zTree3/api/cn/setting.callback.onClick.html new file mode 100644 index 0000000..1f7a266 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onClick.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, clickFlag)setting.callback.onClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被点击的事件回调函数

                    +

                    如果设置了 setting.callback.beforeClick 方法,且返回 false,将无法触发 onClick 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被点击的节点 JSON 数据对象

                    +

                    clickFlagNumber

                    +

                    节点被点击后的选中操作类型,详细看下表

                    + + + + + + + + + + + + +
                    clickFlagselectedMultiautoCancelSelected
                    &&
                    event.ctrlKey / metaKey
                    isSelected选中操作
                    1truefalsefalse普通选中
                    1truefalsetrue普通选中
                    2truetruefalse追加选中
                    0truetruetrue取消选中
                    1falsefalsefalse普通选中
                    1falsefalsetrue普通选中
                    1falsetruefalse普通选中
                    0falsetruetrue取消选中
                    +
                    +

                    setting & function 举例

                    +

                    1. 每次点击节点后, 弹出该节点的 tId、name 的信息

                    +
                    function zTreeOnClick(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onClick: zTreeOnClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onCollapse.html b/static/zTree3/api/cn/setting.callback.onCollapse.html new file mode 100644 index 0000000..1c816c2 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onCollapse.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onCollapse

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被折叠的事件回调函数

                    +

                    如果设置了 setting.callback.beforeCollapse 方法,且返回 false,将无法触发 onCollapse 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被折叠的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次折叠节点后, 弹出该节点的 tId、name 的信息

                    +
                    function zTreeOnCollapse(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onCollapse: zTreeOnCollapse
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onDblClick.html b/static/zTree3/api/cn/setting.callback.onDblClick.html new file mode 100644 index 0000000..deb8e62 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onDblClick.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onDblClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标双击之后的事件回调函数

                    +

                    如果设置了 setting.callback.beforeDblClick 方法,且返回 false,将无法触发 onDblClick 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标双击时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次鼠标双击后, 弹出鼠标所在节点的 tId、name 的信息

                    +
                    function zTreeOnDblClick(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDblClick: zTreeOnDblClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onDrag.html b/static/zTree3/api/cn/setting.callback.onDrag.html new file mode 100644 index 0000000..efd115b --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onDrag.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes)setting.callback.onDrag

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被拖拽的事件回调函数

                    +

                    如果设置了 setting.callback.beforeDrag 方法,且返回 false,将无法触发 onDragMove 和 onDrag 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    被拖拽的节点 treeNodes 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodesArray(JSON)

                    +

                    要被拖拽的节点 JSON 数据集合

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次开始进行拖拽节点后, 弹出被拖拽节点的个数信息

                    +
                    function zTreeOnDrag(event, treeId, treeNodes) {
                    +    alert(treeNodes.length);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDrag: zTreeOnDrag
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onDragMove.html b/static/zTree3/api/cn/setting.callback.onDragMove.html new file mode 100644 index 0000000..e6a8dd9 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onDragMove.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes)setting.callback.onDragMove

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被拖拽过程中移动的事件回调函数

                    +

                    主要用于捕获 zTree 节点拖拽到的 DOM,从而操作对应的 DOM。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    被拖拽的节点 treeNodes 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodesArray(JSON)

                    +

                    要被拖拽的节点 JSON 数据集合

                    +
                    +

                    setting & function 举例

                    +

                    1. 拖拽节点时,随时输出 当前拖拽到的目标 DOM

                    +
                    function zTreeOnDragMove(event, treeId, treeNodes) {
                    +    console.log(event.target);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDragMove: zTreeOnDragMove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onDrop.html b/static/zTree3/api/cn/setting.callback.onDrop.html new file mode 100644 index 0000000..c6773a8 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onDrop.html @@ -0,0 +1,46 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.onDrop

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点拖拽操作结束的事件回调函数

                    +

                    如果设置了 setting.callback.beforeDrop 方法,且返回 false,将无法触发 onDrop 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    目标节点 targetNode 所在 zTree 的 treeId,便于用户操控

                    +

                    treeNodesArray(JSON)

                    +

                    被拖拽的节点 JSON 数据集合

                    +

                    如果拖拽操作为 移动,treeNodes 是当前被拖拽节点的数据集合。

                    +

                    如果拖拽操作为 复制,treeNodes 是复制后 clone 得到的新节点数据。

                    +

                    targetNodeJSON

                    +

                    成为 treeNodes 拖拽结束的目标节点 JSON 数据对象。

                    +

                    如果拖拽成为根节点,则 targetNode = null

                    +

                    moveTypeString

                    +

                    指定移动到目标节点的相对位置

                    +

                    "inner":成为子节点,"prev":成为同级前一个节点,"next":成为同级后一个节点

                    +

                    如果 moveType = null,表明拖拽无效

                    +

                    isCopyBoolean

                    +

                    拖拽节点操作是 复制 或 移动

                    +

                    true:复制;false:移动

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次拖拽操作结束后, 弹出该被拖拽节点的个数以及目标节点的 tId、name 的信息

                    +
                    function zTreeOnDrop(event, treeId, treeNodes, targetNode, moveType) {
                    +    alert(treeNodes.length + "," + (targetNode ? (targetNode.tId + ", " + targetNode.name) : "isRoot" ));
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDrop: zTreeOnDrop
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onExpand.html b/static/zTree3/api/cn/setting.callback.onExpand.html new file mode 100644 index 0000000..791c5f6 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onExpand.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onExpand

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点被展开的事件回调函数

                    +

                    如果设置了 setting.callback.beforeExpand 方法,且返回 false,将无法触发 onExpand 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被展开的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次展开节点后, 弹出该节点的 tId、name 的信息

                    +
                    function zTreeOnExpand(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onExpand: zTreeOnExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onMouseDown.html b/static/zTree3/api/cn/setting.callback.onMouseDown.html new file mode 100644 index 0000000..bc9d0ea --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onMouseDown.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onMouseDown

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标按键按下后的事件回调函数

                    +

                    如果设置了 setting.callback.beforeMouseDown 方法,且返回 false,将无法触发 onMouseDown 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标按键按下时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次鼠标按键按下后, 弹出鼠标所在节点的 tId、name 的信息

                    +
                    function zTreeOnMouseDown(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onMouseDown: zTreeOnMouseDown
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onMouseUp.html b/static/zTree3/api/cn/setting.callback.onMouseUp.html new file mode 100644 index 0000000..a969fef --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onMouseUp.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onMouseUp

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标按键松开后的事件回调函数

                    +

                    如果设置了 setting.callback.beforeMouseUp 方法,且返回 false,将无法触发 onMouseUp 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标按键松开时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次鼠标按键松开后, 弹出鼠标所在节点的 tId、name 的信息

                    +
                    function zTreeOnMouseUp(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onMouseUp: zTreeOnMouseUp
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onNodeCreated.html b/static/zTree3/api/cn/setting.callback.onNodeCreated.html new file mode 100644 index 0000000..2ebaee6 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onNodeCreated.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onNodeCreated

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点生成 DOM 后的事件回调函数

                    +

                    v3.x 采用了延迟加载技术,因此对于父节点未展开的子节点来说,初始化后是不会触发此回调函数,直到其父节点被展开

                    +

                    大数据量的节点加载请注意:不设置 onNodeCreated,可以提升一部分初始化性能

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    生成 DOM 完毕的节点的 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 创建节点 DOM 后, 弹出该节点的 tId、name 的信息

                    +
                    function zTreeOnNodeCreated(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onNodeCreated: zTreeOnNodeCreated
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onRemove.html b/static/zTree3/api/cn/setting.callback.onRemove.html new file mode 100644 index 0000000..e7e625d --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onRemove.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onRemove

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获删除节点之后的事件回调函数。

                    +

                    如果用户设置了 beforeRemove 回调函数,并返回 false,将无法触发 onRemove 事件回调函数。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    将要删除的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 删除节点时,弹出被删除的节点的 tId 以及 name 信息

                    +
                    function zTreeOnRemove(event, treeId, treeNode) {
                    +	alert(treeNode.tId + ", " + treeNode.name);
                    +}
                    +var setting = {
                    +	callback: {
                    +		onRemove: zTreeOnRemove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onRename.html b/static/zTree3/api/cn/setting.callback.onRename.html new file mode 100644 index 0000000..f225463 --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onRename.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, isCancel)setting.callback.onRename

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于捕获节点编辑名称结束之后的事件回调函数。

                    +

                    1、节点进入编辑名称状态,并且修改节点名称后触发此回调函数。如果用户设置了 beforeRename 回调函数,并返回 false,将无法触发 onRename 事件回调函数。

                    +

                    2、如果通过直接修改 treeNode 的数据,并且利用 updateNode 方法更新,是不会触发此回调函数的。

                    +

                    3、从 v3.5.13 开始,取消编辑状态也会触发此回调,根据 isCancel 参数判断

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    被修改名称的节点 JSON 数据对象

                    +

                    isCancelBoolean

                    +

                    是否取消操作 (v3.5.13+)

                    +

                    isCancel = true 表示取消编辑操作(按下 ESC 或 使用 cancelEditName 方法)

                    +

                    isCancel = false 表示确认修改操作

                    +
                    +

                    setting & function 举例

                    +

                    1. 修改名称后,弹出被修改名称的节点的 tId 以及 name 信息

                    +
                    function zTreeOnRename(event, treeId, treeNode, isCancel) {
                    +	alert(treeNode.tId + ", " + treeNode.name);
                    +}
                    +var setting = {
                    +	callback: {
                    +		onRename: zTreeOnRename
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.callback.onRightClick.html b/static/zTree3/api/cn/setting.callback.onRightClick.html new file mode 100644 index 0000000..d51c68d --- /dev/null +++ b/static/zTree3/api/cn/setting.callback.onRightClick.html @@ -0,0 +1,36 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onRightClick

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于捕获 zTree 上鼠标右键点击之后的事件回调函数

                    +

                    1、如果设置了 setting.callback.beforeRightClick 方法,且返回 false,将无法触发 onRightClick 事件回调函数。

                    +

                    2、只要将 function 的引用赋给 onRightClick 属性,则右键点击 zTree 时,将屏蔽浏览器的右键菜单。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    eventjs event 对象

                    +

                    标准的 js event 对象

                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    鼠标右键点击时所在节点的 JSON 数据对象

                    +

                    如果不在节点上,则返回 null

                    +
                    +

                    setting & function 举例

                    +

                    1. 每次鼠标右键点击后, 弹出鼠标所在节点的 tId、name 的信息

                    +
                    function zTreeOnRightClick(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onRightClick: zTreeOnRightClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.autoCheckTrigger.html b/static/zTree3/api/cn/setting.check.autoCheckTrigger.html new file mode 100644 index 0000000..d1efd77 --- /dev/null +++ b/static/zTree3/api/cn/setting.check.autoCheckTrigger.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.check.autoCheckTrigger

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    设置自动关联勾选时是否触发 beforeCheck / onCheck 事件回调函数。[setting.check.enable = true 且 setting.check.chkStyle = "checkbox" 时生效]

                    +

                    1、如果设置 setting.check.chkboxType = { "Y": "", "N": "" },将不会有任何自动关联勾选的操作。

                    +

                    2、如果开启触发,对于节点较多的树将会影响性能,因为所有被联动勾选的操作都会触发事件回调函数,请根据需要决定是否使用此功能。

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 触发 / 不触发 事件回调函数

                    +
                    +

                    setting 举例

                    +

                    1. 需要触发自动关联勾选操作

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		autoCheckTrigger: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.chkDisabledInherit.html b/static/zTree3/api/cn/setting.check.chkDisabledInherit.html new file mode 100644 index 0000000..8af1c2c --- /dev/null +++ b/static/zTree3/api/cn/setting.check.chkDisabledInherit.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.check.chkDisabledInherit

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    当父节点设置 chkDisabled = true 时,设置子节点是否自动继承 chkDisabled = true 。[setting.check.enable = true 时生效]

                    +

                    1、只使用于初始化节点时,便于批量操作。 对于已存在的节点请利用 setChkDisabled 方法单个节点设置。

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示 新加入子节点时,自动继承父节点 chkDisabled = true 的属性。

                    +

                    false 表示 新加入子节点时,不继承父节点 chkDisabled 的属性。

                    +
                    +

                    setting 举例

                    +

                    1. 需要子节点自动继承 chkDisabled = true

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkDisabledInherit: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.chkStyle.html b/static/zTree3/api/cn/setting.check.chkStyle.html new file mode 100644 index 0000000..9706c13 --- /dev/null +++ b/static/zTree3/api/cn/setting.check.chkStyle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    Stringsetting.check.chkStyle

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    勾选框类型(checkbox 或 radio)[setting.check.enable = true 时生效]

                    +

                    默认值:"checkbox"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    chkStyle = "checkbox" 时,显示 checkbox 选择框,setting.check.chkboxType 属性有效。 +
                    chkStyle = "radio" 时,显示 radio 选择框, setting.check.radioType 属性有效。

                    +

                    请注意大小写,不要改变

                    +
                    +

                    checkbox 状态说明

                    +
                    +

                    +
                    +

                    未勾选;如果是父节点,则无子节点被勾选。鼠标移到该节点上显示为:

                    +

                    未勾选;(只有父节点存在此状态)存在被勾选的子节点。鼠标移到该节点上显示为:

                    +

                    被勾选;如果是父节点,则全部子节点都被勾选。鼠标移到该节点上显示为:

                    +

                    被勾选;(只有父节点存在此状态)且部分或无子节点被勾选。鼠标移到该节点上显示为:

                    +
                    +
                    +

                    radio 状态说明

                    +
                    +

                    +
                    +

                    未勾选;如果是父节点,则没有子节点被勾选。鼠标移到该节点上显示为:

                    +

                    未勾选;(只有父节点存在此状态)且存在被勾选的子节点。鼠标移到该节点上显示为:

                    +

                    被勾选;如果是父节点,则没有子节点被勾选。鼠标移到该节点上显示为:

                    +

                    被勾选;(只有父节点存在此状态)且存在被勾选的子节点。鼠标移到该节点上显示为:

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置选择框为 radio

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "radio"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.chkboxType.html b/static/zTree3/api/cn/setting.check.chkboxType.html new file mode 100644 index 0000000..da06b6c --- /dev/null +++ b/static/zTree3/api/cn/setting.check.chkboxType.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    JSONsetting.check.chkboxType

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    勾选 checkbox 对于父子节点的关联关系。[setting.check.enable = true 且 setting.check.chkStyle = "checkbox" 时生效]

                    +

                    默认值:{ "Y": "ps", "N": "ps" }

                    +
                    +
                    +

                    JSON 格式说明

                    +
                    +

                    Y 属性定义 checkbox 被勾选后的情况; +
                    N 属性定义 checkbox 取消勾选后的情况; +
                    "p" 表示操作会影响父级节点; +
                    "s" 表示操作会影响子级节点。

                    +

                    请注意大小写,不要改变

                    +
                    +

                    setting 举例

                    +

                    1. checkbox 勾选操作,只影响父级节点;取消勾选操作,只影响子级节点

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "checkbox",
                    +		chkboxType: { "Y": "p", "N": "s" }
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.enable.html b/static/zTree3/api/cn/setting.check.enable.html new file mode 100644 index 0000000..8b1387e --- /dev/null +++ b/static/zTree3/api/cn/setting.check.enable.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Booleansetting.check.enable

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 的节点上是否显示 checkbox / radio

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 不显示 复选框或单选框

                    +
                    +

                    setting 举例

                    +

                    1. 需要显示 checkbox

                    +
                    var setting = {
                    +	check: {
                    +		enable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.nocheckInherit.html b/static/zTree3/api/cn/setting.check.nocheckInherit.html new file mode 100644 index 0000000..caf9902 --- /dev/null +++ b/static/zTree3/api/cn/setting.check.nocheckInherit.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.check.nocheckInherit

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    当父节点设置 nocheck = true 时,设置子节点是否自动继承 nocheck = true 。[setting.check.enable = true 时生效]

                    +

                    1、只使用于初始化节点时,便于批量操作。 对于已存在的节点请利用 updateNode 方法单个节点设置。

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示 新加入子节点时,自动继承父节点 nocheck = true 的属性。

                    +

                    false 表示 新加入子节点时,不继承父节点 nocheck 的属性。

                    +
                    +

                    setting 举例

                    +

                    1. 需要子节点自动继承 nocheck = true

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		nocheckInherit: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.check.radioType.html b/static/zTree3/api/cn/setting.check.radioType.html new file mode 100644 index 0000000..19f84ca --- /dev/null +++ b/static/zTree3/api/cn/setting.check.radioType.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Stringsetting.check.radioType

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    radio 的分组范围。[setting.check.enable = true 且 setting.check.chkStyle = "radio" 时生效]

                    +

                    默认值:"level"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    radioType = "level" 时,在每一级节点范围内当做一个分组。 +
                    radioType = "all" 时,在整棵树范围内当做一个分组。

                    +

                    请注意大小写,不要改变

                    +
                    +

                    setting 举例

                    +

                    1. 设置 radio 的判别规则为整棵树内

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "radio",
                    +		radioType: "all"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.keep.leaf.html b/static/zTree3/api/cn/setting.data.keep.leaf.html new file mode 100644 index 0000000..af3a721 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.keep.leaf.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.data.keep.leaf

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 的节点叶子节点属性锁,是否始终保持 isParent = false

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 锁定 / 不锁定 叶子节点属性

                    +

                    如果设置为 true,则所有 isParent = false 的节点,都无法添加子节点。

                    +
                    +

                    setting 举例

                    +

                    1. 需要锁定叶子节点状态

                    +
                    var setting = {
                    +	data: {
                    +		keep: {
                    +			leaf: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.keep.parent.html b/static/zTree3/api/cn/setting.data.keep.parent.html new file mode 100644 index 0000000..c4975df --- /dev/null +++ b/static/zTree3/api/cn/setting.data.keep.parent.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.data.keep.parent

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 的节点父节点属性锁,是否始终保持 isParent = true

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 锁定 / 不锁定 父节点属性

                    +

                    如果设置为 true,则所有 isParent = true 的节点,即使该节点的子节点被全部删除或移走,依旧保持父节点状态。

                    +
                    +

                    setting 举例

                    +

                    1. 需要锁定父节点状态

                    +
                    var setting = {
                    +	data: {
                    +		keep: {
                    +			parent: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.key.checked.html b/static/zTree3/api/cn/setting.data.key.checked.html new file mode 100644 index 0000000..ac9fdc1 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.key.checked.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.checked

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    zTree 节点数据中保存 check 状态的属性名称。

                    +

                    默认值:"checked"

                    +

                    请勿与 zTree 节点数据的其他参数冲突,例如:checkedOld

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 显示节点时,将 treeNode 的 isChecked 属性当做节点名称

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			checked: "isChecked"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.key.children.html b/static/zTree3/api/cn/setting.data.key.children.html new file mode 100644 index 0000000..66a49a7 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.key.children.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Stringsetting.data.key.children

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 节点数据中保存子节点数据的属性名称。

                    +

                    默认值:"children"

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 显示节点时,将 treeNode 的 nodes 属性当做节点名称

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			children: "nodes"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.key.name.html b/static/zTree3/api/cn/setting.data.key.name.html new file mode 100644 index 0000000..c25d250 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.key.name.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Stringsetting.data.key.name

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 节点数据保存节点名称的属性名称。

                    +

                    默认值:"name"

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 显示节点时,将 treeNode 的 ename 属性当做节点名称

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			name: "ename"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.key.title.html b/static/zTree3/api/cn/setting.data.key.title.html new file mode 100644 index 0000000..43e6855 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.key.title.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.title

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 节点数据保存节点提示信息的属性名称。[setting.view.showTitle = true 时生效]

                    +

                    如果设置为 "" ,则自动与 setting.data.key.name 保持一致,避免用户反复设置

                    +

                    默认值:""

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 显示节点时,将 treeNode 的 fullName 属性当做节点名称

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			title: "fullName"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.key.url.html b/static/zTree3/api/cn/setting.data.key.url.html new file mode 100644 index 0000000..e534d98 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.key.url.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.url

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 节点数据保存节点链接的目标 URL 的属性名称。

                    +

                    特殊用途:当后台数据只能生成 url 属性,又不想实现点击节点跳转的功能时,可以直接修改此属性为其他不存在的属性名称

                    +

                    默认值:"url"

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 显示节点时,将 treeNode 的 xUrl 属性当做节点链接的目标 URL

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			url: "xUrl"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.simpleData.enable.html b/static/zTree3/api/cn/setting.data.simpleData.enable.html new file mode 100644 index 0000000..5d7bd42 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.simpleData.enable.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Booleansetting.data.simpleData.enable

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    确定 zTree 初始化时的节点数据、异步加载时的节点数据、或 addNodes 方法中输入的 newNodes 数据是否采用简单数据模式 (Array)

                    +

                    不需要用户再把数据库中取出的 List 强行转换为复杂的 JSON 嵌套格式

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 使用 / 不使用 简单数据模式

                    +

                    如果设置为 true,请务必设置 setting.data.simpleData 内的其他参数: idKey / pIdKey / rootPId,并且让数据满足父子关系。

                    +
                    +

                    setting 举例

                    +

                    1. 使用简单 Array 格式的数据

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.simpleData.idKey.html b/static/zTree3/api/cn/setting.data.simpleData.idKey.html new file mode 100644 index 0000000..5b3ffd4 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.simpleData.idKey.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Stringsetting.data.simpleData.idKey

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点数据中保存唯一标识的属性名称。[setting.data.simpleData.enable = true 时生效]

                    +

                    默认值:"id"

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 使用简单 Array 格式的数据

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.simpleData.pIdKey.html b/static/zTree3/api/cn/setting.data.simpleData.pIdKey.html new file mode 100644 index 0000000..d434bc3 --- /dev/null +++ b/static/zTree3/api/cn/setting.data.simpleData.pIdKey.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Stringsetting.data.simpleData.pIdKey

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点数据中保存其父节点唯一标识的属性名称。[setting.data.simpleData.enable = true 时生效]

                    +

                    默认值:"pId"

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 使用简单 Array 格式的数据

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.data.simpleData.rootPId.html b/static/zTree3/api/cn/setting.data.simpleData.rootPId.html new file mode 100644 index 0000000..8cff82d --- /dev/null +++ b/static/zTree3/api/cn/setting.data.simpleData.rootPId.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    String / Numbersetting.data.simpleData.rootPId

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于修正根节点父节点数据,即 pIdKey 指定的属性值。[setting.data.simpleData.enable = true 时生效]

                    +

                    默认值:null

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 使用简单 Array 格式的数据

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.autoExpandTrigger.html b/static/zTree3/api/cn/setting.edit.drag.autoExpandTrigger.html new file mode 100644 index 0000000..126b8a8 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.autoExpandTrigger.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.edit.drag.autoExpandTrigger

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽时父节点自动展开是否触发 onExpand 事件回调函数。[setting.edit.enable = true 时生效]

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 触发 / 不触发 onExpand 事件回调函数。

                    +
                    +

                    setting 举例

                    +

                    1. 设置拖拽时父节点自动展开触发 onExpand 事件回调函数

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			autoExpandTrigger: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.autoOpenTime.html b/static/zTree3/api/cn/setting.edit.drag.autoOpenTime.html new file mode 100644 index 0000000..df78339 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.autoOpenTime.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.autoOpenTime

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽时父节点自动展开的延时间隔。 (单位:ms)[setting.edit.enable = true 时生效]

                    +

                    默认值:500

                    +

                    请根据自己的需求适当调整此值

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置拖拽到父节点上立刻自动展开

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			autoOpenTime: 0
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.borderMax.html b/static/zTree3/api/cn/setting.edit.drag.borderMax.html new file mode 100644 index 0000000..1d4dd68 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.borderMax.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.borderMax

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽节点成为根节点时的 Tree 内边界范围 (单位:px)。[setting.edit.enable = true 时生效]

                    +

                    默认值:10

                    +

                    请根据自己的需求适当调整此值

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 更改拖拽操作节点成为根节点时的 Tree 内边界范围为20px

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			borderMax: 20
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.borderMin.html b/static/zTree3/api/cn/setting.edit.drag.borderMin.html new file mode 100644 index 0000000..463eb2b --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.borderMin.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.borderMin

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽节点成为根节点时的 Tree 外边界范围 (单位:px)。[setting.edit.enable = true 时生效]

                    +

                    默认值:-5

                    +

                    请根据自己的需求适当调整此值

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 更改拖拽操作节点成为根节点时的 Tree 外边界范围为10px

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			borderMin: -10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.inner.html b/static/zTree3/api/cn/setting.edit.drag.inner.html new file mode 100644 index 0000000..06679e1 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.inner.html @@ -0,0 +1,59 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.inner

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽到目标节点时,设置是否允许成为目标节点的子节点。[setting.edit.enable = true 时生效]

                    +

                    拖拽目标是 根 的时候,不触发 prev 和 next,只会触发 inner

                    +

                    此功能主要作用是对拖拽进行适当限制(辅助箭头),需要结合 prev、next 一起使用,才能实现完整功能。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 允许 / 不允许 成为目标节点的子节点

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控(多棵树拖拽时,是目标节点所在树的 treeId)

                    +

                    treeNodesArray(JSON)

                    +

                    被拖拽的节点 JSON 数据集合

                    +

                    targetNodeJSON

                    +

                    拖拽时的目标节点 JSON 数据对象

                    +

                    如果拖拽的节点要成为根节点,则 targetNode = null

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止拖拽成为目标节点的子节点

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: true,
                    +			inner: false
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. 禁止拖拽成为根节点的子节点

                    +
                    function canInner(treeId, nodes, targetNode) {
                    +	return !(targetNode && targetNode.level === 0);
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: true,
                    +			inner: canInner
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.isCopy.html b/static/zTree3/api/cn/setting.edit.drag.isCopy.html new file mode 100644 index 0000000..cff17af --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.isCopy.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Booleansetting.edit.drag.isCopy

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽时, 设置是否允许复制节点。[setting.edit.enable = true 时生效]

                    +

                    默认值:true

                    +
                    +
                    +

                    规则说明

                    +
                    +

                    1、isCopy = true; isMove = true 时,拖拽节点按下 Ctrl 或 Cmd 键表示 copy; 否则为 move

                    +

                    2、isCopy = true; isMove = false 时,所有拖拽操作都是 copy

                    +

                    3、isCopy = false; isMove = true 时,所有拖拽操作都是 move

                    +

                    4、isCopy = false; isMove = false 时,禁止拖拽操作

                    +
                    +

                    setting 举例

                    +

                    1. 设置所有拖拽操作都是 copy

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			isCopy: true,
                    +			isMove: false
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.isMove.html b/static/zTree3/api/cn/setting.edit.drag.isMove.html new file mode 100644 index 0000000..7fdadd1 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.isMove.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Booleansetting.edit.drag.isMove

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽时, 设置是否允许移动节点。[setting.edit.enable = true 时生效]

                    +

                    默认值:true

                    +
                    +
                    +

                    规则说明

                    +
                    +

                    1、isCopy = true; isMove = true 时,拖拽节点按下 Ctrl 或 Cmd 键表示 copy; 否则为 move

                    +

                    2、isCopy = true; isMove = false 时,所有拖拽操作都是 copy

                    +

                    3、isCopy = false; isMove = true 时,所有拖拽操作都是 move

                    +

                    4、isCopy = false; isMove = false 时,禁止拖拽操作

                    +
                    +

                    setting 举例

                    +

                    1. 设置所有拖拽操作都是 move

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			isCopy: false,
                    +			isMove: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.maxShowNodeNum.html b/static/zTree3/api/cn/setting.edit.drag.maxShowNodeNum.html new file mode 100644 index 0000000..3e7a3d2 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.maxShowNodeNum.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.maxShowNodeNum

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽多个兄弟节点时,浮动图层中显示的最大节点数。 多余的节点用...代替。[setting.edit.enable = true 时生效]

                    +

                    默认值:5

                    +

                    请根据自己的需求适当调整此值

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 设置拖拽时最多可显示10个节点

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			maxShowNodeNum: 10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.minMoveSize.html b/static/zTree3/api/cn/setting.edit.drag.minMoveSize.html new file mode 100644 index 0000000..904be41 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.minMoveSize.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.minMoveSize

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    判定是否拖拽操作的最小位移值 (单位:px)。[setting.edit.enable = true 时生效]

                    +

                    根据自己的需求可适当调整此值,如果太小容易导致点击鼠标时误操作进行拖拽

                    +

                    默认值:5

                    +
                    +
                    +

                    setting 举例

                    +

                    1. 更改拖拽操作启动位移值为10px

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			minMoveSize: 10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.next.html b/static/zTree3/api/cn/setting.edit.drag.next.html new file mode 100644 index 0000000..ffc874a --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.next.html @@ -0,0 +1,58 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.next

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽到目标节点时,设置是否允许移动到目标节点后面的操作。[setting.edit.enable = true 时生效]

                    +

                    拖拽目标是 根 的时候,不触发 prev 和 next,只会触发 inner

                    +

                    此功能主要作用是对拖拽进行适当限制(辅助箭头),需要结合 prev、inner 一起使用,才能实现完整功能。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 允许 / 不允许 移动到目标节点后面

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控(多棵树拖拽时,是目标节点所在树的 treeId)

                    +

                    treeNodesArray(JSON)

                    +

                    被拖拽的节点 JSON 数据集合

                    +

                    targetNodeJSON

                    +

                    拖拽时的目标节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止拖拽到节点后面的操作

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: false,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. 禁止拖拽到父节点后面的操作

                    +
                    function canNext(treeId, nodes, targetNode) {
                    +	return !targetNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: canNext,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.drag.prev.html b/static/zTree3/api/cn/setting.edit.drag.prev.html new file mode 100644 index 0000000..bd05361 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.drag.prev.html @@ -0,0 +1,58 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.prev

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    拖拽到目标节点时,设置是否允许移动到目标节点前面的操作。[setting.edit.enable = true 时生效]

                    +

                    拖拽目标是 根 的时候,不触发 prev 和 next,只会触发 inner

                    +

                    此功能主要作用是对拖拽进行适当限制(辅助箭头),需要结合 next、inner 一起使用,才能实现完整功能。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 允许 / 不允许 移动到目标节点前面

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控(多棵树拖拽时,是目标节点所在树的 treeId)

                    +

                    treeNodesArray(JSON)

                    +

                    被拖拽的节点 JSON 数据集合

                    +

                    targetNodeJSON

                    +

                    拖拽时的目标节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 禁止拖拽到节点前面的操作

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: false,
                    +			next: true,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. 禁止拖拽到父节点前面的操作

                    +
                    function canPrev(treeId, nodes, targetNode) {
                    +	return !targetNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: canPrev,
                    +			next: true,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.editNameSelectAll.html b/static/zTree3/api/cn/setting.edit.editNameSelectAll.html new file mode 100644 index 0000000..30784f3 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.editNameSelectAll.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Booleansetting.edit.editNameSelectAll

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    节点编辑名称 input 初次显示时,设置 txt 内容是否为全选状态。 [setting.edit.enable = true 时生效]

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示 全选状态

                    +

                    false 表示 不是全选状态,光标默认在最后

                    +
                    +

                    setting 举例

                    +

                    1. 设置节点编辑名称 input 初次显示时,txt内容为全选状态

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		editNameSelectAll: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.enable.html b/static/zTree3/api/cn/setting.edit.enable.html new file mode 100644 index 0000000..de1afea --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.enable.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Booleansetting.edit.enable

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否处于编辑状态

                    +

                    请在初始化之前设置,初始化后需要改变编辑状态请使用 zTreeObj.setEditable() 方法

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 可以 / 不可以 编辑

                    +
                    +

                    编辑状态规则说明

                    +
                    +

                    1、点击节点时,不会打开 node.url 指定的 URL。 +
                    2、全面支持 编辑 与 异步加载 状态共存。 +
                    3、可以对节点进行拖拽,且支持多棵树之间进行拖拽。 +
                    4、支持拖拽时 复制/移动 节点。(参考: setting.edit.drag.isCopy / setting.edit.drag.isMove) +
                    5、可以通过编辑按钮修改 name 属性。 +
                    6、可以通过删除按钮删除节点。 +
                    +

                    +

                    请注意大小写,不要改变

                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 进入编辑状态

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.removeTitle.html b/static/zTree3/api/cn/setting.edit.removeTitle.html new file mode 100644 index 0000000..55257da --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.removeTitle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.edit.removeTitle

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    删除按钮的 Title 辅助信息。[setting.edit.enable = true & setting.edit.showRemoveBtn = true 时生效]

                    +

                    默认值:"remove"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    鼠标移动到 删除按钮 上时,浏览器自动弹出的辅助信息内容,可根据用户需要自行修改

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置删除按钮 Title 信息的节点 JSON 数据对象

                    +

                    返回值String

                    +

                    返回值同 String 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置删除按钮的 Title 辅助信息为: "删除节点"

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: true,
                    +		removeTitle: "删除节点"
                    +	}
                    +};
                    +......
                    +

                    2. 设置父节点删除按钮的 Title 辅助信息为: "删除父节点"

                    +
                    function setRemoveTitle(treeId, treeNode) {
                    +	return treeNode.isParent ? "删除父节点":"删除叶子节点";
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: true,
                    +		removeTitle: setRemoveTitle
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.renameTitle.html b/static/zTree3/api/cn/setting.edit.renameTitle.html new file mode 100644 index 0000000..2dfbcca --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.renameTitle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.edit.renameTitle

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    编辑名称按钮的 Title 辅助信息。[setting.edit.enable = true & setting.edit.showRenameBtn = true 时生效]

                    +

                    默认值:"rename"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    设置鼠标移动到 编辑名称按钮 上时,浏览器自动弹出的辅助信息内容,可根据用户需要自行修改

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置编辑名称按钮 Title 信息的节点 JSON 数据对象

                    +

                    返回值String

                    +

                    返回值同 String 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置编辑名称按钮的 Title 辅助信息为: "编辑节点名称"

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: true,
                    +		renameTitle: "编辑节点名称"
                    +	}
                    +};
                    +......
                    +

                    2. 设置父节点编辑名称按钮的 Title 辅助信息为: "编辑父节点名称"

                    +
                    function setRenameTitle(treeId, treeNode) {
                    +	return treeNode.isParent ? "编辑父节点名称":"编辑叶子节点名称";
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: true,
                    +		renameTitle: setRenameTitle
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.showRemoveBtn.html b/static/zTree3/api/cn/setting.edit.showRemoveBtn.html new file mode 100644 index 0000000..db62053 --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.showRemoveBtn.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.edit.showRemoveBtn

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    设置是否显示删除按钮。[setting.edit.enable = true 时生效]

                    +

                    当点击某节点的删除按钮时:

                    +

                    1、首先触发 setting.callback.beforeRemove 回调函数,用户可判定是否进行删除操作。

                    +

                    2、如果未设置 beforeRemove 或 beforeRemove 返回 true,则删除节点并触发 setting.callback.onRemove 回调函数。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 隐藏 删除按钮

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置是否显示删除按钮的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 不显示删除按钮

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: false
                    +	}
                    +};
                    +......
                    +

                    2. 设置所有的父节点不显示删除按钮

                    +
                    function setRemoveBtn(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: setRemoveBtn
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.edit.showRenameBtn.html b/static/zTree3/api/cn/setting.edit.showRenameBtn.html new file mode 100644 index 0000000..33dd37a --- /dev/null +++ b/static/zTree3/api/cn/setting.edit.showRenameBtn.html @@ -0,0 +1,51 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.edit.showRenameBtn

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    设置是否显示编辑名称按钮。[setting.edit.enable = true 时生效]

                    +

                    当点击某节点的编辑名称按钮时:

                    +

                    1、进入节点编辑名称状态。

                    +

                    2、编辑名称完毕(Input 失去焦点 或 按下 Enter 键),会触发 setting.callback.beforeRename 回调函数,用户可根据自己的规则判定是否允许修改名称。

                    +

                    3、如果 beforeRename 返回 false,则继续保持编辑名称状态,直到名称符合规则位置 (按下 ESC 键可取消编辑名称状态,恢复原名称)。

                    +

                    4、如果未设置 beforeRename 或 beforeRename 返回 true,则结束节点编辑名称状态,更新节点名称,并触发 setting.callback.onRename 回调函数。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 隐藏 编辑名称按钮

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置是否显示编辑名称按钮的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 不显示编辑名称按钮

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: false
                    +	}
                    +};
                    +......
                    +

                    2. 设置所有的父节点不显示编辑名称按钮

                    +
                    function setRenameBtn(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: setRenameBtn
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.treeId.html b/static/zTree3/api/cn/setting.treeId.html new file mode 100644 index 0000000..819743e --- /dev/null +++ b/static/zTree3/api/cn/setting.treeId.html @@ -0,0 +1,14 @@ +
                    +
                    +

                    Stringsetting.treeId

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 的唯一标识,初始化后,等于 用户定义的 zTree 容器的 id 属性值。

                    +

                    请勿进行初始化 或 修改,属于内部参数。

                    +
                    +
                    + +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.treeObj.html b/static/zTree3/api/cn/setting.treeObj.html new file mode 100644 index 0000000..37684a1 --- /dev/null +++ b/static/zTree3/api/cn/setting.treeObj.html @@ -0,0 +1,14 @@ +
                    +
                    +

                    Objectsetting.treeObj

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 容器的 jQuery 对象,主要功能:便于操作。

                    +

                    请勿进行初始化 或 修改,属于内部参数。

                    +
                    +
                    + +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.addDiyDom.html b/static/zTree3/api/cn/setting.view.addDiyDom.html new file mode 100644 index 0000000..0a508ac --- /dev/null +++ b/static/zTree3/api/cn/setting.view.addDiyDom.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.addDiyDom

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于在节点上固定显示用户自定义控件

                    +

                    1. 大数据量的节点加载请注意:在 addDiyDom 中针对每个节点 查找 DOM 对象并且添加新 DOM 控件,肯定会影响初始化性能;如果不是必须使用,建议不使用此功能

                    +

                    2. 属于高级应用,使用时请确保对 zTree 比较了解。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要显示自定义控件的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置节点后面显示一个按钮

                    +
                    var setting = {
                    +	view: {
                    +		addDiyDom: addDiyDom
                    +	}
                    +};
                    +function addDiyDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.addHoverDom.html b/static/zTree3/api/cn/setting.view.addHoverDom.html new file mode 100644 index 0000000..f073e79 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.addHoverDom.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.addHoverDom

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于当鼠标移动到节点上时,显示用户自定义控件,显示隐藏状态同 zTree 内部的编辑、删除按钮

                    +

                    请务必与 setting.view.removeHoverDom 同时使用;属于高级应用,使用时请确保对 zTree 比较了解。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要显示自定义控件的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置鼠标移到节点上,在后面显示一个按钮

                    +
                    var setting = {
                    +	view: {
                    +		addHoverDom: addHoverDom,
                    +		removeHoverDom: removeHoverDom,
                    +		......
                    +	}
                    +};
                    +function addHoverDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +function removeHoverDom(treeId, treeNode) {
                    +	$("#diyBtn_"+treeNode.id).unbind().remove();
                    +	$("#diyBtn_space_" +treeNode.id).unbind().remove();
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.autoCancelSelected.html b/static/zTree3/api/cn/setting.view.autoCancelSelected.html new file mode 100644 index 0000000..4890f78 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.autoCancelSelected.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Booleansetting.view.autoCancelSelected

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    点击节点时,按下 Ctrl 或 Cmd 键是否允许取消选择操作。

                    +

                    如果不需要此功能,请设置为 false。

                    +

                    默认值: true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 支持 / 不支持 配合 Ctrl 或 Cmd 键进行取消节点选择的操作

                    +
                    +

                    setting 举例

                    +

                    1. 禁止配合 Ctrl 或 Cmd 键进行取消节点选择的操作

                    +
                    var setting = {
                    +	view: {
                    +		autoCancelSelected: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.dblClickExpand.html b/static/zTree3/api/cn/setting.view.dblClickExpand.html new file mode 100644 index 0000000..5f3db96 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.dblClickExpand.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.dblClickExpand

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    双击节点时,是否自动展开父节点的标识

                    +

                    默认值: true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示双击节点 切换 / 不切换 展开状态

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置是否双击切换展开状态的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting 举例

                    +

                    1. 取消默认双击展开父节点的功能

                    +
                    var setting = {
                    +	view: {
                    +		dblClickExpand: false
                    +	}
                    +};
                    +......
                    +

                    2. 设置 zTree 仅仅 level=0 的父节点取消双击展开的功能

                    +
                    function dblClickExpand(treeId, treeNode) {
                    +	return treeNode.level > 0;
                    +};
                    +var setting = {
                    +	view: {
                    +		dblClickExpand: dblClickExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.expandSpeed.html b/static/zTree3/api/cn/setting.view.expandSpeed.html new file mode 100644 index 0000000..3b799c3 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.expandSpeed.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    String / Numbersetting.view.expandSpeed

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 节点展开、折叠时的动画速度,设置方法同 JQuery 动画效果中 speed 参数。

                    +

                    IE6 下会自动关闭动画效果,以保证 zTree 的操作速度

                    +

                    默认值:"fast"

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    三种预定速度之一的字符串("slow", "normal", or "fast")

                    +

                    设置为 "" 时,不显示动画效果

                    +
                    +

                    Number 格式说明

                    +
                    +

                    表示动画时长的毫秒数值 (如:1000)

                    +
                    +

                    setting 举例

                    +

                    1. 设置为慢速显示动画效果

                    +
                    var setting = {
                    +	view: {
                    +		expandSpeed: "slow"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.fontCss.html b/static/zTree3/api/cn/setting.view.fontCss.html new file mode 100644 index 0000000..54efb1b --- /dev/null +++ b/static/zTree3/api/cn/setting.view.fontCss.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    JSON / Function(treeId, treeNode)setting.view.fontCss

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    个性化文字样式,只针对 zTree 在节点上显示的<A>对象。

                    +

                    默认值:{}

                    +
                    +
                    +

                    JSON 格式说明

                    +
                    +

                    JSON 格式为 JQuery css方法中的 JSON 对象格式,例如:{color:"#ff0011", background:"blue"}

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置自定义样式的节点 JSON 数据对象

                    +

                    返回值JSON

                    +

                    返回值同 JSON 格式的数据,例如:{color:"#ff0011", background:"blue"}

                    +
                    +

                    setting & function 举例

                    +

                    1. 不修改CSS,设置全部节点 name 显示为红色

                    +
                    var setting = {
                    +	view: {
                    +		fontCss : {color:"red"}
                    +	}
                    +};
                    +

                    2. 设置 level=0 的节点 name 显示为红色

                    +
                    function setFontCss(treeId, treeNode) {
                    +	return treeNode.level == 0 ? {color:"red"} : {};
                    +};
                    +var setting = {
                    +	view: {
                    +		fontCss: setFontCss
                    +	}
                    +};
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.nameIsHTML.html b/static/zTree3/api/cn/setting.view.nameIsHTML.html new file mode 100644 index 0000000..a1d916c --- /dev/null +++ b/static/zTree3/api/cn/setting.view.nameIsHTML.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Booleansetting.view.nameIsHTML

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 name 属性是否支持 HTML 脚本

                    +

                    如果允许 HTML 脚本,请根据自己的需求做校验,避免出现 js 注入等安全问题。

                    +

                    默认值: false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 支持 / 不支持 HTML 脚本

                    +
                    +

                    setting 举例

                    +

                    1. 设置 name 属性支持 HTML 脚本

                    +
                    var setting = {
                    +	view: {
                    +		nameIsHTML: true
                    +	}
                    +};
                    +var node = {"name":"<font color='red'>test</font>"};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.removeHoverDom.html b/static/zTree3/api/cn/setting.view.removeHoverDom.html new file mode 100644 index 0000000..bb1a9aa --- /dev/null +++ b/static/zTree3/api/cn/setting.view.removeHoverDom.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.removeHoverDom

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于当鼠标移出节点时,隐藏用户自定义控件,显示隐藏状态同 zTree 内部的编辑、删除按钮

                    +

                    请务必与 addHoverDom 同时使用;属于高级应用,使用时请确保对 zTree 比较了解。

                    +

                    默认值:null

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要隐藏自定义控件的节点 JSON 数据对象

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置鼠标移到节点上,在后面显示一个按钮

                    +
                    var setting = {
                    +	view: {
                    +		addHoverDom: addHoverDom,
                    +		removeHoverDom: removeHoverDom,
                    +		......
                    +	}
                    +};
                    +function addHoverDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +function removeHoverDom(treeId, treeNode) {
                    +	$("#diyBtn_"+treeNode.id).unbind().remove();
                    +	$("#diyBtn_space_" +treeNode.id).unbind().remove();
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.selectedMulti.html b/static/zTree3/api/cn/setting.view.selectedMulti.html new file mode 100644 index 0000000..2cc65a2 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.selectedMulti.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Booleansetting.view.selectedMulti

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置是否允许同时选中多个节点。

                    +

                    默认值: true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 支持 / 不支持 同时选中多个节点

                    +

                    1、设置为 true时,按下 Ctrl 或 Cmd 键可以选中多个节点

                    +

                    2、设置为 true / false 都不影响按下 Ctrl 或 Cmd 键可以让已选中的节点取消选中状态( 取消选中状态可以参考 setting.view.autoCancelSelected )

                    +
                    +

                    setting 举例

                    +

                    1. 禁止多点同时选中的功能

                    +
                    var setting = {
                    +	view: {
                    +		selectedMulti: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.showIcon.html b/static/zTree3/api/cn/setting.view.showIcon.html new file mode 100644 index 0000000..ebe423c --- /dev/null +++ b/static/zTree3/api/cn/setting.view.showIcon.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.showIcon

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否显示节点的图标。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 隐藏 图标

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置是否显示图标的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置 zTree 不显示图标

                    +
                    var setting = {
                    +	view: {
                    +		showIcon: false
                    +	}
                    +};
                    +......
                    +

                    2. 设置 zTree 仅仅 level=2 的节点不显示图标

                    +
                    function showIconForTree(treeId, treeNode) {
                    +	return treeNode.level != 2;
                    +};
                    +var setting = {
                    +	view: {
                    +		showIcon: showIconForTree
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.showLine.html b/static/zTree3/api/cn/setting.view.showLine.html new file mode 100644 index 0000000..02ab5eb --- /dev/null +++ b/static/zTree3/api/cn/setting.view.showLine.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Booleansetting.view.showLine

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否显示节点之间的连线。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 不显示 连线

                    +
                    +

                    setting 举例

                    +

                    1. 设置 zTree 不显示节点之间的连线

                    +
                    var setting = {
                    +	view: {
                    +		showLine: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.showTitle.html b/static/zTree3/api/cn/setting.view.showTitle.html new file mode 100644 index 0000000..5bcb860 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.showTitle.html @@ -0,0 +1,46 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.showTitle

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否显示节点的 title 提示信息(即节点 DOM 的 title 属性)。

                    +

                    请务必与 setting.data.key.title 同时使用。

                    +

                    默认值:true

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 显示 / 隐藏 提示信息

                    +

                    如果 setting.view.showTitle = true & setting.data.key.title = '',zTree 会自动使用 setting.data.key.name 指定的节点名称当做 title

                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeIdString

                    +

                    对应 zTree 的 treeId,便于用户操控

                    +

                    treeNodeJSON

                    +

                    需要设置是否显示提示信息的节点 JSON 数据对象

                    +

                    返回值Boolean

                    +

                    返回值同 Boolean 格式的数据

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置 zTree 不显示提示信息

                    +
                    var setting = {
                    +	view: {
                    +		showTitle: false
                    +	}
                    +};
                    +......
                    +

                    2. 设置 zTree 仅仅 level=2 的节点不显示提示信息

                    +
                    function showTitleForTree(treeId, treeNode) {
                    +	return treeNode.level != 2;
                    +};
                    +var setting = {
                    +	view: {
                    +		showTitle: showTitleForTree
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/setting.view.txtSelectedEnable.html b/static/zTree3/api/cn/setting.view.txtSelectedEnable.html new file mode 100644 index 0000000..c22a8c0 --- /dev/null +++ b/static/zTree3/api/cn/setting.view.txtSelectedEnable.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Booleansetting.view.txtSelectedEnable

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 是否允许可以选择 zTree DOM 内的文本。

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true / false 分别表示 允许 / 不允许 选择 zTree Dom 内的文本

                    +
                    +

                    setting & function 举例

                    +

                    1. 设置 zTree 允许选择文本

                    +
                    var setting = {
                    +	view: {
                    +		txtSelectedEnable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.check_Child_State.html b/static/zTree3/api/cn/treeNode.check_Child_State.html new file mode 100644 index 0000000..fa37899 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.check_Child_State.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    NumbertreeNode.check_Child_State

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    用于设置节点的子节点的 checkBox / radio 的半选状态。[setting.check.enable = true 时有效]

                    +

                    v3.x 针对节点数据对象提供 treeNode.getCheckStatus() 方法获取标准的半选状态

                    +

                    zTree 内部使用,请勿进行初始化 或 随意修改

                    +

                    默认值:true

                    +
                    +
                    +

                    Number 格式说明

                    +
                    +

                    规则如下:

                    + + + + + + + + + + + +
                    setting.check.checkType = "checkbox"
                    treeNode.check_Child_State勾选状态说明
                    -1不存在子节点 或 子节点全部设置为 nocheck = true
                    0无 子节点被勾选
                    1部分 子节点被勾选
                    2全部 子节点被勾选
                    +
                    + + + + + + + + + + +
                    setting.check.checkType = "radio"
                    treeNode.check_Child_State勾选状态说明
                    -1不存在子节点 或 子节点全部设置为 nocheck = true
                    0无 子节点被勾选
                    2有 子节点被勾选
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.check_Focus.html b/static/zTree3/api/cn/treeNode.check_Focus.html new file mode 100644 index 0000000..785aec9 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.check_Focus.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.check_Focus

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    用于设置节点的 checkBox / radio 的 focus 状态。[setting.check.enable = true 时有效]

                    +

                    zTree 内部使用,请勿进行初始化 或 随意修改

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示当前鼠标移动到输入框内

                    +

                    false 表示当前鼠标移动到输入框外

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.checked.html b/static/zTree3/api/cn/treeNode.checked.html new file mode 100644 index 0000000..049d6ba --- /dev/null +++ b/static/zTree3/api/cn/treeNode.checked.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    BooleantreeNode.checked

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    节点的 checkBox / radio 的 勾选状态。[setting.check.enable = true & treeNode.nocheck = false 时有效]

                    +

                    1、如果不使用 checked 属性设置勾选状态,请修改 setting.data.key.checked

                    +

                    2、建立 treeNode 数据时设置 treeNode.checked = true 可以让节点的输入框默认为勾选状态

                    +

                    3、修改节点勾选状态,可以使用 treeObj.checkNode / checkAllNodes / updateNode 方法,具体使用哪种请根据自己的需求而定

                    +

                    4、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点的输入框被勾选

                    +

                    false 表示节点的输入框未勾选

                    +
                    +

                    treeNode 举例

                    +

                    1. 初始化的数据设置 默认为勾选状态

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1", checked:true },
                    +{ "id":2, "name":"test2", checked:true }
                    +]
                    +

                    2. 获取第一个根节点的勾选状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var checked = treeObj.getNodes()[0].checked;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.checkedOld.html b/static/zTree3/api/cn/treeNode.checkedOld.html new file mode 100644 index 0000000..cab717e --- /dev/null +++ b/static/zTree3/api/cn/treeNode.checkedOld.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    BooleantreeNode.checkedOld

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    节点的 checkBox / radio 在初始化时的 勾选状态。[setting.check.enable = true & treeNode.nocheck = false 时有效]

                    +

                    1、zTree 初始化节点数据时会对此属性进行赋值,因此请勿对此属性初始化

                    +

                    2、如需配合 zTreeObj.getChangeCheckedNodes 方法实现特殊功能,可以根据需求在使用中自行修改 checkedOld 数据

                    +

                    默认值:checked的初始化值

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点初始化时 输入框被勾选

                    +

                    false 表示节点初始化时 输入框未勾选

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取第一个根节点的初始勾选状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var checkedOld = treeObj.getNodes()[0].checkedOld;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.children.html b/static/zTree3/api/cn/treeNode.children.html new file mode 100644 index 0000000..4bab835 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.children.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Array(JSON)treeNode.children

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点的子节点数据集合。

                    +

                    1、如果不使用 children 属性保存子节点数据,请修改 setting.data.key.children

                    +

                    2、异步加载时,对于设置了 isParent = true 的节点,在展开时将进行异步加载

                    +

                    默认值:无

                    +
                    +
                    +

                    Array(JSON) 格式说明

                    +
                    +

                    标准的 JSON 数据对象

                    +
                    +

                    treeNode 举例

                    +

                    1. 初始化的标准嵌套格式的 JSON 数据对象

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1",
                    +	children: [
                    +	{ "id":3, "name":"test3"},
                    +	{ "id":4, "name":"test4"},
                    +	{ "id":5, "name":"test5"}
                    +	]
                    +},
                    +{ "id":2, "name":"test2"  }
                    +]
                    +

                    2. 获取第一个根节点的子节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes()[0].children;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.chkDisabled.html b/static/zTree3/api/cn/treeNode.chkDisabled.html new file mode 100644 index 0000000..e6bb032 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.chkDisabled.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.chkDisabled

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    1、设置节点的 checkbox / radio 是否禁用 [setting.check.enable = true 时有效]

                    +

                    2、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +

                    3、请勿对已加载的节点修改此属性,禁止 或 取消禁止 请使用 setChkDisabled() 方法

                    +

                    4、初始化时,如果需要子孙节点继承父节点的 chkDisabled 属性,请设置 setting.check.chkDisabledInherit 属性

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示此节点的 checkbox / radio 被禁用。

                    +

                    false 表示此节点的 checkbox / radio 可以使用。

                    +
                    +

                    treeNode 举例

                    +

                    1. 禁用节点 checkbox / radio

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "checked":true, "chkDisabled":true},
                    +	{ "id":2, "name":"test2", "chkDisabled":true},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.click.html b/static/zTree3/api/cn/treeNode.click.html new file mode 100644 index 0000000..833c678 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.click.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    StringtreeNode.click

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    最简单的 click 事件操作。相当于 onclick="..." 的内容。 如果操作较复杂,请使用 onClick 事件回调函数。

                    +

                    由于 IE 对于 onclick 和 click事件共存时的处理与其他浏览器不同,所以请不要利用此参数控制是否允许跳转的操作(例如:treeNode.click = "return false;")。如有类似需求,请不要使用 url 属性设置网址,同时利用 onClick 回调函数控制跳转。

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    标准 javascript 语法, 例如:alert("test"); 等

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置某节点点击时,弹出信息框

                    +
                    var nodes = [
                    +	{ "id":1, "name":"Google CN", "url":"http://g.cn", "click":"alert('test');"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.diy.html b/static/zTree3/api/cn/treeNode.diy.html new file mode 100644 index 0000000..b2fb0d9 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.diy.html @@ -0,0 +1,15 @@ +
                    +
                    +

                    ?treeNode.* DIY *

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    用于保存节点的其他自定义数据信息,不要与 zTree 使用的属性相同即可,用户可随意设定。

                    +
                    +
                    +

                    treeNode 举例

                    +

                    1. 设置节点的备用英文名称

                    +
                    var node = { "id":1, "name":"test1", "ename":"test eName"};
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.editNameFlag.html b/static/zTree3/api/cn/treeNode.editNameFlag.html new file mode 100644 index 0000000..51162b8 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.editNameFlag.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.editNameFlag

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    用于记录节点是否处于编辑名称状态。[setting.edit.enable = true 时有效]

                    +

                    zTree 内部使用,请勿进行初始化 或 随意修改

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点处于编辑名称状态

                    +

                    false 表示节点未处于编辑名称状态

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getCheckStatus.html b/static/zTree3/api/cn/treeNode.getCheckStatus.html new file mode 100644 index 0000000..fc20eac --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getCheckStatus.html @@ -0,0 +1,63 @@ +
                    +
                    +

                    Function()treeNode.getCheckStatus

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    获取节点 checkbox / radio 半勾选状态。[setting.check.enable = true 时有效]

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值JSON

                    +
                    {
                    +	checked: true, //等同于 treeNode.checked
                    +	half: true  //规则见下表
                    +}
                    + + + + + + + + + + + + + + + + + + +
                    setting.check.checkType = "checkbox"
                    treeNode.checkedtreeNode.check_Child_StatetreeNode.halfCheck half
                    --truetrue
                     
                    true-1falsefalse
                    true0falsetrue
                    true1falsetrue
                    true2falsefalse
                     
                    false-1falsefalse
                    false0falsefalse
                    false1falsetrue
                    false2falsetrue
                    +
                    + + + + + + + + + + + + + + + + +
                    setting.check.checkType = "radio"
                    treeNode.checkedtreeNode.check_Child_StatetreeNode.halfCheck half
                    --truetrue
                     
                    true-1falsefalse
                    true0falsefalse
                    true2falsetrue
                     
                    false-1falsefalse
                    false0falsefalse
                    false2falsetrue
                    +
                    +

                    treeNode 举例

                    +

                    1. 获取第一个根节点的半选状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var halfCheck = treeObj.getNodes()[0].getCheckStatus();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getIndex.html b/static/zTree3/api/cn/treeNode.getIndex.html new file mode 100644 index 0000000..babdc2e --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getIndex.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()treeNode.getIndex

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取 treeNode 节点在同级节点中的位置。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值Number

                    +

                    treeNode 节点在同级节点中的位置。(从 0 开始)

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取当前被选中的节点在同级节点中的位置

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getIndex();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getNextNode.html b/static/zTree3/api/cn/treeNode.getNextNode.html new file mode 100644 index 0000000..7a0fa5c --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getNextNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getNextNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取与 treeNode 节点相邻的后一个节点。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值JSON

                    +

                    与 treeNode 节点相邻的后一个节点。

                    +

                    如果 treeNode 是最后一个节点,返回 null 。

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取当前被选中的节点的下一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getNextNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getParentNode.html b/static/zTree3/api/cn/treeNode.getParentNode.html new file mode 100644 index 0000000..31309a6 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getParentNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getParentNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取 treeNode 节点的父节点。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值JSON

                    +

                    treeNode 节点的父节点 JSON 数据对象。

                    +

                    如果 treeNode 是根节点,返回 null 。

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取当前被选中的节点的父节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getParentNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getPath.html b/static/zTree3/api/cn/treeNode.getPath.html new file mode 100644 index 0000000..46318f0 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getPath.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()treeNode.getPath

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取 treeNode 节点的所有父节点(包括自己)。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值Array (JSON)

                    +

                    treeNode 节点的所有父节点的数据集合(包括自己)

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取当前被选中的节点的所有父节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getPath();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.getPreNode.html b/static/zTree3/api/cn/treeNode.getPreNode.html new file mode 100644 index 0000000..9d84184 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.getPreNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getPreNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取与 treeNode 节点相邻的前一个节点。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值JSON

                    +

                    与 treeNode 节点相邻的前一个节点。

                    +

                    如果 treeNode 是第一个节点,返回 null 。

                    +
                    +

                    treeNode 举例

                    +

                    1. 获取当前被选中的节点的前一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getPreNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.halfCheck.html b/static/zTree3/api/cn/treeNode.halfCheck.html new file mode 100644 index 0000000..23ac744 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.halfCheck.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    BooleantreeNode.halfCheck

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    强制节点的 checkBox / radio 的 半勾选状态。[setting.check.enable = true & treeNode.nocheck = false 时有效]

                    +

                    1、强制为半勾选状态后,不再进行自动计算半勾选状态

                    +

                    2、设置 treeNode.halfCheck = false 或 null 才能恢复自动计算半勾选状态

                    +

                    3、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点的输入框 强行设置为半勾选

                    +

                    false 表示节点的输入框 根据 zTree 的规则自动计算半勾选状态

                    +
                    +

                    treeNode 举例

                    +

                    1. 初始化的数据设置 默认为半勾选状态

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1", isParent:true, checked:true, halfCheck:true },
                    +{ "id":2, "name":"test2", isParent:true, checked:false, halfCheck:true },
                    +{ "id":3, "name":"test3", isParent:true, checked:true },
                    +{ "id":4, "name":"test4", isParent:true, checked:false }
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.icon.html b/static/zTree3/api/cn/treeNode.icon.html new file mode 100644 index 0000000..69c5db1 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.icon.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.icon

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点自定义图标的 URL 路径。

                    +

                    1、父节点如果只设置 icon ,会导致展开、折叠时都使用同一个图标

                    +

                    2、父节点展开、折叠使用不同的个性化图标需要同时设置 treeNode.iconOpen / treeNode.iconClose 两个属性

                    +

                    3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    图标图片的 url 可以是相对路径也可以是绝对路径

                    +

                    设置相对路径请注意页面与图片之间的关系,确保图片能够正常加载

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置节点的个性化图标

                    +
                    var nodes = [
                    +	//父节点展开 折叠时使用相同的图标
                    +	{ name:"父节点1", icon:"/img/parent.gif"},
                    +
                    +	//父节点展开 折叠时分别使用不同的图标
                    +	{ name:"父节点2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"}, 
                    +
                    +	//叶子节点个性化图标
                    +	{ name:"叶子节点", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.iconClose.html b/static/zTree3/api/cn/treeNode.iconClose.html new file mode 100644 index 0000000..f51da9c --- /dev/null +++ b/static/zTree3/api/cn/treeNode.iconClose.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.iconClose

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    父节点自定义折叠时图标的 URL 路径。

                    +

                    1、此属性只针对父节点有效

                    +

                    2、此属性必须与 iconOpen 同时使用

                    +

                    3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    图标图片的 url 可以是相对路径也可以是绝对路径

                    +

                    设置相对路径请注意页面与图片之间的关系,确保图片能够正常加载

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置节点的个性化图标

                    +
                    var nodes = [
                    +	//父节点展开 折叠时使用相同的图标
                    +	{ name:"父节点1", icon:"/img/parent.gif"},
                    +
                    +	//父节点展开 折叠时分别使用不同的图标
                    +	{ name:"父节点2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"}, 
                    +
                    +	//叶子节点个性化图标
                    +	{ name:"叶子节点", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.iconOpen.html b/static/zTree3/api/cn/treeNode.iconOpen.html new file mode 100644 index 0000000..29c9baa --- /dev/null +++ b/static/zTree3/api/cn/treeNode.iconOpen.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.iconOpen

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    父节点自定义展开时图标的 URL 路径。

                    +

                    1、此属性只针对父节点有效

                    +

                    2、此属性必须与 iconClose 同时使用

                    +

                    3、如果想利用 className 设置个性化图标,需要设置 treeNode.iconSkin 属性

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    图标图片的 url 可以是相对路径也可以是绝对路径

                    +

                    设置相对路径请注意页面与图片之间的关系,确保图片能够正常加载

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置节点的个性化图标

                    +
                    var nodes = [
                    +	//父节点展开 折叠时使用相同的图标
                    +	{ name:"父节点1", icon:"/img/parent.gif"},
                    +
                    +	//父节点展开 折叠时分别使用不同的图标
                    +	{ name:"父节点2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"}, 
                    +
                    +	//叶子节点个性化图标
                    +	{ name:"叶子节点", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.iconSkin.html b/static/zTree3/api/cn/treeNode.iconSkin.html new file mode 100644 index 0000000..d5d9726 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.iconSkin.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    StringtreeNode.iconSkin

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点自定义图标的 className

                    +

                    1、需要修改 css,增加相应 className 的设置

                    +

                    2、css 方式简单、方便,并且同时支持父节点展开、折叠状态切换图片

                    +

                    3、css 建议采用图片分割渲染的方式以减少反复加载图片,并且避免图片闪动

                    +

                    4、zTree v3.x 的 iconSkin 同样支持 IE6

                    +

                    5、如果想直接使用 图片的Url路径 设置节点的个性化图标,需要设置 treeNode.icon / treeNode.iconOpen / treeNode.iconClose 属性

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    设置个性图标的 className

                    +
                    +

                    css & treeNode 举例

                    +

                    1. 设置节点的个性化图标

                    +
                    css 内容:
                    +.ztree li span.button.diy01_ico_open, .ztree li span.button.diy01_ico_close{...}
                    +
                    +.ztree li span.button.diy02_ico_open{...}
                    +.ztree li span.button.diy02_ico_close{...}
                    +
                    +.ztree li span.button.diy03_ico_docu{...}
                    +
                    +js中节点数据:
                    +var nodes = [
                    +	//父节点展开 折叠时使用相同的图标
                    +	{ name:"父节点1", iconSkin:"diy01"},
                    +
                    +	//父节点展开 折叠时分别使用不同的图标
                    +	{ name:"父节点2", iconSkin:"diy02"},
                    +
                    +	//叶子节点个性化图标
                    +	{ name:"叶子节点", iconSkin:"diy03"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isAjaxing.html b/static/zTree3/api/cn/treeNode.isAjaxing.html new file mode 100644 index 0000000..330c120 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isAjaxing.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    BooleantreeNode.isAjaxing

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点是否正在进行异步加载。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点正在进行异步加载

                    +

                    false 表示节点没有进行异步加载

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点是否节点正在进行异步加载

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isAjaxing = sNodes[0].isAjaxing;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isFirstNode.html b/static/zTree3/api/cn/treeNode.isFirstNode.html new file mode 100644 index 0000000..83b80bd --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isFirstNode.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isFirstNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点是否为同级节点中的第一个节点。

                    +

                    使用 exhide 扩展后,只针对显示的节点设置此属性

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示是同级节点中的第一个节点

                    +

                    false 表示不是同级节点中的第一个节点

                    +

                    节点被隐藏后,isFirstNode = false

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点是否是同级节点中的第一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isFirstNode = sNodes[0].isFirstNode;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isHidden.html b/static/zTree3/api/cn/treeNode.isHidden.html new file mode 100644 index 0000000..5fb388e --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isHidden.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    BooleantreeNode.isHidden

                    +

                    概述[ 依赖 jquery.ztree.exhide 扩展 js ]

                    +
                    +

                    +
                    +

                    判断 treeNode 节点是否被隐藏。

                    +

                    1、初始化 zTree 时,如果节点设置 isHidden = true,会被自动隐藏

                    +

                    2、请勿对已加载的节点修改此属性,隐藏 / 显示 请使用 hideNode() / hideNodes() / showNode() / showNodes() 方法

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示被隐藏

                    +

                    false 表示被显示

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看第一个根节点是否被隐藏

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getNodes();
                    +if (sNodes.length > 0) {
                    +	var isHidden = sNodes[0].isHidden;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isHover.html b/static/zTree3/api/cn/treeNode.isHover.html new file mode 100644 index 0000000..dcef6eb --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isHover.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.isHover

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    记录节点 的 hover 状态,主要用于 setting.view.addHoverDom / removeHoverDom 。

                    +

                    zTree 内部使用,请勿进行初始化 或 随意修改

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点处于 hover 状态

                    +

                    false 表示节点未处于 hover 状态

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isLastNode.html b/static/zTree3/api/cn/treeNode.isLastNode.html new file mode 100644 index 0000000..5d5ac82 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isLastNode.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isLastNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点是否为同级节点中的最后一个节点。

                    +

                    使用 exhide 扩展后,只针对显示的节点设置此属性

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示是同级节点中的最后一个节点

                    +

                    false 表示不是同级节点中的最后一个节点

                    +

                    节点被隐藏后,isLastNode = false

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点是否是同级节点中的最后一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isLastNode = sNodes[0].isLastNode;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.isParent.html b/static/zTree3/api/cn/treeNode.isParent.html new file mode 100644 index 0000000..bab887e --- /dev/null +++ b/static/zTree3/api/cn/treeNode.isParent.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isParent

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点是否为父节点。

                    +

                    1、初始化节点数据时,根据 treeNode.children 属性判断,有子节点则设置为 true,否则为 false

                    +

                    2、初始化节点数据时,如果设定 treeNode.isParent = true,即使无子节点数据,也会设置为父节点

                    +

                    3、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示是父节点

                    +

                    false 表示不是父节点

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点是否是父节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isParent = sNodes[0].isParent;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.level.html b/static/zTree3/api/cn/treeNode.level.html new file mode 100644 index 0000000..aff3254 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.level.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    NumbertreeNode.level

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录节点的层级

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    Number 格式说明

                    +
                    +

                    根节点 level = 0,依次递增

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点的级数

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var level = sNodes[0].level;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.name.html b/static/zTree3/api/cn/treeNode.name.html new file mode 100644 index 0000000..918f2b4 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.name.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.name

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点名称。

                    +

                    1、如果不使用 name 属性保存节点名称,请修改 setting.data.key.name

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    节点显示的名称字符串,标准 String 即可,所有特殊字符都会被自动转义

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置节点的名称为 test1、test2、test3

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1"},
                    +	{ "id":2, "name":"test2"},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.nocheck.html b/static/zTree3/api/cn/treeNode.nocheck.html new file mode 100644 index 0000000..afaa62f --- /dev/null +++ b/static/zTree3/api/cn/treeNode.nocheck.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    BooleantreeNode.nocheck

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    1、设置节点是否隐藏 checkbox / radio [setting.check.enable = true 时有效]

                    +

                    2、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示此节点不显示 checkbox / radio,不影响勾选的关联关系,不影响父节点的半选状态。

                    +

                    false 表示节点具有正常的勾选功能

                    +
                    +

                    treeNode 举例

                    +

                    1. 不显示某个节点的 checkbox / radio

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "nocheck":true},
                    +	{ "id":2, "name":"test2"},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.open.html b/static/zTree3/api/cn/treeNode.open.html new file mode 100644 index 0000000..1eb9aec --- /dev/null +++ b/static/zTree3/api/cn/treeNode.open.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    BooleantreeNode.open

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点的 展开 / 折叠 状态。

                    +

                    1、初始化节点数据时,如果设定 treeNode.open = true,则会直接展开此节点

                    +

                    2、叶子节点 treeNode.open = false

                    +

                    3、为了解决部分朋友生成 json 数据出现的兼容问题, 支持 "false","true" 字符串格式的数据

                    +

                    4、非异步加载模式下,无子节点的父节点设置 open=true 后,可显示为展开状态,但异步加载模式下不会生效。(v3.5.15+)

                    +

                    默认值:false

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示节点为 展开 状态

                    +

                    false 表示节点为 折叠 状态

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点的 展开 / 折叠 状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isOpen = sNodes[0].open;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.parentTId.html b/static/zTree3/api/cn/treeNode.parentTId.html new file mode 100644 index 0000000..d228a23 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.parentTId.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    StringtreeNode.parentTId

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    treeNode 节点的父节点唯一标识 tId。

                    +

                    1、v3.x 用 parentTId 替换了原先的 parentNode 属性,同时增加了 getParentNode 方法,以避免原先 parentNode 造成的 clone 死循环

                    +

                    2、初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    zTree 内部生成的节点唯一标识,请参考 treeNode.tId 的说明

                    +

                    如果 treeNode 是根节点,则 parentTId = null

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点的父节点 tId

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var parentTId = sNodes[0].parentTId;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.tId.html b/static/zTree3/api/cn/treeNode.tId.html new file mode 100644 index 0000000..c32285c --- /dev/null +++ b/static/zTree3/api/cn/treeNode.tId.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.tId

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    treeNode 节点的唯一标识 tId。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    生成规则:setting.treeId + "_" + 内部计数

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点的 tId

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var tId = sNodes[0].tId;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.target.html b/static/zTree3/api/cn/treeNode.target.html new file mode 100644 index 0000000..f7c1b6b --- /dev/null +++ b/static/zTree3/api/cn/treeNode.target.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    StringtreeNode.target

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    设置点击节点后在何处打开 url。[treeNode.url 存在时有效]

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    同超链接 target 属性: "_blank", "_self" 或 其他指定窗口名称

                    +

                    省略此属性,则默认为 "_blank"

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置点击某节点时,弹出新页面

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "url":"http://myTest.com", "target":"_blank"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.url.html b/static/zTree3/api/cn/treeNode.url.html new file mode 100644 index 0000000..0b2e007 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.url.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.url

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    节点链接的目标 URL

                    +

                    1、编辑模式 (setting.edit.enable = true) 下此属性功能失效,如果必须使用类似功能,请利用 onClick 事件回调函数自行控制。

                    +

                    2、如果需要在 onClick 事件回调函数中进行跳转控制,那么请将 URL 地址保存在其他自定义的属性内,请勿使用 url

                    +

                    默认值:无

                    +
                    +
                    +

                    String 格式说明

                    +
                    +

                    同超链接 href 属性

                    +
                    +

                    treeNode 举例

                    +

                    1. 设置某节点点击时,跳转到 g.cn

                    +
                    var nodes = [
                    +	{ "id":1, "name":"Google CN", "url":"http://g.cn"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/treeNode.zAsync.html b/static/zTree3/api/cn/treeNode.zAsync.html new file mode 100644 index 0000000..00e48f3 --- /dev/null +++ b/static/zTree3/api/cn/treeNode.zAsync.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.zAsync

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    记录 treeNode 节点是否已经进行过异步加载,避免父节点反复异步加载数据。

                    +

                    初始化节点数据时,由 zTree 增加此属性,请勿提前赋值

                    +

                    默认值:false (无子节点的父节点); true (有子节点的父节点 & 叶子节点)

                    +
                    +
                    +

                    Boolean 格式说明

                    +
                    +

                    true 表示父节点展开时不需要自动异步加载

                    +

                    false 表示父节点展开时需要自动异步加载

                    +

                    此参数不会对 reAsyncChildNodes 方法造成任何影响

                    +
                    +

                    treeNode 举例

                    +

                    1. 查看当前被选中的节点是否节点是否需要自动异步加载

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var zAsync = sNodes[0].zAsync;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.addNodes.html b/static/zTree3/api/cn/zTreeObj.addNodes.html new file mode 100644 index 0000000..0fa52e3 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.addNodes.html @@ -0,0 +1,47 @@ +
                    +
                    +

                    Function(parentNode, [index], newNodes, isSilent)zTreeObj.addNodes

                    +

                    概述[ 依赖 jquery.ztree.core 扩展 js ]

                    +
                    +

                    +
                    +

                    添加节点。

                    +

                    v3.x 为了避免原先反复初始化造成的数据重复问题,在 初始化 和 添加节点 时内部进行 clone 操作。如果需要获取数据在 zTree 内的对象,请获取此方法的返回值。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    parentNodeJSON

                    +

                    指定的父节点,如果增加根节点,请设置 parentNode 为 null 即可。

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    [index]Number

                    +

                    新节点插入的位置(从 0 开始)

                    +

                    index = -1 时,插入到最后

                    +

                    此参数可忽略

                    +

                    v3.5.19+

                    +

                    newNodesJSON / Array(JSON)

                    +

                    需要增加的节点数据 JSON 对象集合,数据只需要满足 zTree 的节点数据必需的属性即可,详细请参考“treeNode 节点数据详解”

                    +

                    1、v3.x 支持单独添加一个节点,即如果只新增一个节点,不用必须包在数组中

                    +

                    2、使用简单数据模式,请参考 setting.data.simpleData 内的属性说明

                    +

                    isSilentBoolean

                    +

                    设定增加节点后是否自动展开父节点。

                    +

                    isSilent = true 时,不展开父节点,其他值或缺省状态都自动展开。

                    +

                    返回值Array(JSON)

                    +

                    返回值是 zTree 最终添加的节点数据集合

                    +

                    如果 newNodes 是单个节点数据 JSON,返回值也是将其包在 Array 内

                    +

                    请务必记住:返回值中的数据对象 是 newNodes 被 clone 后的,所以绝对不相等!

                    +
                    +

                    function 举例

                    +

                    1. 对于 id = "tree" 的 zTree 增加 1 个根节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var newNode = {name:"newNode1"};
                    +newNode = treeObj.addNodes(null, newNode);
                    +
                    +

                    2. 对于 id = "tree" 的 zTree 增加 3 个根节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var newNodes = [{name:"newNode1"}, {name:"newNode2"}, {name:"newNode3"}];
                    +newNodes = treeObj.addNodes(null, newNodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.cancelEditName.html b/static/zTree3/api/cn/zTreeObj.cancelEditName.html new file mode 100644 index 0000000..9df098f --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.cancelEditName.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(newName)zTreeObj.cancelEditName

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    取消节点的编辑名称状态,可以恢复原名称,也可以强行赋给新的名称。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    newNameString

                    +

                    重新给定的新名称。

                    +

                    如果省略此参数,则恢复原名称。

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 取消 zTree 的编辑名称状态,恢复该节点原有名称

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelEditName();
                    +
                    +

                    2. 取消 zTree 的编辑名称状态,并且重新设定该节点名称

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelEditName("test_new_name");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.cancelSelectedNode.html b/static/zTree3/api/cn/zTreeObj.cancelSelectedNode.html new file mode 100644 index 0000000..d841768 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.cancelSelectedNode.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.cancelSelectedNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    取消节点的选中状态。

                    +

                    v3.x 支持多点同时选中,因此取消选中状态可以全部取消,也可以单独取消某个节点的选中状态。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要取消选中状态的节点。

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    如果省略此参数,则将取消全部被选中节点的选中状态。

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 取消当前所有被选中节点的选中状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelSelectedNode();
                    +
                    +

                    2. 取消当前第一个被选中节点的选中状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) { 
                    +	treeObj.cancelSelectedNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.checkAllNodes.html b/static/zTree3/api/cn/zTreeObj.checkAllNodes.html new file mode 100644 index 0000000..d6eaadf --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.checkAllNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(checked)zTreeObj.checkAllNodes

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    勾选 或 取消勾选 全部节点。[setting.check.enable = true 且 setting.check.chkStyle = "checkbox" 时有效]

                    +

                    此方法不会触发 beforeCheck / onCheck 事件回调函数。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    checkedBoolean

                    +

                    checked = true 表示勾选全部节点

                    +

                    checked = false 表示全部节点取消勾选

                    +

                    不会影响 treeNode.nochecked = true 的节点。

                    +

                    不会影响未加载的节点。

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 勾选全部节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.checkAllNodes(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.checkNode.html b/static/zTree3/api/cn/zTreeObj.checkNode.html new file mode 100644 index 0000000..cb8bb7d --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.checkNode.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(treeNode, checked, checkTypeFlag, callbackFlag)zTreeObj.checkNode

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    勾选 或 取消勾选 单个节点。[setting.check.enable = true 时有效]

                    +

                    v3.x 中 checkNode() 方法可以触发 beforeCheck / onCheck 事件回调函数。便于减少冗余代码

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要勾选 或 取消勾选 的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    checkedBoolean

                    +

                    checked = true 表示勾选节点

                    +

                    checked = false 表示节点取消勾选

                    +

                    省略此参数,则根据对此节点的勾选状态进行 toggle 切换

                    +

                    不影响 treeNode.nochecked = true 的节点。

                    +

                    checkTypeFlagBoolean

                    +

                    checkTypeFlag = true 表示按照 setting.check.chkboxType 属性进行父子节点的勾选联动操作

                    +

                    checkTypeFlag = false 表示只修改此节点勾选状态,无任何勾选联动操作

                    +

                    checkTypeFlag = false 且 treeNode.checked = checked 时,不会触发回调函数,直接返回

                    +

                    不影响父子节点中 treeNode.nochecked = true 的节点。

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true 表示执行此方法时触发 beforeCheck & onCheck 事件回调函数

                    +

                    callbackFlag = false 表示执行此方法时不触发事件回调函数

                    +

                    省略此参数,等同于 false

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 勾选当前选中的节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.checkNode(nodes[i], true, true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.copyNode.html b/static/zTree3/api/cn/zTreeObj.copyNode.html new file mode 100644 index 0000000..f1b624b --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.copyNode.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(targetNode, treeNode, moveType, isSilent)zTreeObj.copyNode

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    复制节点。

                    +

                    v3.x 复制节点时进行 clone 操作。如果需要获取数据在 zTree 内的对象,请获取此方法的返回值。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    targetNodeJSON

                    +

                    要复制到的目标节点 JSON 数据

                    +

                    如果复制成为根节点,请设置 targetNode 为 null 即可

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    treeNodeJSON

                    +

                    需要被复制的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    moveTypeString

                    +

                    复制到目标节点的相对位置

                    +

                    "inner":成为子节点,"prev":成为同级前一个节点,"next":成为同级后一个节点

                    +

                    isSilentBoolean

                    +

                    设定复制节点后是否自动展开父节点。

                    +

                    isSilent = true 时,不展开父节点,其他值或缺省状态都自动展开。

                    +

                    返回值JSON

                    +

                    返回值是最终加入到 zTree 内的节点数据

                    +

                    请务必记住:返回值中的数据对象 是 treeNode 被 clone 后的,所以绝对不相等!

                    +
                    +

                    function 举例

                    +

                    1. 将根节点中第二个节点 复制成为 第一个节点的子节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.copyNode(nodes[0], nodes[1], "inner");
                    +
                    +

                    2. 将根节点中第二个节点 复制成为 第一个节点的前一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.copyNode(nodes[0], nodes[1], "before");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.destroy.html b/static/zTree3/api/cn/zTreeObj.destroy.html new file mode 100644 index 0000000..d9f6da0 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.destroy.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Function(treeId)zTreeObj.destroy

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    从 zTree v3.4 开始提供销毁 zTree 的方法。

                    +

                    1、用此方法可以销毁 zTreeObj 代表的 zTree。

                    +

                    2、销毁当前页面全部的 zTree,也可以使用 $.fn.zTree.destroy() 方法。

                    +

                    3、重新使用已经被销毁的树,必须要使用 init 方法进行初始化。

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 销毁 id 为 "treeDemo" 的 zTree

                    +
                    var zTreeObj = $.fn.zTree.getZTreeObj("treeDemo");
                    +zTreeObj.destroy();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.editName.html b/static/zTree3/api/cn/zTreeObj.editName.html new file mode 100644 index 0000000..2d4eaf7 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.editName.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.editName

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    设置某节点进入编辑名称状态。

                    +

                    1、如果需要用 js 取消编辑名称状态,请使用 cancelEditName(newName) 方法。

                    +

                    2、可利用此方法让当前正编辑的节点 input 输入框获取焦点。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    指定进入编辑名称状态的节点 JSON 数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 设置根节点第一个节点进入编辑名称状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.editName(nodes[0]);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.expandAll.html b/static/zTree3/api/cn/zTreeObj.expandAll.html new file mode 100644 index 0000000..aaa3e46 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.expandAll.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(expandFlag)zTreeObj.expandAll

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    展开 / 折叠 全部节点

                    +

                    此方法不会触发 beforeExpand / onExpand 和 beforeCollapse / onCollapse 事件回调函数。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    expandFlagBoolean

                    +

                    expandFlag = true 表示 展开 全部节点

                    +

                    expandFlag = false 表示 折叠 全部节点

                    +

                    返回值Boolean

                    +

                    返回值表示最终实际操作情况

                    +

                    true 表示 展开 全部节点

                    +

                    false 表示 折叠 全部节点

                    +

                    null 表示 不存在任何父节点

                    +
                    +

                    function 举例

                    +

                    1. 展开全部节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.expandAll(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.expandNode.html b/static/zTree3/api/cn/zTreeObj.expandNode.html new file mode 100644 index 0000000..5d96d3f --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.expandNode.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    Function(treeNode, expandFlag, sonSign, focus, callbackFlag)zTreeObj.expandNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    展开 / 折叠 指定的节点

                    +

                    v3.x 中执行此方法可以触发 beforeExpand / onExpand 或 beforeCollapse / onCollapse 事件回调函数。便于减少冗余代码

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要 展开 / 折叠 的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    expandFlagBoolean

                    +

                    expandFlag = true 表示 展开 节点

                    +

                    expandFlag = false 表示 折叠 节点

                    +

                    省略此参数,则根据对此节点的展开状态进行 toggle 切换

                    +

                    sonSignBoolean

                    +

                    sonSign = true 表示 全部子孙节点 进行与 expandFlag 相同的操作

                    +

                    sonSign = false 表示 只影响此节点,对于其 子孙节点无任何影响

                    +

                    sonSign = false 且 treeNode.open = expandFlag 时,不会触发回调函数,直接返回

                    +

                    省略此参数,等同于 false

                    +

                    focusBoolean

                    +

                    focus = true 表示 展开 / 折叠 操作后,通过设置焦点保证此焦点进入可视区域内

                    +

                    focus = false 表示 展开 / 折叠 操作后,不设置任何焦点

                    +

                    省略此参数,等同于 true

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true 表示执行此方法时触发 beforeExpand / onExpand 或 beforeCollapse / onCollapse 事件回调函数

                    +

                    callbackFlag = false 表示执行此方法时不触发事件回调函数

                    +

                    省略此参数,等同于 false

                    +

                    返回值Boolean

                    +

                    返回值表示最终实际操作情况

                    +

                    true 表示 展开 节点

                    +

                    false 表示 折叠 节点

                    +

                    null 表示 不是父节点

                    +
                    +

                    function 举例

                    +

                    1. 展开当前选择的第一个节点(包括其全部子节点)

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	treeObj.expandNode(nodes[0], true, true, true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getChangeCheckedNodes.html b/static/zTree3/api/cn/zTreeObj.getChangeCheckedNodes.html new file mode 100644 index 0000000..ba86534 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getChangeCheckedNodes.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Function()zTreeObj.getChangeCheckedNodes

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    获取输入框勾选状态被改变的节点集合(与原始数据 checkedOld 对比)。[setting.check.enable = true 时有效]

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值Array(JSON)

                    +

                    返回全部勾选状态被改变的节点集合 Array

                    +

                    如果需要获取每次操作后全部被改变勾选状态的节点数据,请在每次勾选操作后,遍历所有被改变勾选状态的节点数据,让其 checkedOld = checked 就可以了。

                    +
                    +

                    function 举例

                    +

                    1. 获取当前勾选状态被改变的节点集合

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getChangeCheckedNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getCheckedNodes.html b/static/zTree3/api/cn/zTreeObj.getCheckedNodes.html new file mode 100644 index 0000000..85f4ba0 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getCheckedNodes.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Function(checked)zTreeObj.getCheckedNodes

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    获取输入框被勾选 或 未勾选的节点集合。[setting.check.enable = true 时有效]

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    checkedBoolean

                    +

                    checked = true 表示获取 被勾选 的节点集合

                    +

                    checked = false 表示获取 未勾选 的节点集合

                    +

                    省略此参数,等同于 true。

                    +

                    对于 treeNode.nochecked = true 的节点不进行获取。

                    +

                    返回值Array(JSON)

                    +

                    返回全部符合要求的节点集合 Array

                    +
                    +

                    function 举例

                    +

                    1. 获取当前被勾选的节点集合

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getCheckedNodes(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodeByParam.html b/static/zTree3/api/cn/zTreeObj.getNodeByParam.html new file mode 100644 index 0000000..89e72c7 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodeByParam.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodeByParam

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    根据节点数据的属性搜索,获取条件完全匹配的节点数据 JSON 对象

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    keyString

                    +

                    需要精确匹配的属性名称

                    +

                    value?

                    +

                    需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可

                    +

                    parentNodeJSON

                    +

                    搜索范围,指定在某个父节点下的子节点中进行搜索

                    +

                    忽略此参数,表示在全部节点中搜索

                    +

                    返回值JSON

                    +

                    匹配精确搜索的节点数据

                    +

                    1、如无结果,返回 null

                    +

                    2、如有多个节点满足查询条件,只返回第一个匹配到的节点

                    +
                    +

                    function 举例

                    +

                    1. 查找 id = 1 的节点数据

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByParam("id", 1, null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodeByTId.html b/static/zTree3/api/cn/zTreeObj.getNodeByTId.html new file mode 100644 index 0000000..76fcc48 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodeByTId.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(tId)zTreeObj.getNodeByTId

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    根据 zTree 的唯一标识 tId 快速获取节点 JSON 数据对象

                    +

                    通过内部的 cache 获取,不需要遍历节点。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    tIdString

                    +

                    节点在 zTree 内的唯一标识 tId

                    +

                    返回值JSON

                    +

                    tId 对应的节点 JSON 数据对象

                    +

                    如无结果,返回 null

                    +
                    +

                    function 举例

                    +

                    1. 获取 tId = "tree_10" 的节点数据

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByTId("tree_10");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodeIndex.html b/static/zTree3/api/cn/zTreeObj.getNodeIndex.html new file mode 100644 index 0000000..b2c757d --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodeIndex.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.getNodeIndex

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取某节点在同级节点中的序号(从0开始)

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要查询顺序的节点 JSON 数据对象

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值Number

                    +

                    返回值从 0 开始计数

                    +

                    如果不存在该节点数据,返回 -1

                    +
                    +

                    function 举例

                    +

                    1. 获取当前选中的第一个节点在同级节点中的序号

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	var index = treeObj.getNodeIndex(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodes.html b/static/zTree3/api/cn/zTreeObj.getNodes.html new file mode 100644 index 0000000..b368535 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodes.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()zTreeObj.getNodes

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取 zTree 的全部节点数据

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值Array(JSON)

                    +

                    全部节点数据

                    +

                    1、Array 仅仅是根节点的集合(默认情况子节点都处于 children 属性下);

                    +

                    2、如需遍历全部节点需要利用递归,或利用 transformToArray 方法 将数据变成简单的 Array 集合

                    +

                    3、对于异步加载模式下,尚未加载的子节点是无法通过此方法获取的。

                    +
                    +

                    function 举例

                    +

                    1. 获取全部节点数据

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodesByFilter.html b/static/zTree3/api/cn/zTreeObj.getNodesByFilter.html new file mode 100644 index 0000000..6917425 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodesByFilter.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    Function(filter, isSingle, parentNode, invokeParam)zTreeObj.getNodesByFilter

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    根据自定义规则搜索节点数据 JSON 对象集合 或 单个节点数据

                    +

                    可自定义复杂的搜索规则

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    filterFunction

                    +

                    自定义过滤器函数 function filter(node) {...}

                    +

                    filter 参数:node (节点数据 JSON)

                    +

                    filter 返回值:boolean (true 表示符合搜索条件;false 表示不符合搜索条件)

                    +

                    isSingleBoolean

                    +

                    isSingle = true 表示只查找单个节点

                    +

                    isSingle = false 表示查找节点集合

                    +

                    忽略此参数,表示查找节点集合

                    +

                    parentNodeJSON

                    +

                    可以指定在某个父节点下的子节点中搜索

                    +

                    忽略此参数,表示在全部节点中搜索

                    +

                    invokeParam任意类型

                    +

                    用户自定义的数据对象,用于 filter 中进行计算

                    +

                    返回值Array(JSON) / JSON

                    +

                    isSingle = true 返回 第一个找到的节点数据 JSON,无结果时返回 null

                    +

                    isSingle = false 返回 节点数据集合 Array(JSON),无结果时返回 [ ]

                    +
                    +

                    function 举例

                    +

                    1. 查找 level = 2 & name 中包含 "test" 的节点数据

                    +
                    function filter(node) {
                    +    return (node.level == 2 && node.name.indexOf("test")>-1);
                    +}
                    +......
                    +var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodesByFilter(filter, true); // 仅查找一个节点
                    +var nodes = treeObj.getNodesByFilter(filter); // 查找节点集合
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodesByParam.html b/static/zTree3/api/cn/zTreeObj.getNodesByParam.html new file mode 100644 index 0000000..cf45939 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodesByParam.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodesByParam

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    根据节点数据的属性搜索,获取条件完全匹配的节点数据 JSON 对象集合

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    keyString

                    +

                    需要精确匹配的属性名称

                    +

                    value?

                    +

                    需要精确匹配的属性值,可以是任何类型,只要保证与 key 指定的属性值保持一致即可

                    +

                    parentNodeJSON

                    +

                    可以指定在某个父节点下的子节点中搜索

                    +

                    忽略此参数,表示在全部节点中搜索

                    +

                    返回值Array(JSON)

                    +

                    匹配精确搜索的节点数据集合

                    +

                    如无结果,返回 [ ]

                    +
                    +

                    function 举例

                    +

                    1. 查找 name = "test" 的节点数据

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParam("name", "test", null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getNodesByParamFuzzy.html b/static/zTree3/api/cn/zTreeObj.getNodesByParamFuzzy.html new file mode 100644 index 0000000..04d183f --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getNodesByParamFuzzy.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodesByParamFuzzy

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    根据节点数据的属性搜索,获取条件模糊匹配的节点数据 JSON 对象集合

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    keyString

                    +

                    需要模糊匹配的属性名称

                    +

                    valueString

                    +

                    需要模糊匹配的属性值

                    +

                    模糊匹配只能针对 String 类型的数据

                    +

                    parentNodeJSON

                    +

                    可以指定在某个父节点下的子节点中搜索

                    +

                    忽略此参数,表示在全部节点中搜索

                    +

                    返回值Array(JSON)

                    +

                    匹配模糊搜索的节点数据集合

                    +

                    如无结果,返回 [ ]

                    +
                    +

                    function 举例

                    +

                    1. 查找 name 包含 "test" 的节点数据

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParamFuzzy("name", "test", null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.getSelectedNodes.html b/static/zTree3/api/cn/zTreeObj.getSelectedNodes.html new file mode 100644 index 0000000..ab36f8e --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.getSelectedNodes.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Function()zTreeObj.getSelectedNodes

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    获取 zTree 当前被选中的节点数据集合

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值Array(JSON)

                    +

                    当前被选中的节点数据集合

                    +
                    +

                    function 举例

                    +

                    1. 获取当前被选中的节点数据集合

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.hideNode.html b/static/zTree3/api/cn/zTreeObj.hideNode.html new file mode 100644 index 0000000..a1996b8 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.hideNode.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.hideNode

                    +

                    概述[ 依赖 jquery.ztree.exhide 扩展 js ]

                    +
                    +

                    +
                    +

                    隐藏某个节点。

                    +

                    1、此功能不支持 exedit 扩展,因此不要在编辑状态时使用隐藏节点的方法。

                    +

                    2、隐藏/显示节点,会影响节点的 isFirstNode 和 isLastNode 属性。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    指定被隐藏的节点 JSON 数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 隐藏根节点第一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.hideNode(nodes[0]);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.hideNodes.html b/static/zTree3/api/cn/zTreeObj.hideNodes.html new file mode 100644 index 0000000..cf752b5 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.hideNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.hideNodes

                    +

                    概述[ 依赖 jquery.ztree.exhide 扩展 js ]

                    +
                    +

                    +
                    +

                    隐藏一批节点。

                    +

                    1、此功能不支持 exedit 扩展,因此不要在编辑状态时使用隐藏节点的方法。

                    +

                    2、隐藏/显示节点,会影响节点的 isFirstNode 和 isLastNode 属性。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodesArray(JSON)

                    +

                    指定被隐藏的节点 JSON 数据集合

                    +

                    请务必保证这些节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 隐藏根节点第一个节点的子节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.hideNodes(nodes[0].children);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.moveNode.html b/static/zTree3/api/cn/zTreeObj.moveNode.html new file mode 100644 index 0000000..9c9180b --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.moveNode.html @@ -0,0 +1,46 @@ +
                    +
                    +

                    Function(targetNode, treeNode, moveType, isSilent)zTreeObj.moveNode

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    移动节点。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    targetNodeJSON

                    +

                    要移动到的目标节点 JSON 数据

                    +

                    如果移动成为根节点,请设置 targetNode 为 null 即可

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    treeNodeJSON

                    +

                    需要被移动的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    moveTypeString

                    +

                    指定移动到目标节点的相对位置

                    +

                    "inner":成为子节点,"prev":成为同级前一个节点,"next":成为同级后一个节点

                    +

                    isSilentBoolean

                    +

                    设定移动节点后是否自动展开父节点。

                    +

                    isSilent = true 时,不展开父节点,其他值或缺省状态都自动展开。

                    +

                    返回值JSON

                    +

                    返回值是最终被移动的节点数据,正常情况下与 treeNode 参数完全相同

                    +

                    如果 返回值 为 null,说明 移动失败,主要原因有:
                    +  1、targetNode 是 treeNode 父节点,且 moveType = "inner"
                    +  2、targetNode 是 treeNode 子孙节点 +

                    +
                    +

                    function 举例

                    +

                    1. 将根节点中第二个节点 移动成为 第一个节点的子节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.moveNode(nodes[0], nodes[1], "inner");
                    +
                    +

                    2. 将根节点中第二个节点 移动成为 第一个节点的前一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.moveNode(nodes[0], nodes[1], "prev");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.reAsyncChildNodes.html b/static/zTree3/api/cn/zTreeObj.reAsyncChildNodes.html new file mode 100644 index 0000000..4a354e2 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.reAsyncChildNodes.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    Function(parentNode, reloadType, isSilent)zTreeObj.reAsyncChildNodes

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    强行异步加载父节点的子节点。[setting.async.enable = true 时有效]

                    +

                    已经加载过的父节点可反复使用此方法重新加载。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    parentNodeJSON

                    +

                    指定需要异步加载的父节点 JSON 数据

                    +

                    1、parentNode = null 时,相当于从根节点 Root 进行异步加载

                    +

                    2、parentNode.isParent = false 时,不进行异步加载

                    +

                    3、请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    reloadTypeString

                    +

                    reloadType = "refresh" 表示清空后重新加载。

                    +

                    reloadType != "refresh" 时,表示追加子节点处理。

                    +

                    isSilentBoolean

                    +

                    设定异步加载后是否自动展开父节点。

                    +

                    isSilent = true 时,不展开父节点,其他值或缺省状态都自动展开。

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 重新异步加载 zTree

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.reAsyncChildNodes(null, "refresh");
                    +
                    +

                    2. 重新异步加载当前选中的第一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	treeObj.reAsyncChildNodes(nodes[0], "refresh");
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.refresh.html b/static/zTree3/api/cn/zTreeObj.refresh.html new file mode 100644 index 0000000..09a74ca --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.refresh.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Function()zTreeObj.refresh

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    刷新 zTree 。

                    +

                    没有特殊必要,尽量不要使用此方法。单个节点更新请使用 updateNode 方法,异步加载模式下请使用 reAsyncChildNodes 方法。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 刷新 zTree

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.refresh();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.removeChildNodes.html b/static/zTree3/api/cn/zTreeObj.removeChildNodes.html new file mode 100644 index 0000000..588639f --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.removeChildNodes.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(parentNode)zTreeObj.removeChildNodes

                    +

                    概述[ 依赖 jquery.ztree.core 扩展 js ]

                    +
                    +

                    +
                    +

                    清空某父节点的子节点。

                    +

                    1、清空子节点后,父节点会自动变为叶子节点,如需要父节点保持父节点状态,请设置 setting.data.keep.parent 属性。

                    +

                    2、请勿用此方法清空根节点,如果需要清空根节点,直接初始化 zTree,并且设置初始节点为 null 即可。

                    +

                    3、此方法不会触发任何事件回调函数。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    parentNodeJSON

                    +

                    需要清空子节点的父节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值Array(JSON)

                    +

                    将该父节点的子节点数据返回,如果不存在则返回 null

                    +
                    +

                    function 举例

                    +

                    1. 清空选中的第一个节点的子节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes && nodes.length>0) {
                    +	treeObj.removeChildNodes(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.removeNode.html b/static/zTree3/api/cn/zTreeObj.removeNode.html new file mode 100644 index 0000000..442f5c7 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.removeNode.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeNode, callbackFlag)zTreeObj.removeNode

                    +

                    概述[ 依赖 jquery.ztree.core 扩展 js ]

                    +
                    +

                    +
                    +

                    删除节点。

                    +

                    v3.x 中删除节点可以触发 beforeRemove / onRemove 事件回调函数。便于减少冗余代码

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要被删除的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true 表示执行此方法时触发 beforeRemove & onRemove 事件回调函数

                    +

                    callbackFlag = false 表示执行此方法时不触发事件回调函数

                    +

                    省略此参数,等同于 false

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 删除所有选中的节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.removeNode(nodes[i]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.selectNode.html b/static/zTree3/api/cn/zTreeObj.selectNode.html new file mode 100644 index 0000000..8d074c4 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.selectNode.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Function(treeNode, addFlag, isSilent)zTreeObj.selectNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    选中指定节点

                    +

                    v3.x 支持同时选中多个节点。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要被选中的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    addFlagBoolean

                    +

                    addFlag = true 表示追加选中,会出现多点同时被选中的情况

                    +

                    addFlag = false (默认)表示单独选中,原先被选中的节点会被取消选中状态

                    +

                    setting.view.selectedMulti = false 时,此参数无效,始终进行单独选中

                    +

                    isSilentBoolean

                    +

                    isSilent = true 选中节点时,不会让节点自动滚到到可视区域内

                    +

                    isSilent = false (默认)表示选中节点时,会让节点自动滚到到可视区域内

                    +

                    (v3.5.23+)

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 单独选中根节点中第一个节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +if (nodes.length>0) {
                    +	treeObj.selectNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.setChkDisabled.html b/static/zTree3/api/cn/zTreeObj.setChkDisabled.html new file mode 100644 index 0000000..b042ab4 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.setChkDisabled.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(node, disabled, inheritParent, inheritChildren)zTreeObj.setChkDisabled

                    +

                    概述[ 依赖 jquery.ztree.excheck 扩展 js ]

                    +
                    +

                    +
                    +

                    禁用 或 解禁 某个节点的 checkbox / radio [setting.check.enable = true 时有效]

                    +

                    1、节点的 checkbox / radio 被禁用后,无法勾选或取消勾选,但能够影响父节点的半选状态

                    +

                    2、请不要直接修改已加载节点的 treeNode.chkDisabled 属性。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    需要禁用 或 解禁 checkbox / radio 的节点数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    disabledBoolean

                    +

                    disabled = true 表示禁用 checkbox / radio

                    +

                    disabled = false 表示解禁 checkbox / radio

                    +

                    省略此参数,等同于 disabled = false

                    +

                    不影响 treeNode.nochecked = true 的节点。

                    +

                    inheritParentBoolean

                    +

                    inheritParent = true 表示全部父节点进行同样的操作

                    +

                    inheritParent = false 表示不影响父节点

                    +

                    省略此参数,等同于 inheritParent = false

                    +

                    inheritChildrenBoolean

                    +

                    inheritChildren = true 表示全部子节点进行同样的操作

                    +

                    inheritChildren = false 表示不影响子节点

                    +

                    省略此参数,等同于 inheritChildren = false

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 禁用当前选中的节点的 checkbox / radio

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.setChkDisabled(nodes[i], true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.setEditable.html b/static/zTree3/api/cn/zTreeObj.setEditable.html new file mode 100644 index 0000000..c90c8de --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.setEditable.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(editable)zTreeObj.setEditable

                    +

                    概述[ 依赖 jquery.ztree.exedit 扩展 js ]

                    +
                    +

                    +
                    +

                    设置 zTree 进入 / 取消 编辑状态。

                    +

                    对于编辑状态的各种功能需要提前设置对应 setting 中的不同属性

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    editableBoolean

                    +

                    true 表示进入 编辑状态

                    +

                    false 表示取消 编辑状态

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 设置 zTree 进入编辑状态

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.setEditable(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.setting.html b/static/zTree3/api/cn/zTreeObj.setting.html new file mode 100644 index 0000000..61abd53 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.setting.html @@ -0,0 +1,13 @@ +
                    +
                    +

                    JSONzTreeObj.setting

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    zTree 对象使用的 setting 配置数据,详细请参考 “setting 配置详解”中的各个属性详细说明

                    +

                    v3.x 取消了原先操作 setting 的方法,让用户可以较自由的修改参数,但请注意,对于 zTree 初始化有影响的参数后期修改是不会起作用的,请对各个属性有较深入的了解以后再考虑进行修改。

                    +
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.showNode.html b/static/zTree3/api/cn/zTreeObj.showNode.html new file mode 100644 index 0000000..ed22d51 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.showNode.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.showNode

                    +

                    概述[ 依赖 jquery.ztree.exhide 扩展 js ]

                    +
                    +

                    +
                    +

                    显示某个被隐藏的节点。

                    +

                    1、此功能不支持 exedit 扩展,因此不要在编辑状态时使用隐藏节点的方法。

                    +

                    2、隐藏/显示节点,会影响节点的 isFirstNode 和 isLastNode 属性。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    指定被显示的节点 JSON 数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 显示某个隐藏的节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByParam("isHidden", true);
                    +if (node) {
                    +  treeObj.showNode(node);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.showNodes.html b/static/zTree3/api/cn/zTreeObj.showNodes.html new file mode 100644 index 0000000..b090657 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.showNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.showNodes

                    +

                    概述[ 依赖 jquery.ztree.exhide 扩展 js ]

                    +
                    +

                    +
                    +

                    显示一批已经被隐藏的节点。

                    +

                    1、此功能不支持 exedit 扩展,因此不要在编辑状态时使用隐藏节点的方法。

                    +

                    2、隐藏/显示节点,会影响节点的 isFirstNode 和 isLastNode 属性。

                    +

                    3、请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodesArray(JSON)

                    +

                    指定被显示的节点 JSON 数据集合

                    +

                    请务必保证这些节点数据对象 是 zTree 内部的数据对象

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 显示全部隐藏的节点

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParam("isHidden", true);
                    +treeObj.showNodes(nodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.transformToArray.html b/static/zTree3/api/cn/zTreeObj.transformToArray.html new file mode 100644 index 0000000..a46dc61 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.transformToArray.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.transformToArray

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    将 zTree 使用的标准 JSON 嵌套格式的数据转换为简单 Array 格式。(免去用户自行编写递归遍历全部节点的麻烦)

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodesArray(JSON) / JSON

                    +

                    需要被转换的 zTree 节点数据对象集合 或 某个单独节点的数据对象

                    +

                    返回值Array(JSON)

                    +

                    转换后的简单 Array 数据格式

                    +
                    +

                    function 举例

                    +

                    1. 将 zTree 节点数据转换为简单 Array 格式

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.transformToArray(treeObj.getNodes());
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.transformTozTreeNodes.html b/static/zTree3/api/cn/zTreeObj.transformTozTreeNodes.html new file mode 100644 index 0000000..4b02650 --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.transformTozTreeNodes.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    Function(simpleNodes)zTreeObj.transformTozTreeNodes

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    将简单 Array 格式数据转换为 zTree 使用的标准 JSON 嵌套数据格式。

                    +

                    使用此方法,请务必设置节点唯一标识属性名称 setting.data.simpleData.idKey 和 父节点唯一标识属性名称 setting.data.simpleData.pIdKey,并且让数据满足父子关系。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    simpleNodesArray(JSON) / JSON

                    +

                    需要被转换的简单 Array 格式数据 或 某个单独的数据对象

                    +

                    返回值Array(JSON)

                    +

                    zTree 使用的标准数据,子节点都存在于父节点数据的 children 属性中

                    +

                    如果 simpleNodes 是一个 JSON 对象,则被简单封装成长度为 1 的数组。

                    +
                    +

                    function 举例

                    +

                    1. 将简单 Array 格式转换为zTree使用的标准格式

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var simpleNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.transformTozTreeNodes(simpleNodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/cn/zTreeObj.updateNode.html b/static/zTree3/api/cn/zTreeObj.updateNode.html new file mode 100644 index 0000000..847fa6e --- /dev/null +++ b/static/zTree3/api/cn/zTreeObj.updateNode.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeNode, checkTypeFlag)zTreeObj.updateNode

                    +

                    概述[ 依赖 jquery.ztree.core 核心 js ]

                    +
                    +

                    +
                    +

                    更新某节点数据,主要用于该节点显示属性的更新。

                    +

                    1、可针对 name、target、 url、icon、 iconSkin、checked、nocheck 等这几个用于显示效果的参数进行更新,其他用于 zTreeNodes 的参数请不要随意更新,对于展开节点,还请调用 expandNode方法,因此请勿随意修改 open 属性。

                    +

                    2、用此方法修改 checked 勾选状态不会触发 beforeCheck / onCheck 事件回调函数。

                    +

                    请通过 zTree 对象执行此方法。

                    +
                    +
                    +

                    Function 参数说明

                    +
                    +

                    treeNodeJSON

                    +

                    指定需要更新的节点 JSON 数据

                    +

                    请务必保证此节点数据对象 是 zTree 内部的数据对象

                    +

                    checkTypeFlagBoolean

                    +

                    checkTypeFlag = true 表示按照 setting.check.chkboxType 属性进行父子节点的勾选联动操作

                    +

                    checkTypeFlag = false 表示只修改此节点勾选状态,无任何勾选联动操作

                    +

                    当 setting.check.enable = true 且 setting.check.chkStyle = "checkbox" 时才有效

                    +

                    不影响父子节点中 treeNode.nochecked = true 的节点。

                    +

                    返回值

                    +

                    目前无任何返回值

                    +
                    +

                    function 举例

                    +

                    1. 更新根节点中第一个节点的名称

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +if (nodes.length>0) {
                    +	nodes[0].name = "test";
                    +	treeObj.updateNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/fn.zTree._z.html b/static/zTree3/api/en/fn.zTree._z.html new file mode 100644 index 0000000..e2ae61d --- /dev/null +++ b/static/zTree3/api/en/fn.zTree._z.html @@ -0,0 +1,15 @@ +
                    +
                    +

                    JSON$.fn.zTree._z

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    All of the internal methods in zTree v3.x are available through '$. fn.zTree._z', + use this if you want to develop your own zTree plug-ins.

                    +

                    Unless you are writing a plugin, + you should not use this object.

                    +
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/fn.zTree.destroy.html b/static/zTree3/api/en/fn.zTree.destroy.html new file mode 100644 index 0000000..c53cb80 --- /dev/null +++ b/static/zTree3/api/en/fn.zTree.destroy.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeId)$.fn.zTree.destroy

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    From zTree v3.4, zTree provides a method for destruction.

                    +

                    1. This method can destroy a zTree by treeId, or destroy all zTree instances.

                    +

                    2. If you want to destroy a zTree, you can use the 'zTreeObj.destroy()' method.

                    +

                    3. If you want to re-use the tree which has been destroyed, + you must first re-initialise it with the 'init()' method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier

                    +

                    If this parameter is omitted, all zTree instances will be destroyed.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Destroy the zTree with id === 'treeDemo'

                    +
                    $.fn.zTree.destroy("treeDemo");
                    +

                    2. Destroy all zTree instances

                    +
                    $.fn.zTree.destroy();
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/fn.zTree.getZTreeObj.html b/static/zTree3/api/en/fn.zTree.getZTreeObj.html new file mode 100644 index 0000000..49dadaa --- /dev/null +++ b/static/zTree3/api/en/fn.zTree.getZTreeObj.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(treeId)$.fn.zTree.getZTreeObj

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    zTree v3.x provides this method to get zTree object from the tree's Id.

                    +

                    Please initialize zTree first, then you can use this method.

                    +

                    Users don't need to use a global variable to reference the zTree object, + as all of the callback methods will pass 'treeId' parameters, + and you can always call this method to get the zTree object.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier

                    +

                    Return JSON

                    +

                    zTree object

                    +

                    This is a reference to the zTree object.

                    +
                    +

                    Examples of function

                    +

                    1. Get the zTree object with id='tree'

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/fn.zTree.init.html b/static/zTree3/api/en/fn.zTree.init.html new file mode 100644 index 0000000..413056c --- /dev/null +++ b/static/zTree3/api/en/fn.zTree.init.html @@ -0,0 +1,81 @@ +
                    +
                    +

                    Function(obj, zSetting, zNodes)$.fn.zTree.init

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    This method is used to create a zTree.

                    +

                    1. The web page must use the W3C DTD. For example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                    +

                    2. Needs jquery-1.4.2.js or better.

                    +

                    3. Needs jquery-ztree.core-3.0.js or better. + If you are using edit mode or checkbox / radio mode, + make sure you load jquery-ztree.exedit-3.0.js and jquery-ztree.excheck-3.0.js.

                    +

                    4. Needs zTreeStyle.css and image files

                    +

                    5. If you plan to use custom icons, please refer to the Demo, + or see the help on iconSkin.

                    +

                    6. Note: You need to set zTree container's class name to "ztree". + If you need to change it, don't forget to modify the css file. + If you need other special styles, you can modify the css file.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    objectjQuery Object

                    +

                    DOM Container for zTree

                    +

                    zSettingJSON

                    +

                    zTree's configuration data, please refer to "setting details" in the API Document.

                    +

                    zNodesArray(JSON) / JSON

                    +

                    zTree's node data, please refer to "treeNode data details" in the API Document.

                    +

                    1. zTree v3.x support to add single node, that is, if only to add one node, + you can use JSON without using Array.

                    +

                    2. If you are planning on using asynchronous loading of root nodes, set it to null or [ ]

                    +

                    3. If you are using simple data mode, please refer to "setting.data.simpleData" in the API Document.

                    +

                    Return JSON

                    +

                    zTree object

                    +

                    This object can provide the methods of operate the zTree

                    +

                    You can use $.fn.zTree.getZTreeObj method at any time to obtain.

                    +
                    +

                    Examples of setting & function

                    +

                    1. create a simple tree

                    +
                    <!DOCTYPE html>
                    +<HTML>
                    + <HEAD>
                    +  <TITLE> ZTREE DEMO </TITLE>
                    +  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
                    +  <link rel="stylesheet" href="zTreeStyle/zTreeStyle.css" type="text/css">
                    +  <script type="text/javascript" src="jquery-1.4.2.js"></script>
                    +  <script type="text/javascript" src="jquery.ztree.core.js"></script>
                    +<!--
                    +  <script type="text/javascript" src="jquery.ztree.excheck.js"></script>
                    +  <script type="text/javascript" src="jquery.ztree.exedit.js"></script>
                    +-->
                    +  <SCRIPT type="text/javascript" >
                    +	var zTreeObj,
                    +	setting = {
                    +		view: {
                    +			selectedMulti: false
                    +		}
                    +	},
                    +	zTreeNodes = [
                    +		{"name":"Site Map", open:true, children: [
                    +			{ "name":"google", "url":"http://www.google.com", "target":"_blank"},
                    +			{ "name":"baidu", "url":"http://baidu.com", "target":"_blank"},
                    +			{ "name":"sina", "url":"http://www.sina.com.cn", "target":"_blank"}
                    +			]
                    +		}
                    +	];
                    +
                    +	$(document).ready(function(){
                    +		zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
                    +
                    +	});
                    +  </SCRIPT>
                    + </HEAD>
                    +
                    +<BODY>
                    +<ul id="tree" class="ztree" style="width:230px; overflow:auto;"></ul>
                    + </BODY>
                    +</HTML>
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.autoParam.html b/static/zTree3/api/en/setting.async.autoParam.html new file mode 100644 index 0000000..e187b16 --- /dev/null +++ b/static/zTree3/api/en/setting.async.autoParam.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    Array(String)setting.async.autoParam

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    During asynchronous loading, a request is sent to the server, which contains the identify of the parent node, + so it can retrieve the children. + This attribute is an array of strings, which is the identity parameter (or parameters). + It applies when [setting.async.enable = true]

                    +

                    Default:[ ]

                    +
                    +
                    +

                    Array(String) Format

                    +
                    +

                    1. Put the attribute name(s) of node to the array. For example: ["id", "name"]

                    +

                    2. You can rename the parameter name as sent to the server. For example: server only accepts "zId" -- ["id=zId"]

                    +
                    +

                    Examples of setting

                    +

                    1. set auto commit 'id' attribute

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id"]
                    +	}
                    +};
                    +If we have a parent node: {id:1, name:"test"}, When we are asynchronously loading this parent node's children, it will be submitted to the server with parameters: id=1
                    +......
                    +

                    2. set auto commit 'id' attribute, but the parameter name expected by the server is 'zId'

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id=zId"]
                    +	}
                    +};
                    +If we have a parent node: {id:1, name:"test"}, When we are asynchronously loading this parent node's children, it will be submitted to the server with parameters: zId=1
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.contentType.html b/static/zTree3/api/en/setting.async.contentType.html new file mode 100644 index 0000000..c9e1509 --- /dev/null +++ b/static/zTree3/api/en/setting.async.contentType.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Stringsetting.async.contentType

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    When Ajax sends data to the server, it uses this content-type. + It is used when [setting.async.enable = true]

                    +

                    Default:"application/x-www-form-urlencoded"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    contentType = "application/x-www-form-urlencoded", means: the sending data format is "form" format.

                    +

                    contentType = "application/json", means: the sending data format is "json" format. (for .Net)

                    +
                    +

                    Examples of setting

                    +

                    1. set the sending data format to "json" format.

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		contentType: "application/json",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.dataFilter.html b/static/zTree3/api/en/setting.async.dataFilter.html new file mode 100644 index 0000000..4347a08 --- /dev/null +++ b/static/zTree3/api/en/setting.async.dataFilter.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, parentNode, responseData)setting.async.dataFilter

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback function to pre-process Ajax return data. It is valid when [setting.async.enable = true]

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId

                    +

                    parentNodeJSON

                    +

                    Parent node's JSON data object

                    +

                    When asynchronously loading the root, the parentNode = null

                    +

                    responseDataArray(JSON) / JSON / String

                    +

                    Array (JSON) / JSON / String data objects

                    +

                    From v3.4, support XML strings.

                    +

                    Return Array(JSON) / JSON

                    +

                    The return value should be the JSON data structure which is supported by the zTree.

                    +

                    v3.x supports to load single node JSON data object.

                    +
                    +

                    Examples of setting & function

                    +

                    1. Modify the node name attributes returned by an Ajax request.

                    +
                    function ajaxDataFilter(treeId, parentNode, responseData) {
                    +    if (responseData) {
                    +      for(var i =0; i < responseData.length; i++) {
                    +        responseData[i].name += "_filter";
                    +      }
                    +    }
                    +    return responseData;
                    +};
                    +var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		dataFilter: ajaxDataFilter
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.dataType.html b/static/zTree3/api/en/setting.async.dataType.html new file mode 100644 index 0000000..41db300 --- /dev/null +++ b/static/zTree3/api/en/setting.async.dataType.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Stringsetting.async.dataType

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The data type of Ajax requests. It is valid when [setting.async.enable = true]

                    +

                    Default:"text"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    dataType = "text", There is probably no need to change this.

                    +

                    The 'dataType' in zTree and jQuery's ajax requests is same.

                    +
                    +

                    Examples of setting

                    +

                    1. Set the dataType which ajax retrieves to "text".

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		dataType: "text",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.enable.html b/static/zTree3/api/en/setting.async.enable.html new file mode 100644 index 0000000..c284476 --- /dev/null +++ b/static/zTree3/api/en/setting.async.enable.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Booleansetting.async.enable

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set zTree asynchronous loading mode on/off.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true - turn on asynchronous loading mode

                    +

                    false - turn off asynchronous loading mode

                    +

                    If set it is true, you must set other attributes in setting.async

                    +

                    If you don't pass the 'treeNodes' parameter when you initialize zTree, the root nodes will be retrieved using ajax.

                    +
                    +

                    Examples of setting

                    +

                    1. Turn on asynchronous loading mode

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.otherParam.html b/static/zTree3/api/en/setting.async.otherParam.html new file mode 100644 index 0000000..54ae95b --- /dev/null +++ b/static/zTree3/api/en/setting.async.otherParam.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Array(String) / JSONsetting.async.otherParam

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The query parameters of the Ajax request. (key - value) It is valid when [setting.async.enable = true]

                    +

                    Default: [ ]

                    +
                    +
                    +

                    Array(String) Format

                    +
                    +

                    Can be an empty array. e.g. [ ]. The array should contain key value pairs, e.g. [key, value]. (Either or [key] or [key, value, key] is wrong!!)

                    +
                    +

                    JSON Format

                    +
                    +

                    Use JSON hash data to set the key-value pairs. e.g. { key1:value1, key2:value2 }

                    +
                    +

                    Examples of setting

                    +

                    1. Using Array(String) Format

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		otherParam: ["id", "1", "name", "test"]
                    +	}
                    +};
                    +when zTree sends the ajax request, the query string will be like this: id=1&name=test
                    +

                    2. Using JSON data Format

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "http://host/getNode.php",
                    +		otherParam: { "id":"1", "name":"test"}
                    +	}
                    +};
                    +when zTree sends the ajax request, the query string will be like this: id=1&name=test
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.type.html b/static/zTree3/api/en/setting.async.type.html new file mode 100644 index 0000000..c67599a --- /dev/null +++ b/static/zTree3/api/en/setting.async.type.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Stringsetting.async.type

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Http request tyoe in ajax. It is valid when [setting.async.enable = true]

                    +

                    Default: "post"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    "post" - http request mode

                    +

                    "get" - http request mode

                    +

                    Both zTree and jQuery's this 'type' for ajax requests.

                    +
                    +

                    Examples of setting

                    +

                    1. Set http request mode is 'get'

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		type: "get",
                    +		url: "http://host/getNode.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.async.url.html b/static/zTree3/api/en/setting.async.url.html new file mode 100644 index 0000000..2384c08 --- /dev/null +++ b/static/zTree3/api/en/setting.async.url.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.async.url

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The URL to which the ajax request is sent. It is valid when [setting.async.enable = true]

                    +

                    Default: ""

                    +
                    +
                    +

                    String Format

                    +
                    +

                    A url string(e.g. "http://www.domain.com/cgi-bin/my-script.cgi"). Note: please check that the url can be loaded with a browser

                    +

                    Url can also take parameters, please note that they need to be urlencoded.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    Parent node's JSON data object

                    +

                    When asynchronously loading the root, the treeNode = null

                    +

                    Return String

                    +

                    Return value is same as 'String Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. set ajax url is "nodes.php"

                    +
                    var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: "nodes.php",
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +

                    2. set ajax url is "function"

                    +
                    function getAsyncUrl(treeId, treeNode) {
                    +    return treeNode.isParent ? "nodes1.php" : "nodes2.php";
                    +};
                    +var setting = {
                    +	async: {
                    +		enable: true,
                    +		url: getAsyncUrl,
                    +		autoParam: ["id", "name"]
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeAsync.html b/static/zTree3/api/en/setting.callback.beforeAsync.html new file mode 100644 index 0000000..55f52ee --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeAsync.html @@ -0,0 +1,36 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeAsync

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    This callback is made before zTree makes an ajax request, giving you an opportunity to decide if it should proceed or not. + Return false to prevent zTree from sending the ajax request.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the parent node

                    +

                    When asynchronously loading the root, treeNode = null

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If the function returns false, zTree will not send the ajax request, and will not trigger the 'onAsyncSuccess / onAsyncError' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. If the parent node's attribute 'id' is 1, don't send the ajax request.

                    +
                    function myBeforeCallBack(treeId, treeNode) {
                    +    return (treeNode.id !== 1);
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeAsync: myBeforeCallBack
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeCheck.html b/static/zTree3/api/en/setting.callback.beforeCheck.html new file mode 100644 index 0000000..b2d71e5 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeCheck.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeCheck

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Callback before checking or unchecking a node, A false return value from the callback will prevent any change in the checked state.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is checked or unchecked

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not change the checkbox state, and will not trigger the 'onCheck' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. This example returns false, preventing all checkboxes in the tree from toggling.

                    +
                    function myBeforeCheckCallBack(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeCheck: myBeforeCheckCallBack
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeClick.html b/static/zTree3/api/en/setting.callback.beforeClick.html new file mode 100644 index 0000000..250416b --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeClick.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Function(treeId, treeNode, clickFlag)setting.callback.beforeClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Before click callback, return false to prevent the 'onClick' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is clicked

                    +

                    clickFlagNumber

                    +

                    Node is selected or deselected state, please see table below for details

                    + + + + + + + + + + + + +
                    clickFlagselectedMultiautoCancelSelected
                    &&
                    event.ctrlKey / metaKey
                    isSelectedoperate for selected
                    1truefalsefalsenode is selected (single)
                    1truefalsetruenode is selected (single)
                    2truetruefalsenode is selected (multi)
                    0truetruetruenode is deselected
                    1falsefalsefalsenode is selected (single)
                    1falsefalsetruenode is selected (single)
                    1falsetruefalsenode is selected (single)
                    0falsetruetruenode is deselected
                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not change selected state, and will not trigger the 'onClick' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disabled to click the node

                    +
                    function myBeforeClick(treeId, treeNode, clickFlag) {
                    +    return (treeNode.id !== 1);
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeClick: myBeforeClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeCollapse.html b/static/zTree3/api/en/setting.callback.beforeCollapse.html new file mode 100644 index 0000000..950b728 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeCollapse.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeCollapse

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before collapse node, The return value controls the collapse node.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be collapsed

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not collapse node, and will not trigger the 'onCollapse' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disabled to collapse node which is expanded

                    +
                    function myBeforeCollapse(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeCollapse: myBeforeCollapse
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeDblClick.html b/static/zTree3/api/en/setting.callback.beforeDblClick.html new file mode 100644 index 0000000..3d4ead1 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeDblClick.html @@ -0,0 +1,36 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeDblClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Specify callback function, executed before the 'onDblClick' callback, The return value controls the 'onDblClick' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is double clicked

                    +

                    If the DOM which dblclicked isn't a node, it will return null.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, ztree will not trigger the 'onDblClick' callback, no effect on other operations.

                    +

                    This callback function does not affect the auto expand of the parent node , please refer to setting.view.dblClickExpand properties.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to trigger the 'onDblClick' callback

                    +
                    function myBeforeDblClick(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeDblClick: myBeforeDblClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeDrag.html b/static/zTree3/api/en/setting.callback.beforeDrag.html new file mode 100644 index 0000000..fca278d --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeDrag.html @@ -0,0 +1,39 @@ +
                    +
                    +

                    Function(treeId, treeNodes)setting.callback.beforeDrag

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before the drag node callback, The return value controls whether the drag node callback will execute.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the id of the containing tree.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes being dragged

                    +

                    v3.x allows the drag and drop of multiple sibling nodes, so this parameter's type is changed to Array(JSON).

                    +

                    If the selected nodes aren't sibling nodes, you can only drag one node.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will abort the drag and drop, and will not trigger the 'onDrag / beforeDrop / onDrop' sequence of callbacks.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable drag completely (by returning false)

                    +
                    function myBeforeDrag(treeId, treeNodes) {
                    +    return false;
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDrag: myBeforeDrag
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeDragOpen.html b/static/zTree3/api/en/setting.callback.beforeDragOpen.html new file mode 100644 index 0000000..d28bafe --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeDragOpen.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeDragOpen

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Callback executed before drag node to collapsed parent node, The return value controls the auto expand behaviour of the parent node.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the tree is what the treeNode(parent node) is belong to.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the parent node which will be auto expanded

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not auto expand parent node.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to auto expand parent node.

                    +
                    function myBeforeDragOpen(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDragOpen: myBeforeDragOpen
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeDrop.html b/static/zTree3/api/en/setting.callback.beforeDrop.html new file mode 100644 index 0000000..9b24475 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeDrop.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    Function(treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.beforeDrop

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before drag-drop of a node, The return value controls the execution of drag-drop callback.

                    +

                    Default: null

                    +

                    When a node is dropped, if the drop is not in a valid location, this callback will not be triggered, and will revert to the original position.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the id of the containing tree.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which has been dragged

                    +

                    The treeNodes which have been dragged, when copying nodes or moving nodes.

                    +

                    targetNodeJSON

                    +

                    JSON data object of the destination node on which treeNodes are being dropped.

                    +

                    If the treeNodes is the root node, the targetNode = null

                    +

                    moveTypeString

                    +

                    the relative position of move to the target node

                    +

                    "inner": will be child of targetNode

                    +

                    "prev": will be sibling node, and be in front of targetNode

                    +

                    "next": will be sibling node, and be behind targetNode

                    +

                    isCopyBoolean

                    +

                    the flag used to determine if the drop is to copy or move the node

                    +

                    true: copy node; false: move node

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will restore the dragged nodes, and will not trigger the 'onDrop' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to drag nodes to root

                    +
                    function myBeforeDrop(treeId, treeNodes, targetNode, moveType) {
                    +    return !(targetNode == null || (moveType != "inner" && !targetNode.parentTId));
                    +};
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeDrop: myBeforeDrop
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeEditName.html b/static/zTree3/api/en/setting.callback.beforeEditName.html new file mode 100644 index 0000000..a820080 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeEditName.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeEditName

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before click edit button, The return value controls the editing of the name.

                    +

                    This callback is fired when the edit button is clicked, to control the custom editing operation.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be edited.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, allow editing of the name.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable editing of any parent node's name

                    +
                    function myBeforeEditName(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeEditName: myBeforeEditName
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeExpand.html b/static/zTree3/api/en/setting.callback.beforeExpand.html new file mode 100644 index 0000000..8b0a6e7 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeExpand.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeExpand

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before expanding a node, The return value controls the expand node callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be expanded

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not expand node, and will not trigger the 'onExpand' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disables expanding of all nodes

                    +
                    function myBeforeExpand(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeExpand: myBeforeExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeMouseDown.html b/static/zTree3/api/en/setting.callback.beforeMouseDown.html new file mode 100644 index 0000000..d27f431 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeMouseDown.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeMouseDown

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Specify callback function, executed before the 'onMouseDown' callback, The return value controls the 'onMouseDown' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which mouse over

                    +

                    If the DOM which mouse over isn't a node, it will return null.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not trigger the 'onMouseDown' callback, no effect on other operations.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to trigger the 'onMouseDown' callback

                    +
                    function myBeforeMouseDown(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeMouseDown: myBeforeMouseDown
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeMouseUp.html b/static/zTree3/api/en/setting.callback.beforeMouseUp.html new file mode 100644 index 0000000..e7d10de --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeMouseUp.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeMouseUp

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Specify callback function, executed before the 'onMouseUp' callback, The return value controls the 'onMouseUp' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which mouse over

                    +

                    If the DOM which mouse over isn't a node, it will return null.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not trigger the 'onMouseUp' callback, no effect on other operations.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to trigger the 'onMouseUp' callback

                    +
                    function myBeforeMouseUp(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeMouseUp: myBeforeMouseUp
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeRemove.html b/static/zTree3/api/en/setting.callback.beforeRemove.html new file mode 100644 index 0000000..0e155d4 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeRemove.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeRemove

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before remove node, The return value controls the allow to remove node.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be removed.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, zTree will not remove node, and will not trigger the 'onRemove' callback.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to remove node

                    +
                    function myBeforeRemove(treeId, treeNode) {
                    +	return false;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeRemove: myBeforeRemove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeRename.html b/static/zTree3/api/en/setting.callback.beforeRename.html new file mode 100644 index 0000000..bfed144 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeRename.html @@ -0,0 +1,46 @@ +
                    +
                    +

                    Function(treeId, treeNode, newName, isCancel)setting.callback.beforeRename

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Specify callback function to be called before rename(when input DOM blur or press Enter Key), The return value controls the allow to rename node.

                    +

                    When node is editing name, press the ESC key to restore the original name and stop edit name.

                    +

                    From v3.5.13, zTree will trigger this callback when user cancel edit name. please see 'isCancel' parameter.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be rename.

                    +

                    newNameString

                    +

                    the new name

                    +

                    isCancelBoolean

                    +

                    the status about cancel edit name (v3.5.13+)

                    +

                    isCancel = true means: user cancel edit name. (press ESC or use cancelEditName() function)

                    +

                    isCancel = false means: user submit edit name.

                    +

                    Return Boolean

                    +

                    return true or false

                    +

                    If return false, the treeNode will keep the editing name, don't trigger the 'onRename' callback, and will ignore other enents, until the callback return true.

                    +

                    If returns false, zTree will not set the input box to get focus to avoid the warning message which led to repeated triggering ‘beforeRename’ callback. Please use editName() method to set the input box to get focus when user close the warning message.

                    +
                    +

                    Examples of setting & function

                    +

                    1. the length of the new name can't less than 5

                    +
                    function myBeforeRename(treeId, treeNode, newName, isCancel) {
                    +	return newName.length > 5;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true
                    +	},
                    +	callback: {
                    +		beforeRename: myBeforeRename
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.beforeRightClick.html b/static/zTree3/api/en/setting.callback.beforeRightClick.html new file mode 100644 index 0000000..9d05a0b --- /dev/null +++ b/static/zTree3/api/en/setting.callback.beforeRightClick.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.callback.beforeRightClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to capture the right click event before the 'onRightClick' callback, The return value controls the 'onRightClick' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is mouse right clicked

                    +

                    If the DOM which mouse right clicked isn't a node, it will return null.

                    +

                    ReturnBoolean

                    +

                    return true or false

                    +

                    If return false, ztree will not trigger the 'onRightClick' callback, no effect on other operations.

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to trigger the 'onRightClick' callback

                    +
                    function myBeforeRightClick(treeId, treeNode) {
                    +    return false;
                    +};
                    +var setting = {
                    +	callback: {
                    +		beforeRightClick: myBeforeRightClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onAsyncError.html b/static/zTree3/api/en/setting.callback.onAsyncError.html new file mode 100644 index 0000000..239f3ff --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onAsyncError.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    setting.callback.onAsyncError

                    +

                    Function(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) 

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to capture the error event when execute ajax.

                    +

                    If you set 'setting.callback.beforeAsync',and return false, zTree will not execute ajax, and will not trigger the 'onAsyncSuccess / onAsyncError' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the parent node

                    +

                    When load root nodes, treeNode = null

                    +

                    XMLHttpRequestString

                    +

                    XMLHttpRequest Object, please refer to JQuery API documentation.

                    +

                    textStatusString

                    +

                    a string categorizing the status of the request("success", "error"...), please refer to JQuery API documentation.

                    +

                    errorThrownString

                    +

                    eWhen an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, please refer to JQuery API documentation.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When execute ajax make error, alert message.

                    +
                    function myOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
                    +    alert(XMLHttpRequest);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onAsyncError: myOnAsyncError
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onAsyncSuccess.html b/static/zTree3/api/en/setting.callback.onAsyncSuccess.html new file mode 100644 index 0000000..b8deca5 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onAsyncSuccess.html @@ -0,0 +1,38 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, msg)setting.callback.onAsyncSuccess

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to capture the complete success event when execute ajax.

                    +

                    If you set 'setting.callback.beforeAsync',and return false, zTree will not execute ajax, and will not trigger the 'onAsyncSuccess / onAsyncError' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the parent node

                    +

                    When load root nodes, treeNode = null

                    +

                    msgString / Object

                    +

                    The actualnode data which got by ajax. User-friendly debugging.

                    +

                    The actual data's type of msg is affected by 'setting.async.dataType', please refer to JQuery API documentation.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When execute ajax complete success, alert message.

                    +
                    function myOnAsyncSuccess(event, treeId, treeNode, msg) {
                    +    alert(msg);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onAsyncSuccess: myOnAsyncSuccess
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onCheck.html b/static/zTree3/api/en/setting.callback.onCheck.html new file mode 100644 index 0000000..eadfadc --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onCheck.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onCheck

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Used to capture the check or uncheck event when check or uncheck the checkbox and radio.

                    +

                    If you set 'setting.callback.beforeCheck',and return false, zTree will not change check state, and will not trigger the 'onCheck' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is checked or unchecked

                    +
                    +

                    Examples of setting & function

                    +

                    1. When check or uncheck the checkbox and radio, alert info about 'tId' and 'name' and 'checked'.

                    +
                    function myOnCheck(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name + "," + treeNode.checked);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onCheck: myOnCheck
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onClick.html b/static/zTree3/api/en/setting.callback.onClick.html new file mode 100644 index 0000000..537dbe0 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onClick.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, clickFlag)setting.callback.onClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to capture the click event when click node.

                    +

                    If you set 'setting.callback.beforeClick',and return false, zTree will not change selected state, and will not trigger the 'onClick' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is clicked

                    +

                    clickFlagNumber

                    +

                    Node is selected or deselected state, please see table below for details

                    + + + + + + + + + + + + +
                    clickFlagselectedMultiautoCancelSelected
                    &&
                    event.ctrlKey / metaKey
                    isSelectedoperate for selected
                    1truefalsefalsenode is selected (single)
                    1truefalsetruenode is selected (single)
                    2truetruefalsenode is selected (multi)
                    0truetruetruenode is deselected
                    1falsefalsefalsenode is selected (single)
                    1falsefalsetruenode is selected (single)
                    1falsetruefalsenode is selected (single)
                    0falsetruetruenode is deselected
                    +
                    +

                    Examples of setting & function

                    +

                    1. When click node, alert info about 'tId' and 'name'.

                    +
                    function myOnClick(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onClick: myOnClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onCollapse.html b/static/zTree3/api/en/setting.callback.onCollapse.html new file mode 100644 index 0000000..d62f3fe --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onCollapse.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onCollapse

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for collapse node.

                    +

                    If you set 'setting.callback.beforeCollapse',and return false, zTree will not collapse node, and will not trigger the 'onCollapse' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be collapsed

                    +
                    +

                    Examples of setting & function

                    +

                    1. When collapse node, alert info about 'tId' and 'name'.

                    +
                    function myOnCollapse(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onCollapse: myOnCollapse
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onDblClick.html b/static/zTree3/api/en/setting.callback.onDblClick.html new file mode 100644 index 0000000..d59602c --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onDblClick.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onDblClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to capture the dblclick event when double click node.

                    +

                    If you set 'setting.callback.beforeDblClick',and return false, zTree will not trigger the 'onDblClick' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is double clicked

                    +

                    If the DOM which dblclicked isn't a node, it will return null.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When double click node, alert info about 'tId' and 'name'.

                    +
                    function myOnDblClick(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDblClick: myOnDblClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onDrag.html b/static/zTree3/api/en/setting.callback.onDrag.html new file mode 100644 index 0000000..7c975bc --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onDrag.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes)setting.callback.onDrag

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to capture the drag event when drag node.

                    +

                    If you set 'setting.callback.beforeDrag',and return false, zTree will stop drag, and will not trigger the 'onDragMove' & 'onDrag' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the id of the containing tree.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which will be dragged

                    +
                    +

                    Examples of setting & function

                    +

                    1. When drag nodes, alert the number of dragged nodes.

                    +
                    function myOnDrag(event, treeId, treeNodes) {
                    +    alert(treeNodes.length);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDrag: myOnDrag
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onDragMove.html b/static/zTree3/api/en/setting.callback.onDragMove.html new file mode 100644 index 0000000..b8596b9 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onDragMove.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes)setting.callback.onDragMove

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to capture the drag-move event when drag & drop node.

                    +

                    Mainly used to capture the DOM which the nodes was drag in.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the id of the containing tree.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which will be dragged

                    +
                    +

                    Examples of setting & function

                    +

                    1. When drag nodes, output the target dom.

                    +
                    function myOnDragMove(event, treeId, treeNodes) {
                    +	console.log(event.target);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDragMove: myOnDragMove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onDrop.html b/static/zTree3/api/en/setting.callback.onDrop.html new file mode 100644 index 0000000..475526d --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onDrop.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    Function(event, treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.onDrop

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to capture the drop event when drag-drop node.

                    +

                    If you set 'setting.callback.beforeDrop',and return false, zTree will restore the dragged nodes, and will not trigger the 'onDrop' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId, the id of the containing tree.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which has been dragged

                    +

                    The treeNodes are the data of the nodes which be dragged, when move nodes.

                    +

                    The treeNodes are the clone data of the nodes which be dragged, when copy nodes.

                    +

                    targetNodeJSON

                    +

                    JSON data object of the target node which treeNodes are drag-dropped.

                    +

                    If the treeNodes will be root node, the targetNode = null

                    +

                    moveTypeString

                    +

                    the relative position of move to the target node

                    +

                    "inner": will be child of targetNode

                    +

                    "prev": will be sibling node, and be in front of targetNode

                    +

                    "next": will be sibling node, and be behind targetNode

                    +

                    If moveType is null, means drag & drop is cancel.

                    +

                    isCopyBoolean

                    +

                    the flag used to judge copy node or move node

                    +

                    true: copy node; false: move node

                    +
                    +

                    Examples of setting & function

                    +

                    1. When drag-drop nodes complete, alert the number of dragged nodes and info about targetNode.

                    +
                    function myOnDrop(event, treeId, treeNodes, targetNode, moveType) {
                    +    alert(treeNodes.length + "," + (targetNode ? (targetNode.tId + ", " + targetNode.name) : "isRoot" ));
                    +};
                    +var setting = {
                    +	callback: {
                    +		onDrop: myOnDrop
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onExpand.html b/static/zTree3/api/en/setting.callback.onExpand.html new file mode 100644 index 0000000..70024fe --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onExpand.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onExpand

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for expand node.

                    +

                    If you set 'setting.callback.beforeExpand',and return false, zTree will not expand node, and will not trigger the 'onExpand' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be expanded

                    +
                    +

                    Examples of setting & function

                    +

                    1. When expand node, alert info about 'tId' and 'name'.

                    +
                    function myOnExpand(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onExpand: myOnExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onMouseDown.html b/static/zTree3/api/en/setting.callback.onMouseDown.html new file mode 100644 index 0000000..255469f --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onMouseDown.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onMouseDown

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for mouse down.

                    +

                    If you set 'setting.callback.beforeMouseDown',and return false, zTree will not trigger the 'onMouseDown' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which mouse over

                    +

                    If the DOM which mouse over isn't a node, it will return null.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When mouse down, alert info about 'tId' and 'name'.

                    +
                    function myOnMouseDown(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onMouseDown: myOnMouseDown
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onMouseUp.html b/static/zTree3/api/en/setting.callback.onMouseUp.html new file mode 100644 index 0000000..84e06a9 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onMouseUp.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onMouseUp

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for mouse up.

                    +

                    If you set 'setting.callback.beforeMouseUp',and return false, zTree will not trigger the 'onMouseUp' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which mouse over

                    +

                    If the DOM which mouse over isn't a node, it will return null.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When mouse up, alert info about 'tId' and 'name'.

                    +
                    function myOnMouseUp(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onMouseUp: myOnMouseUp
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onNodeCreated.html b/static/zTree3/api/en/setting.callback.onNodeCreated.html new file mode 100644 index 0000000..4e5c8ae --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onNodeCreated.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onNodeCreated

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for node's DOM is created.

                    +

                    Because v3.x uses lazy loading technology, so the nodes which doesn't create DOM when initialized will not trigger this callback, until its parent node is expanded.

                    +

                    Large amount of data to load, please note: do not set onNodeCreated, can improve performance as when initialized.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which DOM is created

                    +
                    +

                    Examples of setting & function

                    +

                    1. When node's DOM is created, alert info about 'tId' and 'name'.

                    +
                    function myOnNodeCreated(event, treeId, treeNode) {
                    +    alert(treeNode.tId + ", " + treeNode.name);
                    +};
                    +var setting = {
                    +	callback: {
                    +		onNodeCreated: myOnNodeCreated
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onRemove.html b/static/zTree3/api/en/setting.callback.onRemove.html new file mode 100644 index 0000000..37ed1f7 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onRemove.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onRemove

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Callback for remove node.

                    +

                    If you set 'setting.callback.beforeRemove',and return false, zTree will not remove node, and will not trigger the 'onRemove' callback.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which was removed.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When remove node, alert info about 'tId' and 'name'.

                    +
                    function myOnRemove(event, treeId, treeNode) {
                    +	alert(treeNode.tId + ", " + treeNode.name);
                    +}
                    +var setting = {
                    +	callback: {
                    +		onRemove: myOnRemove
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onRename.html b/static/zTree3/api/en/setting.callback.onRename.html new file mode 100644 index 0000000..c83206f --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onRename.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Function(event, treeId, treeNode, isCancel)setting.callback.onRename

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Callback for remove node.

                    +

                    1. If you set 'setting.callback.beforeRename',and return false, zTree will keep the editing name, and will not trigger the 'onRename' callback.

                    +

                    2. If you modify treeNode data, and use 'updateNode' function, zTree will not trigger the 'onRename' callback.

                    +

                    3. From v3.5.13, zTree will trigger this callback when user cancel edit name. please see 'isCancel' parameter.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which was rename.

                    +

                    isCancelBoolean

                    +

                    the status about cancel edit name (v3.5.13+)

                    +

                    isCancel = true means: user cancel edit name. (press ESC or use cancelEditName() function)

                    +

                    isCancel = false means: user submit edit name.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When rename node, alert info about 'tId' and 'name'.

                    +
                    function myOnRename(event, treeId, treeNode, isCancel) {
                    +	alert(treeNode.tId + ", " + treeNode.name);
                    +}
                    +var setting = {
                    +	callback: {
                    +		onRename: myOnRename
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.callback.onRightClick.html b/static/zTree3/api/en/setting.callback.onRightClick.html new file mode 100644 index 0000000..110c952 --- /dev/null +++ b/static/zTree3/api/en/setting.callback.onRightClick.html @@ -0,0 +1,36 @@ +
                    +
                    +

                    Function(event, treeId, treeNode)setting.callback.onRightClick

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Callback for mouse right click node.

                    +

                    If you set 'setting.callback.beforeRightClick',and return false, zTree will not trigger the 'onRightClick' callback.

                    +

                    If you set 'setting.callback.onRightClick', zTree will shield the browser context menu when mouse right click on zTree.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    eventjs event Object

                    +

                    event Object

                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which is mouse right clicked

                    +

                    If the DOM which mouse right clicked isn't a node, it will return null.

                    +
                    +

                    Examples of setting & function

                    +

                    1. When mouse right click node, alert info about 'tId' and 'name'.

                    +
                    function myOnRightClick(event, treeId, treeNode) {
                    +    alert(treeNode ? treeNode.tId + ", " + treeNode.name : "isRoot");
                    +};
                    +var setting = {
                    +	callback: {
                    +		onRightClick: myOnRightClick
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.autoCheckTrigger.html b/static/zTree3/api/en/setting.check.autoCheckTrigger.html new file mode 100644 index 0000000..b8b04cc --- /dev/null +++ b/static/zTree3/api/en/setting.check.autoCheckTrigger.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Booleansetting.check.autoCheckTrigger

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    When node is automatically checked or unchecked, this parameter used to set to trigger 'beforeCheck / onCheck' callback. It is valid when [setting.check.enable = true & setting.check.chkStyle = "checkbox"]

                    +

                    1. If you set 'setting.check.chkboxType' to { "Y": "", "N": "" }, will not automatically checked or unchecked.

                    +

                    2. If you turn on the trigger and there are many more nodes, will affect the performance, because the check or uncheck node can cause many nodes to be automatically checked or unchecked, it will trigger a lot of callbacks, according to the need to decide whether to use this feature.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: trigger callback

                    +

                    false means: don't trigger callback

                    +
                    +

                    Examples of setting

                    +

                    1. When node is automatically checked or unchecked, zTree trigger 'beforeCheck / onCheck' callback.

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		autoCheckTrigger: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.chkDisabledInherit.html b/static/zTree3/api/en/setting.check.chkDisabledInherit.html new file mode 100644 index 0000000..98d824e --- /dev/null +++ b/static/zTree3/api/en/setting.check.chkDisabledInherit.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.check.chkDisabledInherit

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    When the parent node's 'chkDisabled' attribute is true, set the child nodes automatically inherit the 'chkDisabled' attribute. It is valid when [setting.check.enable = true]

                    +

                    1. Only be used to initialize the nodes, easy batch operations. Please use the 'updateNode' method modify existing node.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: When add new child nodes, if parent node's 'chkDisabled' attribute is true, the child nodes automatically inherit the 'chkDisabled' attribute.

                    +

                    false means: When add new child nodes, the child nodes don't inherit the 'chkDisabled' attribute from parent node.

                    +
                    +

                    Examples of setting

                    +

                    1. When add new child nodes, the child nodes automatically inherit the 'chkDisabled' attribute from parent node.

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkDisabledInherit: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.chkStyle.html b/static/zTree3/api/en/setting.check.chkStyle.html new file mode 100644 index 0000000..d42e757 --- /dev/null +++ b/static/zTree3/api/en/setting.check.chkStyle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    Stringsetting.check.chkStyle

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Use the checkbox or radio. It is valid when [setting.check.enable = true]

                    +

                    Default: "checkbox"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    When chkStyle = "checkbox", zTree show checkbox, and 'setting.check.chkboxType' attribute is valid. +
                    When chkStyle = "radio", zTree show radio, and 'setting.check.radioType' attribute is valid.

                    +

                    Please note that letter case, do not change.

                    +
                    +

                    checkbox States Descriptions

                    +
                    +

                    +
                    +

                    not checked; If node is parent, so its child nodes have been not checked. when mouse over:

                    +

                    not checked; (only parent node) some of its child nodes have been checked. when mouse over:

                    +

                    be checked; If node is parent, so its all child nodes have been checked. when mouse over:

                    +

                    be checked; (only parent node) some of its child nodes or all have been not checked. when mouse over:

                    +
                    +
                    +

                    radio States Descriptions

                    +
                    +

                    +
                    +

                    not checked; If node is parent, so its child have been not checked. when mouse over:

                    +

                    not checked; (only parent node) some of its child have been checked. when mouse over:

                    +

                    be checked; If node is parent, so its child have been not checked. when mouse over:

                    +

                    be checked; (only parent node) some of its child have been checked. when mouse over:

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. use radio

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "radio"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.chkboxType.html b/static/zTree3/api/en/setting.check.chkboxType.html new file mode 100644 index 0000000..5cecc9e --- /dev/null +++ b/static/zTree3/api/en/setting.check.chkboxType.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    JSONsetting.check.chkboxType

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    When one node is checked or unchecked, control its parent node and its child node auto checked or unchecked. It is valid when [setting.check.enable = true & setting.check.chkStyle = "checkbox"]

                    +

                    Default: { "Y": "ps", "N": "ps" }

                    +
                    +
                    +

                    JSON Format

                    +
                    +

                    "Y" attribute use to set auto check after checkbox was checked. +
                    "N" attribute use to set auto uncheck after checkbox was unchecked. +
                    If value has "p", so parent nodes will be checked or unchecked. +
                    If value has "s", so child nodes will be checked or unchecked.

                    +

                    Please note that letter case, do not change.

                    +
                    +

                    Examples of setting

                    +

                    1. If check the node, so only auto check parent nodes; If uncheck the node, so only auto uncheck child nodes;

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "checkbox",
                    +		chkboxType: { "Y": "p", "N": "s" }
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.enable.html b/static/zTree3/api/en/setting.check.enable.html new file mode 100644 index 0000000..0236b5f --- /dev/null +++ b/static/zTree3/api/en/setting.check.enable.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Booleansetting.check.enable

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Set to use checkbox or radio in zTree

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: use the checkbox or radio

                    +

                    false means: don't use the checkbox or radio

                    +
                    +

                    Examples of setting

                    +

                    1. use the checkbox

                    +
                    var setting = {
                    +	check: {
                    +		enable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.nocheckInherit.html b/static/zTree3/api/en/setting.check.nocheckInherit.html new file mode 100644 index 0000000..758b437 --- /dev/null +++ b/static/zTree3/api/en/setting.check.nocheckInherit.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.check.nocheckInherit

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    When the parent node's 'nocheck' attribute is true, set the child nodes automatically inherit the 'nocheck' attribute. It is valid when [setting.check.enable = true]

                    +

                    1. Only be used to initialize the nodes, easy batch operations. Please use the 'updateNode' method modify existing node.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: When add new child nodes, if parent node's 'nocheck' attribute is true, the child nodes automatically inherit the 'nocheck' attribute.

                    +

                    false means: When add new child nodes, the child nodes don't inherit the 'nocheck' attribute from parent node.

                    +
                    +

                    Examples of setting

                    +

                    1. When add new child nodes, the child nodes automatically inherit the 'nocheck' attribute from parent node.

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		nocheckInherit: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.check.radioType.html b/static/zTree3/api/en/setting.check.radioType.html new file mode 100644 index 0000000..be867d7 --- /dev/null +++ b/static/zTree3/api/en/setting.check.radioType.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Stringsetting.check.radioType

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    The group about radio. It is valid when [setting.check.enable = true & setting.check.chkStyle = "radio"]

                    +

                    Default: "level"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    When radioType = "level", will be grouped with same level nodes which have the same parent node. +
                    When radioType = "all", will be grouped with all nodes.

                    +

                    Please note that letter case, do not change.

                    +
                    +

                    Examples of setting

                    +

                    1. Set the group about radio is all nodes.

                    +
                    var setting = {
                    +	check: {
                    +		enable: true,
                    +		chkStyle: "radio",
                    +		radioType: "all"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.keep.leaf.html b/static/zTree3/api/en/setting.data.keep.leaf.html new file mode 100644 index 0000000..71c573e --- /dev/null +++ b/static/zTree3/api/en/setting.data.keep.leaf.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.data.keep.leaf

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The leaf node's lock, the leaf node will lock the 'isParent' attribute to false.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: lock the leaf node, and the node which 'isParent' attribute is false can't add child nodes.

                    +

                    false means: don't lock the leaf node, and the node which 'isParent' attribute is false can add child nodes.

                    +
                    +

                    Examples of setting

                    +

                    1. lock the leaf node

                    +
                    var setting = {
                    +	data: {
                    +		keep: {
                    +			leaf: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.keep.parent.html b/static/zTree3/api/en/setting.data.keep.parent.html new file mode 100644 index 0000000..5bab2f1 --- /dev/null +++ b/static/zTree3/api/en/setting.data.keep.parent.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.data.keep.parent

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The parent node's lock, the parent node will lock 'isParent' attribute to true.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: lock the parent node, and if remove all of the parent node's child nodes, its 'isParent' attribute still keep to be true..

                    +

                    false means: don't lock the parent node, and if remove all of the parent node's child nodes, its 'isParent' attribute will change to be false..

                    +
                    +

                    Examples of setting

                    +

                    1. lock the parent node

                    +
                    var setting = {
                    +	data: {
                    +		keep: {
                    +			parent: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.key.checked.html b/static/zTree3/api/en/setting.data.key.checked.html new file mode 100644 index 0000000..2678cf2 --- /dev/null +++ b/static/zTree3/api/en/setting.data.key.checked.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.checked

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save the checked state.

                    +

                    Default: "checked"

                    +

                    Please don't set the other node attribute which zTree used. (e.g., checkedOld)

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. set the 'isChecked' attribute to save the checked state.

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			checked: "isChecked"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.key.children.html b/static/zTree3/api/en/setting.data.key.children.html new file mode 100644 index 0000000..321a1a7 --- /dev/null +++ b/static/zTree3/api/en/setting.data.key.children.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Stringsetting.data.key.children

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save the child nodes.

                    +

                    Default: "children"

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the 'nodes' attribute to save the child nodes.

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			children: "nodes"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.key.name.html b/static/zTree3/api/en/setting.data.key.name.html new file mode 100644 index 0000000..0208c55 --- /dev/null +++ b/static/zTree3/api/en/setting.data.key.name.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Stringsetting.data.key.name

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save the node name.

                    +

                    Default: "name"

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the 'ename' attribute to save the node name.

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			name: "ename"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.key.title.html b/static/zTree3/api/en/setting.data.key.title.html new file mode 100644 index 0000000..96540eb --- /dev/null +++ b/static/zTree3/api/en/setting.data.key.title.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.title

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save the 'title' attribute of node DOM. It is valid when [setting.view.showTitle = true]

                    +

                    If set it to "", the title of node DOM will be same as 'setting.data.key.name' attribute.

                    +

                    Default: ""

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the 'fullName' attribute to save the title of node DOM.

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			title: "fullName"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.key.url.html b/static/zTree3/api/en/setting.data.key.url.html new file mode 100644 index 0000000..e9a08ce --- /dev/null +++ b/static/zTree3/api/en/setting.data.key.url.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Stringsetting.data.key.url

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save the node link's url.

                    +

                    Special: If the nodes's data can only use the 'url' attribute, and don't use the link to jump feature, you can modify this attribute to any nonexistent attribute.

                    +

                    Default: "url"

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the 'xUrl' attribute to save the node link's url.

                    +
                    var setting = {
                    +	data: {
                    +		key: {
                    +			url: "xUrl"
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.simpleData.enable.html b/static/zTree3/api/en/setting.data.simpleData.enable.html new file mode 100644 index 0000000..9bb56d1 --- /dev/null +++ b/static/zTree3/api/en/setting.data.simpleData.enable.html @@ -0,0 +1,39 @@ +
                    +
                    +

                    Booleansetting.data.simpleData.enable

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set zTree's node to accept the simple data format, when zTree is initialized or when ajax get / or when use addNodes method.

                    +

                    Don't have to generate the complex nested data.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: zTree's node accept the simple data format.

                    +

                    false means: zTree's node only accept the nested data format.

                    +

                    If set it is true, you must set the other attributes in 'setting.data.simpleData'. (e.g., idKey, pIdKey, rootPId) And let the data satisfy the parent-child relationship.

                    +
                    +

                    Examples of setting

                    +

                    1. use the simple data format

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.simpleData.idKey.html b/static/zTree3/api/en/setting.data.simpleData.idKey.html new file mode 100644 index 0000000..1216e0c --- /dev/null +++ b/static/zTree3/api/en/setting.data.simpleData.idKey.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Stringsetting.data.simpleData.idKey

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save node data's unique identifier. It is valid when [setting.data.simpleData.enable = true]

                    +

                    Default: "id"

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. use the simple data format

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.simpleData.pIdKey.html b/static/zTree3/api/en/setting.data.simpleData.pIdKey.html new file mode 100644 index 0000000..8378c6e --- /dev/null +++ b/static/zTree3/api/en/setting.data.simpleData.pIdKey.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Stringsetting.data.simpleData.pIdKey

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node data's attribute to save its parent node data's unique identifier. It is valid when [setting.data.simpleData.enable = true]

                    +

                    Default: "pId"

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. use the simple data format

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.data.simpleData.rootPId.html b/static/zTree3/api/en/setting.data.simpleData.rootPId.html new file mode 100644 index 0000000..61c9bbd --- /dev/null +++ b/static/zTree3/api/en/setting.data.simpleData.rootPId.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    String / Numbersetting.data.simpleData.rootPId

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set the default value of root's 'pIdKey' specified attribute values​​. It is valid when [setting.data.simpleData.enable = true]

                    +

                    Default: null

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. use the simple data format

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var treeNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.autoExpandTrigger.html b/static/zTree3/api/en/setting.edit.drag.autoExpandTrigger.html new file mode 100644 index 0000000..804ee66 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.autoExpandTrigger.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Booleansetting.edit.drag.autoExpandTrigger

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag node cause the parent node is automatically expanded, set whether to allow to trigger the 'onExpand' callback. It is valid when [setting.edit.enable = true]

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: trigger the 'onExpand' callback.

                    +

                    false means: don't trigger the 'onExpand' callback.

                    +
                    +

                    Examples of setting

                    +

                    1. Set to allow to trigger the 'onExpand' callback

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			autoExpandTrigger: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.autoOpenTime.html b/static/zTree3/api/en/setting.edit.drag.autoOpenTime.html new file mode 100644 index 0000000..74982af --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.autoOpenTime.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.autoOpenTime

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Drag to the parent node, the parent node auto expand time interval. (Unit: ms) It is valid when [setting.edit.enable = true]

                    +

                    Default: 500

                    +

                    Please adjust the value according to needs.

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. When drag node to other parent node, expand it at once.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			autoOpenTime: 0
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.borderMax.html b/static/zTree3/api/en/setting.edit.drag.borderMax.html new file mode 100644 index 0000000..edbb752 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.borderMax.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.borderMax

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag a node to root, the zTree's inner border width. (Unit: px) It is valid when [setting.edit.enable = true]

                    +

                    Default: 10

                    +

                    Please adjust the value according to needs.

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. adjust the inner border width is 20px

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			borderMax: 20
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.borderMin.html b/static/zTree3/api/en/setting.edit.drag.borderMin.html new file mode 100644 index 0000000..e845853 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.borderMin.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.borderMin

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag a node to root, the zTree's outer border width. (Unit: px) It is valid when [setting.edit.enable = true]

                    +

                    Default: -5

                    +

                    Please adjust the value according to needs.

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. adjust the outer border width is 10px

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			borderMin: -10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.inner.html b/static/zTree3/api/en/setting.edit.drag.inner.html new file mode 100644 index 0000000..5258e2f --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.inner.html @@ -0,0 +1,60 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.inner

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag one node to the target node, set whether to allow the node to be the target node's child. It is valid when [setting.edit.enable = true]

                    +

                    If the target node is root, so zTree will only trigger 'inner' and not trigger 'prev / next'.

                    +

                    This function mainly for the appropriate limit drag and drop (auxiliary arrow), it requires a combination of 'prev, next' together, to achieve full functionality.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: allow the node to be the target node's child.

                    +

                    false means: don't allow the node to be the target node's child.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which has been dragged

                    +

                    targetNodeJSON

                    +

                    JSON data object of the target node which treeNodes are draged over.

                    +

                    If the treeNodes will be root node, the targetNode = null

                    +

                    Return Boolean

                    +

                    return true or false

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to drag the node to the target node's inner.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: true,
                    +			inner: false
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. disable to drag the node to be root node's child.

                    +
                    function canInner(treeId, nodes, targetNode) {
                    +	return !(targetNode && targetNode.level === 0);
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: true,
                    +			inner: canInner
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.isCopy.html b/static/zTree3/api/en/setting.edit.drag.isCopy.html new file mode 100644 index 0000000..1207d2a --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.isCopy.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Booleansetting.edit.drag.isCopy

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag-drop node, set whether to allow to copy node. It is valid when [setting.edit.enable = true]

                    +

                    Default: true

                    +
                    +
                    +

                    Rules Description

                    +
                    +

                    1. If isCopy = true and isMove = true, when drag-drop node, press Ctrl-Key or Cmd-key can copy node, don't press Ctrl-Key or Cmd-key can move node.

                    +

                    2. If isCopy = true and isMove = false, when drag-drop node, will copy node.

                    +

                    3. If isCopy = false and isMove = true, when drag-drop node, will move node.

                    +

                    4. If isCopy = false and isMove = false, so disable to drag-drop node.

                    +
                    +

                    Examples of setting

                    +

                    1. all of the drag-drop operation will copy node.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			isCopy: true,
                    +			isMove: false
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.isMove.html b/static/zTree3/api/en/setting.edit.drag.isMove.html new file mode 100644 index 0000000..e4a7ca3 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.isMove.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Booleansetting.edit.drag.isMove

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag-drop node, set whether to allow to move node. It is valid when [setting.edit.enable = true]

                    +

                    Default: true

                    +
                    +
                    +

                    Rules Description

                    +
                    +

                    1. If isCopy = true and isMove = true, when drag-drop node, press Ctrl-Key or Cmd-key can copy node, don't press Ctrl-Key or Cmd-key can move node.

                    +

                    2. If isCopy = true and isMove = false, when drag-drop node, will copy node.

                    +

                    3. If isCopy = false and isMove = true, when drag-drop node, will move node.

                    +

                    4. If isCopy = false and isMove = false, so disable to drag-drop node.

                    +
                    +

                    Examples of setting

                    +

                    1. all of the drag-drop operation will move node.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			isCopy: false,
                    +			isMove: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.maxShowNodeNum.html b/static/zTree3/api/en/setting.edit.drag.maxShowNodeNum.html new file mode 100644 index 0000000..dbc3ae4 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.maxShowNodeNum.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.maxShowNodeNum

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When dragging more than one sibling node, the floating layer shows the maximum number of nodes. zTree using '...' instead of redundant nodes. It is valid when [setting.edit.enable = true]

                    +

                    Default: 5

                    +

                    Please adjust the value according to needs.

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the maximum number is 10

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			maxShowNodeNum: 10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.minMoveSize.html b/static/zTree3/api/en/setting.edit.drag.minMoveSize.html new file mode 100644 index 0000000..8270a99 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.minMoveSize.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Numbersetting.edit.drag.minMoveSize

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    The minimum offset which used to determine the drag operator start. (Unit: px) It is valid when [setting.edit.enable = true]

                    +

                    Please adjust the value according to needs. Note: If it is too small, will easily lead to misoperation when you click mouse.

                    +

                    Default: 5

                    +
                    +
                    +

                    Examples of setting

                    +

                    1. Set the minimum offset is 10px.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			minMoveSize: 10
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.next.html b/static/zTree3/api/en/setting.edit.drag.next.html new file mode 100644 index 0000000..11323f1 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.next.html @@ -0,0 +1,59 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.next

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag one node to the target node, set whether to allow the node to be the target node's next sibling. It is valid when [setting.edit.enable = true]

                    +

                    If the target node is root, so zTree will only trigger 'inner' and not trigger 'prev / next'.

                    +

                    This function mainly for the appropriate limit drag and drop (auxiliary arrow), it requires a combination of 'prev, inner' together, to achieve full functionality.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: allow the node to be the target node's next sibling.

                    +

                    false means: don't allow the node to be the target node's next sibling.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which has been dragged

                    +

                    targetNodeJSON

                    +

                    JSON data object of the target node which treeNodes are draged over.

                    +

                    Return Boolean

                    +

                    return true or false

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to drag the node to the target node's next sibling.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: false,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. disable to drag the node to be all of the parent nodes's next sibling.

                    +
                    function canNext(treeId, nodes, targetNode) {
                    +	return !targetNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: true,
                    +			next: canNext,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.drag.prev.html b/static/zTree3/api/en/setting.edit.drag.prev.html new file mode 100644 index 0000000..84e3b1a --- /dev/null +++ b/static/zTree3/api/en/setting.edit.drag.prev.html @@ -0,0 +1,59 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNodes, targetNode)setting.edit.drag.prev

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When drag one node to the target node, set whether to allow the node to be the target node's previous sibling. It is valid when [setting.edit.enable = true]

                    +

                    If the target node is root, so zTree will only trigger 'inner' and not trigger 'prev / next'.

                    +

                    This function mainly for the appropriate limit drag and drop (auxiliary arrow), it requires a combination of 'next, inner' together, to achieve full functionality.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: allow the node to be the target node's previous sibling.

                    +

                    false means: don't allow the node to be the target node's previous sibling.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodesArray(JSON)

                    +

                    A collection of the nodes which has been dragged

                    +

                    targetNodeJSON

                    +

                    JSON data object of the target node which treeNodes are draged over.

                    +

                    Return Boolean

                    +

                    return true or false

                    +
                    +

                    Examples of setting & function

                    +

                    1. disable to drag the node to the target node's previous sibling.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: false,
                    +			next: true,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +

                    2. disable to drag the node to be all of the parent nodes's previous sibling.

                    +
                    function canPrev(treeId, nodes, targetNode) {
                    +	return !targetNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		drag: {
                    +			prev: canPrev,
                    +			next: true,
                    +			inner: true
                    +		}
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.editNameSelectAll.html b/static/zTree3/api/en/setting.edit.editNameSelectAll.html new file mode 100644 index 0000000..a030359 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.editNameSelectAll.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Booleansetting.edit.editNameSelectAll

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    When edit node's name, the text in input is selected or unselected. It is valid when [setting.edit.enable = true]

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: when show the input, the text in input is selected

                    +

                    false means: when show the input, the text in input is not selected

                    +
                    +

                    Examples of setting

                    +

                    1. When edit node's name, the text in input is selected.

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		editNameSelectAll: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.enable.html b/static/zTree3/api/en/setting.edit.enable.html new file mode 100644 index 0000000..ec9d2b3 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.enable.html @@ -0,0 +1,39 @@ +
                    +
                    +

                    Booleansetting.edit.enable

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Set zTree is in edit mode

                    +

                    Please set this attribute before zTree initialization. If you need to change the edit mode after the initialization, please use zTreeObj.setEditable() method.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: zTree is in edit mode.

                    +

                    false means: zTree is not in edit mode.

                    +
                    +

                    Editing Rules Description

                    +
                    +

                    1. When click the node, it will not open 'node.url' specified URL. +
                    2. Support for dynamic tree editing. +
                    3. You can drag-drop nodes, and support drag-drop nodes between multiple trees. +
                    4. Support use drag-drop to copy or move the node. (Reference: setting.edit.drag.isCopy / setting.edit.drag.isMove) +
                    5. You can use the Edit button to modify the name attribute. +
                    6. You can use the Remove button to remove the node. +
                    +

                    +

                    Please note that letter case, do not change.

                    +
                    +

                    Examples of setting

                    +

                    1. edit the tree

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.removeTitle.html b/static/zTree3/api/en/setting.edit.removeTitle.html new file mode 100644 index 0000000..d749c05 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.removeTitle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.edit.removeTitle

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    the title of the remove button DOM. It is valid when [setting.edit.enable = true & setting.edit.showRemoveBtn = true]

                    +

                    Default: "remove"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    When the mouse over the remove button, the browser auto pop-up message content.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which show the remove button

                    +

                    Return String

                    +

                    Return value is same as 'String Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Set title is 'remove the node' about all the remove button

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: true,
                    +		removeTitle: "remove the node"
                    +	}
                    +};
                    +......
                    +

                    2. Set title is 'remove the parent node' about the parent node, and is 'remove the leaf node' about the leaf node

                    +
                    function setRemoveTitle(treeId, treeNode) {
                    +	return treeNode.isParent ? "remove the parent node":"remove the leaf node";
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: true,
                    +		removeTitle: setRemoveTitle
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.renameTitle.html b/static/zTree3/api/en/setting.edit.renameTitle.html new file mode 100644 index 0000000..aa2d719 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.renameTitle.html @@ -0,0 +1,48 @@ +
                    +
                    +

                    String / Function(treeId, treeNode)setting.edit.renameTitle

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    the title of the rename button DOM. It is valid when [setting.edit.enable = true & setting.edit.showRenameBtn = true]

                    +

                    Default: "rename"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    When the mouse over the rename button, the browser auto pop-up message content.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which show the rename button

                    +

                    Return String

                    +

                    return value is same as 'String Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Set title is 'rename the node' about all the rename button

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: true,
                    +		renameTitle: "rename the node"
                    +	}
                    +};
                    +......
                    +

                    2. Set title is 'rename the parent node' about the parent node, and is 'rename the leaf node' about the leaf node

                    +
                    function setRenameTitle(treeId, treeNode) {
                    +	return treeNode.isParent ? "rename the parent node":"rename the leaf node";
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: true,
                    +		renameTitle: setRenameTitle
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.showRemoveBtn.html b/static/zTree3/api/en/setting.edit.showRemoveBtn.html new file mode 100644 index 0000000..2c64ac1 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.showRemoveBtn.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.edit.showRemoveBtn

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Set to show or hide the remove button. It is valid when [setting.edit.enable = true]

                    +

                    When you click the remove button:

                    +

                    1. zTree will trigger the setting.callback.beforeRemove callback, and you can decide whether to allow delete.

                    +

                    2. If you don't set the 'beforeRemove' or the 'beforeRemove' callback return true, so zTree will trigger the setting.callback.onRemove callback after remove the node.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: show the remove button

                    +

                    false means: hide the remove button

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which show the remove button

                    +

                    Return Boolean

                    +

                    Return value is same as 'Boolean Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Hide the remove button

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: false
                    +	}
                    +};
                    +......
                    +

                    2. Hide the remove button of parent node

                    +
                    function setRemoveBtn(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRemoveBtn: setRemoveBtn
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.edit.showRenameBtn.html b/static/zTree3/api/en/setting.edit.showRenameBtn.html new file mode 100644 index 0000000..390f0a1 --- /dev/null +++ b/static/zTree3/api/en/setting.edit.showRenameBtn.html @@ -0,0 +1,52 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.edit.showRenameBtn

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Set to show or hide the rename button. It is valid when [setting.edit.enable = true]

                    +

                    When you click the rename button:

                    +

                    1. Click the rename button, you can rename the node.

                    +

                    2. After rename operation (the input DOM blur or press the Enter Key), zTree will trigger the setting.callback.beforeRename callback, and you can decide whether to allow rename.

                    +

                    3. If the 'beforeRename' callback return false, so zTree will keep the edit status. (Press the ESC key, can be restored to the original state.

                    +

                    4. If you don't set the 'beforeRename' or the 'beforeRename' callback return true, so zTree will trigger the setting.callback.onRename callback after rename the node.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: show the rename button

                    +

                    false means: hide the rename button

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which show the rename button

                    +

                    Return Boolean

                    +

                    Return value is same as 'Boolean Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Hide the rename button

                    +
                    var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: false
                    +	}
                    +};
                    +......
                    +

                    2. Hide the rename button of parent node

                    +
                    function setRenameBtn(treeId, treeNode) {
                    +	return !treeNode.isParent;
                    +}
                    +var setting = {
                    +	edit: {
                    +		enable: true,
                    +		showRenameBtn: setRenameBtn
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.treeId.html b/static/zTree3/api/en/setting.treeId.html new file mode 100644 index 0000000..e4b04b3 --- /dev/null +++ b/static/zTree3/api/en/setting.treeId.html @@ -0,0 +1,14 @@ +
                    +
                    +

                    Stringsetting.treeId

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    zTree unique identifier. After the initialization, it equals to the id attribute value of the user-defined zTree container.

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +
                    +
                    + +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.treeObj.html b/static/zTree3/api/en/setting.treeObj.html new file mode 100644 index 0000000..30eb66c --- /dev/null +++ b/static/zTree3/api/en/setting.treeObj.html @@ -0,0 +1,14 @@ +
                    +
                    +

                    Objectsetting.treeObj

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    zTree DOM's jQuery object, the main function: easy to internal operations.

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +
                    +
                    + +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.addDiyDom.html b/static/zTree3/api/en/setting.view.addDiyDom.html new file mode 100644 index 0000000..efcc8d4 --- /dev/null +++ b/static/zTree3/api/en/setting.view.addDiyDom.html @@ -0,0 +1,40 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.addDiyDom

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    This function used to display the custom control on the node.

                    +

                    1. If you have huge node data, please note: this function will affect the initialization performance. If not required, it is recommended not to use this function.

                    +

                    2. This function is an advanced application, please make sure that a better understanding of zTree before you use it.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which display the custom control.

                    +
                    +

                    Examples of setting & function

                    +

                    1. Display button in all nodes.

                    +
                    var setting = {
                    +	view: {
                    +		addDiyDom: addDiyDom
                    +	}
                    +};
                    +function addDiyDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.addHoverDom.html b/static/zTree3/api/en/setting.view.addHoverDom.html new file mode 100644 index 0000000..9c6ccf6 --- /dev/null +++ b/static/zTree3/api/en/setting.view.addHoverDom.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.addHoverDom

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to display custom control when mouse move over the node. (e.g. the rename and remove button)

                    +

                    If you use this function, so must set setting.view.removeHoverDom, please make sure that a better understanding of zTree before you use it.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to display the custom control.

                    +
                    +

                    Examples of setting & function

                    +

                    1. Display a button when mouse move over the node, and hide the button when mouse move out.

                    +
                    var setting = {
                    +	view: {
                    +		addHoverDom: addHoverDom,
                    +		removeHoverDom: removeHoverDom,
                    +		......
                    +	}
                    +};
                    +function addHoverDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +function removeHoverDom(treeId, treeNode) {
                    +	$("#diyBtn_"+treeNode.id).unbind().remove();
                    +	$("#diyBtn_space_" +treeNode.id).unbind().remove();
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.autoCancelSelected.html b/static/zTree3/api/en/setting.view.autoCancelSelected.html new file mode 100644 index 0000000..44ab90d --- /dev/null +++ b/static/zTree3/api/en/setting.view.autoCancelSelected.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Booleansetting.view.autoCancelSelected

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    When click the selected node while pressing the Ctrl-key or Cmd-key, allow to cancel selected the node.

                    +

                    If you don't need this function, please set to false.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: press the Ctrl-key or Cmd-key, can cancel selected node.

                    +

                    false means: press the Ctrl-key or Cmd-key, can't cancel selected node.

                    +
                    +

                    Examples of setting

                    +

                    1. Press the Ctrl-key or Cmd-key, can't cancel selected node.

                    +
                    var setting = {
                    +	view: {
                    +		autoCancelSelected: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.dblClickExpand.html b/static/zTree3/api/en/setting.view.dblClickExpand.html new file mode 100644 index 0000000..210dfec --- /dev/null +++ b/static/zTree3/api/en/setting.view.dblClickExpand.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.dblClickExpand

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    When double-click the parent node, 'dblClickExpand' is used to decide whether to expand the parent node.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: When double-click the parent node, zTree will expand the parent node.

                    +

                    false means: When double-click the parent node, zTree will not expand the parent node.

                    +
                    +

                    Function Pamameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which be double-clicked.

                    +

                    Return Boolean

                    +

                    Return value is same as 'Boolean Format'

                    +
                    +

                    Example of setting

                    +

                    1. When double-click the parent node, zTree will not expand the parent node.

                    +
                    var setting = {
                    +	view: {
                    +		dblClickExpand: false
                    +	}
                    +};
                    +......
                    +

                    2. When double-click the parent node, zTree will expand the parent node which level>0.

                    +
                    function dblClickExpand(treeId, treeNode) {
                    +	return treeNode.level > 0;
                    +};
                    +var setting = {
                    +	view: {
                    +		dblClickExpand: dblClickExpand
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.expandSpeed.html b/static/zTree3/api/en/setting.view.expandSpeed.html new file mode 100644 index 0000000..1911e74 --- /dev/null +++ b/static/zTree3/api/en/setting.view.expandSpeed.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    String / Numbersetting.view.expandSpeed

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The animation speed of expand or collapse node. As same as 'speed' parameter in jQuery

                    +

                    In order to ensure zTree operating speed, if use the IE6, zTree will not use animation.

                    +

                    Default: "fast"

                    +
                    +
                    +

                    String Format

                    +
                    +

                    e.g. "slow", "normal", or "fast"

                    +

                    If set to "", zTree will not use animation.

                    +
                    +

                    Number Format

                    +
                    +

                    How long the animation will run. [Unit: ms] (e.g. 1000)

                    +
                    +

                    Examples of setting

                    +

                    1. Set the animation speed to slow

                    +
                    var setting = {
                    +	view: {
                    +		expandSpeed: "slow"
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.fontCss.html b/static/zTree3/api/en/setting.view.fontCss.html new file mode 100644 index 0000000..02bddea --- /dev/null +++ b/static/zTree3/api/en/setting.view.fontCss.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    JSON / Function(treeId, treeNode)setting.view.fontCss

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Personalized text style, only applies to <A> object in the node DOM

                    +

                    Default: {}

                    +
                    +
                    +

                    JSON Format

                    +
                    +

                    As same as .css() method in jQuery. e.g. {color:"#ff0011", background:"blue"}

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which use the personalized text style

                    +

                    Return JSON

                    +

                    Return value is same as 'JSON Format'. e.g. {color:"#ff0011", background:"blue"}

                    +
                    +

                    Examples of setting & function

                    +

                    1. Don't modify css file, and set the node name's color to red

                    +
                    var setting = {
                    +	view: {
                    +		fontCss : {color:"red"}
                    +	}
                    +};
                    +

                    2. Don't modify css file, and set the root node name's color to red

                    +
                    function setFontCss(treeId, treeNode) {
                    +	return treeNode.level == 0 ? {color:"red"} : {};
                    +};
                    +var setting = {
                    +	view: {
                    +		fontCss: setFontCss
                    +	}
                    +};
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.nameIsHTML.html b/static/zTree3/api/en/setting.view.nameIsHTML.html new file mode 100644 index 0000000..4fe19ad --- /dev/null +++ b/static/zTree3/api/en/setting.view.nameIsHTML.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.view.nameIsHTML

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set to use HTML in 'name' attribute.

                    +

                    If allow HTML, please do check to avoid security issues, e.g. JavaScript Injection...

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: 'name' attribute can be HTML.

                    +

                    false means: 'name' attribute is only TEXT.

                    +
                    +

                    Examples of setting

                    +

                    1. Set to allow HTML

                    +
                    var setting = {
                    +	view: {
                    +		nameIsHTML: true
                    +	}
                    +};
                    +var node = {"name":"<font color='red'>test</font>"};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.removeHoverDom.html b/static/zTree3/api/en/setting.view.removeHoverDom.html new file mode 100644 index 0000000..83f8047 --- /dev/null +++ b/static/zTree3/api/en/setting.view.removeHoverDom.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Function(treeId, treeNode)setting.view.removeHoverDom

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to hide custom control when mouse move out the node. (e.g. the rename and remove button)

                    +

                    If you use this function, so must set setting.view.addHoverDom, please make sure that a better understanding of zTree before you use it.

                    +

                    Default: null

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to hide the custom control.

                    +
                    +

                    Examples of setting & function

                    +

                    1. Display a button when mouse move over the node, and hide the button when mouse move out.

                    +
                    var setting = {
                    +	view: {
                    +		addHoverDom: addHoverDom,
                    +		removeHoverDom: removeHoverDom,
                    +		......
                    +	}
                    +};
                    +function addHoverDom(treeId, treeNode) {
                    +	var aObj = $("#" + treeNode.tId + "_a");
                    +	if ($("#diyBtn_"+treeNode.id).length>0) return;
                    +	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
                    +		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
                    +		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
                    +	aObj.append(editStr);
                    +	var btn = $("#diyBtn_"+treeNode.id);
                    +	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
                    +};
                    +function removeHoverDom(treeId, treeNode) {
                    +	$("#diyBtn_"+treeNode.id).unbind().remove();
                    +	$("#diyBtn_space_" +treeNode.id).unbind().remove();
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.selectedMulti.html b/static/zTree3/api/en/setting.view.selectedMulti.html new file mode 100644 index 0000000..074fb68 --- /dev/null +++ b/static/zTree3/api/en/setting.view.selectedMulti.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Booleansetting.view.selectedMulti

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set whether to allow select multiple nodes.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true mean: you can select multiple nodes.

                    +

                    false mean: you can only select one node.

                    +

                    1. Press Ctrl-key or Cmd-key, you can select multiple nodes.

                    +

                    2、This attribute don't affect the feature of cancel select node. ( please see setting.view.autoCancelSelected )

                    +
                    +

                    Examples of setting

                    +

                    1. Only select one node.

                    +
                    var setting = {
                    +	view: {
                    +		selectedMulti: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.showIcon.html b/static/zTree3/api/en/setting.view.showIcon.html new file mode 100644 index 0000000..69f1b05 --- /dev/null +++ b/static/zTree3/api/en/setting.view.showIcon.html @@ -0,0 +1,45 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.showIcon

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set to show or hide node icon.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: show node icon.

                    +

                    false means: hide node icon.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to show icon.

                    +

                    Return Boolean

                    +

                    Return value is same as 'Boolean Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Hide node icon

                    +
                    var setting = {
                    +	view: {
                    +		showIcon: false
                    +	}
                    +};
                    +......
                    +

                    2. Hide node icon which level=2

                    +
                    function showIconForTree(treeId, treeNode) {
                    +	return treeNode.level != 2;
                    +};
                    +var setting = {
                    +	view: {
                    +		showIcon: showIconForTree
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.showLine.html b/static/zTree3/api/en/setting.view.showLine.html new file mode 100644 index 0000000..a554014 --- /dev/null +++ b/static/zTree3/api/en/setting.view.showLine.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Booleansetting.view.showLine

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set to show or hide line.

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: show line.

                    +

                    false means: hide line.

                    +
                    +

                    Examples of setting

                    +

                    1. Hide line

                    +
                    var setting = {
                    +	view: {
                    +		showLine: false
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.showTitle.html b/static/zTree3/api/en/setting.view.showTitle.html new file mode 100644 index 0000000..8af6984 --- /dev/null +++ b/static/zTree3/api/en/setting.view.showTitle.html @@ -0,0 +1,47 @@ +
                    +
                    +

                    Boolean / Function(treeId, treeNode)setting.view.showTitle

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set to show or hide the 'title' attribute of node DOM.

                    +

                    Please see the setting.data.key.title attribute

                    +

                    Default: true

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: show the 'title' attribute of node DOM.

                    +

                    false means: hide the 'title' attribute of node DOM.

                    +

                    When setting.view.showTitle = true & setting.data.key.title = '', zTree will set the 'setting.data.key.name' attribute to the 'setting.data.key.title'.

                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeIdString

                    +

                    zTree unique identifier: treeId.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to show title.

                    +

                    Return Boolean

                    +

                    Return value is same as 'Boolean Format'

                    +
                    +

                    Examples of setting & function

                    +

                    1. Hide the 'title' attribute of node DOM.

                    +
                    var setting = {
                    +	view: {
                    +		showTitle: false
                    +	}
                    +};
                    +......
                    +

                    2. Hide the 'title' attribute of node DOM which level=2.

                    +
                    function showTitleForTree(treeId, treeNode) {
                    +	return treeNode.level != 2;
                    +};
                    +var setting = {
                    +	view: {
                    +		showTitle: showTitleForTree
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/setting.view.txtSelectedEnable.html b/static/zTree3/api/en/setting.view.txtSelectedEnable.html new file mode 100644 index 0000000..a380930 --- /dev/null +++ b/static/zTree3/api/en/setting.view.txtSelectedEnable.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Booleansetting.view.txtSelectedEnable

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Set to allow or don't allow to select the text which in zTree's DOM.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: Allow to select the txt which in zTree's DOM.

                    +

                    false means: Don't allow to select the txt which in zTree's DOM.

                    +
                    +

                    Examples of setting & function

                    +

                    1. Allow to select the txt which in zTree's DOM.

                    +
                    var setting = {
                    +	view: {
                    +		txtSelectedEnable: true
                    +	}
                    +};
                    +......
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.check_Child_State.html b/static/zTree3/api/en/treeNode.check_Child_State.html new file mode 100644 index 0000000..48efb79 --- /dev/null +++ b/static/zTree3/api/en/treeNode.check_Child_State.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    NumbertreeNode.check_Child_State

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Used to record the node's half-checked state about its all child nodes's checkbox or radio. It is valid when [setting.check.enable = true]

                    +

                    zTree v3.x provides treeNode.getCheckStatus () method to get an accurate the half-checked status.

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +

                    Default: true

                    +
                    +
                    +

                    Number Format

                    +
                    +

                    Rules:

                    + + + + + + + + + + + +
                    setting.check.checkType = "checkbox"
                    treeNode.check_Child_StateChecked Status Description
                    -1Has no child nodes or all child nodes's 'nocheck' attribute is true.
                    0All of the child nodes has not been checked.
                    1Some of the child nodes has been checked.
                    2All of the child nodes has been checked.
                    +
                    + + + + + + + + + + +
                    setting.check.checkType = "radio"
                    treeNode.check_Child_StateChecked Status Description
                    -1Has no child nodes or all child nodes's 'nocheck' attribute is true.
                    0All of the child nodes has not been checked.
                    2Some of the child nodes has been checked.
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.check_Focus.html b/static/zTree3/api/en/treeNode.check_Focus.html new file mode 100644 index 0000000..77b7359 --- /dev/null +++ b/static/zTree3/api/en/treeNode.check_Focus.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.check_Focus

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Used to record the status which the checkbox or radio get focus. It is valid when [setting.check.enable = true]

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: mouse move over the checkbox

                    +

                    false means: mouse move out the checkbox

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.checked.html b/static/zTree3/api/en/treeNode.checked.html new file mode 100644 index 0000000..8a55f3d --- /dev/null +++ b/static/zTree3/api/en/treeNode.checked.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    BooleantreeNode.checked

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    The checked status about node's checkbox or radio. It is valid when [setting.check.enable = true & treeNode.nocheck = false]

                    +

                    1. If change the 'checked' to other attribute, please set the 'setting.data.key.checked' attribute.

                    +

                    2. If you create node data, and set 'checked' attribute to true, zTree will check this node's checkbox or radio when zTree is initialized.

                    +

                    3. Use the treeObj.checkNode or checkAllNodes or updateNode method, you can check or uncheck the node. Please see the API about these methods.

                    +

                    4. zTree support identification string 'true' & 'false'.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: check the checkbox or radio when zTree is initialized.

                    +

                    false means: uncheck the checkbox or radio when zTree is initialized.

                    +
                    +

                    Examples of treeNode

                    +

                    1. check the checkbox when zTree is initialized

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1", checked:true },
                    +{ "id":2, "name":"test2", checked:true }
                    +]
                    +

                    2. Get the checked status of the first root node

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var checked = treeObj.getNodes()[0].checked;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.checkedOld.html b/static/zTree3/api/en/treeNode.checkedOld.html new file mode 100644 index 0000000..ee51626 --- /dev/null +++ b/static/zTree3/api/en/treeNode.checkedOld.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    BooleantreeNode.checkedOld

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    The checked status about node's checkbox or radio when zTree was initialized. It is valid when [setting.check.enable = true & treeNode.nocheck = false]

                    +

                    1. Do not initialize it, it will be initialized when the node is initialized.

                    +

                    2. If you need to achieve special features, you can use the zTreeObj.getChangeCheckedNodes method and modify the value of 'checkedOld' attribute.

                    +

                    Default: the value of 'checked' attribute when zTree is initialized

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the checkbox or radio is checked when zTree is initialized.

                    +

                    false means: the checkbox or radio is not checked when zTree is initialized.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the original checked status of the first root node

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var checkedOld = treeObj.getNodes()[0].checkedOld;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.children.html b/static/zTree3/api/en/treeNode.children.html new file mode 100644 index 0000000..d765bb9 --- /dev/null +++ b/static/zTree3/api/en/treeNode.children.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Array(JSON)treeNode.children

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The data collections of node's child nodes.

                    +

                    1. If change the 'children' to other attribute, please set the 'setting.data.key.children' attribute.

                    +

                    2. If you set to use dynamic tree, when a node is expanded which 'isParent' attribute is true and which has no child nodes, zTree will use ajax to get its child nodes.

                    +

                    Default: undefined

                    +
                    +
                    +

                    Array(JSON) Format

                    +
                    +

                    Standard JSON Data object

                    +
                    +

                    Examples of treeNode

                    +

                    1. Use the standard JSON data object.

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1",
                    +	children: [
                    +	{ "id":3, "name":"test3"},
                    +	{ "id":4, "name":"test4"},
                    +	{ "id":5, "name":"test5"}
                    +	]
                    +},
                    +{ "id":2, "name":"test2"  }
                    +]
                    +

                    2. Get the first root node's child nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes()[0].children;
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.chkDisabled.html b/static/zTree3/api/en/treeNode.chkDisabled.html new file mode 100644 index 0000000..7a5fcf3 --- /dev/null +++ b/static/zTree3/api/en/treeNode.chkDisabled.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.chkDisabled

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    1. Set node's checkbox / radio to disabled. It is valid when [setting.check.enable = true]

                    +

                    2. zTree support identification string 'true' & 'false'.

                    +

                    3. Please don't change this attribute of the nodes which have been created. If you want to disable or undisable the nodes, please use 'setChkDisabled()' methods.

                    +

                    4. When zTree initialize the nodes, if you need to the child nodes automatically inherit the 'chkDisabled' attribute, please see 'setting.check.chkDisabledInherit'.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: this node's checkbox / radio is disabled.

                    +

                    false means: this node's checkbox / radio is able.

                    +
                    +

                    Examples of treeNode

                    +

                    1. disable some node's checkbox / radio

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "checked":true, "chkDisabled":true},
                    +	{ "id":2, "name":"test2", "chkDisabled":true},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.click.html b/static/zTree3/api/en/treeNode.click.html new file mode 100644 index 0000000..1f9db62 --- /dev/null +++ b/static/zTree3/api/en/treeNode.click.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    StringtreeNode.click

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Simple click event operations. As same as : (onclick ="...") the code. If the operation is more complex, please use the onClick callback.

                    +

                    Because IE is different to other browsers in operating the event of ‘onclick’ and ‘click’ coexistence, please do not use this parameter to control whether to allow the redirection operation (for example: treeNode.click = "return false;"). If there is similar requirements, please do not use the 'url' attribute to save the website address, but use the 'onClick' callback to control jumps.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    Standard javascript syntax, for example: alert ("test"); etc.

                    +
                    +

                    Examples of treeNode

                    +

                    1. When click this node, will alert msg.

                    +
                    var nodes = [
                    +	{ "id":1, "name":"Google CN", "url":"http://g.cn", "click":"alert('test');"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.diy.html b/static/zTree3/api/en/treeNode.diy.html new file mode 100644 index 0000000..68c39ba --- /dev/null +++ b/static/zTree3/api/en/treeNode.diy.html @@ -0,0 +1,15 @@ +
                    +
                    +

                    ?treeNode.* DIY *

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to save other custom data of node, do not use the same attribute name with ztree used, the user can freely set.

                    +
                    +
                    +

                    Examples of treeNode

                    +

                    1. Use 'ename' attribute to save more info

                    +
                    var node = { "id":1, "name":"test1", "ename":"test eName"};
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.editNameFlag.html b/static/zTree3/api/en/treeNode.editNameFlag.html new file mode 100644 index 0000000..f60ef2a --- /dev/null +++ b/static/zTree3/api/en/treeNode.editNameFlag.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.editNameFlag

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to save the node editing name status. It is valid when [setting.edit.enable = true]

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: node is being edited.

                    +

                    false means: node is not being edited.

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getCheckStatus.html b/static/zTree3/api/en/treeNode.getCheckStatus.html new file mode 100644 index 0000000..3c9a2e6 --- /dev/null +++ b/static/zTree3/api/en/treeNode.getCheckStatus.html @@ -0,0 +1,63 @@ +
                    +
                    +

                    Function()treeNode.getCheckStatus

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Get the node's half-checked status of checkbox or radio. It is valid when [setting.check.enable = true]

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnJSON

                    +
                    {
                    +	checked: true, //As same as 'treeNode.checked'
                    +	half: true  //Rule the table below
                    +}
                    + + + + + + + + + + + + + + + + + + +
                    setting.check.checkType = "checkbox"
                    treeNode.checkedtreeNode.check_Child_StatetreeNode.halfCheck half
                    --truetrue
                     
                    true-1falsefalse
                    true0falsetrue
                    true1falsetrue
                    true2falsefalse
                     
                    false-1falsefalse
                    false0falsefalse
                    false1falsetrue
                    false2falsetrue
                    +
                    + + + + + + + + + + + + + + + + +
                    setting.check.checkType = "radio"
                    treeNode.checkedtreeNode.check_Child_StatetreeNode.halfCheck half
                    --truetrue
                     
                    true-1falsefalse
                    true0falsefalse
                    true2falsetrue
                     
                    false-1falsefalse
                    false0falsefalse
                    false2falsetrue
                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first root node's half-checked status

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var halfCheck = treeObj.getNodes()[0].getCheckStatus();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getIndex.html b/static/zTree3/api/en/treeNode.getIndex.html new file mode 100644 index 0000000..2c31cfe --- /dev/null +++ b/static/zTree3/api/en/treeNode.getIndex.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()treeNode.getIndex

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the treeNode's index in its parent node's children.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnNumber

                    +

                    the treeNode's index in its parent node's children. ( start at 0 )

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's index.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getIndex();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getNextNode.html b/static/zTree3/api/en/treeNode.getNextNode.html new file mode 100644 index 0000000..755aa6e --- /dev/null +++ b/static/zTree3/api/en/treeNode.getNextNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getNextNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the treeNode's next sibling node.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnJSON

                    +

                    JSON data object of the treeNode's next sibling node

                    +

                    If have not the next node, return null.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's next sibling node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getNextNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getParentNode.html b/static/zTree3/api/en/treeNode.getParentNode.html new file mode 100644 index 0000000..16bab30 --- /dev/null +++ b/static/zTree3/api/en/treeNode.getParentNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getParentNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the treeNode's parent node.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnJSON

                    +

                    JSON data object of treeNode's parent node.

                    +

                    If treeNode is root, return null.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's parent node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getParentNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getPath.html b/static/zTree3/api/en/treeNode.getPath.html new file mode 100644 index 0000000..5f81676 --- /dev/null +++ b/static/zTree3/api/en/treeNode.getPath.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()treeNode.getPath

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the treeNode's all parent nodes. (Include itself)

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnArray (JSON)

                    +

                    Array of treeNode's all parent nodes. (Include itself)

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's all parent nodes.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getPath();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.getPreNode.html b/static/zTree3/api/en/treeNode.getPreNode.html new file mode 100644 index 0000000..f6745b1 --- /dev/null +++ b/static/zTree3/api/en/treeNode.getPreNode.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function()treeNode.getPreNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the treeNode's previous sibling node.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    ReturnJSON

                    +

                    JSON data object of the treeNode's previous sibling node

                    +

                    If have not the previous node, return null.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's previous sibling node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var node = sNodes[0].getPreNode();
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.halfCheck.html b/static/zTree3/api/en/treeNode.halfCheck.html new file mode 100644 index 0000000..8375326 --- /dev/null +++ b/static/zTree3/api/en/treeNode.halfCheck.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    BooleantreeNode.halfCheck

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Force node checkBox / radio to the half-checked status. It is valid when [setting.check.enable = true & treeNode.nocheck = false]

                    +

                    1. If you force to the half-checked status, zTree will not automatically calculated the half-checked status about this node.

                    +

                    2. Until you set treeNode.halfCheck to false or null, zTree will automatically calculated the half-checked status about this node.

                    +

                    3. zTree support identification string 'true' & 'false'.

                    +

                    Defaul: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the checkbox or radio is half-checked when zTree is initialized.

                    +

                    false means: the half-checked status will be automatically calculated

                    +
                    +

                    Examples of treeNode

                    +

                    1. set the half-checked status when zTree is initialized

                    +
                    var nodes = [
                    +{ "id":1, "name":"test1", isParent:true, checked:true, halfCheck:true },
                    +{ "id":2, "name":"test2", isParent:true, checked:false, halfCheck:true },
                    +{ "id":3, "name":"test3", isParent:true, checked:true },
                    +{ "id":4, "name":"test4", isParent:true, checked:false }
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.icon.html b/static/zTree3/api/en/treeNode.icon.html new file mode 100644 index 0000000..4e1c99f --- /dev/null +++ b/static/zTree3/api/en/treeNode.icon.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.icon

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    URL path of node's custom icon.

                    +

                    1. If you only set the 'icon' attribute to parent node, the parent node will only show one icon when it is expanded or collapsed.

                    +

                    2. If you need to show two icons when it is expanded or collapsed, please set the 'treeNode.iconOpen' and 'treeNode.iconClose' attribute.

                    +

                    3. If you need to use css to set the custom icon, please set the 'treeNode.iconSkin' attribute.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    Icon image url can be a relative path or absolute path.

                    +

                    If use a relative path, please note the relationship between icon image and the page, ensure the correct image path.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Set the custom icon

                    +
                    var nodes = [
                    +	//Only show one icon when it is expanded or collapsed.
                    +	{ name:"Parent Node 1", icon:"/img/parent.gif"},
                    +
                    +	//Show two icons when it is expanded or collapsed.
                    +	{ name:"Parent Node 2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"},
                    +
                    +	//the custom icon for leaf node
                    +	{ name:"Leaf Node", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.iconClose.html b/static/zTree3/api/en/treeNode.iconClose.html new file mode 100644 index 0000000..2259e8f --- /dev/null +++ b/static/zTree3/api/en/treeNode.iconClose.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.iconClose

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    URL path of parent node's custom icon when it is collapsed.

                    +

                    1. Only parent node support this attribute.

                    +

                    2. This attribute must be used simultaneously with 'iconOpen' attribute.

                    +

                    3. If you need to use css to set the custom icon, please set the 'treeNode.iconSkin' attribute.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    Icon image url can be a relative path or absolute path.

                    +

                    If use a relative path, please note the relationship between icon image and the page, ensure the correct image path.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Set the custom icon

                    +
                    var nodes = [
                    +	//Only show one icon when it is expanded or collapsed.
                    +	{ name:"Parent Node 1", icon:"/img/parent.gif"},
                    +
                    +	//Show two icons when it is expanded or collapsed.
                    +	{ name:"Parent Node 2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"},
                    +
                    +	//the custom icon for leaf node
                    +	{ name:"Leaf Node", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.iconOpen.html b/static/zTree3/api/en/treeNode.iconOpen.html new file mode 100644 index 0000000..3203615 --- /dev/null +++ b/static/zTree3/api/en/treeNode.iconOpen.html @@ -0,0 +1,33 @@ +
                    +
                    +

                    StringtreeNode.iconOpen

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    URL path of parent node's custom icon when it is expanded.

                    +

                    1. Only parent node support this attribute.

                    +

                    2. This attribute must be used simultaneously with 'iconClose' attribute.

                    +

                    3. If you need to use css to set the custom icon, please set the 'treeNode.iconSkin' attribute.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    Icon image url can be a relative path or absolute path.

                    +

                    If use a relative path, please note the relationship between icon image and the page, ensure the correct image path.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Set the custom icon

                    +
                    var nodes = [
                    +	//Only show one icon when it is expanded or collapsed.
                    +	{ name:"Parent Node 1", icon:"/img/parent.gif"},
                    +
                    +	//Show two icons when it is expanded or collapsed.
                    +	{ name:"Parent Node 2", iconOpen:"/img/open.gif", iconClose:"/img/close.gif"},
                    +
                    +	//the custom icon for leaf node
                    +	{ name:"Leaf Node", icon:"/img/leaf.gif"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.iconSkin.html b/static/zTree3/api/en/treeNode.iconSkin.html new file mode 100644 index 0000000..fca7fbf --- /dev/null +++ b/static/zTree3/api/en/treeNode.iconSkin.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    StringtreeNode.iconSkin

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The className of node's custom icon.

                    +

                    1. You need to modify the css, add the definition of className.

                    +

                    2. The css is simple, convenient, and support the parent node to switch icons when it is expanded or collapsed.

                    +

                    3. Recommend the use of CSS Sprites, can reduce repeating load the image, to avoid image flicker.

                    +

                    4. The 'iconSkin' support IE6 in zTree v3.x.

                    +

                    5. If you need to use image's URL to set the custom icon, please set the 'treeNode.icon' or 'treeNode.iconOpen' or 'treeNode.iconClose' attribute.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    The string about custom icon's className.

                    +
                    +

                    Examples of css & treeNode

                    +

                    1. Set the custom icon

                    +
                    css example:
                    +.ztree li span.button.diy01_ico_open, .ztree li span.button.diy01_ico_close{...}
                    +
                    +.ztree li span.button.diy02_ico_open{...}
                    +.ztree li span.button.diy02_ico_close{...}
                    +
                    +.ztree li span.button.diy03_ico_docu{...}
                    +
                    +node's data example:
                    +var nodes = [
                    +	//Only show one icon when it is expanded or collapsed.
                    +	{ name:"Parent Node 1", iconSkin:"diy01"},
                    +
                    +	//Show two icons when it is expanded or collapsed.
                    +	{ name:"Parent Node 2", iconSkin:"diy02"},
                    +
                    +	//the custom icon for leaf node
                    +	{ name:"Leaf Node", iconSkin:"diy03"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isAjaxing.html b/static/zTree3/api/en/treeNode.isAjaxing.html new file mode 100644 index 0000000..ddadf41 --- /dev/null +++ b/static/zTree3/api/en/treeNode.isAjaxing.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    BooleantreeNode.isAjaxing

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Judge whether the node's child nodes being loaded asynchronously.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node's child nodes is being loaded asynchronously

                    +

                    false means: the node's child nodes is not being loaded asynchronously

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first selected node's child nodes being loaded asynchronously

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isAjaxing = sNodes[0].isAjaxing;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isFirstNode.html b/static/zTree3/api/en/treeNode.isFirstNode.html new file mode 100644 index 0000000..a8ee61c --- /dev/null +++ b/static/zTree3/api/en/treeNode.isFirstNode.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isFirstNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Judge whether the node is the sibling nodes's first node.

                    +

                    If you use the 'exhide' pack, so this attribute will only support the node which be shown.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node is first node.

                    +

                    false means: the node is not first node.

                    +

                    If the node has been hidden, isFirstNode = false

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first selected node is the sibling nodes's first node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isFirstNode = sNodes[0].isFirstNode;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isHidden.html b/static/zTree3/api/en/treeNode.isHidden.html new file mode 100644 index 0000000..3a07b94 --- /dev/null +++ b/static/zTree3/api/en/treeNode.isHidden.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isHidden

                    +

                    Overview[ depends on jquery.ztree.exhide js ]

                    +
                    +

                    +
                    +

                    Judge whether the node has been hidden.

                    +

                    1. When initialize zTree, the nodes which be set 'isHidden = true' will be hidden.

                    +

                    +

                    2. Please don't change this attribute of the nodes which have been created. If you want to hide or show nodes, please use 'hideNode() / hideNodes() / showNode() / showNodes()' methods.

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: this node is hidden.

                    +

                    false means: this node is shown.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first root node has been hidden.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getNodes();
                    +if (sNodes.length > 0) {
                    +	var isHidden = sNodes[0].isHidden;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isHover.html b/static/zTree3/api/en/treeNode.isHover.html new file mode 100644 index 0000000..e18ed0c --- /dev/null +++ b/static/zTree3/api/en/treeNode.isHover.html @@ -0,0 +1,19 @@ +
                    +
                    +

                    BooleantreeNode.isHover

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Used to record the hover status of node's DOM. For 'setting.view.addHoverDom / removeHoverDom'.

                    +

                    Do not initialize or modify it, it is an internal argument.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node's DOM is in hover.

                    +

                    false means: the node's DOM is not in hover.

                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isLastNode.html b/static/zTree3/api/en/treeNode.isLastNode.html new file mode 100644 index 0000000..cd2ca26 --- /dev/null +++ b/static/zTree3/api/en/treeNode.isLastNode.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isLastNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Judge whether the node is the sibling nodes's last node.

                    +

                    If you use the 'exhide' pack, so this attribute will only support the node which be shown.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node is last node.

                    +

                    false means: the node is not last node.

                    +

                    If the node has been hidden, isLastNode = false

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first selected node is the sibling nodes's last node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isLastNode = sNodes[0].isLastNode;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.isParent.html b/static/zTree3/api/en/treeNode.isParent.html new file mode 100644 index 0000000..dad4b81 --- /dev/null +++ b/static/zTree3/api/en/treeNode.isParent.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.isParent

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Judge whether the node is the parent node.

                    +

                    1. When zTree initialize the node data, the node which has children is set to true, otherwise false.

                    +

                    2. When zTree initialize the node data, if set treeNode.isParent to true, the node will be set to be parent node.

                    +

                    3. In order to solve the problem of someone make json data, supporting "false", "true" format of the data string.

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node is parent node.

                    +

                    false means: the node is not parent node.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first selected node is the parent node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isParent = sNodes[0].isParent;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.level.html b/static/zTree3/api/en/treeNode.level.html new file mode 100644 index 0000000..d151162 --- /dev/null +++ b/static/zTree3/api/en/treeNode.level.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    NumbertreeNode.level

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The level of node

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    Number Format

                    +
                    +

                    The root node's level = 0, and next level = 1, ...

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's level

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var level = sNodes[0].level;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.name.html b/static/zTree3/api/en/treeNode.name.html new file mode 100644 index 0000000..fa508cc --- /dev/null +++ b/static/zTree3/api/en/treeNode.name.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.name

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The node's name

                    +

                    1. If you want to change 'name' attribute, please modify the 'setting.data.key.name' attribute.

                    +

                    Default: undenfined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    String object. The HTML special characters are escaped

                    +
                    +

                    Examples of treeNode

                    +

                    1. Set node's name to 'test1', 'test2', 'test3'

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1"},
                    +	{ "id":2, "name":"test2"},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.nocheck.html b/static/zTree3/api/en/treeNode.nocheck.html new file mode 100644 index 0000000..6c4880c --- /dev/null +++ b/static/zTree3/api/en/treeNode.nocheck.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    BooleantreeNode.nocheck

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    1. Set node to hide the checkbox or radio. It is valid when [setting.check.enable = true]

                    +

                    2. zTree support identification string 'true' & 'false'.

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node hide the checkbox or radio, and don't affect the checked association, and don't affect its parent node's half-checked status.

                    +

                    false means: the node show the checkbox or radio.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Hide some node's checkbox / radio

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "nocheck":true},
                    +	{ "id":2, "name":"test2"},
                    +	{ "id":3, "name":"test3"}
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.open.html b/static/zTree3/api/en/treeNode.open.html new file mode 100644 index 0000000..bc910de --- /dev/null +++ b/static/zTree3/api/en/treeNode.open.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    BooleantreeNode.open

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to record the parent node's expand status.

                    +

                    1. When zTree initialize the node data, if you set treeNode.open = true, zTree will default expand this parent node.

                    +

                    2. Leaf node's 'open' attribute is false.

                    +

                    3. In order to solve the problem of someone make json data, supporting "false", "true" format of the data string.

                    +

                    4. When setting.async.enable = false, the parent node will be expanded which have no child nodes and its attribute 'open' is true. (v3.5.15+)

                    +

                    Default: false

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the parent node is expanded.

                    +

                    false means: the parent node is collapsed.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's expand status.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var isOpen = sNodes[0].open;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.parentTId.html b/static/zTree3/api/en/treeNode.parentTId.html new file mode 100644 index 0000000..0bc2a6d --- /dev/null +++ b/static/zTree3/api/en/treeNode.parentTId.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    StringtreeNode.parentTId

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The unique identifier of node's parent node.

                    +

                    1. zTree v3.x using 'parentTId' replaced the original 'parentNode' attribute, and increased getParentNode () method, in order to avoid the original 'parentNode' cause the clone () method infinite loop.

                    +

                    2. Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    String Format

                    +
                    +

                    String object of node's parent node's tId. please see API about 'treeNode.tId'

                    +

                    If treeNode is root node, parentTId is null.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's parent node's tId

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var parentTId = sNodes[0].parentTId;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.tId.html b/static/zTree3/api/en/treeNode.tId.html new file mode 100644 index 0000000..18c2855 --- /dev/null +++ b/static/zTree3/api/en/treeNode.tId.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.tId

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The unique identifier of node.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +
                    +
                    +

                    String Format

                    +
                    +

                    tId rules: setting.treeId + "_" + zTree counter

                    +
                    +

                    Examples of treeNode

                    +

                    1. Get the first selected node's tId

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var tId = sNodes[0].tId;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.target.html b/static/zTree3/api/en/treeNode.target.html new file mode 100644 index 0000000..176a7a3 --- /dev/null +++ b/static/zTree3/api/en/treeNode.target.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    StringtreeNode.target

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Used to set the target where the node is clicked to open url. It is valid when [treeNode.url exists]

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    As same as <a> tag's 'target' attribute. e.g. '_blank', '_self' or other window name.

                    +

                    if this attribute is omitted, zTree default set it to '_blank'

                    +
                    +

                    Exmaples of treeNode

                    +

                    1. Set target is '_blank'

                    +
                    var nodes = [
                    +	{ "id":1, "name":"test1", "url":"http://myTest.com", "target":"_blank"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.url.html b/static/zTree3/api/en/treeNode.url.html new file mode 100644 index 0000000..5552445 --- /dev/null +++ b/static/zTree3/api/en/treeNode.url.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    StringtreeNode.url

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The URL of node link

                    +

                    1. In edit mode (setting.edit.enable = true) , this feature fails. If you must use a similar feature, please use the 'onClick' callback for their own control.

                    +

                    2. If you use the 'onClick' callback function to control opening URL , then set the URL in the other custom attribute, do not use the 'url' attribute.

                    +

                    Default: undefined

                    +
                    +
                    +

                    String Format

                    +
                    +

                    As same as <a> tag's 'href' attribute.

                    +
                    +

                    Examples of treeNode

                    +

                    1. Set the URL is 'g.cn'

                    +
                    var nodes = [
                    +	{ "id":1, "name":"Google CN", "url":"http://g.cn"},
                    +	......
                    +]
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/treeNode.zAsync.html b/static/zTree3/api/en/treeNode.zAsync.html new file mode 100644 index 0000000..b3ff414 --- /dev/null +++ b/static/zTree3/api/en/treeNode.zAsync.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    BooleantreeNode.zAsync

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Judge whether the parent node's child nodes will be loaded asynchronously when the parent node is expanded.

                    +

                    Do not initialize or modify it, it is created by the zTree.

                    +

                    Default:false (the parent node which have no child nodes); true (the parent node which have child nodes or the leaf node)

                    +
                    +
                    +

                    Boolean Format

                    +
                    +

                    true means: the node's child nodes will not be loaded asynchronously when the parent node is expanded.

                    +

                    false means: the node's child nodes will be loaded asynchronously when the parent node is expanded.

                    +

                    This attribute will not effect to 'reAsyncChildNodes()' method

                    +
                    +

                    Examples of treeNode

                    +

                    1. Judge whether the first selected node's child nodes has been loaded asynchronously

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var sNodes = treeObj.getSelectedNodes();
                    +if (sNodes.length > 0) {
                    +	var zAsync = sNodes[0].zAsync;
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.addNodes.html b/static/zTree3/api/en/zTreeObj.addNodes.html new file mode 100644 index 0000000..c40caaf --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.addNodes.html @@ -0,0 +1,47 @@ +
                    +
                    +

                    Function(parentNode, [index], newNodes, isSilent)zTreeObj.addNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Add nodes

                    +

                    In order to avoid duplication data resulting from repeated initialization, zTree v3.x will automatically clone node data when zTree initialized or add nodes. If you need to get the data objects within the zTree, please get the return value of this method.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    parentNodeJSON

                    +

                    The additional node's parent node. If additional node is root node, please the parentNode is null.

                    +

                    Please ensure this node data object is a data object within zTree.

                    +

                    [index]Number

                    +

                    The index of the parentNode's children where the newnodes will be added (the value start from 0)

                    +

                    When index = -1, the newnodes will be added to the last

                    +

                    This parameter can be ignore.

                    +

                    v3.5.19+

                    +

                    newNodesJSON / Array(JSON)

                    +

                    The node data's JSON object collection which need to increase, refer to 'treeNode treeNode data details'

                    +

                    1. zTree v3.x support to add single node, that is, if you only add a node, you can don't use the array.

                    +

                    2. If you use simple data model, please refer to the attributes within the 'setting.data.simpleData'.

                    +

                    isSilentBoolean

                    +

                    Set whether to automatically expand the parent node, after add nodes.

                    +

                    isSilent = true means: don't auto expand the parent node. Otherwise auto expand.

                    +

                    Return Array(JSON)

                    +

                    return the new nodes in zTree

                    +

                    If the newNodes is single data object, the return value is a array with length is 1.

                    +

                    Note: the node data JSON object in the return value is not equal to the JSON object in the 'newNodes'.

                    +
                    +

                    Examples of function

                    +

                    1. Add one root node to zTree which id is 'tree'

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var newNode = {name:"newNode1"};
                    +newNode = treeObj.addNodes(null, newNode);
                    +
                    +

                    2. Add three root nodes to zTree which id is 'tree'

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var newNodes = [{name:"newNode1"}, {name:"newNode2"}, {name:"newNode3"}];
                    +newNodes = treeObj.addNodes(null, newNodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.cancelEditName.html b/static/zTree3/api/en/zTreeObj.cancelEditName.html new file mode 100644 index 0000000..8afdae0 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.cancelEditName.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(newName)zTreeObj.cancelEditName

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Cancel the edit name status. Can restore the original name, and can also force assigned to a new name.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    newNameString

                    +

                    Re given a new name

                    +

                    If this parameter is omitted, then restore the original name.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Cancel edit name, and restore the original name.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelEditName();
                    +
                    +

                    2. Cancel edit name , and set the new name.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelEditName("test_new_name");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.cancelSelectedNode.html b/static/zTree3/api/en/zTreeObj.cancelSelectedNode.html new file mode 100644 index 0000000..84c6c80 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.cancelSelectedNode.html @@ -0,0 +1,35 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.cancelSelectedNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    To cancel the selected node.

                    +

                    zTree v3.x support to select multiple nodes, so you can cancel a single selected node, and you can cancel all of the selected nodes too.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to cancel selected.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    If you omit this parameter, zTree will cancel all of the selected nodes.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Cancel all of the selected nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.cancelSelectedNode();
                    +
                    +

                    2. Cancel the first node of the selected nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) { 
                    +	treeObj.cancelSelectedNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.checkAllNodes.html b/static/zTree3/api/en/zTreeObj.checkAllNodes.html new file mode 100644 index 0000000..276b629 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.checkAllNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(checked)zTreeObj.checkAllNodes

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Check or unCheck all nodes which have been initialized. It is valid when [setting.check.enable = true & setting.check.chkStyle = "checkbox"]

                    +

                    This method does not trigger 'beforeCheck' or 'onCheck' callback function.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    checkedBoolean

                    +

                    checked = true means: check all nodes.

                    +

                    checked = false means: uncheck all nodes.

                    +

                    Don't affect the node which 'nochecked' attribute is true.

                    +

                    Don't affect the node is not loaded.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. check all nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.checkAllNodes(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.checkNode.html b/static/zTree3/api/en/zTreeObj.checkNode.html new file mode 100644 index 0000000..7411ef8 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.checkNode.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(treeNode, checked, checkTypeFlag, callbackFlag)zTreeObj.checkNode

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Check or unCheck a single node. It is valid when [setting.check.enable = true]

                    +

                    Use checkNode() method of zTree v3.x can trigger 'beforeCheck' or 'onCheck' callback function. for reduce redundant code.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to be checked or unchecked.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    checkedBoolean

                    +

                    checked = true means: check node.

                    +

                    checked = false means: uncheck node.

                    +

                    If this parameter is omitted, then toggle check or uncheck depend this node's expanded state.

                    +

                    Don't affect the node which 'nochecked' attribute is true.

                    +

                    checkTypeFlagBoolean

                    +

                    checkTypeFlag = true means: According to 'setting.check.chkboxType' attribute automatically check or uncheck the parent and child nodes.

                    +

                    checkTypeFlag = false means: only check or uncheck this node, don't affect its parent and child nodes.

                    +

                    When checkTypeFlag = false and treeNode.checked = checked, will not trigger callback function.

                    +

                    Don't affect the parent and child nodes which 'nochecked' attribute is true.

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true means: call this method, will trigger 'beforeCheck' & 'onCheck' callback.

                    +

                    callbackFlag = false means: call this method, will not trigger callback.

                    +

                    If this parameter is omitted, it is same as 'callbackFlag = false'

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. check the selected nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.checkNode(nodes[i], true, true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.copyNode.html b/static/zTree3/api/en/zTreeObj.copyNode.html new file mode 100644 index 0000000..ff7b5b5 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.copyNode.html @@ -0,0 +1,47 @@ +
                    +
                    +

                    Function(targetNode, treeNode, moveType, isSilent)zTreeObj.copyNode

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Copy the node

                    +

                    When copy nodes, zTree v3.x will clone nodes. If you need to get the data object in zTree, please get the return value of this method.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    targetNodeJSON

                    +

                    JSON data object of the node to be target.

                    +

                    If copy the node to root node, please set the 'targetNode' to null.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be copied.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    moveTypeString

                    +

                    Copied to the target node's relative position.

                    +

                    "inner" means: to be taregetNode's child node.

                    +

                    "prev" means: to be taregetNode's previous sibling node.

                    +

                    "next" means: to be taregetNode's next sibling node.

                    +

                    isSilentBoolean

                    +

                    After copy the node, whether to automatically expand its parent node.

                    +

                    isSilent = true means: don't expand its parent node.

                    +

                    isSilent = false or omit this parameter means: expand its parent node.

                    +

                    Return JSON

                    +

                    return the new node in zTree

                    +

                    Note: the node data JSON object in the return value is not equal to the treeNode.

                    +
                    +

                    Examples of function

                    +

                    1. Copy the second root node to the first root node's child node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.copyNode(nodes[0], nodes[1], "inner");
                    +
                    +

                    2. Copy the second root node to the first root node's previous sibling node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.copyNode(nodes[0], nodes[1], "before");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.destroy.html b/static/zTree3/api/en/zTreeObj.destroy.html new file mode 100644 index 0000000..80c5281 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.destroy.html @@ -0,0 +1,25 @@ +
                    +
                    +

                    Function(treeId)zTreeObj.destroy

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    From zTree v3.4, zTree support the method for destruction.

                    +

                    1. This method can destroy the zTreeObj's zTree.

                    +

                    2. If you want to destory all of the zTrees, you can use the '$.fn.zTree.destroy()' method.

                    +

                    3. If you want to use the tree which has been destroyed, you must use the 'init()' method at first.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. destroy the zTree which its id is 'treeDemo'

                    +
                    var zTreeObj = $.fn.zTree.getZTreeObj("treeDemo");
                    +zTreeObj.destroy();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.editName.html b/static/zTree3/api/en/zTreeObj.editName.html new file mode 100644 index 0000000..f8df264 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.editName.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.editName

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Start editing the node's name.

                    +

                    1. If need to cancel editing the node's name, please use cancelEditName(newName) method.

                    +

                    2. This method can be used to set the editing node‘s input box to get focus.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be editing name

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Retrun none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Start editing the first selected node's name.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.editName(nodes[0]);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.expandAll.html b/static/zTree3/api/en/zTreeObj.expandAll.html new file mode 100644 index 0000000..ef28a31 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.expandAll.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(expandFlag)zTreeObj.expandAll

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Expand or collapse all nodes.

                    +

                    This method does not trigger 'beforeExpand / onExpand' or 'beforeCollapse / onCollapse' callback function.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    expandFlagBoolean

                    +

                    expandFlag = true means: expand all nodes.

                    +

                    expandFlag = false means: collapse all nodes.

                    +

                    Return Boolean

                    +

                    return the result of expand or collapse.

                    +

                    true means: expand all nodes

                    +

                    false means: collapse all nodes

                    +

                    null means: have no parent node to expand or collapse.

                    +
                    +

                    Examples of function

                    +

                    1. Expand all nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.expandAll(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.expandNode.html b/static/zTree3/api/en/zTreeObj.expandNode.html new file mode 100644 index 0000000..01e7442 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.expandNode.html @@ -0,0 +1,50 @@ +
                    +
                    +

                    Function(treeNode, expandFlag, sonSign, focus, callbackFlag)zTreeObj.expandNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Expand or collapse single node.

                    +

                    Use expandNode() method of zTree v3.x can trigger 'beforeExpand / onExpand' or 'beforeCollapse / onCollapse' callback function. for reduce redundant code.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be expanded or collapsed

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    expandFlagBoolean

                    +

                    expandFlag = true means: expand the node.

                    +

                    expandFlag = false means: collapse the node.

                    +

                    If this parameter is omitted, then toggle expand or collapse depend this node's expanded state.

                    +

                    sonSignBoolean

                    +

                    sonSign = true means: expand or collapse all of the child nodes depend the 'expandFlag' parameter.

                    +

                    sonSign = false means: only expand or collapse this node.

                    +

                    When sonSign = false and treeNode.open = expandFlag, will not trigger the callback.

                    +

                    If this parameter is omitted, it is same as 'sonSign = false'.

                    +

                    focusBoolean

                    +

                    focus = true means: after expand or collapse, set the focus of this node for view.

                    +

                    focus = false means: after expand or coolapse, don't set the focus of this node.

                    +

                    If this parameter is omitted, it is same as 'focus = true'.

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true means: call this method, will trigger 'beforeExpand / onExpand' or 'beforeCollapse / onCollapse' callback.

                    +

                    callbackFlag = false means: call this method, will not trigger callback.

                    +

                    If this parameter is omitted, it is same as 'callbackFlag = false'

                    +

                    Return Boolean

                    +

                    return the result of expand or collapse.

                    +

                    true means: expand node

                    +

                    false means: collapse node

                    +

                    null means: the node is not parent node.

                    +
                    +

                    Examples of function

                    +

                    1. Expand the first selected node. (and expand this node's child nodes)

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	treeObj.expandNode(nodes[0], true, true, true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getChangeCheckedNodes.html b/static/zTree3/api/en/zTreeObj.getChangeCheckedNodes.html new file mode 100644 index 0000000..d0f9cf3 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getChangeCheckedNodes.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Function()zTreeObj.getChangeCheckedNodes

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Get the collection of nodes which be changed checked status. (Compared with the original data checkedOld) It is valid when [setting.check.enable = true]

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    Return Array(JSON)

                    +

                    return the collection of nodes which be changed checked status (Array)

                    +

                    If you need to get the collection of nodes which changed the checked status, when nodes be checked or unchecked, so please set treeNode.checkedOld = treeNode.checked ( for all of the be changed checked status nodes ).

                    +
                    +

                    Examples of function

                    +

                    1. Get the collection of nodes which be changed checked status

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getChangeCheckedNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getCheckedNodes.html b/static/zTree3/api/en/zTreeObj.getCheckedNodes.html new file mode 100644 index 0000000..7a7c3b9 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getCheckedNodes.html @@ -0,0 +1,28 @@ +
                    +
                    +

                    Function(checked)zTreeObj.getCheckedNodes

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Get the collection of nodes which be checked or unchecked. It is valid when [setting.check.enable = true]

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    checkedBoolean

                    +

                    checked = true means: get the collection of nodes which be checked

                    +

                    checked = false means: get the collection of nodes which be unchecked

                    +

                    If this parameter is omitted, it is same as 'checked = true'

                    +

                    Don't get the nodes which 'nochecked' attribute is true.

                    +

                    Return Array(JSON)

                    +

                    return the collection of nodes which be checked or unchecked. (Array)

                    +
                    +

                    Examples of function

                    +

                    1. Get the collection of nodes which be checked.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getCheckedNodes(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodeByParam.html b/static/zTree3/api/en/zTreeObj.getNodeByParam.html new file mode 100644 index 0000000..05572e7 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodeByParam.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodeByParam

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    According to the node data attribute, search the node which exactly matches, and get the JSON object of node.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    keyString

                    +

                    The name of attribute which need to exactly match

                    +

                    value?

                    +

                    The value which need to exactly match, can be any type, please ensure its type consistent with the attribute values.

                    +

                    parentNodeJSON

                    +

                    The search range, you can search node from a parent node's child nodes.

                    +

                    If this parameter is omitted, zTree will search node from all nodes.

                    +

                    Return JSON

                    +

                    JSON data object of the node which be searched.

                    +

                    1. If search none node, return null.

                    +

                    2. If there are many nodes can be searched, return the first node.

                    +
                    +

                    Examples of function

                    +

                    1. Search the node which its 'id' attribute is 1.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByParam("id", 1, null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodeByTId.html b/static/zTree3/api/en/zTreeObj.getNodeByTId.html new file mode 100644 index 0000000..8fd26ea --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodeByTId.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(tId)zTreeObj.getNodeByTId

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    According the unique identifier tId of zTree, quick get the node's JSON data object.

                    +

                    Get the node from the cache, don't need to search from all nodes.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    tIdString

                    +

                    The unique identifier of node.

                    +

                    Return JSON

                    +

                    JSON data object of the node which be searched.

                    +

                    If no result, return null.

                    +
                    +

                    Examples of function

                    +

                    1. 1. Search the node which its 'tId' attribute is 'tree_10'

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByTId("tree_10");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodeIndex.html b/static/zTree3/api/en/zTreeObj.getNodeIndex.html new file mode 100644 index 0000000..ad828e7 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodeIndex.html @@ -0,0 +1,30 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.getNodeIndex

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the node's index in the same level nodes. (start from 0)

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to get index.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Return Number

                    +

                    return the index. (start from 0)

                    +

                    If there is no this node, return -1.

                    +
                    +

                    Examples of function

                    +

                    1. Get the first selected node's index in the same level nodes.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	var index = treeObj.getNodeIndex(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodes.html b/static/zTree3/api/en/zTreeObj.getNodes.html new file mode 100644 index 0000000..5906a43 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodes.html @@ -0,0 +1,26 @@ +
                    +
                    +

                    Function()zTreeObj.getNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get all of the nodes in zTree

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    Return Array(JSON)

                    +

                    return all of the nodes

                    +

                    1. This array is a collection of the root nodes (the default child nodes are in the 'children' attributes);

                    +

                    2. Traverse all the nodes need to use recursion, or the use of transformToArray() method make the nodes to be a simple array.

                    +

                    3. For the asynchronous loading mode, can't get the nodes which are yet loaded.

                    +
                    +

                    Examples of function

                    +

                    1. Get all of the nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodesByFilter.html b/static/zTree3/api/en/zTreeObj.getNodesByFilter.html new file mode 100644 index 0000000..2cd6baa --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodesByFilter.html @@ -0,0 +1,43 @@ +
                    +
                    +

                    Function(filter, isSingle, parentNode, invokeParam)zTreeObj.getNodesByFilter

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Search the single node's data or collection of nodes's data by custom rules.

                    +

                    Can be customized complex search rules.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    filterFunction

                    +

                    Custom search function. e.g. function filter(node) {...}

                    +

                    filter's parameter: node (node's data -- JSON)

                    +

                    filter's return: boolean (true means: match the rules; false means: don't match the rules)

                    +

                    isSingleBoolean

                    +

                    isSingle = true means: search only one node

                    +

                    isSingle = false means: search the array of the nodes

                    +

                    If this parameter is omitted, as same as false

                    +

                    parentNodeJSON

                    +

                    The search range, you can search node from a parent node's child nodes.

                    +

                    If this parameter is omitted, zTree will search node from all nodes.

                    +

                    invokeParamanything

                    +

                    Custom data object by user, used to calculate in the filter function.

                    +

                    Return Array(JSON) / JSON

                    +

                    If isSingle = true, will return the first node's data (JSON) what be matched. If no match, return null.

                    +

                    If isSingle = false, will return the array of all nodes's data what be matched. if no match, return [ ].

                    +
                    +

                    Examples of function

                    +

                    1. Search the nodes which their 'name' contains 'test' and 'level' is 2.

                    +
                    function filter(node) {
                    +    return (node.level == 2 && node.name.indexOf("test")>-1);
                    +}
                    +......
                    +var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodesByFilter(filter, true); // search only one node
                    +var nodes = treeObj.getNodesByFilter(filter); // search the array of the nodes
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodesByParam.html b/static/zTree3/api/en/zTreeObj.getNodesByParam.html new file mode 100644 index 0000000..3173af4 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodesByParam.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodesByParam

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    According to the node data attribute, search the nodes which exactly matches, and get the JSON objects collection of nodes.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    keyString

                    +

                    The name of attribute which need to exactly match

                    +

                    value?

                    +

                    The value which need to exactly match, can be any type, please ensure its type consistent with the attribute values.

                    +

                    parentNodeJSON

                    +

                    The search range, you can search node from a parent node's child nodes.

                    +

                    If this parameter is omitted, zTree will search node from all nodes.

                    +

                    Return Array(JSON)

                    +

                    The JSON data objects collection of the nodes which be searched.

                    +

                    If search none node, return [ ].

                    +
                    +

                    Examples of function

                    +

                    1. Search the nodes which their 'name' attribute is 'test'.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParam("name", "test", null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getNodesByParamFuzzy.html b/static/zTree3/api/en/zTreeObj.getNodesByParamFuzzy.html new file mode 100644 index 0000000..14b6c29 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getNodesByParamFuzzy.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(key, value, parentNode)zTreeObj.getNodesByParamFuzzy

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    According to the node data attribute, search the nodes which fuzzy matches, and get the JSON objects collection of nodes.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    keyString

                    +

                    The name of attribute which need to fuzzy match

                    +

                    valueString

                    +

                    The value which need to fuzzy match.

                    +

                    The type of value can only be String

                    +

                    parentNodeJSON

                    +

                    The search range, you can search node from a parent node's child nodes.

                    +

                    If this parameter is omitted, zTree will search node from all nodes.

                    +

                    Return Array(JSON)

                    +

                    The JSON data objects collection of the nodes which be searched.

                    +

                    If search none node, return [ ].

                    +
                    +

                    Examples of function

                    +

                    1. Search the nodes which their 'name' attribute contains the string 'test'.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParamFuzzy("name", "test", null);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.getSelectedNodes.html b/static/zTree3/api/en/zTreeObj.getSelectedNodes.html new file mode 100644 index 0000000..4a0f060 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.getSelectedNodes.html @@ -0,0 +1,23 @@ +
                    +
                    +

                    Function()zTreeObj.getSelectedNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Get the JSON data objects collection of the selected nodes in zTree.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    Return Array(JSON)

                    +

                    The JSON data objects collection of the selected nodes.

                    +
                    +

                    Examples of function

                    +

                    1. get the selected nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.hideNode.html b/static/zTree3/api/en/zTreeObj.hideNode.html new file mode 100644 index 0000000..8ddb684 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.hideNode.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.hideNode

                    +

                    Overview[ depends on jquery.ztree.exhide js ]

                    +
                    +

                    +
                    +

                    To hide any node.

                    +

                    1. This feature can't support the 'exedit' feature, so please don't use this feature in edit mode.

                    +

                    2. If you hide or show the nodes, it will effect the 'isFirstNode' and 'isLastNode' attribute.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be hidden

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Retrun none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. hide the first root node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.hideNode(nodes[0]);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.hideNodes.html b/static/zTree3/api/en/zTreeObj.hideNodes.html new file mode 100644 index 0000000..9bf8e6b --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.hideNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.hideNodes

                    +

                    Overview[ depends on jquery.ztree.exhide js ]

                    +
                    +

                    +
                    +

                    To hide a group of nodes.

                    +

                    1. This feature can't support the 'exedit' feature, so please don't use this feature in edit mode.

                    +

                    2. If you hide or show the nodes, it will effect the 'isFirstNode' and 'isLastNode' attribute.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodesArray(JSON)

                    +

                    the array of the nodes which will be hidden

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Retrun none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. hide the first root node's children.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.hideNodes(nodes[0].children);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.moveNode.html b/static/zTree3/api/en/zTreeObj.moveNode.html new file mode 100644 index 0000000..1f3b88c --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.moveNode.html @@ -0,0 +1,49 @@ +
                    +
                    +

                    Function(targetNode, treeNode, moveType, isSilent)zTreeObj.moveNode

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Move the node

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    targetNodeJSON

                    +

                    JSON data object of the node to be target.

                    +

                    If move the node to root node, please set the 'targetNode' to null.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be moved.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    moveTypeString

                    +

                    Moved to the target node's relative position.

                    +

                    "inner" means: to be taregetNode's child node.

                    +

                    "prev" means: to be taregetNode's previous sibling node.

                    +

                    "next" means: to be taregetNode's next sibling node.

                    +

                    isSilentBoolean

                    +

                    After move the node, whether to automatically expand its parent node.

                    +

                    isSilent = true means: don't expand its parent node.

                    +

                    isSilent = false or omit this parameter means: expand its parent node.

                    +

                    Return JSON

                    +

                    return the node which be moved, it is same as the 'treeNode' parameter.

                    +

                    Return null means: move node has failed. The cause:
                    +  1. the targetNode is the treeNode's parent node, and moveType = "inner"
                    +  2. the targetNode is the treeNode's child node. +

                    +
                    +

                    Examples of function

                    +

                    1. Move the second root node to the first root node's child node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.moveNode(nodes[0], nodes[1], "inner");
                    +
                    +

                    2. Move the second root node to the first root node's previous sibling node.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +treeObj.moveNode(nodes[0], nodes[1], "prev");
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.reAsyncChildNodes.html b/static/zTree3/api/en/zTreeObj.reAsyncChildNodes.html new file mode 100644 index 0000000..63a0896 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.reAsyncChildNodes.html @@ -0,0 +1,42 @@ +
                    +
                    +

                    Function(parentNode, reloadType, isSilent)zTreeObj.reAsyncChildNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Forced asynchronous loading child nodes of parent node. It is valid when [setting.async.enable = true]

                    +

                    You can use this method to reload child nodes.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    parentNodeJSON

                    +

                    The parent node which will asynchronous loading child nodes.

                    +

                    1. If parentNode = null, it is same as reload root nodes.

                    +

                    2. If parentNode.isParent = false, don't load nodes.

                    +

                    3. Please ensure that this data object is an internal node data object in zTree.

                    +

                    reloadTypeString

                    +

                    reloadType = "refresh" means: reload child nodes.

                    +

                    reloadType != "refresh" means: append to load child nodes.

                    +

                    isSilentBoolean

                    +

                    Set whether to automatically expand the parent node, after load nodes.

                    +

                    isSilent = true means: don't auto expand the parent node. Otherwise auto expand.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. reload root nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.reAsyncChildNodes(null, "refresh");
                    +
                    +

                    2. reload the first selected node's child nodes.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes.length>0) {
                    +	treeObj.reAsyncChildNodes(nodes[0], "refresh");
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.refresh.html b/static/zTree3/api/en/zTreeObj.refresh.html new file mode 100644 index 0000000..8316192 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.refresh.html @@ -0,0 +1,24 @@ +
                    +
                    +

                    Function()zTreeObj.refresh

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Refresh zTree

                    +

                    If you have no special need, try not to use this method. If you refresh single node, please use updateNode() method. If you refresh child nodes in dynamic mode, please use the reAsyncChildNodes() method.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. refresh zTree

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.refresh();
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.removeChildNodes.html b/static/zTree3/api/en/zTreeObj.removeChildNodes.html new file mode 100644 index 0000000..c249e17 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.removeChildNodes.html @@ -0,0 +1,32 @@ +
                    +
                    +

                    Function(parentNode)zTreeObj.removeChildNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Remove a parent node's child nodes

                    +

                    1. After remove child nodes, the parent node will become a leaf node. Such as the need to maintain the parent node is still a parent node, set 'setting.data.keep.parent' attribute.

                    +

                    2. Do not use this method to empty the root. If you need to empty the root, you can initialization zTree, and set the initial nodes is null.

                    +

                    3. This method does not trigger any callback function.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    parentNodeJSON

                    +

                    The parent node which need to clear its child nodes.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Return Array(JSON)

                    +

                    Return the parent node's child nodes which have been removed. If has no child nodes, return null.

                    +
                    +

                    Examples of function

                    +

                    1. Remove the first selected node's child nodes

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +if (nodes && nodes.length>0) {
                    +	treeObj.removeChildNodes(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.removeNode.html b/static/zTree3/api/en/zTreeObj.removeNode.html new file mode 100644 index 0000000..67ad7e2 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.removeNode.html @@ -0,0 +1,34 @@ +
                    +
                    +

                    Function(treeNode, callbackFlag)zTreeObj.removeNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Remove a node

                    +

                    Use removeNode() method of zTree v3.x can trigger 'beforeRemove / onRemove' callback function. for reduce redundant code.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be removed.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    callbackFlagBoolean

                    +

                    callbackFlag = true means: call this method, will trigger 'beforeRemove' & 'onRemove' callback.

                    +

                    callbackFlag = false means: call this method, will not trigger callback.

                    +

                    If this parameter is omitted, it is same as 'callbackFlag = false'

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Remove all of the selected nodes.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.removeNode(nodes[i]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.selectNode.html b/static/zTree3/api/en/zTreeObj.selectNode.html new file mode 100644 index 0000000..45c4c10 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.selectNode.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeNode, addFlag, isSilent)zTreeObj.selectNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Select a node

                    +

                    zTree v3.x supports select multiple nodes.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node to be selected.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    addFlagBoolean

                    +

                    addFlag = true means: append to select node, don't affect the previously selected node, can select multiple nodes.

                    +

                    addFlag = false (default) means: select single node, prior the selected node is deselected.

                    +

                    If setting.view.selectedMulti = false, this para, this parameter is not valid, always select single node

                    +

                    isSilent = true means: when you select node, zTree will not scroll the node into view.

                    +

                    isSilent = false (default) means: when you select node, zTree will scroll the node into view.

                    +

                    (v3.5.23+)

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Exampleso of function

                    +

                    1. Select single node which be first selected.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +if (nodes.length>0) {
                    +	treeObj.selectNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.setChkDisabled.html b/static/zTree3/api/en/zTreeObj.setChkDisabled.html new file mode 100644 index 0000000..ced5869 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.setChkDisabled.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(node, disabled, inheritParent, inheritChildren)zTreeObj.setChkDisabled

                    +

                    Overview[ depends on jquery.ztree.excheck js ]

                    +
                    +

                    +
                    +

                    Set the node's checkbox or radio is disabled or remove disabled. It is valid when [setting.check.enable = true]

                    +

                    1. After the node's checkbox / radio is disabled, it can not be checked or unchecked, but it can affect the half-checked status of the parent node.

                    +

                    2. Please do not directly modify the 'chkDisabled' attribute of the loaded node.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to be checked or unchecked.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    disabledBoolean

                    +

                    disabled = true means: the node's checkbox / radio is disabled.

                    +

                    disabled = false means: the node's checkbox / radio is removed disabled.

                    +

                    If this parameter is omitted, it is same as disabled = false

                    +

                    Don't affect the node which 'nochecked' attribute is true.

                    +

                    inheritParentBoolean

                    +

                    inheritParent = true means: all parent nodes's disabled status will be same as this node.

                    +

                    inheritParent = false means: all parent nodes's disabled status will be not affected.

                    +

                    If this parameter is omitted, it is same as 'inheritParent = false'

                    +

                    inheritChildrenBoolean

                    +

                    inheritChildren = true means: all child nodes's disabled status will be same as this node.

                    +

                    inheritChildren = false means: all child nodes's disabled status will be not affected.

                    +

                    If this parameter is omitted, it is same as 'inheritChildren = false'

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Set the selected nodes's checkbox / radio to disable.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getSelectedNodes();
                    +for (var i=0, l=nodes.length; i < l; i++) {
                    +	treeObj.setChkDisabled(nodes[i], true);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.setEditable.html b/static/zTree3/api/en/zTreeObj.setEditable.html new file mode 100644 index 0000000..a44b0ff --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.setEditable.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(editable)zTreeObj.setEditable

                    +

                    Overview[ depends on jquery.ztree.exedit js ]

                    +
                    +

                    +
                    +

                    Edit mode and normal mode switch.

                    +

                    To use edit mode, please set the attributes in 'setting.edit'

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    editableBoolean

                    +

                    true means: set zTree to edit mode.

                    +

                    false means: set zTree to normal mode.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. set zTree to edit mode

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +treeObj.setEditable(true);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.setting.html b/static/zTree3/api/en/zTreeObj.setting.html new file mode 100644 index 0000000..d80c139 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.setting.html @@ -0,0 +1,14 @@ +
                    +
                    +

                    JSONzTreeObj.setting

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    The configuration data of zTree, refer to "setting details"

                    +

                    zTree v3.x to cancel the original operation setting method, so users can modify.

                    +

                    Note: Modify the parameters which affect zTree initialization will not work, please first understand the different attributes.

                    +
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.showNode.html b/static/zTree3/api/en/zTreeObj.showNode.html new file mode 100644 index 0000000..08b2a06 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.showNode.html @@ -0,0 +1,31 @@ +
                    +
                    +

                    Function(treeNode)zTreeObj.showNode

                    +

                    Overview[ depends on jquery.ztree.exhide js ]

                    +
                    +

                    +
                    +

                    To hide any node which be hidden.

                    +

                    1. This feature can't support the 'exedit' feature, so please don't use this feature in edit mode.

                    +

                    2. If you hide or show the nodes, it will effect the 'isFirstNode' and 'isLastNode' attribute.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodesArray(JSON)

                    +

                    JSON data object of the node to be shown

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Retrun none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. show someone node which be hidden.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var node = treeObj.getNodeByParam("isHidden", true);
                    +if (node) {
                    +  treeObj.showNode(node);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.showNodes.html b/static/zTree3/api/en/zTreeObj.showNodes.html new file mode 100644 index 0000000..c0c926c --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.showNodes.html @@ -0,0 +1,29 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.showNodes

                    +

                    Overview[ depends on jquery.ztree.exhide js ]

                    +
                    +

                    +
                    +

                    To show a group of nodes which be hidden.

                    +

                    1. This feature can't support the 'exedit' feature, so please don't use this feature in edit mode.

                    +

                    2. If you hide or show the nodes, it will effect the 'isFirstNode' and 'isLastNode' attribute.

                    +

                    3. Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodesArray(JSON)

                    +

                    the array of the nodes which will be shown

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    Retrun none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. show all of the nodes which be hidden.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodesByParam("isHidden", true);
                    +treeObj.showNodes(nodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.transformToArray.html b/static/zTree3/api/en/zTreeObj.transformToArray.html new file mode 100644 index 0000000..4b2296d --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.transformToArray.html @@ -0,0 +1,27 @@ +
                    +
                    +

                    Function(treeNodes)zTreeObj.transformToArray

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    +

                    Transform the zTree nodes data into simple array. (To avoid the user to write code to traverse all nodes)

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodesArray(JSON) / JSON

                    +

                    JSON data object of the node which need to be transformed.

                    +

                    or JSON data objects collection of the nodes which need to be transformed.

                    +

                    Return Array(JSON)

                    +

                    The JSON data objects array of the nodes which be transformed.

                    +
                    +

                    Examples of function

                    +

                    1. Transform the zTree nodes data into simple array.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.transformToArray(treeObj.getNodes());
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.transformTozTreeNodes.html b/static/zTree3/api/en/zTreeObj.transformTozTreeNodes.html new file mode 100644 index 0000000..7015016 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.transformTozTreeNodes.html @@ -0,0 +1,44 @@ +
                    +
                    +

                    Function(simpleNodes)zTreeObj.transformTozTreeNodes

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Transform the simple array into zTree nodes data.

                    +

                    If you use this method, you must set 'setting.data.simpleData.idKey' and 'setting.data.simpleData.pIdKey' attribute, and let the data are consistent with parent-child relationship.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    simpleNodesArray(JSON) / JSON

                    +

                    JSON data object of the node which need to be transformed.

                    +

                    or JSON data objects array of the nodes which need to be transformed.

                    +

                    Return Array(JSON)

                    +

                    Standard data which zTree use. The child nodes are stored in the parent node's 'children' attribute.

                    +

                    If simpleNodes is a single JSON, so the return array's length is 1.

                    +
                    +

                    Examples of function

                    +

                    1. Transform the simple array data into zTree nodes format.

                    +
                    var setting = {
                    +	data: {
                    +		simpleData: {
                    +			enable: true,
                    +			idKey: "id",
                    +			pIdKey: "pId",
                    +			rootPId: 0
                    +		}
                    +	}
                    +};
                    +var simpleNodes = [
                    +    {"id":1, "pId":0, "name":"test1"},
                    +    {"id":11, "pId":1, "name":"test11"},
                    +    {"id":12, "pId":1, "name":"test12"},
                    +    {"id":111, "pId":11, "name":"test111"}
                    +];
                    +var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.transformTozTreeNodes(simpleNodes);
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/api/en/zTreeObj.updateNode.html b/static/zTree3/api/en/zTreeObj.updateNode.html new file mode 100644 index 0000000..7639ff4 --- /dev/null +++ b/static/zTree3/api/en/zTreeObj.updateNode.html @@ -0,0 +1,37 @@ +
                    +
                    +

                    Function(treeNode, checkTypeFlag)zTreeObj.updateNode

                    +

                    Overview[ depends on jquery.ztree.core js ]

                    +
                    +

                    +
                    +

                    Update node data. Primarily used to update the node's DOM.

                    +

                    1. Can update the attributes for display (e.g. 'name', 'target', 'url', 'icon', 'iconSkin', 'checked', 'nocheck'), do not update the other attributes. For example: If you need to expand the node, please use expandNode() method, do not modify the 'open' attribute.

                    +

                    2. Use updateNode() method of zTree can't trigger 'beforeCheck' or 'onCheck' callback function.

                    +

                    Please use zTree object to executing the method.

                    +
                    +
                    +

                    Function Parameter Descriptions

                    +
                    +

                    treeNodeJSON

                    +

                    JSON data object of the node which need to update.

                    +

                    Please ensure that this data object is an internal node data object in zTree.

                    +

                    checkTypeFlagBoolean

                    +

                    checkTypeFlag = true means: According to 'setting.check.chkboxType' attribute automatically check or uncheck the parent and child nodes.

                    +

                    checkTypeFlag = false means: only check or uncheck this node, don't affect its parent and child nodes.

                    +

                    This parameter is valid when 'setting.check.enable = true' and 'setting.check.chkStyle = "checkbox"'

                    +

                    Don't affect the parent and child nodes which 'nochecked' attribute is true.

                    +

                    Return none

                    +

                    no return value

                    +
                    +

                    Examples of function

                    +

                    1. Modify the first selected node's name, and update it.

                    +
                    var treeObj = $.fn.zTree.getZTreeObj("tree");
                    +var nodes = treeObj.getNodes();
                    +if (nodes.length>0) {
                    +	nodes[0].name = "test";
                    +	treeObj.updateNode(nodes[0]);
                    +}
                    +
                    +
                    +
                    \ No newline at end of file diff --git a/static/zTree3/css/awesomeStyle/awesome.css b/static/zTree3/css/awesomeStyle/awesome.css new file mode 100644 index 0000000..c1fcf3a --- /dev/null +++ b/static/zTree3/css/awesomeStyle/awesome.css @@ -0,0 +1,386 @@ +/*------------------------------------- +zTree Style using fontawesome instead of images + +version: 1.1 +author: Mike King +email: mikkelking @ hotmail . com +website: http://code.google.com/p/jquerytree/ + +-------------------------------------*/ +/* Definitions ----------------------*/ +/* End of Definitions ---------------*/ +/* Imports -------------------------*/ +/* End of Imports ------------------*/ +.ztree * { + padding: 0; + margin: 0; + font-size: 12px; + font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif; + background-color: #af0000; +} +.ztree { + margin: 0; + padding: 5px; + color: #ffffff; + background-color: #af0000; +} +.ztree li { + padding: 0; + margin: 0; + list-style: none; + line-height: 17px; + text-align: left; + white-space: nowrap; + outline: 0; +} +.ztree li ul { + margin: 0px; + padding: 0 0 0 18px; +} +.ztree li a { + padding-right: 3px; + margin: 0; + cursor: pointer; + height: 17px; + color: #ffffff; + background-color: transparent; + text-decoration: none; + vertical-align: top; + display: inline-block; +} +.ztree li a input.rename { + height: 14px; + width: 80px; + padding: 0; + margin: 0; + color: #af0000; + background-color: #ffffff; + font-size: 12px; + border: 1px #585956 solid; + *border: 0px; +} +.ztree li a:hover { + text-decoration: underline; +} +.ztree li a.curSelectedNode { + padding-top: 0px; + background-color: #af4040; + color: #ffff00; + height: 17px; + opacity: 0.8; +} +.ztree li a.curSelectedNode_Edit { + padding-top: 0px; + background-color: transparent; + color: #ffff00; + height: 17px; + border: 1px #666 solid; + opacity: 0.8; +} +.ztree li a.tmpTargetNode_inner { + padding-top: 0px; + background-color: #aaa; + color: #ffff00; + height: 17px; + border: 1px #666 solid; + opacity: 0.8; + filter: alpha(opacity=80); +} +.ztree li span { + line-height: 17px; + margin-right: 2px; + background-color: transparent; +} +.ztree li span.button { + line-height: 0; + margin: 0; + padding: 0; + width: 15px; + height: 17px; + display: inline-block; + vertical-align: top; + border: 0px solid; + cursor: pointer; + outline: none; + background-color: transparent; + background-repeat: no-repeat; + background-attachment: scroll; +} +.ztree li span.button::before { + color: #ffffff; + font-family: FontAwesome; + padding-top: 10px; +} +.ztree li span.button.chk { + margin: 0px; + cursor: auto; + width: 12px; + display: inline-block; + padding-top: 10px; + padding-left: 2px; +} +.ztree li span.button.chk.checkbox_false_full::before { + content: "\f096"; +} +.ztree li span.button.chk.checkbox_false_full_focus::before { + content: "\f096"; + color: #ffff00; +} +.ztree li span.button.chk.checkbox_false_part::before { + content: "\f096"; + color: #aaaaaa; +} +.ztree li span.button.chk.checkbox_false_part_focus::before { + content: "\f096"; + color: #cad96c; +} +.ztree li span.button.chk.checkbox_false_disable::before { + content: "\f096"; + color: #808080; +} +.ztree li span.button.chk.checkbox_true_full::before { + content: "\f046"; +} +.ztree li span.button.chk.checkbox_true_full_focus::before { + content: "\f046"; +} +.ztree li span.button.chk.checkbox_true_part::before { + content: "\f14a"; +} +.ztree li span.button.chk.checkbox_true_part_focus::before { + content: "\f14a"; + color: #ffff00; +} +.ztree li span.button.chk.checkbox_true_full_focus::before { + content: "\f046"; + color: #ffff00; +} +.ztree li span.button.chk.checkbox_true_part::before { + content: "\f046"; + color: #aaaaaa; +} +.ztree li span.button.chk.checkbox_true_part_focus::before { + content: "\f046"; + color: #cad96c; +} +.ztree li span.button.chk.checkbox_true_disable::before { + content: "\f046"; + color: #808080; +} +.ztree li span.button.chk.radio_false_full::before { + content: "\f10c"; +} +.ztree li span.button.chk.radio_false_full_focus::before { + content: "\f10c"; + color: #ffff00; +} +.ztree li span.button.chk.radio_false_part::before { + content: "\f10c"; + color: #aaaaaa; +} +.ztree li span.button.chk.radio_false_part_focus::before { + content: "\f10c"; + color: #ffff00; +} +.ztree li span.button.chk.radio_false_disable::before { + content: "\f1db"; + color: #808080; +} +.ztree li span.button.chk.radio_true_full::before { + content: "\f192"; +} +.ztree li span.button.chk.radio_true_full_focus::before { + content: "\f192"; + color: #ffff00; +} +.ztree li span.button.chk.radio_true_part::before { + content: "\f192"; + color: #aaaaaa; +} +.ztree li span.button.chk.radio_true_part_focus::before { + content: "\f192"; + color: #aaaaaa; +} +.ztree li span.button.chk.radio_true_disable::before { + content: "\f1db"; + color: #808080; +} +.ztree li span.button.switch { + width: 15px; + height: 17px; +} +.ztree li span.button.root_open::before { + content: "\f078"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.root_close::before { + content: "\f115"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.roots_open::before { + content: "\f078"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.roots_close::before { + content: "\f054"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.center_open::before { + content: "\f078"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.center_close::before { + content: "\f054"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.bottom_open::before { + content: "\f078"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.bottom_close::before { + content: "\f054"; + padding-top: 10px; + padding-left: 2px; + display: inline-block; +} +.ztree li span.button.root_docu { + background: none; +} +.ztree li span.button.roots_docu::before { + content: "\f022"; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.center_docu::before { + padding-top: 10px; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.bottom_docu::before { + padding-top: 10px; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.noline_docu { + background: none; +} +.ztree li span.button.ico_open::before { + content: "\f115"; + font-family: FontAwesome; + padding-top: 10px; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.ico_close::before { + content: "\f114"; + font-family: FontAwesome; + padding-top: 10px; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.ico_docu::before { + content: "\f022"; + font-family: FontAwesome; + padding-top: 10px; + padding-left: 2px; + display: inline-block; + color: #ffffff; +} +.ztree li span.button.edit { + margin-left: 4px; + margin-right: -1px; + vertical-align: top; + *vertical-align: middle; + padding-top: 10px; +} +.ztree li span.button.edit::before { + content: "\f044"; + font-family: FontAwesome; +} +.ztree li span.button.remove { + margin-left: 4px; + margin-right: -1px; + vertical-align: top; + *vertical-align: middle; + padding-top: 10px; +} +.ztree li span.button.remove::before { + content: "\f1f8"; + font-family: FontAwesome; +} +.ztree li span.button.add { + margin-left: 4px; + margin-right: -1px; + vertical-align: top; + *vertical-align: middle; + padding-top: 10px; +} +.ztree li span.button.add::before { + content: "\f067"; + font-family: FontAwesome; +} +.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: 17px; + display: inline-block; + padding: 0; + margin: 2px 0 0 1px; + border: 0 none; + position: absolute; + background-color: transparent; + background-attachment: scroll; +} +span.tmpzTreeMove_arrow::before { + content: "\f04b"; + font-family: FontAwesome; + color: #ffff00; +} +ul.ztree.zTreeDragUL { + margin: 0; + padding: 0; + position: absolute; + width: auto; + height: auto; + overflow: hidden; + background-color: #cfcfcf; + border: 1px #ffff00 dotted; + opacity: 0.8; + filter: alpha(opacity=80); +} +.ztreeMask { + z-index: 10000; + background-color: #cfcfcf; + opacity: 0.0; + filter: alpha(opacity=0); + position: absolute; +} diff --git a/static/zTree3/css/awesomeStyle/awesome.less b/static/zTree3/css/awesomeStyle/awesome.less new file mode 100644 index 0000000..b282d81 --- /dev/null +++ b/static/zTree3/css/awesomeStyle/awesome.less @@ -0,0 +1,146 @@ +/*------------------------------------- +zTree Style using fontawesome instead of images + +version: 1.1 +author: Mike King +email: mikkelking @ hotmail . com +website: http://code.google.com/p/jquerytree/ + +-------------------------------------*/ + +/* Definitions ----------------------*/ +@font-size: 12px; +// Regular icon and text color is white, which suits any medium -> dark background +@color-normal: white; +// Background color +@color-bg: #af0000; +// Highlight color +@color-highlight: yellow; +// Partially selected (checkboxes, radio buttons) +@color-partial: #aaaaaa; +// Partially selected and focused (checkboxes, radio buttons) +@color-partfocus: #cad96c; +// Disabled altogether +@color-disabled: #808080; +// Editing color +@color-edit: yellow; +@w: 15px; +@h: 17px; +@pad-left: 2px; +@pad-top: 10px; +/* End of Definitions ---------------*/ + +/* Imports -------------------------*/ +@import "fa.less"; +/* End of Imports ------------------*/ + +.ztree * {padding:0; margin:0; font-size:@font-size; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif; background-color: @color-bg;} +.ztree { + margin:0; padding:5px; color:@color-normal; background-color: @color-bg; + li { + padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0; + ul { + margin: 0px; padding:0 0 0 18px; + } + ul.line { } + a {padding-right:3px; margin:0; cursor:pointer; height:@h; color:@color-normal; background-color: transparent; + text-decoration:none; vertical-align:top; display: inline-block; + input.rename {height:14px; width:80px; padding:0; margin:0; + color: @color-bg; background-color: @color-normal; + font-size:@font-size; border:1px #585956 solid; *border:0px} + } + a:hover {text-decoration:underline} + a.curSelectedNode {padding-top:0px; background-color:#af4040; color:@color-highlight; height:@h; opacity:0.8;} + a.curSelectedNode_Edit {padding-top:0px; background-color:transparent; color:@color-highlight; height:@h; border:1px #666 solid; opacity:0.8;} + a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:@color-highlight; height:@h; border:1px #666 solid; + opacity:0.8; filter:alpha(opacity=80)} + a.tmpTargetNode_prev {} + a.tmpTargetNode_next {} + span {line-height:@h; margin-right:2px; background-color:transparent;} + span.button {line-height:0; margin:0; padding: 0; width:@w; height:@h; display: inline-block; vertical-align:top; + border:0px solid; cursor: pointer;outline:none; + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; + + &::before{color: @color-normal; font-family: FontAwesome; padding-top:@pad-top;} + &.chk { margin:0px; cursor: auto; width: 12px; + display: inline-block;padding-top:@pad-top;padding-left:@pad-left; + + &.checkbox_false_full::before {content: @fa-square-o;} + &.checkbox_false_full_focus::before {content: @fa-square-o; color:@color-highlight;} + &.checkbox_false_part::before {content: @fa-square-o;color: @color-partial;} + &.checkbox_false_part_focus::before {content: @fa-square-o; color:@color-partfocus;} + &.checkbox_false_disable::before {content: @fa-square-o; color:@color-disabled;} + &.checkbox_true_full::before {content: @fa-check-square-o;} + &.checkbox_true_full_focus::before {content: @fa-check-square-o;} + &.checkbox_true_part::before {content: @fa-check-square;} + &.checkbox_true_part_focus::before {content: @fa-check-square; color: @color-highlight} + &.checkbox_true_full_focus::before {content: @fa-check-square-o; color: @color-highlight} + &.checkbox_true_part::before {content: @fa-check-square-o;color: @color-partial} + &.checkbox_true_part_focus::before {content: @fa-check-square-o;color: @color-partfocus;} + &.checkbox_true_disable::before {content: @fa-check-square-o;color: @color-disabled} + + &.radio_false_full::before {content: @fa-circle-o;} + &.radio_false_full_focus::before {content: @fa-circle-o;color: @color-highlight} + &.radio_false_part::before {content: @fa-circle-o;color: @color-partial} + &.radio_false_part_focus::before {content: @fa-circle-o;color: @color-highlight} + &.radio_false_disable::before {content: @fa-circle-thin;color: @color-disabled} + &.radio_true_full::before {content: @fa-dot-circle-o;} + &.radio_true_full_focus::before {content: @fa-dot-circle-o;color: @color-highlight} + &.radio_true_part::before {content: @fa-dot-circle-o;color: @color-partial} + &.radio_true_part_focus::before {content: @fa-dot-circle-o;color: @color-partial;} + &.radio_true_disable::before {content: @fa-circle-thin;color: @color-disabled} + + } + &.switch {width:@w; height:@h} + &.root_open::before{content: @fa-chevron-down;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.root_close::before{content: @fa-folder-open-o;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.roots_open::before{content: @fa-chevron-down;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.roots_close::before{content: @fa-chevron-right;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.center_open::before{content: @fa-chevron-down;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.center_close::before{content: @fa-chevron-right;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.bottom_open::before{content: @fa-chevron-down;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.bottom_close::before{content: @fa-chevron-right;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;} + &.noline_open{} + &.noline_close{} + &.root_docu{ background:none;} + &.roots_docu::before{content: @fa-list-alt;padding-left:@pad-left;display: inline-block;color:@color-normal;} + &.center_docu::before{padding-top:@pad-top;padding-left:@pad-left;display: inline-block;color:@color-normal;} + &.bottom_docu::before{padding-top:@pad-top;padding-left:@pad-left;display: inline-block;color:@color-normal;} + &.noline_docu{ background:none;} + + &.ico_open::before {content: @fa-folder-open-o;font-family: FontAwesome;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;color:@color-normal;} + &.ico_close::before {content: @fa-folder-o;font-family: FontAwesome;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;color:@color-normal;} + &.ico_docu::before{content: @fa-list-alt;font-family: FontAwesome;padding-top:@pad-top;padding-left:@pad-left;display: inline-block;color:@color-normal;} + + &.edit {margin-left:4px; margin-right: -1px; vertical-align:top; *vertical-align:middle;padding-top:@pad-top;} + &.edit::before{content: @fa-pencil-square-o;font-family: FontAwesome;} + + &.remove {margin-left:4px; margin-right: -1px; vertical-align:top; *vertical-align:middle;padding-top:@pad-top;} + &.remove::before{content: @fa-trash;font-family: FontAwesome;} + + + &.add {margin-left:4px; margin-right: -1px; vertical-align:top; *vertical-align:middle;padding-top:@pad-top;} + &.add::before{content: @fa-plus;font-family: FontAwesome;} + + &.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)} + +// this is the arrow that moves +span.tmpzTreeMove_arrow{width:16px; height:@h; display: inline-block; + padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; + background-color:transparent; background-attachment: scroll; + } +span.tmpzTreeMove_arrow::before{content: @fa-play;font-family: FontAwesome;color: @color-highlight; + } +// outline + +ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; + background-color:#cfcfcf; border:1px @color-highlight dotted; opacity:0.8; filter:alpha(opacity=80)} +.ztreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} + diff --git a/static/zTree3/css/awesomeStyle/fa.less b/static/zTree3/css/awesomeStyle/fa.less new file mode 100644 index 0000000..3714884 --- /dev/null +++ b/static/zTree3/css/awesomeStyle/fa.less @@ -0,0 +1,480 @@ +@fa-glass: "\f000"; +@fa-music: "\f001"; +@fa-search: "\f002"; +@fa-envelope-o: "\f003"; +@fa-heart: "\f004"; +@fa-star: "\f005"; +@fa-star-o: "\f006"; +@fa-user: "\f007"; +@fa-film: "\f008"; +@fa-th-large: "\f009"; +@fa-th: "\f00a"; +@fa-th-list: "\f00b"; +@fa-check: "\f00c"; +@fa-times: "\f00d"; +@fa-search-plus: "\f00e"; +@fa-search-minus: "\f010"; +@fa-power-off: "\f011"; +@fa-signal: "\f012"; +@fa-cog: "\f013"; +@fa-trash-o: "\f014"; +@fa-home: "\f015"; +@fa-file-o: "\f016"; +@fa-clock-o: "\f017"; +@fa-road: "\f018"; +@fa-download: "\f019"; +@fa-arrow-circle-o-down: "\f01a"; +@fa-arrow-circle-o-up: "\f01b"; +@fa-inbox: "\f01c"; +@fa-play-circle-o: "\f01d"; +@fa-repeat: "\f01e"; +@fa-refresh: "\f021"; +@fa-list-alt: "\f022"; +@fa-lock: "\f023"; +@fa-flag: "\f024"; +@fa-headphones: "\f025"; +@fa-volume-off: "\f026"; +@fa-volume-down: "\f027"; +@fa-volume-up: "\f028"; +@fa-qrcode: "\f029"; +@fa-barcode: "\f02a"; +@fa-tag: "\f02b"; +@fa-tags: "\f02c"; +@fa-book: "\f02d"; +@fa-bookmark: "\f02e"; +@fa-print: "\f02f"; +@fa-camera: "\f030"; +@fa-font: "\f031"; +@fa-bold: "\f032"; +@fa-italic: "\f033"; +@fa-text-height: "\f034"; +@fa-text-width: "\f035"; +@fa-align-left: "\f036"; +@fa-align-center: "\f037"; +@fa-align-right: "\f038"; +@fa-align-justify: "\f039"; +@fa-list: "\f03a"; +@fa-outdent: "\f03b"; +@fa-indent: "\f03c"; +@fa-video-camera: "\f03d"; +@fa-picture-o: "\f03e"; +@fa-pencil: "\f040"; +@fa-map-marker: "\f041"; +@fa-adjust: "\f042"; +@fa-tint: "\f043"; +@fa-pencil-square-o: "\f044"; +@fa-share-square-o: "\f045"; +@fa-check-square-o: "\f046"; +@fa-arrows: "\f047"; +@fa-step-backward: "\f048"; +@fa-fast-backward: "\f049"; +@fa-backward: "\f04a"; +@fa-play: "\f04b"; +@fa-pause: "\f04c"; +@fa-stop: "\f04d"; +@fa-forward: "\f04e"; +@fa-fast-forward: "\f050"; +@fa-step-forward: "\f051"; +@fa-eject: "\f052"; +@fa-chevron-left: "\f053"; +@fa-chevron-right: "\f054"; +@fa-plus-circle: "\f055"; +@fa-minus-circle: "\f056"; +@fa-times-circle: "\f057"; +@fa-check-circle: "\f058"; +@fa-question-circle: "\f059"; +@fa-info-circle: "\f05a"; +@fa-crosshairs: "\f05b"; +@fa-times-circle-o: "\f05c"; +@fa-check-circle-o: "\f05d"; +@fa-ban: "\f05e"; +@fa-arrow-left: "\f060"; +@fa-arrow-right: "\f061"; +@fa-arrow-up: "\f062"; +@fa-arrow-down: "\f063"; +@fa-share: "\f064"; +@fa-expand: "\f065"; +@fa-compress: "\f066"; +@fa-plus: "\f067"; +@fa-minus: "\f068"; +@fa-asterisk: "\f069"; +@fa-exclamation-circle: "\f06a"; +@fa-gift: "\f06b"; +@fa-leaf: "\f06c"; +@fa-fire: "\f06d"; +@fa-eye: "\f06e"; +@fa-eye-slash: "\f070"; +@fa-exclamation-triangle: "\f071"; +@fa-plane: "\f072"; +@fa-calendar: "\f073"; +@fa-random: "\f074"; +@fa-comment: "\f075"; +@fa-magnet: "\f076"; +@fa-chevron-up: "\f077"; +@fa-chevron-down: "\f078"; +@fa-retweet: "\f079"; +@fa-shopping-cart: "\f07a"; +@fa-folder: "\f07b"; +@fa-folder-open: "\f07c"; +@fa-arrows-v: "\f07d"; +@fa-arrows-h: "\f07e"; +@fa-bar-chart: "\f080"; +@fa-twitter-square: "\f081"; +@fa-facebook-square: "\f082"; +@fa-camera-retro: "\f083"; +@fa-key: "\f084"; +@fa-cogs: "\f085"; +@fa-comments: "\f086"; +@fa-thumbs-o-up: "\f087"; +@fa-thumbs-o-down: "\f088"; +@fa-star-half: "\f089"; +@fa-heart-o: "\f08a"; +@fa-sign-out: "\f08b"; +@fa-linkedin-square: "\f08c"; +@fa-thumb-tack: "\f08d"; +@fa-external-link: "\f08e"; +@fa-sign-in: "\f090"; +@fa-trophy: "\f091"; +@fa-github-square: "\f092"; +@fa-upload: "\f093"; +@fa-lemon-o: "\f094"; +@fa-phone: "\f095"; +@fa-square-o: "\f096"; +@fa-bookmark-o: "\f097"; +@fa-phone-square: "\f098"; +@fa-twitter: "\f099"; +@fa-facebook: "\f09a"; +@fa-github: "\f09b"; +@fa-unlock: "\f09c"; +@fa-credit-card: "\f09d"; +@fa-rss: "\f09e"; +@fa-hdd-o: "\f0a0"; +@fa-bullhorn: "\f0a1"; +@fa-bell: "\f0f3"; +@fa-certificate: "\f0a3"; +@fa-hand-o-right: "\f0a4"; +@fa-hand-o-left: "\f0a5"; +@fa-hand-o-up: "\f0a6"; +@fa-hand-o-down: "\f0a7"; +@fa-arrow-circle-left: "\f0a8"; +@fa-arrow-circle-right: "\f0a9"; +@fa-arrow-circle-up: "\f0aa"; +@fa-arrow-circle-down: "\f0ab"; +@fa-globe: "\f0ac"; +@fa-wrench: "\f0ad"; +@fa-tasks: "\f0ae"; +@fa-filter: "\f0b0"; +@fa-briefcase: "\f0b1"; +@fa-arrows-alt: "\f0b2"; +@fa-users: "\f0c0"; +@fa-link: "\f0c1"; +@fa-cloud: "\f0c2"; +@fa-flask: "\f0c3"; +@fa-scissors: "\f0c4"; +@fa-files-o: "\f0c5"; +@fa-paperclip: "\f0c6"; +@fa-floppy-o: "\f0c7"; +@fa-square: "\f0c8"; +@fa-bars: "\f0c9"; +@fa-list-ul: "\f0ca"; +@fa-list-ol: "\f0cb"; +@fa-strikethrough: "\f0cc"; +@fa-underline: "\f0cd"; +@fa-table: "\f0ce"; +@fa-magic: "\f0d0"; +@fa-truck: "\f0d1"; +@fa-pinterest: "\f0d2"; +@fa-pinterest-square: "\f0d3"; +@fa-google-plus-square: "\f0d4"; +@fa-google-plus: "\f0d5"; +@fa-money: "\f0d6"; +@fa-caret-down: "\f0d7"; +@fa-caret-up: "\f0d8"; +@fa-caret-left: "\f0d9"; +@fa-caret-right: "\f0da"; +@fa-columns: "\f0db"; +@fa-sort: "\f0dc"; +@fa-sort-desc: "\f0dd"; +@fa-sort-asc: "\f0de"; +@fa-envelope: "\f0e0"; +@fa-linkedin: "\f0e1"; +@fa-undo: "\f0e2"; +@fa-gavel: "\f0e3"; +@fa-tachometer: "\f0e4"; +@fa-comment-o: "\f0e5"; +@fa-comments-o: "\f0e6"; +@fa-bolt: "\f0e7"; +@fa-sitemap: "\f0e8"; +@fa-umbrella: "\f0e9"; +@fa-clipboard: "\f0ea"; +@fa-lightbulb-o: "\f0eb"; +@fa-exchange: "\f0ec"; +@fa-cloud-download: "\f0ed"; +@fa-cloud-upload: "\f0ee"; +@fa-user-md: "\f0f0"; +@fa-stethoscope: "\f0f1"; +@fa-suitcase: "\f0f2"; +@fa-bell-o: "\f0a2"; +@fa-coffee: "\f0f4"; +@fa-cutlery: "\f0f5"; +@fa-file-text-o: "\f0f6"; +@fa-building-o: "\f0f7"; +@fa-hospital-o: "\f0f8"; +@fa-ambulance: "\f0f9"; +@fa-medkit: "\f0fa"; +@fa-fighter-jet: "\f0fb"; +@fa-beer: "\f0fc"; +@fa-h-square: "\f0fd"; +@fa-plus-square: "\f0fe"; +@fa-angle-double-left: "\f100"; +@fa-angle-double-right: "\f101"; +@fa-angle-double-up: "\f102"; +@fa-angle-double-down: "\f103"; +@fa-angle-left: "\f104"; +@fa-angle-right: "\f105"; +@fa-angle-up: "\f106"; +@fa-angle-down: "\f107"; +@fa-desktop: "\f108"; +@fa-laptop: "\f109"; +@fa-tablet: "\f10a"; +@fa-mobile: "\f10b"; +@fa-circle-o: "\f10c"; +@fa-quote-left: "\f10d"; +@fa-quote-right: "\f10e"; +@fa-spinner: "\f110"; +@fa-circle: "\f111"; +@fa-reply: "\f112"; +@fa-github-alt: "\f113"; +@fa-folder-o: "\f114"; +@fa-folder-open-o: "\f115"; +@fa-smile-o: "\f118"; +@fa-frown-o: "\f119"; +@fa-meh-o: "\f11a"; +@fa-gamepad: "\f11b"; +@fa-keyboard-o: "\f11c"; +@fa-flag-o: "\f11d"; +@fa-flag-checkered: "\f11e"; +@fa-terminal: "\f120"; +@fa-code: "\f121"; +@fa-reply-all: "\f122"; +@fa-star-half-o: "\f123"; +@fa-location-arrow: "\f124"; +@fa-crop: "\f125"; +@fa-code-fork: "\f126"; +@fa-chain-broken: "\f127"; +@fa-question: "\f128"; +@fa-info: "\f129"; +@fa-exclamation: "\f12a"; +@fa-superscript: "\f12b"; +@fa-subscript: "\f12c"; +@fa-eraser: "\f12d"; +@fa-puzzle-piece: "\f12e"; +@fa-microphone: "\f130"; +@fa-microphone-slash: "\f131"; +@fa-shield: "\f132"; +@fa-calendar-o: "\f133"; +@fa-fire-extinguisher: "\f134"; +@fa-rocket: "\f135"; +@fa-maxcdn: "\f136"; +@fa-chevron-circle-left: "\f137"; +@fa-chevron-circle-right: "\f138"; +@fa-chevron-circle-up: "\f139"; +@fa-chevron-circle-down: "\f13a"; +@fa-html5: "\f13b"; +@fa-css3: "\f13c"; +@fa-anchor: "\f13d"; +@fa-unlock-alt: "\f13e"; +@fa-bullseye: "\f140"; +@fa-ellipsis-h: "\f141"; +@fa-ellipsis-v: "\f142"; +@fa-rss-square: "\f143"; +@fa-play-circle: "\f144"; +@fa-ticket: "\f145"; +@fa-minus-square: "\f146"; +@fa-minus-square-o: "\f147"; +@fa-level-up: "\f148"; +@fa-level-down: "\f149"; +@fa-check-square: "\f14a"; +@fa-pencil-square: "\f14b"; +@fa-external-link-square: "\f14c"; +@fa-share-square: "\f14d"; +@fa-compass: "\f14e"; +@fa-caret-square-o-down: "\f150"; +@fa-caret-square-o-up: "\f151"; +@fa-caret-square-o-right: "\f152"; +@fa-eur: "\f153"; +@fa-gbp: "\f154"; +@fa-usd: "\f155"; +@fa-inr: "\f156"; +@fa-jpy: "\f157"; +@fa-rub: "\f158"; +@fa-krw: "\f159"; +@fa-btc: "\f15a"; +@fa-file: "\f15b"; +@fa-file-text: "\f15c"; +@fa-sort-alpha-asc: "\f15d"; +@fa-sort-alpha-desc: "\f15e"; +@fa-sort-amount-asc: "\f160"; +@fa-sort-amount-desc: "\f161"; +@fa-sort-numeric-asc: "\f162"; +@fa-sort-numeric-desc: "\f163"; +@fa-thumbs-up: "\f164"; +@fa-thumbs-down: "\f165"; +@fa-youtube-square: "\f166"; +@fa-youtube: "\f167"; +@fa-xing: "\f168"; +@fa-xing-square: "\f169"; +@fa-youtube-play: "\f16a"; +@fa-dropbox: "\f16b"; +@fa-stack-overflow: "\f16c"; +@fa-instagram: "\f16d"; +@fa-flickr: "\f16e"; +@fa-adn: "\f170"; +@fa-bitbucket: "\f171"; +@fa-bitbucket-square: "\f172"; +@fa-tumblr: "\f173"; +@fa-tumblr-square: "\f174"; +@fa-long-arrow-down: "\f175"; +@fa-long-arrow-up: "\f176"; +@fa-long-arrow-left: "\f177"; +@fa-long-arrow-right: "\f178"; +@fa-apple: "\f179"; +@fa-windows: "\f17a"; +@fa-android: "\f17b"; +@fa-linux: "\f17c"; +@fa-dribbble: "\f17d"; +@fa-skype: "\f17e"; +@fa-foursquare: "\f180"; +@fa-trello: "\f181"; +@fa-female: "\f182"; +@fa-male: "\f183"; +@fa-gittip: "\f184"; +@fa-sun-o: "\f185"; +@fa-moon-o: "\f186"; +@fa-archive: "\f187"; +@fa-bug: "\f188"; +@fa-vk: "\f189"; +@fa-weibo: "\f18a"; +@fa-renren: "\f18b"; +@fa-pagelines: "\f18c"; +@fa-stack-exchange: "\f18d"; +@fa-arrow-circle-o-right: "\f18e"; +@fa-arrow-circle-o-left: "\f190"; +@fa-caret-square-o-left: "\f191"; +@fa-dot-circle-o: "\f192"; +@fa-wheelchair: "\f193"; +@fa-vimeo-square: "\f194"; +@fa-try: "\f195"; +@fa-plus-square-o: "\f196"; +@fa-space-shuttle: "\f197"; +@fa-slack: "\f198"; +@fa-envelope-square: "\f199"; +@fa-wordpress: "\f19a"; +@fa-openid: "\f19b"; +@fa-university: "\f19c"; +@fa-graduation-cap: "\f19d"; +@fa-yahoo: "\f19e"; +@fa-google: "\f1a0"; +@fa-reddit: "\f1a1"; +@fa-reddit-square: "\f1a2"; +@fa-stumbleupon-circle: "\f1a3"; +@fa-stumbleupon: "\f1a4"; +@fa-delicious: "\f1a5"; +@fa-digg: "\f1a6"; +@fa-pied-piper: "\f1a7"; +@fa-pied-piper-alt: "\f1a8"; +@fa-drupal: "\f1a9"; +@fa-joomla: "\f1aa"; +@fa-language: "\f1ab"; +@fa-fax: "\f1ac"; +@fa-building: "\f1ad"; +@fa-child: "\f1ae"; +@fa-paw: "\f1b0"; +@fa-spoon: "\f1b1"; +@fa-cube: "\f1b2"; +@fa-cubes: "\f1b3"; +@fa-behance: "\f1b4"; +@fa-behance-square: "\f1b5"; +@fa-steam: "\f1b6"; +@fa-steam-square: "\f1b7"; +@fa-recycle: "\f1b8"; +@fa-car: "\f1b9"; +@fa-taxi: "\f1ba"; +@fa-tree: "\f1bb"; +@fa-spotify: "\f1bc"; +@fa-deviantart: "\f1bd"; +@fa-soundcloud: "\f1be"; +@fa-database: "\f1c0"; +@fa-file-pdf-o: "\f1c1"; +@fa-file-word-o: "\f1c2"; +@fa-file-excel-o: "\f1c3"; +@fa-file-powerpoint-o: "\f1c4"; +@fa-file-image-o: "\f1c5"; +@fa-file-archive-o: "\f1c6"; +@fa-file-audio-o: "\f1c7"; +@fa-file-video-o: "\f1c8"; +@fa-file-code-o: "\f1c9"; +@fa-vine: "\f1ca"; +@fa-codepen: "\f1cb"; +@fa-jsfiddle: "\f1cc"; +@fa-life-ring: "\f1cd"; +@fa-circle-o-notch: "\f1ce"; +@fa-rebel: "\f1d0"; +@fa-empire: "\f1d1"; +@fa-git-square: "\f1d2"; +@fa-git: "\f1d3"; +@fa-hacker-news: "\f1d4"; +@fa-tencent-weibo: "\f1d5"; +@fa-qq: "\f1d6"; +@fa-weixin: "\f1d7"; +@fa-paper-plane: "\f1d8"; +@fa-paper-plane-o: "\f1d9"; +@fa-history: "\f1da"; +@fa-circle-thin: "\f1db"; +@fa-header: "\f1dc"; +@fa-paragraph: "\f1dd"; +@fa-sliders: "\f1de"; +@fa-share-alt: "\f1e0"; +@fa-share-alt-square: "\f1e1"; +@fa-bomb: "\f1e2"; +@fa-futbol-o: "\f1e3"; +@fa-tty: "\f1e4"; +@fa-binoculars: "\f1e5"; +@fa-plug: "\f1e6"; +@fa-slideshare: "\f1e7"; +@fa-twitch: "\f1e8"; +@fa-yelp: "\f1e9"; +@fa-newspaper-o: "\f1ea"; +@fa-wifi: "\f1eb"; +@fa-calculator: "\f1ec"; +@fa-paypal: "\f1ed"; +@fa-google-wallet: "\f1ee"; +@fa-cc-visa: "\f1f0"; +@fa-cc-mastercard: "\f1f1"; +@fa-cc-discover: "\f1f2"; +@fa-cc-amex: "\f1f3"; +@fa-cc-paypal: "\f1f4"; +@fa-cc-stripe: "\f1f5"; +@fa-bell-slash: "\f1f6"; +@fa-bell-slash-o: "\f1f7"; +@fa-trash: "\f1f8"; +@fa-copyright: "\f1f9"; +@fa-at: "\f1fa"; +@fa-eyedropper: "\f1fb"; +@fa-paint-brush: "\f1fc"; +@fa-birthday-cake: "\f1fd"; +@fa-area-chart: "\f1fe"; +@fa-pie-chart: "\f200"; +@fa-line-chart: "\f201"; +@fa-lastfm: "\f202"; +@fa-lastfm-square: "\f203"; +@fa-toggle-off: "\f204"; +@fa-toggle-on: "\f205"; +@fa-bicycle: "\f206"; +@fa-bus: "\f207"; +@fa-ioxhost: "\f208"; +@fa-angellist: "\f209"; +@fa-cc: "\f20a"; +@fa-ils: "\f20b"; +@fa-meanpath: "\f20c"; + diff --git a/static/zTree3/css/awesomeStyle/img/loading.gif b/static/zTree3/css/awesomeStyle/img/loading.gif new file mode 100644 index 0000000..e8c2892 Binary files /dev/null and b/static/zTree3/css/awesomeStyle/img/loading.gif differ diff --git a/static/zTree3/css/demo.css b/static/zTree3/css/demo.css new file mode 100644 index 0000000..f6dba0d --- /dev/null +++ b/static/zTree3/css/demo.css @@ -0,0 +1,33 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;} +body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;} +h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;} +h1 {font-size: 24px;line-height: 34px;text-align: center;} +h2 {font-size: 14px;line-height: 24px;padding-top: 5px;} +h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;} +a {color:#3C6E31;text-decoration: underline;} +a:hover {background-color:#3C6E31;color:white;} +input.radio {margin: 0 2px 0 8px;} +input.radio.first {margin-left:0;} +input.empty {color: lightgray;} +code {color: #2f332a;} +.highlight_red {color:#A60000;} +.highlight_green {color:#A7F43D;} +li {list-style: circle;font-size: 12px;} +li.title {list-style: none;} +ul.list {margin-left: 17px;} + +div.content_wrap {width: 600px;height:380px;} +div.content_wrap div.left{float: left;width: 250px;} +div.content_wrap div.right{float: right;width: 340px;} +div.zTreeDemoBackground {width:250px;height:362px;text-align:left;} + +ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;} +ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;} +ul.log.small {height:45px;} +ul.log li {color: #666666;list-style: none;padding-left: 10px;} +ul.log li.dark {background-color: #E3E3E3;} + +/* ruler */ +div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer} +div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer} \ No newline at end of file diff --git a/static/zTree3/css/metroStyle/img/line_conn.png b/static/zTree3/css/metroStyle/img/line_conn.png new file mode 100644 index 0000000..b211da2 Binary files /dev/null and b/static/zTree3/css/metroStyle/img/line_conn.png differ diff --git a/static/zTree3/css/metroStyle/img/loading.gif b/static/zTree3/css/metroStyle/img/loading.gif new file mode 100644 index 0000000..e8c2892 Binary files /dev/null and b/static/zTree3/css/metroStyle/img/loading.gif differ diff --git a/static/zTree3/css/metroStyle/img/metro.gif b/static/zTree3/css/metroStyle/img/metro.gif new file mode 100644 index 0000000..664b969 Binary files /dev/null and b/static/zTree3/css/metroStyle/img/metro.gif differ diff --git a/static/zTree3/css/metroStyle/img/metro.png b/static/zTree3/css/metroStyle/img/metro.png new file mode 100644 index 0000000..e9e58a3 Binary files /dev/null and b/static/zTree3/css/metroStyle/img/metro.png differ diff --git a/static/zTree3/css/metroStyle/metroStyle.css b/static/zTree3/css/metroStyle/metroStyle.css new file mode 100644 index 0000000..af81f42 --- /dev/null +++ b/static/zTree3/css/metroStyle/metroStyle.css @@ -0,0 +1,96 @@ +/*------------------------------------- +zTree Style + +version: 3.4 +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:17px; 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.png) 0 0 repeat-y;} + +.ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; 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:#e5e5e5; color:black; height:21px; opacity:0.8;} +.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;} +.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 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 #585956 solid; *border:0px} +.ztree li span {line-height:21px; margin-right:2px} +.ztree li span.button {line-height:0; margin:0; padding: 0; width:21px; height:21px; 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/metro.png"); *background-image:url("./img/metro.gif")} + +.ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto} +.ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;} +.ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;} +.ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;} +.ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;} +.ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;} +.ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;} +.ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;} +.ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;} +.ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;} +.ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;} +.ztree li span.button.chk.radio_false_full {background-position: -47px -5px;} +.ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;} +.ztree li span.button.chk.radio_false_part {background-position: -47px -47px;} +.ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;} +.ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;} +.ztree li span.button.chk.radio_true_full {background-position: -68px -5px;} +.ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;} +.ztree li span.button.chk.radio_true_part {background-position: -68px -47px;} +.ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;} +.ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;} + +.ztree li span.button.switch {width:21px; height:21px} +.ztree li span.button.root_open{background-position:-105px -63px} +.ztree li span.button.root_close{background-position:-126px -63px} +.ztree li span.button.roots_open{background-position: -105px 0;} +.ztree li span.button.roots_close{background-position: -126px 0;} +.ztree li span.button.center_open{background-position: -105px -21px;} +.ztree li span.button.center_close{background-position: -126px -21px;} +.ztree li span.button.bottom_open{background-position: -105px -42px;} +.ztree li span.button.bottom_close{background-position: -126px -42px;} +.ztree li span.button.noline_open{background-position: -105px -84px;} +.ztree li span.button.noline_close{background-position: -126px -84px;} +.ztree li span.button.root_docu{ background:none;} +.ztree li span.button.roots_docu{background-position: -84px 0;} +.ztree li span.button.center_docu{background-position: -84px -21px;} +.ztree li span.button.bottom_docu{background-position: -84px -42px;} +.ztree li span.button.noline_docu{ background:none;} + +.ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle} +.ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.edit:hover { + background-position: -168px -21px; +} +.ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle} +.ztree li span.button.remove:hover { + background-position: -168px -42px; +} +.ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle} +.ztree li span.button.add:hover { + background-position: -168px 0; +} +.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:21px; 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:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.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} diff --git a/static/zTree3/css/zTreeStyle/img/diy/1_close.png b/static/zTree3/css/zTreeStyle/img/diy/1_close.png new file mode 100644 index 0000000..68ccb3c Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/1_close.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/1_open.png b/static/zTree3/css/zTreeStyle/img/diy/1_open.png new file mode 100644 index 0000000..d6ff36d Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/1_open.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/2.png b/static/zTree3/css/zTreeStyle/img/diy/2.png new file mode 100644 index 0000000..9eff506 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/2.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/3.png b/static/zTree3/css/zTreeStyle/img/diy/3.png new file mode 100644 index 0000000..d7ba6d0 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/3.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/4.png b/static/zTree3/css/zTreeStyle/img/diy/4.png new file mode 100644 index 0000000..753e2bf Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/4.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/5.png b/static/zTree3/css/zTreeStyle/img/diy/5.png new file mode 100644 index 0000000..0c5eccd Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/5.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/6.png b/static/zTree3/css/zTreeStyle/img/diy/6.png new file mode 100644 index 0000000..070b835 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/6.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/7.png b/static/zTree3/css/zTreeStyle/img/diy/7.png new file mode 100644 index 0000000..532b037 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/7.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/8.png b/static/zTree3/css/zTreeStyle/img/diy/8.png new file mode 100644 index 0000000..a8f3a86 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/8.png differ diff --git a/static/zTree3/css/zTreeStyle/img/diy/9.png b/static/zTree3/css/zTreeStyle/img/diy/9.png new file mode 100644 index 0000000..4db73cd Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/diy/9.png differ diff --git a/static/zTree3/css/zTreeStyle/img/line_conn.gif b/static/zTree3/css/zTreeStyle/img/line_conn.gif new file mode 100644 index 0000000..d561d36 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/line_conn.gif differ diff --git a/static/zTree3/css/zTreeStyle/img/loading.gif b/static/zTree3/css/zTreeStyle/img/loading.gif new file mode 100644 index 0000000..e8c2892 Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/loading.gif differ diff --git a/static/zTree3/css/zTreeStyle/img/zTreeStandard.gif b/static/zTree3/css/zTreeStyle/img/zTreeStandard.gif new file mode 100644 index 0000000..50c94fd Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/zTreeStandard.gif differ diff --git a/static/zTree3/css/zTreeStyle/img/zTreeStandard.png b/static/zTree3/css/zTreeStyle/img/zTreeStandard.png new file mode 100644 index 0000000..ffda01e Binary files /dev/null and b/static/zTree3/css/zTreeStyle/img/zTreeStandard.png differ diff --git a/static/zTree3/css/zTreeStyle/zTreeStyle.css b/static/zTree3/css/zTreeStyle/zTreeStyle.css new file mode 100644 index 0000000..4a1705b --- /dev/null +++ b/static/zTree3/css/zTreeStyle/zTreeStyle.css @@ -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; +}*/ \ No newline at end of file diff --git a/static/zTree3/js/jquery-1.4.4.min.js b/static/zTree3/js/jquery-1.4.4.min.js new file mode 100644 index 0000000..8f3ca2e --- /dev/null +++ b/static/zTree3/js/jquery-1.4.4.min.js @@ -0,0 +1,167 @@ +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
                    a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
                    ";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
                    t
                    ";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

                    ";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
                    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
                    ","
                    "],thead:[1,"","
                    "],tr:[2,"","
                    "],td:[3,"","
                    "],col:[2,"","
                    "],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
                    ","
                    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
                    ").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/static/zTree3/js/jquery.ztree.all.js b/static/zTree3/js/jquery.ztree.all.js new file mode 100644 index 0000000..1256860 --- /dev/null +++ b/static/zTree3/js/jquery.ztree.all.js @@ -0,0 +1,3734 @@ + +/* + * 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 ($) { + var settings = {}, roots = {}, caches = {}, + //default consts of core + _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" + } + }, + //default setting of core + _setting = { + treeId: "", + treeObj: null, + view: { + addDiyDom: null, + autoCancelSelected: true, + dblClickExpand: true, + expandSpeed: "fast", + fontCss: {}, + nameIsHTML: false, + selectedMulti: true, + showIcon: true, + showLine: true, + showTitle: true, + txtSelectedEnable: false + }, + data: { + key: { + children: "children", + name: "name", + title: "", + url: "url", + icon: "icon" + }, + simpleData: { + enable: false, + idKey: "id", + pIdKey: "pId", + rootPId: null + }, + keep: { + parent: false, + leaf: false + } + }, + async: { + enable: false, + 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 + } + }, + //default root of core + //zTree use root to save full data + _initRoot = function (setting) { + var r = data.getRoot(setting); + if (!r) { + r = {}; + data.setRoot(setting, r); + } + r[setting.data.key.children] = []; + r.expandTriggerFlag = false; + r.curSelectedList = []; + r.noSelection = true; + r.createdNodes = []; + r.zId = 0; + r._ver = (new Date()).getTime(); + }, + //default cache of core + _initCache = function (setting) { + var c = data.getCache(setting); + if (!c) { + c = {}; + data.setCache(setting, c); + } + c.nodes = []; + c.doms = []; + }, + //default bindEvent of core + _bindEvent = function (setting) { + var o = setting.treeObj, + c = consts.event; + o.bind(c.NODECREATED, function (event, treeId, node) { + tools.apply(setting.callback.onNodeCreated, [event, treeId, node]); + }); + + o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) { + tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]); + }); + + o.bind(c.EXPAND, function (event, treeId, node) { + tools.apply(setting.callback.onExpand, [event, treeId, node]); + }); + + o.bind(c.COLLAPSE, function (event, treeId, node) { + tools.apply(setting.callback.onCollapse, [event, treeId, node]); + }); + + o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) { + tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]); + }); + + o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) { + tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]); + }); + + o.bind(c.REMOVE, function (event, treeId, treeNode) { + tools.apply(setting.callback.onRemove, [event, treeId, treeNode]); + }); + + o.bind(c.SELECTED, function (event, treeId, node) { + tools.apply(setting.callback.onSelected, [treeId, node]); + }); + o.bind(c.UNSELECTED, function (event, treeId, node) { + tools.apply(setting.callback.onUnSelected, [treeId, node]); + }); + }, + _unbindEvent = function (setting) { + var o = setting.treeObj, + c = consts.event; + o.unbind(c.NODECREATED) + .unbind(c.CLICK) + .unbind(c.EXPAND) + .unbind(c.COLLAPSE) + .unbind(c.ASYNC_SUCCESS) + .unbind(c.ASYNC_ERROR) + .unbind(c.REMOVE) + .unbind(c.SELECTED) + .unbind(c.UNSELECTED); + }, + //default event proxy of core + _eventProxy = function (event) { + var target = event.target, + setting = data.getSetting(event.data.treeId), + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null, + tmp = null; + + if (tools.eqs(event.type, "mousedown")) { + treeEventType = "mousedown"; + } else if (tools.eqs(event.type, "mouseup")) { + treeEventType = "mouseup"; + } else if (tools.eqs(event.type, "contextmenu")) { + treeEventType = "contextmenu"; + } else if (tools.eqs(event.type, "click")) { + if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode" + consts.id.SWITCH) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "switchNode"; + } else { + tmp = tools.getMDom(setting, target, [{tagName: "a", attrName: "treeNode" + consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "clickNode"; + } + } + } else if (tools.eqs(event.type, "dblclick")) { + treeEventType = "dblclick"; + tmp = tools.getMDom(setting, target, [{tagName: "a", attrName: "treeNode" + consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "switchNode"; + } + } + if (treeEventType.length > 0 && tId.length == 0) { + tmp = tools.getMDom(setting, target, [{tagName: "a", attrName: "treeNode" + consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + } + } + // event to node + if (tId.length > 0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "switchNode" : + if (!node.isParent) { + nodeEventType = ""; + } else if (tools.eqs(event.type, "click") + || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) { + nodeEventCallback = handler.onSwitchNode; + } else { + nodeEventType = ""; + } + break; + case "clickNode" : + nodeEventCallback = handler.onClickNode; + break; + } + } + // event to zTree + switch (treeEventType) { + case "mousedown" : + treeEventCallback = handler.onZTreeMousedown; + break; + case "mouseup" : + treeEventCallback = handler.onZTreeMouseup; + break; + case "dblclick" : + treeEventCallback = handler.onZTreeDblclick; + break; + case "contextmenu" : + treeEventCallback = handler.onZTreeContextmenu; + break; + } + var proxyResult = { + stop: false, + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of core + _initNode = function (setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var r = data.getRoot(setting), + childKey = setting.data.key.children; + n.level = level; + n.tId = setting.treeId + "_" + (++r.zId); + n.parentTId = parentNode ? parentNode.tId : null; + n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open; + if (n[childKey] && n[childKey].length > 0) { + n.isParent = true; + n.zAsync = true; + } else { + n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent; + n.open = (n.isParent && !setting.async.enable) ? n.open : false; + n.zAsync = !n.isParent; + } + n.isFirstNode = isFirstNode; + n.isLastNode = isLastNode; + n.getParentNode = function () { + return data.getNodeCache(setting, n.parentTId); + }; + n.getPreNode = function () { + return data.getPreNode(setting, n); + }; + n.getNextNode = function () { + return data.getNextNode(setting, n); + }; + n.getIndex = function () { + return data.getNodeIndex(setting, n); + }; + n.getPath = function () { + return data.getNodePath(setting, n); + }; + n.isAjaxing = false; + data.fixPIdKeyValue(setting, n); + }, + _init = { + bind: [_bindEvent], + unbind: [_unbindEvent], + caches: [_initCache], + nodes: [_initNode], + proxys: [_eventProxy], + roots: [_initRoot], + beforeA: [], + afterA: [], + innerBeforeA: [], + innerAfterA: [], + zTreeTools: [] + }, + //method of operate data + data = { + addNodeCache: function (setting, node) { + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node; + }, + getNodeCacheId: function (tId) { + return tId.substring(tId.lastIndexOf("_") + 1); + }, + addAfterA: function (afterA) { + _init.afterA.push(afterA); + }, + addBeforeA: function (beforeA) { + _init.beforeA.push(beforeA); + }, + addInnerAfterA: function (innerAfterA) { + _init.innerAfterA.push(innerAfterA); + }, + addInnerBeforeA: function (innerBeforeA) { + _init.innerBeforeA.push(innerBeforeA); + }, + addInitBind: function (bindEvent) { + _init.bind.push(bindEvent); + }, + addInitUnBind: function (unbindEvent) { + _init.unbind.push(unbindEvent); + }, + addInitCache: function (initCache) { + _init.caches.push(initCache); + }, + addInitNode: function (initNode) { + _init.nodes.push(initNode); + }, + addInitProxy: function (initProxy, isFirst) { + if (!!isFirst) { + _init.proxys.splice(0, 0, initProxy); + } else { + _init.proxys.push(initProxy); + } + }, + addInitRoot: function (initRoot) { + _init.roots.push(initRoot); + }, + addNodesData: function (setting, parentNode, index, nodes) { + var childKey = setting.data.key.children, params; + if (!parentNode[childKey]) { + parentNode[childKey] = []; + index = -1; + } else if (index >= parentNode[childKey].length) { + index = -1; + } + + if (parentNode[childKey].length > 0 && index === 0) { + parentNode[childKey][0].isFirstNode = false; + view.setNodeLineIcos(setting, parentNode[childKey][0]); + } else if (parentNode[childKey].length > 0 && index < 0) { + parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false; + view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]); + } + parentNode.isParent = true; + + if (index < 0) { + parentNode[childKey] = parentNode[childKey].concat(nodes); + } else { + params = [index, 0].concat(nodes); + parentNode[childKey].splice.apply(parentNode[childKey], params); + } + }, + addSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + if (!data.isSelectedNode(setting, node)) { + root.curSelectedList.push(node); + } + }, + addCreatedNode: function (setting, node) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + root.createdNodes.push(node); + } + }, + addZTreeTools: function (zTreeTools) { + _init.zTreeTools.push(zTreeTools); + }, + exSetting: function (s) { + $.extend(true, _setting, s); + }, + fixPIdKeyValue: function (setting, node) { + if (setting.data.simpleData.enable) { + node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId; + } + }, + getAfterA: function (setting, node, array) { + for (var i = 0, j = _init.afterA.length; i < j; i++) { + _init.afterA[i].apply(this, arguments); + } + }, + getBeforeA: function (setting, node, array) { + for (var i = 0, j = _init.beforeA.length; i < j; i++) { + _init.beforeA[i].apply(this, arguments); + } + }, + getInnerAfterA: function (setting, node, array) { + for (var i = 0, j = _init.innerAfterA.length; i < j; i++) { + _init.innerAfterA[i].apply(this, arguments); + } + }, + getInnerBeforeA: function (setting, node, array) { + for (var i = 0, j = _init.innerBeforeA.length; i < j; i++) { + _init.innerBeforeA[i].apply(this, arguments); + } + }, + getCache: function (setting) { + return caches[setting.treeId]; + }, + getNodeIndex: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length - 1; i <= l; i++) { + if (p[childKey][i] === node) { + return i; + } + } + return -1; + }, + getNextNode: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length - 1; i <= l; i++) { + if (p[childKey][i] === node) { + return (i == l ? null : p[childKey][i + 1]); + } + } + return null; + }, + getNodeByParam: function (setting, nodes, key, value) { + if (!nodes || !key) return null; + var childKey = setting.data.key.children; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + return nodes[i]; + } + var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value); + if (tmp) return tmp; + } + return null; + }, + getNodeCache: function (setting, tId) { + if (!tId) return null; + var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)]; + return n ? n : null; + }, + getNodeName: function (setting, node) { + var nameKey = setting.data.key.name; + return "" + node[nameKey]; + }, + getNodePath: function (setting, node) { + if (!node) return null; + + var path; + if (node.parentTId) { + path = node.getParentNode().getPath(); + } else { + path = []; + } + + if (path) { + path.push(node); + } + + return path; + }, + getNodeTitle: function (setting, node) { + var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title; + return "" + node[t]; + }, + getNodes: function (setting) { + return data.getRoot(setting)[setting.data.key.children]; + }, + getNodesByParam: function (setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByParamFuzzy: function (setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + value = value.toLowerCase(); + for (var i = 0, l = nodes.length; i < l; i++) { + if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value) > -1) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByFilter: function (setting, nodes, filter, isSingle, invokeParam) { + if (!nodes) return (isSingle ? null : []); + var childKey = setting.data.key.children, + result = isSingle ? null : []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (tools.apply(filter, [nodes[i], invokeParam], false)) { + if (isSingle) { + return nodes[i]; + } + result.push(nodes[i]); + } + var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam); + if (isSingle && !!tmpResult) { + return tmpResult; + } + result = isSingle ? tmpResult : result.concat(tmpResult); + } + return result; + }, + getPreNode: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length; i < l; i++) { + if (p[childKey][i] === node) { + return (i == 0 ? null : p[childKey][i - 1]); + } + } + return null; + }, + getRoot: function (setting) { + return setting ? roots[setting.treeId] : null; + }, + getRoots: function () { + return roots; + }, + getSetting: function (treeId) { + return settings[treeId]; + }, + getSettings: function () { + return settings; + }, + getZTreeTools: function (treeId) { + var r = this.getRoot(this.getSetting(treeId)); + return r ? r.treeTools : null; + }, + initCache: function (setting) { + for (var i = 0, j = _init.caches.length; i < j; i++) { + _init.caches[i].apply(this, arguments); + } + }, + initNode: function (setting, level, node, parentNode, preNode, nextNode) { + for (var i = 0, j = _init.nodes.length; i < j; i++) { + _init.nodes[i].apply(this, arguments); + } + }, + initRoot: function (setting) { + for (var i = 0, j = _init.roots.length; i < j; i++) { + _init.roots[i].apply(this, arguments); + } + }, + isSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + for (var i = 0, j = root.curSelectedList.length; i < j; i++) { + if (node === root.curSelectedList[i]) return true; + } + return false; + }, + removeNodeCache: function (setting, node) { + var childKey = setting.data.key.children; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + data.removeNodeCache(setting, node[childKey][i]); + } + } + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null; + }, + removeSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + for (var i = 0, j = root.curSelectedList.length; i < j; i++) { + if (node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) { + root.curSelectedList.splice(i, 1); + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]); + i--; + j--; + } + } + }, + setCache: function (setting, cache) { + caches[setting.treeId] = cache; + }, + setRoot: function (setting, root) { + roots[setting.treeId] = root; + }, + setZTreeTools: function (setting, zTreeTools) { + for (var i = 0, j = _init.zTreeTools.length; i < j; i++) { + _init.zTreeTools[i].apply(this, arguments); + } + }, + transformToArrayFormat: function (setting, nodes) { + if (!nodes) return []; + var childKey = setting.data.key.children, + r = []; + if (tools.isArray(nodes)) { + for (var i = 0, l = nodes.length; i < l; i++) { + r.push(nodes[i]); + if (nodes[i][childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey])); + } + } else { + r.push(nodes); + if (nodes[childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[childKey])); + } + return r; + }, + transformTozTreeFormat: function (setting, sNodes) { + var i, l, + key = setting.data.simpleData.idKey, + parentKey = setting.data.simpleData.pIdKey, + childKey = setting.data.key.children; + if (!key || key == "" || !sNodes) return []; + + if (tools.isArray(sNodes)) { + var r = []; + var tmpMap = {}; + for (i = 0, l = sNodes.length; i < l; i++) { + tmpMap[sNodes[i][key]] = sNodes[i]; + } + for (i = 0, l = sNodes.length; i < l; i++) { + if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) { + if (!tmpMap[sNodes[i][parentKey]][childKey]) + tmpMap[sNodes[i][parentKey]][childKey] = []; + tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]); + } else { + r.push(sNodes[i]); + } + } + return r; + } else { + return [sNodes]; + } + } + }, + //method of event proxy + event = { + bindEvent: function (setting) { + for (var i = 0, j = _init.bind.length; i < j; i++) { + _init.bind[i].apply(this, arguments); + } + }, + unbindEvent: function (setting) { + for (var i = 0, j = _init.unbind.length; i < j; i++) { + _init.unbind[i].apply(this, arguments); + } + }, + bindTree: function (setting) { + var eventParam = { + treeId: setting.treeId + }, + o = setting.treeObj; + if (!setting.view.txtSelectedEnable) { + // for can't select text + o.bind('selectstart', handler.onSelectStart).css({ + "-moz-user-select": "-moz-none" + }); + } + o.bind('click', eventParam, event.proxy); + o.bind('dblclick', eventParam, event.proxy); + o.bind('mouseover', eventParam, event.proxy); + o.bind('mouseout', eventParam, event.proxy); + o.bind('mousedown', eventParam, event.proxy); + o.bind('mouseup', eventParam, event.proxy); + o.bind('contextmenu', eventParam, event.proxy); + }, + unbindTree: function (setting) { + var o = setting.treeObj; + o.unbind('selectstart', handler.onSelectStart) + .unbind('click', event.proxy) + .unbind('dblclick', event.proxy) + .unbind('mouseover', event.proxy) + .unbind('mouseout', event.proxy) + .unbind('mousedown', event.proxy) + .unbind('mouseup', event.proxy) + .unbind('contextmenu', event.proxy); + }, + doProxy: function (e) { + var results = []; + for (var i = 0, j = _init.proxys.length; i < j; i++) { + var proxyResult = _init.proxys[i].apply(this, arguments); + results.push(proxyResult); + if (proxyResult.stop) { + break; + } + } + return results; + }, + proxy: function (e) { + var setting = data.getSetting(e.data.treeId); + if (!tools.uCanDo(setting, e)) return true; + var results = event.doProxy(e), + r = true, x = false; + for (var i = 0, l = results.length; i < l; i++) { + var proxyResult = results[i]; + if (proxyResult.nodeEventCallback) { + x = true; + r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + if (proxyResult.treeEventCallback) { + x = true; + r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + } + return r; + } + }, + //method of event handler + handler = { + onSwitchNode: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (node.open) { + if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } else { + if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } + return true; + }, + onClickNode: function (event, node) { + var setting = data.getSetting(event.data.treeId), + clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1; + if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true; + if (clickFlag === 0) { + view.cancelPreSelectedNode(setting, node); + } else { + view.selectNode(setting, node, clickFlag === 2); + } + setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]); + return true; + }, + onZTreeMousedown: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]); + } + return true; + }, + onZTreeMouseup: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]); + } + return true; + }, + onZTreeDblclick: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]); + } + return true; + }, + onZTreeContextmenu: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]); + } + return (typeof setting.callback.onRightClick) != "function"; + }, + onSelectStart: function (e) { + var n = e.originalEvent.srcElement.nodeName.toLowerCase(); + return (n === "input" || n === "textarea" ); + } + }, + //method of tools for zTree + tools = { + apply: function (fun, param, defaultValue) { + if ((typeof fun) == "function") { + return fun.apply(zt, param ? param : []); + } + return defaultValue; + }, + canAsync: function (setting, node) { + var childKey = setting.data.key.children; + return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0))); + }, + clone: function (obj) { + if (obj === null) return null; + var o = tools.isArray(obj) ? [] : {}; + for (var i in obj) { + o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? tools.clone(obj[i]) : obj[i]); + } + return o; + }, + eqs: function (str1, str2) { + return str1.toLowerCase() === str2.toLowerCase(); + }, + isArray: function (arr) { + return Object.prototype.toString.apply(arr) === "[object Array]"; + }, + isElement: function (o) { + return ( + typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2 + o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string" + ); + }, + $: function (node, exp, setting) { + if (!!exp && typeof exp != "string") { + setting = exp; + exp = ""; + } + if (typeof node == "string") { + return $(node, setting ? setting.treeObj.get(0).ownerDocument : null); + } else { + return $("#" + node.tId + exp, setting ? setting.treeObj : null); + } + }, + getMDom: function (setting, curDom, targetExpr) { + if (!curDom) return null; + while (curDom && curDom.id !== setting.treeId) { + for (var i = 0, l = targetExpr.length; curDom.tagName && i < l; i++) { + if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) { + return curDom; + } + } + curDom = curDom.parentNode; + } + return null; + }, + getNodeMainDom: function (target) { + return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0)); + }, + isChildOrSelf: function (dom, parentId) { + return ( $(dom).closest("#" + parentId).length > 0 ); + }, + uCanDo: function (setting, e) { + return true; + } + }, + //method of operate ztree dom + view = { + addNodes: function (setting, parentNode, index, newNodes, isSilent) { + if (setting.data.keep.leaf && parentNode && !parentNode.isParent) { + return; + } + if (!tools.isArray(newNodes)) { + newNodes = [newNodes]; + } + if (setting.data.simpleData.enable) { + newNodes = data.transformTozTreeFormat(setting, newNodes); + } + if (parentNode) { + var target_switchObj = $$(parentNode, consts.id.SWITCH, setting), + target_icoObj = $$(parentNode, consts.id.ICON, setting), + target_ulObj = $$(parentNode, consts.id.UL, setting); + + if (!parentNode.open) { + view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE); + view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE); + parentNode.open = false; + target_ulObj.css({ + "display": "none" + }); + } + + data.addNodesData(setting, parentNode, index, newNodes); + view.createNodes(setting, parentNode.level + 1, newNodes, parentNode, index); + if (!isSilent) { + view.expandCollapseParentNode(setting, parentNode, true); + } + } else { + data.addNodesData(setting, data.getRoot(setting), index, newNodes); + view.createNodes(setting, 0, newNodes, null, index); + } + }, + appendNodes: function (setting, level, nodes, parentNode, index, initFlag, openFlag) { + if (!nodes) return []; + var html = [], + childKey = setting.data.key.children; + + var tmpPNode = (parentNode) ? parentNode : data.getRoot(setting), + tmpPChild = tmpPNode[childKey], + isFirstNode, isLastNode; + + if (!tmpPChild || index >= tmpPChild.length - nodes.length) { + index = -1; + } + + for (var i = 0, l = nodes.length; i < l; i++) { + var node = nodes[i]; + if (initFlag) { + isFirstNode = ((index === 0 || tmpPChild.length == nodes.length) && (i == 0)); + isLastNode = (index < 0 && i == (nodes.length - 1)); + data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag); + data.addNodeCache(setting, node); + } + + var childHtml = []; + if (node[childKey] && node[childKey].length > 0) { + //make child html first, because checkType + childHtml = view.appendNodes(setting, level + 1, node[childKey], node, -1, initFlag, openFlag && node.open); + } + if (openFlag) { + + view.makeDOMNodeMainBefore(html, setting, node); + view.makeDOMNodeLine(html, setting, node); + data.getBeforeA(setting, node, html); + view.makeDOMNodeNameBefore(html, setting, node); + data.getInnerBeforeA(setting, node, html); + view.makeDOMNodeIcon(html, setting, node); + data.getInnerAfterA(setting, node, html); + view.makeDOMNodeNameAfter(html, setting, node); + data.getAfterA(setting, node, html); + if (node.isParent && node.open) { + view.makeUlHtml(setting, node, html, childHtml.join('')); + } + view.makeDOMNodeMainAfter(html, setting, node); + data.addCreatedNode(setting, node); + } + } + return html; + }, + appendParentULDom: function (setting, node) { + var html = [], + nObj = $$(node, setting); + if (!nObj.get(0) && !!node.parentTId) { + view.appendParentULDom(setting, node.getParentNode()); + nObj = $$(node, setting); + } + var ulObj = $$(node, consts.id.UL, setting); + if (ulObj.get(0)) { + ulObj.remove(); + } + var childKey = setting.data.key.children, + childHtml = view.appendNodes(setting, node.level + 1, node[childKey], node, -1, false, true); + view.makeUlHtml(setting, node, html, childHtml.join('')); + nObj.append(html.join('')); + }, + asyncNode: function (setting, node, isSilent, callback) { + var i, l; + if (node && !node.isParent) { + tools.apply(callback); + return false; + } else if (node && node.isAjaxing) { + return false; + } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) { + tools.apply(callback); + return false; + } + if (node) { + node.isAjaxing = true; + var icoObj = $$(node, consts.id.ICON, setting); + icoObj.attr({"style": "", "class": consts.className.BUTTON + " " + consts.className.ICO_LOADING}); + } + + var tmpParam = {}; + for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) { + var pKey = setting.async.autoParam[i].split("="), spKey = pKey; + if (pKey.length > 1) { + spKey = pKey[1]; + pKey = pKey[0]; + } + tmpParam[spKey] = node[pKey]; + } + if (tools.isArray(setting.async.otherParam)) { + for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) { + tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1]; + } + } else { + for (var p in setting.async.otherParam) { + tmpParam[p] = setting.async.otherParam[p]; + } + } + + var _tmpV = data.getRoot(setting)._ver; + $.ajax({ + contentType: setting.async.contentType, + cache: false, + type: setting.async.type, + url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url), + data: setting.async.contentType.indexOf('application/json') > -1 ? JSON.stringify(tmpParam) : tmpParam, + dataType: setting.async.dataType, + success: function (msg) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + var newNodes = []; + try { + if (!msg || msg.length == 0) { + newNodes = []; + } else if (typeof msg == "string") { + newNodes = eval("(" + msg + ")"); + } else { + newNodes = msg; + } + } catch (err) { + newNodes = msg; + } + + if (node) { + node.isAjaxing = null; + node.zAsync = true; + } + view.setNodeLineIcos(setting, node); + if (newNodes && newNodes !== "") { + newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes); + view.addNodes(setting, node, -1, !!newNodes ? tools.clone(newNodes) : [], !!isSilent); + } else { + view.addNodes(setting, node, -1, [], !!isSilent); + } + setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]); + tools.apply(callback); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + if (node) node.isAjaxing = null; + view.setNodeLineIcos(setting, node); + setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]); + } + }); + return true; + }, + cancelPreSelectedNode: function (setting, node, excludeNode) { + var list = data.getRoot(setting).curSelectedList, + i, n; + for (i = list.length - 1; i >= 0; i--) { + n = list[i]; + if (node === n || (!node && (!excludeNode || excludeNode !== n))) { + $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED); + if (node) { + data.removeSelectedNode(setting, node); + break; + } else { + list.splice(i, 1); + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]); + } + } + } + }, + createNodeCallback: function (setting) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + while (root.createdNodes.length > 0) { + var node = root.createdNodes.shift(); + tools.apply(setting.view.addDiyDom, [setting.treeId, node]); + if (!!setting.callback.onNodeCreated) { + setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]); + } + } + } + }, + createNodes: function (setting, level, nodes, parentNode, index) { + if (!nodes || nodes.length == 0) return; + var root = data.getRoot(setting), + childKey = setting.data.key.children, + openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0); + root.createdNodes = []; + var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, index, true, openFlag), + parentObj, nextObj; + + if (!parentNode) { + parentObj = setting.treeObj; + //setting.treeObj.append(zTreeHtml.join('')); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + if (ulObj.get(0)) { + parentObj = ulObj; + //ulObj.append(zTreeHtml.join('')); + } + } + if (parentObj) { + if (index >= 0) { + nextObj = parentObj.children()[index]; + } + if (index >= 0 && nextObj) { + $(nextObj).before(zTreeHtml.join('')); + } else { + parentObj.append(zTreeHtml.join('')); + } + } + + view.createNodeCallback(setting); + }, + destroy: function (setting) { + if (!setting) return; + data.initCache(setting); + data.initRoot(setting); + event.unbindTree(setting); + event.unbindEvent(setting); + setting.treeObj.empty(); + delete settings[setting.treeId]; + }, + expandCollapseNode: function (setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children; + var tmpCb, _callback; + if (!node) { + tools.apply(callback, []); + return; + } + if (root.expandTriggerFlag) { + _callback = callback; + tmpCb = function () { + if (_callback) _callback(); + if (node.open) { + setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]); + } else { + setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]); + } + }; + callback = tmpCb; + root.expandTriggerFlag = false; + } + if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length > 0 && !$$(node[childKey][0], setting).get(0)))) { + view.appendParentULDom(setting, node); + view.createNodeCallback(setting); + } + if (node.open == expandFlag) { + tools.apply(callback, []); + return; + } + var ulObj = $$(node, consts.id.UL, setting), + switchObj = $$(node, consts.id.SWITCH, setting), + icoObj = $$(node, consts.id.ICON, setting); + + if (node.isParent) { + node.open = !node.open; + if (node.iconOpen && node.iconClose) { + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + } + + if (node.open) { + view.replaceSwitchClass(node, switchObj, consts.folder.OPEN); + view.replaceIcoClass(node, icoObj, consts.folder.OPEN); + if (animateFlag == false || setting.view.expandSpeed == "") { + ulObj.show(); + tools.apply(callback, []); + } else { + if (node[childKey] && node[childKey].length > 0) { + ulObj.slideDown(setting.view.expandSpeed, callback); + } else { + ulObj.show(); + tools.apply(callback, []); + } + } + } else { + view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE); + view.replaceIcoClass(node, icoObj, consts.folder.CLOSE); + if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) { + ulObj.hide(); + tools.apply(callback, []); + } else { + ulObj.slideUp(setting.view.expandSpeed, callback); + } + } + } else { + tools.apply(callback, []); + } + }, + expandCollapseParentNode: function (setting, node, expandFlag, animateFlag, callback) { + if (!node) return; + if (!node.parentTId) { + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); + return; + } else { + view.expandCollapseNode(setting, node, expandFlag, animateFlag); + } + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback); + } + }, + expandCollapseSonNode: function (setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + treeNodes = (node) ? node[childKey] : root[childKey], + selfAnimateSign = (node) ? false : animateFlag, + expandTriggerFlag = data.getRoot(setting).expandTriggerFlag; + data.getRoot(setting).expandTriggerFlag = false; + if (treeNodes) { + for (var i = 0, l = treeNodes.length; i < l; i++) { + if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign); + } + } + data.getRoot(setting).expandTriggerFlag = expandTriggerFlag; + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); + }, + isSelectedNode: function (setting, node) { + if (!node) { + return false; + } + var list = data.getRoot(setting).curSelectedList, + i; + for (i = list.length - 1; i >= 0; i--) { + if (node === list[i]) { + return true; + } + } + return false; + }, + makeDOMNodeIcon: function (html, setting, node) { + var nameStr = data.getNodeName(setting, node), + name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g, '&').replace(//g, '>'); + html.push("", name, ""); + }, + makeDOMNodeLine: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeMainAfter: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeMainBefore: function (html, setting, node) { + html.push("
                  • "); + }, + makeDOMNodeNameAfter: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeNameBefore: function (html, setting, node) { + var title = data.getNodeTitle(setting, node), + url = view.makeNodeUrl(setting, node), + fontcss = view.makeNodeFontCss(setting, node), + fontStyle = []; + for (var f in fontcss) { + fontStyle.push(f, ":", fontcss[f], ";"); + } + html.push(" 0) ? "href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''), + "'"); + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) { + html.push("title='", title.replace(/'/g, "'").replace(//g, '>'), "'"); + } + html.push(">"); + }, + makeNodeFontCss: function (setting, node) { + var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss); + return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {}; + }, + makeNodeIcoClass: function (setting, node) { + var icoCss = ["ico"]; + if (!node.isAjaxing) { + icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0]; + if (node.isParent) { + icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + icoCss.push(consts.folder.DOCU); + } + } + return consts.className.BUTTON + " " + icoCss.join('_'); + }, + makeNodeIcoStyle: function (setting, node) { + var icoStyle = []; + if (!node.isAjaxing) { + var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node[setting.data.key.icon]; + if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;"); + if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) { + icoStyle.push("width:0px;height:0px;"); + } + } + return icoStyle.join(''); + }, + makeNodeLineClass: function (setting, node) { + var lineClass = []; + if (setting.view.showLine) { + if (node.level == 0 && node.isFirstNode && node.isLastNode) { + lineClass.push(consts.line.ROOT); + } else if (node.level == 0 && node.isFirstNode) { + lineClass.push(consts.line.ROOTS); + } else if (node.isLastNode) { + lineClass.push(consts.line.BOTTOM); + } else { + lineClass.push(consts.line.CENTER); + } + } else { + lineClass.push(consts.line.NOLINE); + } + if (node.isParent) { + lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + lineClass.push(consts.folder.DOCU); + } + return view.makeNodeLineClassEx(node) + lineClass.join('_'); + }, + makeNodeLineClassEx: function (node) { + return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " "; + }, + makeNodeTarget: function (node) { + return (node.target || "_blank"); + }, + makeNodeUrl: function (setting, node) { + var urlKey = setting.data.key.url; + return node[urlKey] ? node[urlKey] : null; + }, + makeUlHtml: function (setting, node, html, content) { + html.push("
                      "); + html.push(content); + html.push("
                    "); + }, + makeUlLineClass: function (setting, node) { + return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : ""); + }, + removeChildNodes: function (setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + nodes = node[childKey]; + if (!nodes) return; + + for (var i = 0, l = nodes.length; i < l; i++) { + data.removeNodeCache(setting, nodes[i]); + } + data.removeSelectedNode(setting); + delete node[childKey]; + + if (!setting.data.keep.parent) { + node.isParent = false; + node.open = false; + var tmp_switchObj = $$(node, consts.id.SWITCH, setting), + tmp_icoObj = $$(node, consts.id.ICON, setting); + view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU); + $$(node, consts.id.UL, setting).remove(); + } else { + $$(node, consts.id.UL, setting).empty(); + } + }, + scrollIntoView: function (dom) { + if (!dom) { + return; + } + // code src: http://jsfiddle.net/08u6cxwj/ + if (!Element.prototype.scrollIntoViewIfNeeded) { + Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) { + function withinBounds(value, min, max, extent) { + if (false === centerIfNeeded || max <= value + extent && value <= min + extent) { + return Math.min(max, Math.max(min, value)); + } else { + return (min + max) / 2; + } + } + + function makeArea(left, top, width, height) { + return { + "left": left, "top": top, "width": width, "height": height + , "right": left + width, "bottom": top + height + , "translate": function (x, y) { + return makeArea(x + left, y + top, width, height); + } + , "relativeFromTo": function (lhs, rhs) { + var newLeft = left, newTop = top; + lhs = lhs.offsetParent; + rhs = rhs.offsetParent; + if (lhs === rhs) { + return area; + } + for (; lhs; lhs = lhs.offsetParent) { + newLeft += lhs.offsetLeft + lhs.clientLeft; + newTop += lhs.offsetTop + lhs.clientTop; + } + for (; rhs; rhs = rhs.offsetParent) { + newLeft -= rhs.offsetLeft + rhs.clientLeft; + newTop -= rhs.offsetTop + rhs.clientTop; + } + return makeArea(newLeft, newTop, width, height); + } + }; + } + + var parent, elem = this, area = makeArea( + this.offsetLeft, this.offsetTop, + this.offsetWidth, this.offsetHeight); + while (tools.isElement(parent = elem.parentNode)) { + var clientLeft = parent.offsetLeft + parent.clientLeft; + var clientTop = parent.offsetTop + parent.clientTop; + + // Make area relative to parent's client area. + area = area.relativeFromTo(elem, parent).translate(-clientLeft, -clientTop); + + parent.scrollLeft = withinBounds( + parent.scrollLeft, + area.right - parent.clientWidth, area.left, + parent.clientWidth); + + parent.scrollTop = withinBounds( + parent.scrollTop, + area.bottom - parent.clientHeight, area.top, + parent.clientHeight); + + // Determine actual scroll amount by reading back scroll properties. + area = area.translate(clientLeft - parent.scrollLeft, + clientTop - parent.scrollTop); + elem = parent; + } + }; + } + dom.scrollIntoViewIfNeeded(); + }, + setFirstNode: function (setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if (childLength > 0) { + parentNode[childKey][0].isFirstNode = true; + } + }, + setLastNode: function (setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if (childLength > 0) { + parentNode[childKey][childLength - 1].isLastNode = true; + } + }, + removeNode: function (setting, node) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : root; + + node.isFirstNode = false; + node.isLastNode = false; + node.getPreNode = function () { + return null; + }; + node.getNextNode = function () { + return null; + }; + + if (!data.getNodeCache(setting, node.tId)) { + return; + } + + $$(node, setting).remove(); + data.removeNodeCache(setting, node); + data.removeSelectedNode(setting, node); + + for (var i = 0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i].tId == node.tId) { + parentNode[childKey].splice(i, 1); + break; + } + } + view.setFirstNode(setting, parentNode); + view.setLastNode(setting, parentNode); + + var tmp_ulObj, tmp_switchObj, tmp_icoObj, + childLength = parentNode[childKey].length; + + //repair nodes old parent + if (!setting.data.keep.parent && childLength == 0) { + //old parentNode has no child nodes + parentNode.isParent = false; + parentNode.open = false; + tmp_ulObj = $$(parentNode, consts.id.UL, setting); + tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting); + tmp_icoObj = $$(parentNode, consts.id.ICON, setting); + view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU); + tmp_ulObj.css("display", "none"); + + } else if (setting.view.showLine && childLength > 0) { + //old parentNode has child nodes + var newLast = parentNode[childKey][childLength - 1]; + tmp_ulObj = $$(newLast, consts.id.UL, setting); + tmp_switchObj = $$(newLast, consts.id.SWITCH, setting); + tmp_icoObj = $$(newLast, consts.id.ICON, setting); + if (parentNode == root) { + if (parentNode[childKey].length == 1) { + //node was root, and ztree has only one root after move node + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT); + } else { + var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting); + view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS); + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + } else { + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + tmp_ulObj.removeClass(consts.line.LINE); + } + }, + replaceIcoClass: function (node, obj, newName) { + if (!obj || node.isAjaxing) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[tmpList.length - 1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + }, + replaceSwitchClass: function (node, obj, newName) { + if (!obj) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.line.ROOT: + case consts.line.ROOTS: + case consts.line.CENTER: + case consts.line.BOTTOM: + case consts.line.NOLINE: + tmpList[0] = view.makeNodeLineClassEx(node) + newName; + break; + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + if (newName !== consts.folder.DOCU) { + obj.removeAttr("disabled"); + } else { + obj.attr("disabled", "disabled"); + } + }, + selectNode: function (setting, node, addFlag) { + if (!addFlag) { + view.cancelPreSelectedNode(setting, null, node); + } + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED); + data.addSelectedNode(setting, node); + setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]); + }, + setNodeFontCss: function (setting, treeNode) { + var aObj = $$(treeNode, consts.id.A, setting), + fontCss = view.makeNodeFontCss(setting, treeNode); + if (fontCss) { + aObj.css(fontCss); + } + }, + setNodeLineIcos: function (setting, node) { + if (!node) return; + var switchObj = $$(node, consts.id.SWITCH, setting), + ulObj = $$(node, consts.id.UL, setting), + icoObj = $$(node, consts.id.ICON, setting), + ulLine = view.makeUlLineClass(setting, node); + if (ulLine.length == 0) { + ulObj.removeClass(consts.line.LINE); + } else { + ulObj.addClass(ulLine); + } + switchObj.attr("class", view.makeNodeLineClass(setting, node)); + if (node.isParent) { + switchObj.removeAttr("disabled"); + } else { + switchObj.attr("disabled", "disabled"); + } + icoObj.removeAttr("style"); + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + icoObj.attr("class", view.makeNodeIcoClass(setting, node)); + }, + setNodeName: function (setting, node) { + var title = data.getNodeTitle(setting, node), + nObj = $$(node, consts.id.SPAN, setting); + nObj.empty(); + if (setting.view.nameIsHTML) { + nObj.html(data.getNodeName(setting, node)); + } else { + nObj.text(data.getNodeName(setting, node)); + } + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("title", !title ? "" : title); + } + }, + setNodeTarget: function (setting, node) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("target", view.makeNodeTarget(node)); + }, + setNodeUrl: function (setting, node) { + var aObj = $$(node, consts.id.A, setting), + url = view.makeNodeUrl(setting, node); + if (url == null || url.length == 0) { + aObj.removeAttr("href"); + } else { + aObj.attr("href", url); + } + }, + switchNode: function (setting, node) { + if (node.open || !tools.canAsync(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + } else if (setting.async.enable) { + if (!view.asyncNode(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + return; + } + } else if (node) { + view.expandCollapseNode(setting, node, !node.open); + } + } + }; + // zTree defind + $.fn.zTree = { + consts: _consts, + _z: { + tools: tools, + view: view, + event: event, + data: data + }, + getZTreeObj: function (treeId) { + var o = data.getZTreeTools(treeId); + return o ? o : null; + }, + destroy: function (treeId) { + if (!!treeId && treeId.length > 0) { + view.destroy(data.getSetting(treeId)); + } else { + for (var s in settings) { + view.destroy(settings[s]); + } + } + }, + init: function (obj, zSetting, zNodes) { + var setting = tools.clone(_setting); + $.extend(true, setting, zSetting); + setting.treeId = obj.attr("id"); + setting.treeObj = obj; + setting.treeObj.empty(); + settings[setting.treeId] = setting; + //For some older browser,(e.g., ie6) + if (typeof document.body.style.maxHeight === "undefined") { + setting.view.expandSpeed = ""; + } + data.initRoot(setting); + var root = data.getRoot(setting), + childKey = setting.data.key.children; + zNodes = zNodes ? tools.clone(tools.isArray(zNodes) ? zNodes : [zNodes]) : []; + if (setting.data.simpleData.enable) { + root[childKey] = data.transformTozTreeFormat(setting, zNodes); + } else { + root[childKey] = zNodes; + } + + data.initCache(setting); + event.unbindTree(setting); + event.bindTree(setting); + event.unbindEvent(setting); + event.bindEvent(setting); + + var zTreeTools = { + setting: setting, + addNodes: function (parentNode, index, newNodes, isSilent) { + if (!parentNode) parentNode = null; + if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null; + + var i = parseInt(index, 10); + if (isNaN(i)) { + isSilent = !!newNodes; + newNodes = index; + index = -1; + } else { + index = i; + } + if (!newNodes) return null; + + + var xNewNodes = tools.clone(tools.isArray(newNodes) ? newNodes : [newNodes]); + + function addCallback() { + view.addNodes(setting, parentNode, index, xNewNodes, (isSilent == true)); + } + + if (tools.canAsync(setting, parentNode)) { + view.asyncNode(setting, parentNode, isSilent, addCallback); + } else { + addCallback(); + } + return xNewNodes; + }, + cancelSelectedNode: function (node) { + view.cancelPreSelectedNode(setting, node); + }, + destroy: function () { + view.destroy(setting); + }, + expandAll: function (expandFlag) { + expandFlag = !!expandFlag; + view.expandCollapseSonNode(setting, null, expandFlag, true); + return expandFlag; + }, + expandNode: function (node, expandFlag, sonSign, focus, callbackFlag) { + if (!node || !node.isParent) return null; + if (expandFlag !== true && expandFlag !== false) { + expandFlag = !node.open; + } + callbackFlag = !!callbackFlag; + + if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) { + return null; + } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) { + return null; + } + if (expandFlag && node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false); + } + if (expandFlag === node.open && !sonSign) { + return null; + } + + data.getRoot(setting).expandTriggerFlag = callbackFlag; + if (!tools.canAsync(setting, node) && sonSign) { + view.expandCollapseSonNode(setting, node, expandFlag, true, showNodeFocus); + } else { + node.open = !expandFlag; + view.switchNode(this.setting, node); + showNodeFocus(); + } + return expandFlag; + + function showNodeFocus() { + var a = $$(node, setting).get(0); + if (a && focus !== false) { + view.scrollIntoView(a); + } + } + }, + getNodes: function () { + return data.getNodes(setting); + }, + getNodeByParam: function (key, value, parentNode) { + if (!key) return null; + return data.getNodeByParam(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodeByTId: function (tId) { + return data.getNodeCache(setting, tId); + }, + getNodesByParam: function (key, value, parentNode) { + if (!key) return null; + return data.getNodesByParam(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodesByParamFuzzy: function (key, value, parentNode) { + if (!key) return null; + return data.getNodesByParamFuzzy(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodesByFilter: function (filter, isSingle, parentNode, invokeParam) { + isSingle = !!isSingle; + if (!filter || (typeof filter != "function")) return (isSingle ? null : []); + return data.getNodesByFilter(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), filter, isSingle, invokeParam); + }, + getNodeIndex: function (node) { + if (!node) return null; + var childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i] == node) return i; + } + return -1; + }, + getSelectedNodes: function () { + var r = [], list = data.getRoot(setting).curSelectedList; + for (var i = 0, l = list.length; i < l; i++) { + r.push(list[i]); + } + return r; + }, + isSelectedNode: function (node) { + return data.isSelectedNode(setting, node); + }, + reAsyncChildNodes: function (parentNode, reloadType, isSilent) { + if (!this.setting.async.enable) return; + var isRoot = !parentNode; + if (isRoot) { + parentNode = data.getRoot(setting); + } + if (reloadType == "refresh") { + var childKey = this.setting.data.key.children; + for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) { + data.removeNodeCache(setting, parentNode[childKey][i]); + } + data.removeSelectedNode(setting); + parentNode[childKey] = []; + if (isRoot) { + this.setting.treeObj.empty(); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + ulObj.empty(); + } + } + view.asyncNode(this.setting, isRoot ? null : parentNode, !!isSilent); + }, + refresh: function () { + this.setting.treeObj.empty(); + var root = data.getRoot(setting), + nodes = root[setting.data.key.children] + data.initRoot(setting); + root[setting.data.key.children] = nodes + data.initCache(setting); + view.createNodes(setting, 0, root[setting.data.key.children], null, -1); + }, + removeChildNodes: function (node) { + if (!node) return null; + var childKey = setting.data.key.children, + nodes = node[childKey]; + view.removeChildNodes(setting, node); + return nodes ? nodes : null; + }, + removeNode: function (node, callbackFlag) { + if (!node) return; + callbackFlag = !!callbackFlag; + if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return; + view.removeNode(setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]); + } + }, + selectNode: function (node, addFlag, isSilent) { + if (!node) return; + if (tools.uCanDo(setting)) { + addFlag = setting.view.selectedMulti && addFlag; + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), true, false, showNodeFocus); + } else if (!isSilent) { + try { + $$(node, setting).focus().blur(); + } catch (e) { + } + } + view.selectNode(setting, node, addFlag); + } + + function showNodeFocus() { + if (isSilent) { + return; + } + var a = $$(node, setting).get(0); + view.scrollIntoView(a); + } + }, + transformTozTreeNodes: function (simpleNodes) { + return data.transformTozTreeFormat(setting, simpleNodes); + }, + transformToArray: function (nodes) { + return data.transformToArrayFormat(setting, nodes); + }, + updateNode: function (node, checkTypeFlag) { + if (!node) return; + var nObj = $$(node, setting); + if (nObj.get(0) && tools.uCanDo(setting)) { + view.setNodeName(setting, node); + view.setNodeTarget(setting, node); + view.setNodeUrl(setting, node); + view.setNodeLineIcos(setting, node); + view.setNodeFontCss(setting, node); + } + } + } + root.treeTools = zTreeTools; + data.setZTreeTools(setting, zTreeTools); + + if (root[childKey] && root[childKey].length > 0) { + view.createNodes(setting, 0, root[childKey], null, -1); + } else if (setting.async.enable && setting.async.url && setting.async.url !== '') { + view.asyncNode(setting); + } + return zTreeTools; + } + }; + + var zt = $.fn.zTree, + $$ = tools.$, + consts = zt.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($){ + //default consts of excheck + var _consts = { + 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" + } + }, + //default setting of excheck + _setting = { + check: { + enable: false, + autoCheckTrigger: false, + chkStyle: _consts.checkbox.STYLE, + nocheckInherit: false, + chkDisabledInherit: false, + radioType: _consts.radio.TYPE_LEVEL, + chkboxType: { + "Y": "ps", + "N": "ps" + } + }, + data: { + key: { + checked: "checked" + } + }, + callback: { + beforeCheck:null, + onCheck:null + } + }, + //default root of excheck + _initRoot = function (setting) { + var r = data.getRoot(setting); + r.radioCheckedList = []; + }, + //default cache of excheck + _initCache = function(treeId) {}, + //default bind event of excheck + _bindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.bind(c.CHECK, function (event, srcEvent, treeId, node) { + event.srcEvent = srcEvent; + tools.apply(setting.callback.onCheck, [event, treeId, node]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.unbind(c.CHECK); + }, + //default event proxy of excheck + _eventProxy = function(e) { + var target = e.target, + setting = data.getSetting(e.data.treeId), + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null; + + if (tools.eqs(e.type, "mouseover")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoverCheck"; + } + } else if (tools.eqs(e.type, "mouseout")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoutCheck"; + } + } else if (tools.eqs(e.type, "click")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "checkNode"; + } + } + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "checkNode" : + nodeEventCallback = _handler.onCheckNode; + break; + case "mouseoverCheck" : + nodeEventCallback = _handler.onMouseoverCheck; + break; + case "mouseoutCheck" : + nodeEventCallback = _handler.onMouseoutCheck; + break; + } + } + var proxyResult = { + stop: nodeEventType === "checkNode", + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of excheck + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var checkedKey = setting.data.key.checked; + if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true"); + n[checkedKey] = !!n[checkedKey]; + n.checkedOld = n[checkedKey]; + if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true"); + n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck); + if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true"); + n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled); + if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true"); + n.halfCheck = !!n.halfCheck; + n.check_Child_State = -1; + n.check_Focus = false; + n.getCheckStatus = function() {return data.getCheckStatus(setting, n);}; + + if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) { + var r = data.getRoot(setting); + r.radioCheckedList.push(n); + } + }, + //add dom for check + _beforeA = function(setting, node, html) { + var checkedKey = setting.data.key.checked; + if (setting.check.enable) { + data.makeChkFlag(setting, node); + html.push(""); + } + }, + //update zTreeObj, add method of check + _zTreeTools = function(setting, zTreeTools) { + zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) { + var checkedKey = this.setting.data.key.checked; + if (node.chkDisabled === true) return; + if (checked !== true && checked !== false) { + checked = !node[checkedKey]; + } + callbackFlag = !!callbackFlag; + + if (node[checkedKey] === checked && !checkTypeFlag) { + return; + } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) { + return; + } + if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) { + node[checkedKey] = checked; + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]); + } + } + } + + zTreeTools.checkAllNodes = function(checked) { + view.repairAllChk(this.setting, !!checked); + } + + zTreeTools.getCheckedNodes = function(checked) { + var childKey = this.setting.data.key.children; + checked = (checked !== false); + return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked); + } + + zTreeTools.getChangeCheckedNodes = function() { + var childKey = this.setting.data.key.children; + return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]); + } + + zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) { + disabled = !!disabled; + inheritParent = !!inheritParent; + inheritChildren = !!inheritChildren; + view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren); + view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent); + } + + var _updateNode = zTreeTools.updateNode; + zTreeTools.updateNode = function(node, checkTypeFlag) { + if (_updateNode) _updateNode.apply(zTreeTools, arguments); + if (!node || !this.setting.check.enable) return; + var nObj = $$(node, this.setting); + if (nObj.get(0) && tools.uCanDo(this.setting)) { + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + } + } + }, + //method of operate data + _data = { + getRadioCheckedList: function(setting) { + var checkedList = data.getRoot(setting).radioCheckedList; + for (var i=0, j=checkedList.length; i -1 && node.check_Child_State < 2) : (node.check_Child_State > 0))) + }; + return r; + }, + getTreeCheckedNodes: function(setting, nodes, checked, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL); + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) { + results.push(nodes[i]); + if(onlyOne) { + break; + } + } + data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results); + if(onlyOne && results.length > 0) { + break; + } + } + return results; + }, + getTreeChangeCheckedNodes: function(setting, nodes, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked; + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) { + results.push(nodes[i]); + } + data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results); + } + return results; + }, + makeChkFlag: function(setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + chkFlag = -1; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var cNode = node[childKey][i]; + var tmp = -1; + if (setting.check.chkStyle == consts.radio.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 2; + } else if (cNode[checkedKey]) { + tmp = 2; + } else { + tmp = cNode.check_Child_State > 0 ? 2:0; + } + if (tmp == 2) { + chkFlag = 2; break; + } else if (tmp == 0){ + chkFlag = 0; + } + } else if (setting.check.chkStyle == consts.checkbox.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 1; + } else if (cNode[checkedKey] ) { + tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1; + } else { + tmp = (cNode.check_Child_State > 0) ? 1 : 0; + } + if (tmp === 1) { + chkFlag = 1; break; + } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) { + chkFlag = 1; break; + } else if (chkFlag === 2 && tmp > -1 && tmp < 2) { + chkFlag = 1; break; + } else if (tmp > -1) { + chkFlag = tmp; + } + } + } + } + node.check_Child_State = chkFlag; + } + }, + //method of event proxy + _event = { + + }, + //method of event handler + _handler = { + onCheckNode: function (event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkedKey = setting.data.key.checked; + if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true; + node[checkedKey] = !node[checkedKey]; + view.checkNodeRelation(setting, node); + var checkObj = $$(node, consts.id.CHECK, setting); + view.setChkClass(setting, checkObj, node); + view.repairParentChkClassWithSelf(setting, node); + setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]); + return true; + }, + onMouseoverCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = true; + view.setChkClass(setting, checkObj, node); + return true; + }, + onMouseoutCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = false; + view.setChkClass(setting, checkObj, node); + return true; + } + }, + //method of tools for zTree + _tools = { + + }, + //method of operate ztree dom + _view = { + checkNodeRelation: function(setting, node) { + var pNode, i, l, + childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + r = consts.radio; + if (setting.check.chkStyle == r.STYLE) { + var checkedList = data.getRadioCheckedList(setting); + if (node[checkedKey]) { + if (setting.check.radioType == r.TYPE_ALL) { + for (i = checkedList.length-1; i >= 0; i--) { + pNode = checkedList[i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + checkedList.splice(i, 1); + + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + if (pNode.parentTId != node.parentTId) { + view.repairParentChkClassWithSelf(setting, pNode); + } + } + } + checkedList.push(node); + } else { + var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (i = 0, l = parentNode[childKey].length; i < l; i++) { + pNode = parentNode[childKey][i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + } + } + } + } else if (setting.check.radioType == r.TYPE_ALL) { + for (i = 0, l = checkedList.length; i < l; i++) { + if (node == checkedList[i]) { + checkedList.splice(i, 1); + break; + } + } + } + + } else { + if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, false); + } + if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, false); + } + } + }, + makeChkClass: function(setting, node) { + var checkedKey = setting.data.key.checked, + c = consts.checkbox, r = consts.radio, + fullStyle = ""; + if (node.chkDisabled === true) { + fullStyle = c.DISABLED; + } else if (node.halfCheck) { + fullStyle = c.PART; + } else if (setting.check.chkStyle == r.STYLE) { + fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART; + } else { + fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART); + } + var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle; + chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName; + return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName; + }, + repairAllChk: function(setting, checked) { + if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) { + var checkedKey = setting.data.key.checked, + childKey = setting.data.key.children, + root = data.getRoot(setting); + for (var i = 0, l = root[childKey].length; i 0) { + view.repairParentChkClass(setting, node[childKey][0]); + } else { + view.repairParentChkClass(setting, node); + } + }, + repairSonChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + var childKey = setting.data.key.children; + if (node.chkDisabled != chkDisabled) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + if (node[childKey] && inherit) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var sNode = node[childKey][i]; + view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit); + } + } + }, + repairParentChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + if (node.chkDisabled != chkDisabled && inherit) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit); + }, + setChkClass: function(setting, obj, node) { + if (!obj) return; + if (node.nocheck === true) { + obj.hide(); + } else { + obj.show(); + } + obj.attr('class', view.makeChkClass(setting, node)); + }, + setParentNodeCheckBox: function(setting, node, value, srcNode) { + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + data.makeChkFlag(setting, node); + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + if (node.parentTId) { + var pSign = true; + if (!value) { + var pNodes = node.getParentNode()[childKey]; + for (var i = 0, l = pNodes.length; i < l; i++) { + if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey]) + || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) { + pSign = false; + break; + } + } + } + if (pSign) { + view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode); + } + } + }, + setSonNodeCheckBox: function(setting, node, value, srcNode) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + + var hasDisable = false; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var sNode = node[childKey][i]; + view.setSonNodeCheckBox(setting, sNode, value, srcNode); + if (sNode.chkDisabled === true) hasDisable = true; + } + } + + if (node != data.getRoot(setting) && node.chkDisabled !== true) { + if (hasDisable && node.nocheck !== true) { + data.makeChkFlag(setting, node); + } + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1; + } else { + node.check_Child_State = -1; + } + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + + } + }, + + _z = { + tools: _tools, + view: _view, + event: _event, + data: _data + }; + $.extend(true, $.fn.zTree.consts, _consts); + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.exSetting(_setting); + data.addInitBind(_bindEvent); + data.addInitUnBind(_unbindEvent); + data.addInitCache(_initCache); + data.addInitNode(_initNode); + data.addInitProxy(_eventProxy, true); + data.addInitRoot(_initRoot); + data.addBeforeA(_beforeA); + data.addZTreeTools(_zTreeTools); + + var _createNodes = view.createNodes; + view.createNodes = function(setting, level, nodes, parentNode, index) { + if (_createNodes) _createNodes.apply(view, arguments); + if (!nodes) return; + view.repairParentChkClassWithSelf(setting, parentNode); + } + var _removeNode = view.removeNode; + view.removeNode = function(setting, node) { + var parentNode = node.getParentNode(); + if (_removeNode) _removeNode.apply(view, arguments); + if (!node || !parentNode) return; + view.repairChkClass(setting, parentNode); + view.repairParentChkClass(setting, parentNode); + } + + var _appendNodes = view.appendNodes; + view.appendNodes = function(setting, level, nodes, parentNode, index, initFlag, openFlag) { + var html = ""; + if (_appendNodes) { + html = _appendNodes.apply(view, arguments); + } + if (parentNode) { + data.makeChkFlag(setting, parentNode); + } + return html; + } +})(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($){ + //default consts of exedit + var _consts = { + 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" + } + }, + //default setting of exedit + _setting = { + edit: { + enable: false, + editNameSelectAll: false, + showRemoveBtn: true, + showRenameBtn: true, + removeTitle: "remove", + renameTitle: "rename", + drag: { + autoExpandTrigger: false, + isCopy: true, + isMove: true, + prev: true, + next: true, + inner: true, + 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 + } + }, + //default root of exedit + _initRoot = function (setting) { + var r = data.getRoot(setting), rs = data.getRoots(); + r.curEditNode = null; + r.curEditInput = null; + r.curHoverNode = null; + r.dragFlag = 0; + r.dragNodeShowBefore = []; + r.dragMaskList = new Array(); + rs.showHoverDom = true; + }, + //default cache of exedit + _initCache = function(treeId) {}, + //default bind event of exedit + _bindEvent = function(setting) { + var o = setting.treeObj; + var c = consts.event; + o.bind(c.RENAME, function (event, treeId, treeNode, isCancel) { + tools.apply(setting.callback.onRename, [event, treeId, treeNode, isCancel]); + }); + + o.bind(c.DRAG, function (event, srcEvent, treeId, treeNodes) { + tools.apply(setting.callback.onDrag, [srcEvent, treeId, treeNodes]); + }); + + o.bind(c.DRAGMOVE,function(event, srcEvent, treeId, treeNodes){ + tools.apply(setting.callback.onDragMove,[srcEvent, treeId, treeNodes]); + }); + + o.bind(c.DROP, function (event, srcEvent, treeId, treeNodes, targetNode, moveType, isCopy) { + tools.apply(setting.callback.onDrop, [srcEvent, treeId, treeNodes, targetNode, moveType, isCopy]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj; + var c = consts.event; + o.unbind(c.RENAME); + o.unbind(c.DRAG); + o.unbind(c.DRAGMOVE); + o.unbind(c.DROP); + }, + //default event proxy of exedit + _eventProxy = function(e) { + var target = e.target, + setting = data.getSetting(e.data.treeId), + relatedTarget = e.relatedTarget, + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null, + tmp = null; + + if (tools.eqs(e.type, "mouseover")) { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "hoverOverNode"; + } + } else if (tools.eqs(e.type, "mouseout")) { + tmp = tools.getMDom(setting, relatedTarget, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (!tmp) { + tId = "remove"; + nodeEventType = "hoverOutNode"; + } + } else if (tools.eqs(e.type, "mousedown")) { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "mousedownNode"; + } + } + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "mousedownNode" : + nodeEventCallback = _handler.onMousedownNode; + break; + case "hoverOverNode" : + nodeEventCallback = _handler.onHoverOverNode; + break; + case "hoverOutNode" : + nodeEventCallback = _handler.onHoverOutNode; + break; + } + } + var proxyResult = { + stop: false, + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of exedit + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + n.isHover = false; + n.editNameFlag = false; + }, + //update zTreeObj, add method of edit + _zTreeTools = function(setting, zTreeTools) { + zTreeTools.cancelEditName = function(newName) { + var root = data.getRoot(this.setting); + if (!root.curEditNode) return; + view.cancelCurEditNode(this.setting, newName?newName:null, true); + } + zTreeTools.copyNode = function(targetNode, node, moveType, isSilent) { + if (!node) return null; + if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) return null; + var _this = this, + newNode = tools.clone(node); + if (!targetNode) { + targetNode = null; + moveType = consts.move.TYPE_INNER; + } + if (moveType == consts.move.TYPE_INNER) { + function copyCallback() { + view.addNodes(_this.setting, targetNode, -1, [newNode], isSilent); + } + + if (tools.canAsync(this.setting, targetNode)) { + view.asyncNode(this.setting, targetNode, isSilent, copyCallback); + } else { + copyCallback(); + } + } else { + view.addNodes(this.setting, targetNode.parentNode, -1, [newNode], isSilent); + view.moveNode(this.setting, targetNode, newNode, moveType, false, isSilent); + } + return newNode; + } + zTreeTools.editName = function(node) { + if (!node || !node.tId || node !== data.getNodeCache(this.setting, node.tId)) return; + if (node.parentTId) view.expandCollapseParentNode(this.setting, node.getParentNode(), true); + view.editNode(this.setting, node) + } + zTreeTools.moveNode = function(targetNode, node, moveType, isSilent) { + if (!node) return node; + if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) { + return null; + } else if (targetNode && ((node.parentTId == targetNode.tId && moveType == consts.move.TYPE_INNER) || $$(node, this.setting).find("#" + targetNode.tId).length > 0)) { + return null; + } else if (!targetNode) { + targetNode = null; + } + var _this = this; + function moveCallback() { + view.moveNode(_this.setting, targetNode, node, moveType, false, isSilent); + } + if (tools.canAsync(this.setting, targetNode) && moveType === consts.move.TYPE_INNER) { + view.asyncNode(this.setting, targetNode, isSilent, moveCallback); + } else { + moveCallback(); + } + return node; + } + zTreeTools.setEditable = function(editable) { + this.setting.edit.enable = editable; + return this.refresh(); + } + }, + //method of operate data + _data = { + setSonNodeLevel: function(setting, parentNode, node) { + if (!node) return; + var childKey = setting.data.key.children; + node.level = (parentNode)? parentNode.level + 1 : 0; + if (!node[childKey]) return; + for (var i = 0, l = node[childKey].length; i < l; i++) { + if (node[childKey][i]) data.setSonNodeLevel(setting, node, node[childKey][i]); + } + } + }, + //method of event proxy + _event = { + + }, + //method of event handler + _handler = { + onHoverOverNode: function(event, node) { + var setting = data.getSetting(event.data.treeId), + root = data.getRoot(setting); + if (root.curHoverNode != node) { + _handler.onHoverOutNode(event); + } + root.curHoverNode = node; + view.addHoverDom(setting, node); + }, + onHoverOutNode: function(event, node) { + var setting = data.getSetting(event.data.treeId), + root = data.getRoot(setting); + if (root.curHoverNode && !data.isSelectedNode(setting, root.curHoverNode)) { + view.removeTreeDom(setting, root.curHoverNode); + root.curHoverNode = null; + } + }, + onMousedownNode: function(eventMouseDown, _node) { + var i,l, + setting = data.getSetting(eventMouseDown.data.treeId), + root = data.getRoot(setting), roots = data.getRoots(); + //right click can't drag & drop + if (eventMouseDown.button == 2 || !setting.edit.enable || (!setting.edit.drag.isCopy && !setting.edit.drag.isMove)) return true; + + //input of edit node name can't drag & drop + var target = eventMouseDown.target, + _nodes = data.getRoot(setting).curSelectedList, + nodes = []; + if (!data.isSelectedNode(setting, _node)) { + nodes = [_node]; + } else { + for (i=0, l=_nodes.length; i1) { + var pNodes = nodes[0].parentTId ? nodes[0].getParentNode()[childKey] : data.getNodes(setting); + tmpNodes = []; + for (i=0, l=pNodes.length; i -1 && (lastIndex+1) !== i) { + isOrder = false; + } + tmpNodes.push(pNodes[i]); + lastIndex = i; + } + if (nodes.length === tmpNodes.length) { + nodes = tmpNodes; + break; + } + } + } + if (isOrder) { + preNode = nodes[0].getPreNode(); + nextNode = nodes[nodes.length-1].getNextNode(); + } + + //set node in selected + curNode = $$("
                      ", setting); + for (i=0, l=nodes.length; i0); + view.removeTreeDom(setting, tmpNode); + + if (i > setting.edit.drag.maxShowNodeNum-1) { + continue; + } + + tmpDom = $$("
                    • ", setting); + tmpDom.append($$(tmpNode, consts.id.A, setting).clone()); + tmpDom.css("padding", "0"); + tmpDom.children("#" + tmpNode.tId + consts.id.A).removeClass(consts.node.CURSELECTED); + curNode.append(tmpDom); + if (i == setting.edit.drag.maxShowNodeNum-1) { + tmpDom = $$("
                    • ...
                    • ", setting); + curNode.append(tmpDom); + } + } + curNode.attr("id", nodes[0].tId + consts.id.UL + "_tmp"); + curNode.addClass(setting.treeObj.attr("class")); + curNode.appendTo(body); + + tmpArrow = $$("", setting); + tmpArrow.attr("id", "zTreeMove_arrow_tmp"); + tmpArrow.appendTo(body); + + setting.treeObj.trigger(consts.event.DRAG, [event, setting.treeId, nodes]); + } + + if (root.dragFlag == 1) { + if (tmpTarget && tmpArrow.attr("id") == event.target.id && tmpTargetNodeId && (event.clientX + doc.scrollLeft()+2) > ($("#" + tmpTargetNodeId + consts.id.A, tmpTarget).offset().left)) { + var xT = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget); + event.target = (xT.length > 0) ? xT.get(0) : event.target; + } else if (tmpTarget) { + tmpTarget.removeClass(consts.node.TMPTARGET_TREE); + if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV) + .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER); + } + tmpTarget = null; + tmpTargetNodeId = null; + + //judge drag & drop in multi ztree + isOtherTree = false; + targetSetting = setting; + var settings = data.getSettings(); + for (var s in settings) { + if (settings[s].treeId && settings[s].edit.enable && settings[s].treeId != setting.treeId + && (event.target.id == settings[s].treeId || $(event.target).parents("#" + settings[s].treeId).length>0)) { + isOtherTree = true; + targetSetting = settings[s]; + } + } + + var docScrollTop = doc.scrollTop(), + docScrollLeft = doc.scrollLeft(), + treeOffset = targetSetting.treeObj.offset(), + scrollHeight = targetSetting.treeObj.get(0).scrollHeight, + scrollWidth = targetSetting.treeObj.get(0).scrollWidth, + dTop = (event.clientY + docScrollTop - treeOffset.top), + dBottom = (targetSetting.treeObj.height() + treeOffset.top - event.clientY - docScrollTop), + dLeft = (event.clientX + docScrollLeft - treeOffset.left), + dRight = (targetSetting.treeObj.width() + treeOffset.left - event.clientX - docScrollLeft), + isTop = (dTop < setting.edit.drag.borderMax && dTop > setting.edit.drag.borderMin), + isBottom = (dBottom < setting.edit.drag.borderMax && dBottom > setting.edit.drag.borderMin), + isLeft = (dLeft < setting.edit.drag.borderMax && dLeft > setting.edit.drag.borderMin), + isRight = (dRight < setting.edit.drag.borderMax && dRight > setting.edit.drag.borderMin), + isTreeInner = dTop > setting.edit.drag.borderMin && dBottom > setting.edit.drag.borderMin && dLeft > setting.edit.drag.borderMin && dRight > setting.edit.drag.borderMin, + isTreeTop = (isTop && targetSetting.treeObj.scrollTop() <= 0), + isTreeBottom = (isBottom && (targetSetting.treeObj.scrollTop() + targetSetting.treeObj.height()+10) >= scrollHeight), + isTreeLeft = (isLeft && targetSetting.treeObj.scrollLeft() <= 0), + isTreeRight = (isRight && (targetSetting.treeObj.scrollLeft() + targetSetting.treeObj.width()+10) >= scrollWidth); + + if (event.target && tools.isChildOrSelf(event.target, targetSetting.treeId)) { + //get node
                    • dom + var targetObj = event.target; + while (targetObj && targetObj.tagName && !tools.eqs(targetObj.tagName, "li") && targetObj.id != targetSetting.treeId) { + targetObj = targetObj.parentNode; + } + + var canMove = true; + //don't move to self or children of self + for (i=0, l=nodes.length; i 0) { + canMove = false; + break; + } + } + if (canMove && event.target && tools.isChildOrSelf(event.target, targetObj.id + consts.id.A)) { + tmpTarget = $(targetObj); + tmpTargetNodeId = targetObj.id; + } + } + + //the mouse must be in zTree + tmpNode = nodes[0]; + if (isTreeInner && tools.isChildOrSelf(event.target, targetSetting.treeId)) { + //judge mouse move in root of ztree + if (!tmpTarget && (event.target.id == targetSetting.treeId || isTreeTop || isTreeBottom || isTreeLeft || isTreeRight) && (isOtherTree || (!isOtherTree && tmpNode.parentTId))) { + tmpTarget = targetSetting.treeObj; + } + //auto scroll top + if (isTop) { + targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10); + } else if (isBottom) { + targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10); + } + if (isLeft) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10); + } else if (isRight) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10); + } + //auto scroll left + if (tmpTarget && tmpTarget != targetSetting.treeObj && tmpTarget.offset().left < targetSetting.treeObj.offset().left) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+ tmpTarget.offset().left - targetSetting.treeObj.offset().left); + } + } + + curNode.css({ + "top": (event.clientY + docScrollTop + 3) + "px", + "left": (event.clientX + docScrollLeft + 3) + "px" + }); + + var dX = 0; + var dY = 0; + if (tmpTarget && tmpTarget.attr("id")!=targetSetting.treeId) { + var tmpTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId), + isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy), + isPrev = !!(preNode && tmpTargetNodeId === preNode.tId), + isNext = !!(nextNode && tmpTargetNodeId === nextNode.tId), + isInner = (tmpNode.parentTId && tmpNode.parentTId == tmpTargetNodeId), + canPrev = (isCopy || !isNext) && tools.apply(targetSetting.edit.drag.prev, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.prev), + canNext = (isCopy || !isPrev) && tools.apply(targetSetting.edit.drag.next, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.next), + canInner = (isCopy || !isInner) && !(targetSetting.data.keep.leaf && !tmpTargetNode.isParent) && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.inner); + + function clearMove() { + tmpTarget = null; + tmpTargetNodeId = ""; + moveType = consts.move.TYPE_INNER; + tmpArrow.css({ + "display":"none" + }); + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null + } + } + if (!canPrev && !canNext && !canInner) { + clearMove(); + } else { + var tmpTargetA = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget), + tmpNextA = tmpTargetNode.isLastNode ? null : $("#" + tmpTargetNode.getNextNode().tId + consts.id.A, tmpTarget.next()), + tmpTop = tmpTargetA.offset().top, + tmpLeft = tmpTargetA.offset().left, + prevPercent = canPrev ? (canInner ? 0.25 : (canNext ? 0.5 : 1) ) : -1, + nextPercent = canNext ? (canInner ? 0.75 : (canPrev ? 0.5 : 0) ) : -1, + dY_percent = (event.clientY + docScrollTop - tmpTop)/tmpTargetA.height(); + + if ((prevPercent==1 || dY_percent<=prevPercent && dY_percent>=-.2) && canPrev) { + dX = 1 - tmpArrow.width(); + dY = tmpTop - tmpArrow.height()/2; + moveType = consts.move.TYPE_PREV; + } else if ((nextPercent==0 || dY_percent>=nextPercent && dY_percent<=1.2) && canNext) { + dX = 1 - tmpArrow.width(); + dY = (tmpNextA == null || (tmpTargetNode.isParent && tmpTargetNode.open)) ? (tmpTop + tmpTargetA.height() - tmpArrow.height()/2) : (tmpNextA.offset().top - tmpArrow.height()/2); + moveType = consts.move.TYPE_NEXT; + } else if (canInner) { + dX = 5 - tmpArrow.width(); + dY = tmpTop; + moveType = consts.move.TYPE_INNER; + } else { + clearMove(); + } + + if (tmpTarget) { + tmpArrow.css({ + "display":"block", + "top": dY + "px", + "left": (tmpLeft + dX) + "px" + }); + tmpTargetA.addClass(consts.node.TMPTARGET_NODE + "_" + moveType); + + if (preTmpTargetNodeId != tmpTargetNodeId || preTmpMoveType != moveType) { + startTime = (new Date()).getTime(); + } + if (tmpTargetNode && tmpTargetNode.isParent && moveType == consts.move.TYPE_INNER) { + var startTimer = true; + if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId !== tmpTargetNode.tId) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } else if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId === tmpTargetNode.tId) { + startTimer = false; + } + if (startTimer) { + window.zTreeMoveTimer = setTimeout(function() { + if (moveType != consts.move.TYPE_INNER) return; + if (tmpTargetNode && tmpTargetNode.isParent && !tmpTargetNode.open && (new Date()).getTime() - startTime > targetSetting.edit.drag.autoOpenTime + && tools.apply(targetSetting.callback.beforeDragOpen, [targetSetting.treeId, tmpTargetNode], true)) { + view.switchNode(targetSetting, tmpTargetNode); + if (targetSetting.edit.drag.autoExpandTrigger) { + targetSetting.treeObj.trigger(consts.event.EXPAND, [targetSetting.treeId, tmpTargetNode]); + } + } + }, targetSetting.edit.drag.autoOpenTime+50); + window.zTreeMoveTargetNodeTId = tmpTargetNode.tId; + } + } + } + } + } else { + moveType = consts.move.TYPE_INNER; + if (tmpTarget && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, null], !!targetSetting.edit.drag.inner)) { + tmpTarget.addClass(consts.node.TMPTARGET_TREE); + } else { + tmpTarget = null; + } + tmpArrow.css({ + "display":"none" + }); + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } + } + preTmpTargetNodeId = tmpTargetNodeId; + preTmpMoveType = moveType; + + setting.treeObj.trigger(consts.event.DRAGMOVE, [event, setting.treeId, nodes]); + } + return false; + } + + doc.bind("mouseup", _docMouseUp); + function _docMouseUp(event) { + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } + preTmpTargetNodeId = null; + preTmpMoveType = null; + doc.unbind("mousemove", _docMouseMove); + doc.unbind("mouseup", _docMouseUp); + doc.unbind("selectstart", _docSelect); + body.css("cursor", "auto"); + if (tmpTarget) { + tmpTarget.removeClass(consts.node.TMPTARGET_TREE); + if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV) + .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER); + } + tools.showIfameMask(setting, false); + + roots.showHoverDom = true; + if (root.dragFlag == 0) return; + root.dragFlag = 0; + + var i, l, tmpNode; + for (i=0, l=nodes.length; i 0) { + root.dragMaskList[0].remove(); + root.dragMaskList.shift(); + } + if (showSign) { + //show mask + var iframeList = $$("iframe", setting); + for (var i = 0, l = iframeList.length; i < l; i++) { + var obj = iframeList.get(i), + r = tools.getAbs(obj), + dragMask = $$("
                      ", setting); + dragMask.appendTo($$("body", setting)); + root.dragMaskList.push(dragMask); + } + } + } + }, + //method of operate ztree dom + _view = { + addEditBtn: function(setting, node) { + if (node.editNameFlag || $$(node, consts.id.EDIT, setting).length > 0) { + return; + } + if (!tools.apply(setting.edit.showRenameBtn, [setting.treeId, node], setting.edit.showRenameBtn)) { + return; + } + var aObj = $$(node, consts.id.A, setting), + editStr = ""; + aObj.append(editStr); + + $$(node, consts.id.EDIT, setting).bind('click', + function() { + if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeEditName, [setting.treeId, node], true) == false) return false; + view.editNode(setting, node); + return false; + } + ).show(); + }, + addRemoveBtn: function(setting, node) { + if (node.editNameFlag || $$(node, consts.id.REMOVE, setting).length > 0) { + return; + } + if (!tools.apply(setting.edit.showRemoveBtn, [setting.treeId, node], setting.edit.showRemoveBtn)) { + return; + } + var aObj = $$(node, consts.id.A, setting), + removeStr = ""; + aObj.append(removeStr); + + $$(node, consts.id.REMOVE, setting).bind('click', + function() { + if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return false; + view.removeNode(setting, node); + setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]); + return false; + } + ).bind('mousedown', + function(eventMouseDown) { + return true; + } + ).show(); + }, + addHoverDom: function(setting, node) { + if (data.getRoots().showHoverDom) { + node.isHover = true; + if (setting.edit.enable) { + view.addEditBtn(setting, node); + view.addRemoveBtn(setting, node); + } + tools.apply(setting.view.addHoverDom, [setting.treeId, node]); + } + }, + cancelCurEditNode: function (setting, forceName, isCancel) { + var root = data.getRoot(setting), + nameKey = setting.data.key.name, + node = root.curEditNode; + + if (node) { + var inputObj = root.curEditInput, + newName = forceName ? forceName:(isCancel ? node[nameKey]: inputObj.val()); + if (tools.apply(setting.callback.beforeRename, [setting.treeId, node, newName, isCancel], true) === false) { + return false; + } + node[nameKey] = newName; + var aObj = $$(node, consts.id.A, setting); + aObj.removeClass(consts.node.CURSELECTED_EDIT); + inputObj.unbind(); + view.setNodeName(setting, node); + node.editNameFlag = false; + root.curEditNode = null; + root.curEditInput = null; + view.selectNode(setting, node, false); + setting.treeObj.trigger(consts.event.RENAME, [setting.treeId, node, isCancel]); + } + root.noSelection = true; + return true; + }, + editNode: function(setting, node) { + var root = data.getRoot(setting); + view.editNodeBlur = false; + if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) { + setTimeout(function() {tools.inputFocus(root.curEditInput);}, 0); + return; + } + var nameKey = setting.data.key.name; + node.editNameFlag = true; + view.removeTreeDom(setting, node); + view.cancelCurEditNode(setting); + view.selectNode(setting, node, false); + $$(node, consts.id.SPAN, setting).html(""); + var inputObj = $$(node, consts.id.INPUT, setting); + inputObj.attr("value", node[nameKey]); + if (setting.edit.editNameSelectAll) { + tools.inputSelect(inputObj); + } else { + tools.inputFocus(inputObj); + } + + inputObj.bind('blur', function(event) { + if (!view.editNodeBlur) { + view.cancelCurEditNode(setting); + } + }).bind('keydown', function(event) { + if (event.keyCode=="13") { + view.editNodeBlur = true; + view.cancelCurEditNode(setting); + } else if (event.keyCode=="27") { + view.cancelCurEditNode(setting, null, true); + } + }).bind('click', function(event) { + return false; + }).bind('dblclick', function(event) { + return false; + }); + + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED_EDIT); + root.curEditInput = inputObj; + root.noSelection = false; + root.curEditNode = node; + }, + moveNode: function(setting, targetNode, node, moveType, animateFlag, isSilent) { + var root = data.getRoot(setting), + childKey = setting.data.key.children; + if (targetNode == node) return; + if (setting.data.keep.leaf && targetNode && !targetNode.isParent && moveType == consts.move.TYPE_INNER) return; + var oldParentNode = (node.parentTId ? node.getParentNode(): root), + targetNodeIsRoot = (targetNode === null || targetNode == root); + if (targetNodeIsRoot && targetNode === null) targetNode = root; + if (targetNodeIsRoot) moveType = consts.move.TYPE_INNER; + var targetParentNode = (targetNode.parentTId ? targetNode.getParentNode() : root); + + if (moveType != consts.move.TYPE_PREV && moveType != consts.move.TYPE_NEXT) { + moveType = consts.move.TYPE_INNER; + } + + if (moveType == consts.move.TYPE_INNER) { + if (targetNodeIsRoot) { + //parentTId of root node is null + node.parentTId = null; + } else { + if (!targetNode.isParent) { + targetNode.isParent = true; + targetNode.open = !!targetNode.open; + view.setNodeLineIcos(setting, targetNode); + } + node.parentTId = targetNode.tId; + } + } + + //move node Dom + var targetObj, target_ulObj; + if (targetNodeIsRoot) { + targetObj = setting.treeObj; + target_ulObj = targetObj; + } else { + if (!isSilent && moveType == consts.move.TYPE_INNER) { + view.expandCollapseNode(setting, targetNode, true, false); + } else if (!isSilent) { + view.expandCollapseNode(setting, targetNode.getParentNode(), true, false); + } + targetObj = $$(targetNode, setting); + target_ulObj = $$(targetNode, consts.id.UL, setting); + if (!!targetObj.get(0) && !target_ulObj.get(0)) { + var ulstr = []; + view.makeUlHtml(setting, targetNode, ulstr, ''); + targetObj.append(ulstr.join('')); + } + target_ulObj = $$(targetNode, consts.id.UL, setting); + } + var nodeDom = $$(node, setting); + if (!nodeDom.get(0)) { + nodeDom = view.appendNodes(setting, node.level, [node], null, -1, false, true).join(''); + } else if (!targetObj.get(0)) { + nodeDom.remove(); + } + if (target_ulObj.get(0) && moveType == consts.move.TYPE_INNER) { + target_ulObj.append(nodeDom); + } else if (targetObj.get(0) && moveType == consts.move.TYPE_PREV) { + targetObj.before(nodeDom); + } else if (targetObj.get(0) && moveType == consts.move.TYPE_NEXT) { + targetObj.after(nodeDom); + } + + //repair the data after move + var i,l, + tmpSrcIndex = -1, + tmpTargetIndex = 0, + oldNeighbor = null, + newNeighbor = null, + oldLevel = node.level; + if (node.isFirstNode) { + tmpSrcIndex = 0; + if (oldParentNode[childKey].length > 1 ) { + oldNeighbor = oldParentNode[childKey][1]; + oldNeighbor.isFirstNode = true; + } + } else if (node.isLastNode) { + tmpSrcIndex = oldParentNode[childKey].length -1; + oldNeighbor = oldParentNode[childKey][tmpSrcIndex - 1]; + oldNeighbor.isLastNode = true; + } else { + for (i = 0, l = oldParentNode[childKey].length; i < l; i++) { + if (oldParentNode[childKey][i].tId == node.tId) { + tmpSrcIndex = i; + break; + } + } + } + if (tmpSrcIndex >= 0) { + oldParentNode[childKey].splice(tmpSrcIndex, 1); + } + if (moveType != consts.move.TYPE_INNER) { + for (i = 0, l = targetParentNode[childKey].length; i < l; i++) { + if (targetParentNode[childKey][i].tId == targetNode.tId) tmpTargetIndex = i; + } + } + if (moveType == consts.move.TYPE_INNER) { + if (!targetNode[childKey]) targetNode[childKey] = new Array(); + if (targetNode[childKey].length > 0) { + newNeighbor = targetNode[childKey][targetNode[childKey].length - 1]; + newNeighbor.isLastNode = false; + } + targetNode[childKey].splice(targetNode[childKey].length, 0, node); + node.isLastNode = true; + node.isFirstNode = (targetNode[childKey].length == 1); + } else if (targetNode.isFirstNode && moveType == consts.move.TYPE_PREV) { + targetParentNode[childKey].splice(tmpTargetIndex, 0, node); + newNeighbor = targetNode; + newNeighbor.isFirstNode = false; + node.parentTId = targetNode.parentTId; + node.isFirstNode = true; + node.isLastNode = false; + + } else if (targetNode.isLastNode && moveType == consts.move.TYPE_NEXT) { + targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node); + newNeighbor = targetNode; + newNeighbor.isLastNode = false; + node.parentTId = targetNode.parentTId; + node.isFirstNode = false; + node.isLastNode = true; + + } else { + if (moveType == consts.move.TYPE_PREV) { + targetParentNode[childKey].splice(tmpTargetIndex, 0, node); + } else { + targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node); + } + node.parentTId = targetNode.parentTId; + node.isFirstNode = false; + node.isLastNode = false; + } + data.fixPIdKeyValue(setting, node); + data.setSonNodeLevel(setting, node.getParentNode(), node); + + //repair node what been moved + view.setNodeLineIcos(setting, node); + view.repairNodeLevelClass(setting, node, oldLevel) + + //repair node's old parentNode dom + if (!setting.data.keep.parent && oldParentNode[childKey].length < 1) { + //old parentNode has no child nodes + oldParentNode.isParent = false; + oldParentNode.open = false; + var tmp_ulObj = $$(oldParentNode, consts.id.UL, setting), + tmp_switchObj = $$(oldParentNode, consts.id.SWITCH, setting), + tmp_icoObj = $$(oldParentNode, consts.id.ICON, setting); + view.replaceSwitchClass(oldParentNode, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(oldParentNode, tmp_icoObj, consts.folder.DOCU); + tmp_ulObj.css("display", "none"); + + } else if (oldNeighbor) { + //old neigbor node + view.setNodeLineIcos(setting, oldNeighbor); + } + + //new neigbor node + if (newNeighbor) { + view.setNodeLineIcos(setting, newNeighbor); + } + + //repair checkbox / radio + if (!!setting.check && setting.check.enable && view.repairChkClass) { + view.repairChkClass(setting, oldParentNode); + view.repairParentChkClassWithSelf(setting, oldParentNode); + if (oldParentNode != node.parent) + view.repairParentChkClassWithSelf(setting, node); + } + + //expand parents after move + if (!isSilent) { + view.expandCollapseParentNode(setting, node.getParentNode(), true, animateFlag); + } + }, + removeEditBtn: function(setting, node) { + $$(node, consts.id.EDIT, setting).unbind().remove(); + }, + removeRemoveBtn: function(setting, node) { + $$(node, consts.id.REMOVE, setting).unbind().remove(); + }, + removeTreeDom: function(setting, node) { + node.isHover = false; + view.removeEditBtn(setting, node); + view.removeRemoveBtn(setting, node); + tools.apply(setting.view.removeHoverDom, [setting.treeId, node]); + }, + repairNodeLevelClass: function(setting, node, oldLevel) { + if (oldLevel === node.level) return; + var liObj = $$(node, setting), + aObj = $$(node, consts.id.A, setting), + ulObj = $$(node, consts.id.UL, setting), + oldClass = consts.className.LEVEL + oldLevel, + newClass = consts.className.LEVEL + node.level; + liObj.removeClass(oldClass); + liObj.addClass(newClass); + aObj.removeClass(oldClass); + aObj.addClass(newClass); + ulObj.removeClass(oldClass); + ulObj.addClass(newClass); + }, + selectNodes : function(setting, nodes) { + for (var i=0, l=nodes.length; i0); + } + } + }, + + _z = { + tools: _tools, + view: _view, + event: _event, + data: _data + }; + $.extend(true, $.fn.zTree.consts, _consts); + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.exSetting(_setting); + data.addInitBind(_bindEvent); + data.addInitUnBind(_unbindEvent); + data.addInitCache(_initCache); + data.addInitNode(_initNode); + data.addInitProxy(_eventProxy); + data.addInitRoot(_initRoot); + data.addZTreeTools(_zTreeTools); + + var _cancelPreSelectedNode = view.cancelPreSelectedNode; + view.cancelPreSelectedNode = function (setting, node) { + var list = data.getRoot(setting).curSelectedList; + for (var i=0, j=list.length; i0?(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-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;i0)},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&&d0},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;s0&&(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&&e1&&(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 +-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,">");b.push("",d,"")},makeDOMNodeLine:function(b,a,c){b.push("")},makeDOMNodeMainAfter:function(b){b.push("
                    • ")},makeDOMNodeMainBefore:function(b,a,c){b.push("
                    • ")},makeDOMNodeNameAfter:function(b){b.push("")}, +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("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, +">"),"'");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("
                        ");c.push(d);c.push("
                      ")},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;e0)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;g0){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;f0?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-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;i0?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;i0){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;k0?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-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;f0)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;i0?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(""))});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)1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a-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("
                        ", +e);for(a=0,c=l.length;a0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("
                      • ",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("
                      • ...
                      • ",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("", +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=ce.edit.drag.borderMin;var j=pe.edit.drag.borderMin,F=qe.edit.drag.borderMin,x=He.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;a0){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=-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;a0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f
                        ",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="";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="";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("");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=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p0)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;c0)}},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;a0)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 0 && tId.length == 0) { + tmp = tools.getMDom(setting, target, [{tagName: "a", attrName: "treeNode" + consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + } + } + // event to node + if (tId.length > 0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "switchNode" : + if (!node.isParent) { + nodeEventType = ""; + } else if (tools.eqs(event.type, "click") + || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) { + nodeEventCallback = handler.onSwitchNode; + } else { + nodeEventType = ""; + } + break; + case "clickNode" : + nodeEventCallback = handler.onClickNode; + break; + } + } + // event to zTree + switch (treeEventType) { + case "mousedown" : + treeEventCallback = handler.onZTreeMousedown; + break; + case "mouseup" : + treeEventCallback = handler.onZTreeMouseup; + break; + case "dblclick" : + treeEventCallback = handler.onZTreeDblclick; + break; + case "contextmenu" : + treeEventCallback = handler.onZTreeContextmenu; + break; + } + var proxyResult = { + stop: false, + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of core + _initNode = function (setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var r = data.getRoot(setting), + childKey = setting.data.key.children; + n.level = level; + n.tId = setting.treeId + "_" + (++r.zId); + n.parentTId = parentNode ? parentNode.tId : null; + n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open; + if (n[childKey] && n[childKey].length > 0) { + n.isParent = true; + n.zAsync = true; + } else { + n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent; + n.open = (n.isParent && !setting.async.enable) ? n.open : false; + n.zAsync = !n.isParent; + } + n.isFirstNode = isFirstNode; + n.isLastNode = isLastNode; + n.getParentNode = function () { + return data.getNodeCache(setting, n.parentTId); + }; + n.getPreNode = function () { + return data.getPreNode(setting, n); + }; + n.getNextNode = function () { + return data.getNextNode(setting, n); + }; + n.getIndex = function () { + return data.getNodeIndex(setting, n); + }; + n.getPath = function () { + return data.getNodePath(setting, n); + }; + n.isAjaxing = false; + data.fixPIdKeyValue(setting, n); + }, + _init = { + bind: [_bindEvent], + unbind: [_unbindEvent], + caches: [_initCache], + nodes: [_initNode], + proxys: [_eventProxy], + roots: [_initRoot], + beforeA: [], + afterA: [], + innerBeforeA: [], + innerAfterA: [], + zTreeTools: [] + }, + //method of operate data + data = { + addNodeCache: function (setting, node) { + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node; + }, + getNodeCacheId: function (tId) { + return tId.substring(tId.lastIndexOf("_") + 1); + }, + addAfterA: function (afterA) { + _init.afterA.push(afterA); + }, + addBeforeA: function (beforeA) { + _init.beforeA.push(beforeA); + }, + addInnerAfterA: function (innerAfterA) { + _init.innerAfterA.push(innerAfterA); + }, + addInnerBeforeA: function (innerBeforeA) { + _init.innerBeforeA.push(innerBeforeA); + }, + addInitBind: function (bindEvent) { + _init.bind.push(bindEvent); + }, + addInitUnBind: function (unbindEvent) { + _init.unbind.push(unbindEvent); + }, + addInitCache: function (initCache) { + _init.caches.push(initCache); + }, + addInitNode: function (initNode) { + _init.nodes.push(initNode); + }, + addInitProxy: function (initProxy, isFirst) { + if (!!isFirst) { + _init.proxys.splice(0, 0, initProxy); + } else { + _init.proxys.push(initProxy); + } + }, + addInitRoot: function (initRoot) { + _init.roots.push(initRoot); + }, + addNodesData: function (setting, parentNode, index, nodes) { + var childKey = setting.data.key.children, params; + if (!parentNode[childKey]) { + parentNode[childKey] = []; + index = -1; + } else if (index >= parentNode[childKey].length) { + index = -1; + } + + if (parentNode[childKey].length > 0 && index === 0) { + parentNode[childKey][0].isFirstNode = false; + view.setNodeLineIcos(setting, parentNode[childKey][0]); + } else if (parentNode[childKey].length > 0 && index < 0) { + parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false; + view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]); + } + parentNode.isParent = true; + + if (index < 0) { + parentNode[childKey] = parentNode[childKey].concat(nodes); + } else { + params = [index, 0].concat(nodes); + parentNode[childKey].splice.apply(parentNode[childKey], params); + } + }, + addSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + if (!data.isSelectedNode(setting, node)) { + root.curSelectedList.push(node); + } + }, + addCreatedNode: function (setting, node) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + root.createdNodes.push(node); + } + }, + addZTreeTools: function (zTreeTools) { + _init.zTreeTools.push(zTreeTools); + }, + exSetting: function (s) { + $.extend(true, _setting, s); + }, + fixPIdKeyValue: function (setting, node) { + if (setting.data.simpleData.enable) { + node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId; + } + }, + getAfterA: function (setting, node, array) { + for (var i = 0, j = _init.afterA.length; i < j; i++) { + _init.afterA[i].apply(this, arguments); + } + }, + getBeforeA: function (setting, node, array) { + for (var i = 0, j = _init.beforeA.length; i < j; i++) { + _init.beforeA[i].apply(this, arguments); + } + }, + getInnerAfterA: function (setting, node, array) { + for (var i = 0, j = _init.innerAfterA.length; i < j; i++) { + _init.innerAfterA[i].apply(this, arguments); + } + }, + getInnerBeforeA: function (setting, node, array) { + for (var i = 0, j = _init.innerBeforeA.length; i < j; i++) { + _init.innerBeforeA[i].apply(this, arguments); + } + }, + getCache: function (setting) { + return caches[setting.treeId]; + }, + getNodeIndex: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length - 1; i <= l; i++) { + if (p[childKey][i] === node) { + return i; + } + } + return -1; + }, + getNextNode: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length - 1; i <= l; i++) { + if (p[childKey][i] === node) { + return (i == l ? null : p[childKey][i + 1]); + } + } + return null; + }, + getNodeByParam: function (setting, nodes, key, value) { + if (!nodes || !key) return null; + var childKey = setting.data.key.children; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + return nodes[i]; + } + var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value); + if (tmp) return tmp; + } + return null; + }, + getNodeCache: function (setting, tId) { + if (!tId) return null; + var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)]; + return n ? n : null; + }, + getNodeName: function (setting, node) { + var nameKey = setting.data.key.name; + return "" + node[nameKey]; + }, + getNodePath: function (setting, node) { + if (!node) return null; + + var path; + if (node.parentTId) { + path = node.getParentNode().getPath(); + } else { + path = []; + } + + if (path) { + path.push(node); + } + + return path; + }, + getNodeTitle: function (setting, node) { + var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title; + return "" + node[t]; + }, + getNodes: function (setting) { + return data.getRoot(setting)[setting.data.key.children]; + }, + getNodesByParam: function (setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByParamFuzzy: function (setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + value = value.toLowerCase(); + for (var i = 0, l = nodes.length; i < l; i++) { + if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value) > -1) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByFilter: function (setting, nodes, filter, isSingle, invokeParam) { + if (!nodes) return (isSingle ? null : []); + var childKey = setting.data.key.children, + result = isSingle ? null : []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (tools.apply(filter, [nodes[i], invokeParam], false)) { + if (isSingle) { + return nodes[i]; + } + result.push(nodes[i]); + } + var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam); + if (isSingle && !!tmpResult) { + return tmpResult; + } + result = isSingle ? tmpResult : result.concat(tmpResult); + } + return result; + }, + getPreNode: function (setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = p[childKey].length; i < l; i++) { + if (p[childKey][i] === node) { + return (i == 0 ? null : p[childKey][i - 1]); + } + } + return null; + }, + getRoot: function (setting) { + return setting ? roots[setting.treeId] : null; + }, + getRoots: function () { + return roots; + }, + getSetting: function (treeId) { + return settings[treeId]; + }, + getSettings: function () { + return settings; + }, + getZTreeTools: function (treeId) { + var r = this.getRoot(this.getSetting(treeId)); + return r ? r.treeTools : null; + }, + initCache: function (setting) { + for (var i = 0, j = _init.caches.length; i < j; i++) { + _init.caches[i].apply(this, arguments); + } + }, + initNode: function (setting, level, node, parentNode, preNode, nextNode) { + for (var i = 0, j = _init.nodes.length; i < j; i++) { + _init.nodes[i].apply(this, arguments); + } + }, + initRoot: function (setting) { + for (var i = 0, j = _init.roots.length; i < j; i++) { + _init.roots[i].apply(this, arguments); + } + }, + isSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + for (var i = 0, j = root.curSelectedList.length; i < j; i++) { + if (node === root.curSelectedList[i]) return true; + } + return false; + }, + removeNodeCache: function (setting, node) { + var childKey = setting.data.key.children; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + data.removeNodeCache(setting, node[childKey][i]); + } + } + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null; + }, + removeSelectedNode: function (setting, node) { + var root = data.getRoot(setting); + for (var i = 0, j = root.curSelectedList.length; i < j; i++) { + if (node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) { + root.curSelectedList.splice(i, 1); + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]); + i--; + j--; + } + } + }, + setCache: function (setting, cache) { + caches[setting.treeId] = cache; + }, + setRoot: function (setting, root) { + roots[setting.treeId] = root; + }, + setZTreeTools: function (setting, zTreeTools) { + for (var i = 0, j = _init.zTreeTools.length; i < j; i++) { + _init.zTreeTools[i].apply(this, arguments); + } + }, + transformToArrayFormat: function (setting, nodes) { + if (!nodes) return []; + var childKey = setting.data.key.children, + r = []; + if (tools.isArray(nodes)) { + for (var i = 0, l = nodes.length; i < l; i++) { + r.push(nodes[i]); + if (nodes[i][childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey])); + } + } else { + r.push(nodes); + if (nodes[childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[childKey])); + } + return r; + }, + transformTozTreeFormat: function (setting, sNodes) { + var i, l, + key = setting.data.simpleData.idKey, + parentKey = setting.data.simpleData.pIdKey, + childKey = setting.data.key.children; + if (!key || key == "" || !sNodes) return []; + + if (tools.isArray(sNodes)) { + var r = []; + var tmpMap = {}; + for (i = 0, l = sNodes.length; i < l; i++) { + tmpMap[sNodes[i][key]] = sNodes[i]; + } + for (i = 0, l = sNodes.length; i < l; i++) { + if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) { + if (!tmpMap[sNodes[i][parentKey]][childKey]) + tmpMap[sNodes[i][parentKey]][childKey] = []; + tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]); + } else { + r.push(sNodes[i]); + } + } + return r; + } else { + return [sNodes]; + } + } + }, + //method of event proxy + event = { + bindEvent: function (setting) { + for (var i = 0, j = _init.bind.length; i < j; i++) { + _init.bind[i].apply(this, arguments); + } + }, + unbindEvent: function (setting) { + for (var i = 0, j = _init.unbind.length; i < j; i++) { + _init.unbind[i].apply(this, arguments); + } + }, + bindTree: function (setting) { + var eventParam = { + treeId: setting.treeId + }, + o = setting.treeObj; + if (!setting.view.txtSelectedEnable) { + // for can't select text + o.bind('selectstart', handler.onSelectStart).css({ + "-moz-user-select": "-moz-none" + }); + } + o.bind('click', eventParam, event.proxy); + o.bind('dblclick', eventParam, event.proxy); + o.bind('mouseover', eventParam, event.proxy); + o.bind('mouseout', eventParam, event.proxy); + o.bind('mousedown', eventParam, event.proxy); + o.bind('mouseup', eventParam, event.proxy); + o.bind('contextmenu', eventParam, event.proxy); + }, + unbindTree: function (setting) { + var o = setting.treeObj; + o.unbind('selectstart', handler.onSelectStart) + .unbind('click', event.proxy) + .unbind('dblclick', event.proxy) + .unbind('mouseover', event.proxy) + .unbind('mouseout', event.proxy) + .unbind('mousedown', event.proxy) + .unbind('mouseup', event.proxy) + .unbind('contextmenu', event.proxy); + }, + doProxy: function (e) { + var results = []; + for (var i = 0, j = _init.proxys.length; i < j; i++) { + var proxyResult = _init.proxys[i].apply(this, arguments); + results.push(proxyResult); + if (proxyResult.stop) { + break; + } + } + return results; + }, + proxy: function (e) { + var setting = data.getSetting(e.data.treeId); + if (!tools.uCanDo(setting, e)) return true; + var results = event.doProxy(e), + r = true, x = false; + for (var i = 0, l = results.length; i < l; i++) { + var proxyResult = results[i]; + if (proxyResult.nodeEventCallback) { + x = true; + r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + if (proxyResult.treeEventCallback) { + x = true; + r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + } + return r; + } + }, + //method of event handler + handler = { + onSwitchNode: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (node.open) { + if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } else { + if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } + return true; + }, + onClickNode: function (event, node) { + var setting = data.getSetting(event.data.treeId), + clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1; + if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true; + if (clickFlag === 0) { + view.cancelPreSelectedNode(setting, node); + } else { + view.selectNode(setting, node, clickFlag === 2); + } + setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]); + return true; + }, + onZTreeMousedown: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]); + } + return true; + }, + onZTreeMouseup: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]); + } + return true; + }, + onZTreeDblclick: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]); + } + return true; + }, + onZTreeContextmenu: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]); + } + return (typeof setting.callback.onRightClick) != "function"; + }, + onSelectStart: function (e) { + var n = e.originalEvent.srcElement.nodeName.toLowerCase(); + return (n === "input" || n === "textarea" ); + } + }, + //method of tools for zTree + tools = { + apply: function (fun, param, defaultValue) { + if ((typeof fun) == "function") { + return fun.apply(zt, param ? param : []); + } + return defaultValue; + }, + canAsync: function (setting, node) { + var childKey = setting.data.key.children; + return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0))); + }, + clone: function (obj) { + if (obj === null) return null; + var o = tools.isArray(obj) ? [] : {}; + for (var i in obj) { + o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? tools.clone(obj[i]) : obj[i]); + } + return o; + }, + eqs: function (str1, str2) { + return str1.toLowerCase() === str2.toLowerCase(); + }, + isArray: function (arr) { + return Object.prototype.toString.apply(arr) === "[object Array]"; + }, + isElement: function (o) { + return ( + typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2 + o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string" + ); + }, + $: function (node, exp, setting) { + if (!!exp && typeof exp != "string") { + setting = exp; + exp = ""; + } + if (typeof node == "string") { + return $(node, setting ? setting.treeObj.get(0).ownerDocument : null); + } else { + return $("#" + node.tId + exp, setting ? setting.treeObj : null); + } + }, + getMDom: function (setting, curDom, targetExpr) { + if (!curDom) return null; + while (curDom && curDom.id !== setting.treeId) { + for (var i = 0, l = targetExpr.length; curDom.tagName && i < l; i++) { + if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) { + return curDom; + } + } + curDom = curDom.parentNode; + } + return null; + }, + getNodeMainDom: function (target) { + return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0)); + }, + isChildOrSelf: function (dom, parentId) { + return ( $(dom).closest("#" + parentId).length > 0 ); + }, + uCanDo: function (setting, e) { + return true; + } + }, + //method of operate ztree dom + view = { + addNodes: function (setting, parentNode, index, newNodes, isSilent) { + if (setting.data.keep.leaf && parentNode && !parentNode.isParent) { + return; + } + if (!tools.isArray(newNodes)) { + newNodes = [newNodes]; + } + if (setting.data.simpleData.enable) { + newNodes = data.transformTozTreeFormat(setting, newNodes); + } + if (parentNode) { + var target_switchObj = $$(parentNode, consts.id.SWITCH, setting), + target_icoObj = $$(parentNode, consts.id.ICON, setting), + target_ulObj = $$(parentNode, consts.id.UL, setting); + + if (!parentNode.open) { + view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE); + view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE); + parentNode.open = false; + target_ulObj.css({ + "display": "none" + }); + } + + data.addNodesData(setting, parentNode, index, newNodes); + view.createNodes(setting, parentNode.level + 1, newNodes, parentNode, index); + if (!isSilent) { + view.expandCollapseParentNode(setting, parentNode, true); + } + } else { + data.addNodesData(setting, data.getRoot(setting), index, newNodes); + view.createNodes(setting, 0, newNodes, null, index); + } + }, + appendNodes: function (setting, level, nodes, parentNode, index, initFlag, openFlag) { + if (!nodes) return []; + var html = [], + childKey = setting.data.key.children; + + var tmpPNode = (parentNode) ? parentNode : data.getRoot(setting), + tmpPChild = tmpPNode[childKey], + isFirstNode, isLastNode; + + if (!tmpPChild || index >= tmpPChild.length - nodes.length) { + index = -1; + } + + for (var i = 0, l = nodes.length; i < l; i++) { + var node = nodes[i]; + if (initFlag) { + isFirstNode = ((index === 0 || tmpPChild.length == nodes.length) && (i == 0)); + isLastNode = (index < 0 && i == (nodes.length - 1)); + data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag); + data.addNodeCache(setting, node); + } + + var childHtml = []; + if (node[childKey] && node[childKey].length > 0) { + //make child html first, because checkType + childHtml = view.appendNodes(setting, level + 1, node[childKey], node, -1, initFlag, openFlag && node.open); + } + if (openFlag) { + + view.makeDOMNodeMainBefore(html, setting, node); + view.makeDOMNodeLine(html, setting, node); + data.getBeforeA(setting, node, html); + view.makeDOMNodeNameBefore(html, setting, node); + data.getInnerBeforeA(setting, node, html); + view.makeDOMNodeIcon(html, setting, node); + data.getInnerAfterA(setting, node, html); + view.makeDOMNodeNameAfter(html, setting, node); + data.getAfterA(setting, node, html); + if (node.isParent && node.open) { + view.makeUlHtml(setting, node, html, childHtml.join('')); + } + view.makeDOMNodeMainAfter(html, setting, node); + data.addCreatedNode(setting, node); + } + } + return html; + }, + appendParentULDom: function (setting, node) { + var html = [], + nObj = $$(node, setting); + if (!nObj.get(0) && !!node.parentTId) { + view.appendParentULDom(setting, node.getParentNode()); + nObj = $$(node, setting); + } + var ulObj = $$(node, consts.id.UL, setting); + if (ulObj.get(0)) { + ulObj.remove(); + } + var childKey = setting.data.key.children, + childHtml = view.appendNodes(setting, node.level + 1, node[childKey], node, -1, false, true); + view.makeUlHtml(setting, node, html, childHtml.join('')); + nObj.append(html.join('')); + }, + asyncNode: function (setting, node, isSilent, callback) { + var i, l; + if (node && !node.isParent) { + tools.apply(callback); + return false; + } else if (node && node.isAjaxing) { + return false; + } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) { + tools.apply(callback); + return false; + } + if (node) { + node.isAjaxing = true; + var icoObj = $$(node, consts.id.ICON, setting); + icoObj.attr({"style": "", "class": consts.className.BUTTON + " " + consts.className.ICO_LOADING}); + } + + var tmpParam = {}; + for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) { + var pKey = setting.async.autoParam[i].split("="), spKey = pKey; + if (pKey.length > 1) { + spKey = pKey[1]; + pKey = pKey[0]; + } + tmpParam[spKey] = node[pKey]; + } + if (tools.isArray(setting.async.otherParam)) { + for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) { + tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1]; + } + } else { + for (var p in setting.async.otherParam) { + tmpParam[p] = setting.async.otherParam[p]; + } + } + + var _tmpV = data.getRoot(setting)._ver; + $.ajax({ + contentType: setting.async.contentType, + cache: false, + type: setting.async.type, + url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url), + data: setting.async.contentType.indexOf('application/json') > -1 ? JSON.stringify(tmpParam) : tmpParam, + dataType: setting.async.dataType, + success: function (msg) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + var newNodes = []; + try { + if (!msg || msg.length == 0) { + newNodes = []; + } else if (typeof msg == "string") { + newNodes = eval("(" + msg + ")"); + } else { + newNodes = msg; + } + } catch (err) { + newNodes = msg; + } + + if (node) { + node.isAjaxing = null; + node.zAsync = true; + } + view.setNodeLineIcos(setting, node); + if (newNodes && newNodes !== "") { + newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes); + view.addNodes(setting, node, -1, !!newNodes ? tools.clone(newNodes) : [], !!isSilent); + } else { + view.addNodes(setting, node, -1, [], !!isSilent); + } + setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]); + tools.apply(callback); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + if (node) node.isAjaxing = null; + view.setNodeLineIcos(setting, node); + setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]); + } + }); + return true; + }, + cancelPreSelectedNode: function (setting, node, excludeNode) { + var list = data.getRoot(setting).curSelectedList, + i, n; + for (i = list.length - 1; i >= 0; i--) { + n = list[i]; + if (node === n || (!node && (!excludeNode || excludeNode !== n))) { + $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED); + if (node) { + data.removeSelectedNode(setting, node); + break; + } else { + list.splice(i, 1); + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]); + } + } + } + }, + createNodeCallback: function (setting) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + while (root.createdNodes.length > 0) { + var node = root.createdNodes.shift(); + tools.apply(setting.view.addDiyDom, [setting.treeId, node]); + if (!!setting.callback.onNodeCreated) { + setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]); + } + } + } + }, + createNodes: function (setting, level, nodes, parentNode, index) { + if (!nodes || nodes.length == 0) return; + var root = data.getRoot(setting), + childKey = setting.data.key.children, + openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0); + root.createdNodes = []; + var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, index, true, openFlag), + parentObj, nextObj; + + if (!parentNode) { + parentObj = setting.treeObj; + //setting.treeObj.append(zTreeHtml.join('')); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + if (ulObj.get(0)) { + parentObj = ulObj; + //ulObj.append(zTreeHtml.join('')); + } + } + if (parentObj) { + if (index >= 0) { + nextObj = parentObj.children()[index]; + } + if (index >= 0 && nextObj) { + $(nextObj).before(zTreeHtml.join('')); + } else { + parentObj.append(zTreeHtml.join('')); + } + } + + view.createNodeCallback(setting); + }, + destroy: function (setting) { + if (!setting) return; + data.initCache(setting); + data.initRoot(setting); + event.unbindTree(setting); + event.unbindEvent(setting); + setting.treeObj.empty(); + delete settings[setting.treeId]; + }, + expandCollapseNode: function (setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children; + var tmpCb, _callback; + if (!node) { + tools.apply(callback, []); + return; + } + if (root.expandTriggerFlag) { + _callback = callback; + tmpCb = function () { + if (_callback) _callback(); + if (node.open) { + setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]); + } else { + setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]); + } + }; + callback = tmpCb; + root.expandTriggerFlag = false; + } + if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length > 0 && !$$(node[childKey][0], setting).get(0)))) { + view.appendParentULDom(setting, node); + view.createNodeCallback(setting); + } + if (node.open == expandFlag) { + tools.apply(callback, []); + return; + } + var ulObj = $$(node, consts.id.UL, setting), + switchObj = $$(node, consts.id.SWITCH, setting), + icoObj = $$(node, consts.id.ICON, setting); + + if (node.isParent) { + node.open = !node.open; + if (node.iconOpen && node.iconClose) { + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + } + + if (node.open) { + view.replaceSwitchClass(node, switchObj, consts.folder.OPEN); + view.replaceIcoClass(node, icoObj, consts.folder.OPEN); + if (animateFlag == false || setting.view.expandSpeed == "") { + ulObj.show(); + tools.apply(callback, []); + } else { + if (node[childKey] && node[childKey].length > 0) { + ulObj.slideDown(setting.view.expandSpeed, callback); + } else { + ulObj.show(); + tools.apply(callback, []); + } + } + } else { + view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE); + view.replaceIcoClass(node, icoObj, consts.folder.CLOSE); + if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) { + ulObj.hide(); + tools.apply(callback, []); + } else { + ulObj.slideUp(setting.view.expandSpeed, callback); + } + } + } else { + tools.apply(callback, []); + } + }, + expandCollapseParentNode: function (setting, node, expandFlag, animateFlag, callback) { + if (!node) return; + if (!node.parentTId) { + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); + return; + } else { + view.expandCollapseNode(setting, node, expandFlag, animateFlag); + } + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback); + } + }, + expandCollapseSonNode: function (setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + treeNodes = (node) ? node[childKey] : root[childKey], + selfAnimateSign = (node) ? false : animateFlag, + expandTriggerFlag = data.getRoot(setting).expandTriggerFlag; + data.getRoot(setting).expandTriggerFlag = false; + if (treeNodes) { + for (var i = 0, l = treeNodes.length; i < l; i++) { + if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign); + } + } + data.getRoot(setting).expandTriggerFlag = expandTriggerFlag; + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); + }, + isSelectedNode: function (setting, node) { + if (!node) { + return false; + } + var list = data.getRoot(setting).curSelectedList, + i; + for (i = list.length - 1; i >= 0; i--) { + if (node === list[i]) { + return true; + } + } + return false; + }, + makeDOMNodeIcon: function (html, setting, node) { + var nameStr = data.getNodeName(setting, node), + name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g, '&').replace(//g, '>'); + html.push("", name, ""); + }, + makeDOMNodeLine: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeMainAfter: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeMainBefore: function (html, setting, node) { + html.push("
                      • "); + }, + makeDOMNodeNameAfter: function (html, setting, node) { + html.push(""); + }, + makeDOMNodeNameBefore: function (html, setting, node) { + var title = data.getNodeTitle(setting, node), + url = view.makeNodeUrl(setting, node), + fontcss = view.makeNodeFontCss(setting, node), + fontStyle = []; + for (var f in fontcss) { + fontStyle.push(f, ":", fontcss[f], ";"); + } + html.push(" 0) ? "href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''), + "'"); + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) { + html.push("title='", title.replace(/'/g, "'").replace(//g, '>'), "'"); + } + html.push(">"); + }, + makeNodeFontCss: function (setting, node) { + var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss); + return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {}; + }, + makeNodeIcoClass: function (setting, node) { + var icoCss = ["ico"]; + if (!node.isAjaxing) { + icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0]; + if (node.isParent) { + icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + icoCss.push(consts.folder.DOCU); + } + } + return consts.className.BUTTON + " " + icoCss.join('_'); + }, + makeNodeIcoStyle: function (setting, node) { + var icoStyle = []; + if (!node.isAjaxing) { + var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node[setting.data.key.icon]; + if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;"); + if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) { + icoStyle.push("width:0px;height:0px;"); + } + } + return icoStyle.join(''); + }, + makeNodeLineClass: function (setting, node) { + var lineClass = []; + if (setting.view.showLine) { + if (node.level == 0 && node.isFirstNode && node.isLastNode) { + lineClass.push(consts.line.ROOT); + } else if (node.level == 0 && node.isFirstNode) { + lineClass.push(consts.line.ROOTS); + } else if (node.isLastNode) { + lineClass.push(consts.line.BOTTOM); + } else { + lineClass.push(consts.line.CENTER); + } + } else { + lineClass.push(consts.line.NOLINE); + } + if (node.isParent) { + lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + lineClass.push(consts.folder.DOCU); + } + return view.makeNodeLineClassEx(node) + lineClass.join('_'); + }, + makeNodeLineClassEx: function (node) { + return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " "; + }, + makeNodeTarget: function (node) { + return (node.target || "_blank"); + }, + makeNodeUrl: function (setting, node) { + var urlKey = setting.data.key.url; + return node[urlKey] ? node[urlKey] : null; + }, + makeUlHtml: function (setting, node, html, content) { + html.push("
                          "); + html.push(content); + html.push("
                        "); + }, + makeUlLineClass: function (setting, node) { + return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : ""); + }, + removeChildNodes: function (setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + nodes = node[childKey]; + if (!nodes) return; + + for (var i = 0, l = nodes.length; i < l; i++) { + data.removeNodeCache(setting, nodes[i]); + } + data.removeSelectedNode(setting); + delete node[childKey]; + + if (!setting.data.keep.parent) { + node.isParent = false; + node.open = false; + var tmp_switchObj = $$(node, consts.id.SWITCH, setting), + tmp_icoObj = $$(node, consts.id.ICON, setting); + view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU); + $$(node, consts.id.UL, setting).remove(); + } else { + $$(node, consts.id.UL, setting).empty(); + } + }, + scrollIntoView: function (dom) { + if (!dom) { + return; + } + // code src: http://jsfiddle.net/08u6cxwj/ + if (!Element.prototype.scrollIntoViewIfNeeded) { + Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) { + function withinBounds(value, min, max, extent) { + if (false === centerIfNeeded || max <= value + extent && value <= min + extent) { + return Math.min(max, Math.max(min, value)); + } else { + return (min + max) / 2; + } + } + + function makeArea(left, top, width, height) { + return { + "left": left, "top": top, "width": width, "height": height + , "right": left + width, "bottom": top + height + , "translate": function (x, y) { + return makeArea(x + left, y + top, width, height); + } + , "relativeFromTo": function (lhs, rhs) { + var newLeft = left, newTop = top; + lhs = lhs.offsetParent; + rhs = rhs.offsetParent; + if (lhs === rhs) { + return area; + } + for (; lhs; lhs = lhs.offsetParent) { + newLeft += lhs.offsetLeft + lhs.clientLeft; + newTop += lhs.offsetTop + lhs.clientTop; + } + for (; rhs; rhs = rhs.offsetParent) { + newLeft -= rhs.offsetLeft + rhs.clientLeft; + newTop -= rhs.offsetTop + rhs.clientTop; + } + return makeArea(newLeft, newTop, width, height); + } + }; + } + + var parent, elem = this, area = makeArea( + this.offsetLeft, this.offsetTop, + this.offsetWidth, this.offsetHeight); + while (tools.isElement(parent = elem.parentNode)) { + var clientLeft = parent.offsetLeft + parent.clientLeft; + var clientTop = parent.offsetTop + parent.clientTop; + + // Make area relative to parent's client area. + area = area.relativeFromTo(elem, parent).translate(-clientLeft, -clientTop); + + parent.scrollLeft = withinBounds( + parent.scrollLeft, + area.right - parent.clientWidth, area.left, + parent.clientWidth); + + parent.scrollTop = withinBounds( + parent.scrollTop, + area.bottom - parent.clientHeight, area.top, + parent.clientHeight); + + // Determine actual scroll amount by reading back scroll properties. + area = area.translate(clientLeft - parent.scrollLeft, + clientTop - parent.scrollTop); + elem = parent; + } + }; + } + dom.scrollIntoViewIfNeeded(); + }, + setFirstNode: function (setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if (childLength > 0) { + parentNode[childKey][0].isFirstNode = true; + } + }, + setLastNode: function (setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if (childLength > 0) { + parentNode[childKey][childLength - 1].isLastNode = true; + } + }, + removeNode: function (setting, node) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : root; + + node.isFirstNode = false; + node.isLastNode = false; + node.getPreNode = function () { + return null; + }; + node.getNextNode = function () { + return null; + }; + + if (!data.getNodeCache(setting, node.tId)) { + return; + } + + $$(node, setting).remove(); + data.removeNodeCache(setting, node); + data.removeSelectedNode(setting, node); + + for (var i = 0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i].tId == node.tId) { + parentNode[childKey].splice(i, 1); + break; + } + } + view.setFirstNode(setting, parentNode); + view.setLastNode(setting, parentNode); + + var tmp_ulObj, tmp_switchObj, tmp_icoObj, + childLength = parentNode[childKey].length; + + //repair nodes old parent + if (!setting.data.keep.parent && childLength == 0) { + //old parentNode has no child nodes + parentNode.isParent = false; + parentNode.open = false; + tmp_ulObj = $$(parentNode, consts.id.UL, setting); + tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting); + tmp_icoObj = $$(parentNode, consts.id.ICON, setting); + view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU); + tmp_ulObj.css("display", "none"); + + } else if (setting.view.showLine && childLength > 0) { + //old parentNode has child nodes + var newLast = parentNode[childKey][childLength - 1]; + tmp_ulObj = $$(newLast, consts.id.UL, setting); + tmp_switchObj = $$(newLast, consts.id.SWITCH, setting); + tmp_icoObj = $$(newLast, consts.id.ICON, setting); + if (parentNode == root) { + if (parentNode[childKey].length == 1) { + //node was root, and ztree has only one root after move node + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT); + } else { + var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting); + view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS); + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + } else { + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + tmp_ulObj.removeClass(consts.line.LINE); + } + }, + replaceIcoClass: function (node, obj, newName) { + if (!obj || node.isAjaxing) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[tmpList.length - 1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + }, + replaceSwitchClass: function (node, obj, newName) { + if (!obj) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.line.ROOT: + case consts.line.ROOTS: + case consts.line.CENTER: + case consts.line.BOTTOM: + case consts.line.NOLINE: + tmpList[0] = view.makeNodeLineClassEx(node) + newName; + break; + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + if (newName !== consts.folder.DOCU) { + obj.removeAttr("disabled"); + } else { + obj.attr("disabled", "disabled"); + } + }, + selectNode: function (setting, node, addFlag) { + if (!addFlag) { + view.cancelPreSelectedNode(setting, null, node); + } + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED); + data.addSelectedNode(setting, node); + setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]); + }, + setNodeFontCss: function (setting, treeNode) { + var aObj = $$(treeNode, consts.id.A, setting), + fontCss = view.makeNodeFontCss(setting, treeNode); + if (fontCss) { + aObj.css(fontCss); + } + }, + setNodeLineIcos: function (setting, node) { + if (!node) return; + var switchObj = $$(node, consts.id.SWITCH, setting), + ulObj = $$(node, consts.id.UL, setting), + icoObj = $$(node, consts.id.ICON, setting), + ulLine = view.makeUlLineClass(setting, node); + if (ulLine.length == 0) { + ulObj.removeClass(consts.line.LINE); + } else { + ulObj.addClass(ulLine); + } + switchObj.attr("class", view.makeNodeLineClass(setting, node)); + if (node.isParent) { + switchObj.removeAttr("disabled"); + } else { + switchObj.attr("disabled", "disabled"); + } + icoObj.removeAttr("style"); + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + icoObj.attr("class", view.makeNodeIcoClass(setting, node)); + }, + setNodeName: function (setting, node) { + var title = data.getNodeTitle(setting, node), + nObj = $$(node, consts.id.SPAN, setting); + nObj.empty(); + if (setting.view.nameIsHTML) { + nObj.html(data.getNodeName(setting, node)); + } else { + nObj.text(data.getNodeName(setting, node)); + } + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("title", !title ? "" : title); + } + }, + setNodeTarget: function (setting, node) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("target", view.makeNodeTarget(node)); + }, + setNodeUrl: function (setting, node) { + var aObj = $$(node, consts.id.A, setting), + url = view.makeNodeUrl(setting, node); + if (url == null || url.length == 0) { + aObj.removeAttr("href"); + } else { + aObj.attr("href", url); + } + }, + switchNode: function (setting, node) { + if (node.open || !tools.canAsync(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + } else if (setting.async.enable) { + if (!view.asyncNode(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + return; + } + } else if (node) { + view.expandCollapseNode(setting, node, !node.open); + } + } + }; + // zTree defind + $.fn.zTree = { + consts: _consts, + _z: { + tools: tools, + view: view, + event: event, + data: data + }, + getZTreeObj: function (treeId) { + var o = data.getZTreeTools(treeId); + return o ? o : null; + }, + destroy: function (treeId) { + if (!!treeId && treeId.length > 0) { + view.destroy(data.getSetting(treeId)); + } else { + for (var s in settings) { + view.destroy(settings[s]); + } + } + }, + init: function (obj, zSetting, zNodes) { + var setting = tools.clone(_setting); + $.extend(true, setting, zSetting); + setting.treeId = obj.attr("id"); + setting.treeObj = obj; + setting.treeObj.empty(); + settings[setting.treeId] = setting; + //For some older browser,(e.g., ie6) + if (typeof document.body.style.maxHeight === "undefined") { + setting.view.expandSpeed = ""; + } + data.initRoot(setting); + var root = data.getRoot(setting), + childKey = setting.data.key.children; + zNodes = zNodes ? tools.clone(tools.isArray(zNodes) ? zNodes : [zNodes]) : []; + if (setting.data.simpleData.enable) { + root[childKey] = data.transformTozTreeFormat(setting, zNodes); + } else { + root[childKey] = zNodes; + } + + data.initCache(setting); + event.unbindTree(setting); + event.bindTree(setting); + event.unbindEvent(setting); + event.bindEvent(setting); + + var zTreeTools = { + setting: setting, + addNodes: function (parentNode, index, newNodes, isSilent) { + if (!parentNode) parentNode = null; + if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null; + + var i = parseInt(index, 10); + if (isNaN(i)) { + isSilent = !!newNodes; + newNodes = index; + index = -1; + } else { + index = i; + } + if (!newNodes) return null; + + + var xNewNodes = tools.clone(tools.isArray(newNodes) ? newNodes : [newNodes]); + + function addCallback() { + view.addNodes(setting, parentNode, index, xNewNodes, (isSilent == true)); + } + + if (tools.canAsync(setting, parentNode)) { + view.asyncNode(setting, parentNode, isSilent, addCallback); + } else { + addCallback(); + } + return xNewNodes; + }, + cancelSelectedNode: function (node) { + view.cancelPreSelectedNode(setting, node); + }, + destroy: function () { + view.destroy(setting); + }, + expandAll: function (expandFlag) { + expandFlag = !!expandFlag; + view.expandCollapseSonNode(setting, null, expandFlag, true); + return expandFlag; + }, + expandNode: function (node, expandFlag, sonSign, focus, callbackFlag) { + if (!node || !node.isParent) return null; + if (expandFlag !== true && expandFlag !== false) { + expandFlag = !node.open; + } + callbackFlag = !!callbackFlag; + + if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) { + return null; + } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) { + return null; + } + if (expandFlag && node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false); + } + if (expandFlag === node.open && !sonSign) { + return null; + } + + data.getRoot(setting).expandTriggerFlag = callbackFlag; + if (!tools.canAsync(setting, node) && sonSign) { + view.expandCollapseSonNode(setting, node, expandFlag, true, showNodeFocus); + } else { + node.open = !expandFlag; + view.switchNode(this.setting, node); + showNodeFocus(); + } + return expandFlag; + + function showNodeFocus() { + var a = $$(node, setting).get(0); + if (a && focus !== false) { + view.scrollIntoView(a); + } + } + }, + getNodes: function () { + return data.getNodes(setting); + }, + getNodeByParam: function (key, value, parentNode) { + if (!key) return null; + return data.getNodeByParam(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodeByTId: function (tId) { + return data.getNodeCache(setting, tId); + }, + getNodesByParam: function (key, value, parentNode) { + if (!key) return null; + return data.getNodesByParam(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodesByParamFuzzy: function (key, value, parentNode) { + if (!key) return null; + return data.getNodesByParamFuzzy(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), key, value); + }, + getNodesByFilter: function (filter, isSingle, parentNode, invokeParam) { + isSingle = !!isSingle; + if (!filter || (typeof filter != "function")) return (isSingle ? null : []); + return data.getNodesByFilter(setting, parentNode ? parentNode[setting.data.key.children] : data.getNodes(setting), filter, isSingle, invokeParam); + }, + getNodeIndex: function (node) { + if (!node) return null; + var childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (var i = 0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i] == node) return i; + } + return -1; + }, + getSelectedNodes: function () { + var r = [], list = data.getRoot(setting).curSelectedList; + for (var i = 0, l = list.length; i < l; i++) { + r.push(list[i]); + } + return r; + }, + isSelectedNode: function (node) { + return data.isSelectedNode(setting, node); + }, + reAsyncChildNodes: function (parentNode, reloadType, isSilent) { + if (!this.setting.async.enable) return; + var isRoot = !parentNode; + if (isRoot) { + parentNode = data.getRoot(setting); + } + if (reloadType == "refresh") { + var childKey = this.setting.data.key.children; + for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) { + data.removeNodeCache(setting, parentNode[childKey][i]); + } + data.removeSelectedNode(setting); + parentNode[childKey] = []; + if (isRoot) { + this.setting.treeObj.empty(); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + ulObj.empty(); + } + } + view.asyncNode(this.setting, isRoot ? null : parentNode, !!isSilent); + }, + refresh: function () { + this.setting.treeObj.empty(); + var root = data.getRoot(setting), + nodes = root[setting.data.key.children] + data.initRoot(setting); + root[setting.data.key.children] = nodes + data.initCache(setting); + view.createNodes(setting, 0, root[setting.data.key.children], null, -1); + }, + removeChildNodes: function (node) { + if (!node) return null; + var childKey = setting.data.key.children, + nodes = node[childKey]; + view.removeChildNodes(setting, node); + return nodes ? nodes : null; + }, + removeNode: function (node, callbackFlag) { + if (!node) return; + callbackFlag = !!callbackFlag; + if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return; + view.removeNode(setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]); + } + }, + selectNode: function (node, addFlag, isSilent) { + if (!node) return; + if (tools.uCanDo(setting)) { + addFlag = setting.view.selectedMulti && addFlag; + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), true, false, showNodeFocus); + } else if (!isSilent) { + try { + $$(node, setting).focus().blur(); + } catch (e) { + } + } + view.selectNode(setting, node, addFlag); + } + + function showNodeFocus() { + if (isSilent) { + return; + } + var a = $$(node, setting).get(0); + view.scrollIntoView(a); + } + }, + transformTozTreeNodes: function (simpleNodes) { + return data.transformTozTreeFormat(setting, simpleNodes); + }, + transformToArray: function (nodes) { + return data.transformToArrayFormat(setting, nodes); + }, + updateNode: function (node, checkTypeFlag) { + if (!node) return; + var nObj = $$(node, setting); + if (nObj.get(0) && tools.uCanDo(setting)) { + view.setNodeName(setting, node); + view.setNodeTarget(setting, node); + view.setNodeUrl(setting, node); + view.setNodeLineIcos(setting, node); + view.setNodeFontCss(setting, node); + } + } + } + root.treeTools = zTreeTools; + data.setZTreeTools(setting, zTreeTools); + + if (root[childKey] && root[childKey].length > 0) { + view.createNodes(setting, 0, root[childKey], null, -1); + } else if (setting.async.enable && setting.async.url && setting.async.url !== '') { + view.asyncNode(setting); + } + return zTreeTools; + } + }; + + var zt = $.fn.zTree, + $$ = tools.$, + consts = zt.consts; +})(jQuery); \ No newline at end of file diff --git a/static/zTree3/js/jquery.ztree.core.min.js b/static/zTree3/js/jquery.ztree.core.min.js new file mode 100644 index 0000000..4980f03 --- /dev/null +++ b/static/zTree3/js/jquery.ztree.core.min.js @@ -0,0 +1,74 @@ +/* + * 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-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;i0)},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&&d0},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;s0&&(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&&e1&&(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 +-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,">");b.push("",d,"")},makeDOMNodeLine:function(b,a,c){b.push("")},makeDOMNodeMainAfter:function(b){b.push("
                      • ")},makeDOMNodeMainBefore:function(b,a,c){b.push("
                      • ")},makeDOMNodeNameAfter:function(b){b.push("")}, +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("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, +">"),"'");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("
                          ");c.push(d);c.push("
                        ")},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;e0)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;g0){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;f0?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); diff --git a/static/zTree3/js/jquery.ztree.excheck.js b/static/zTree3/js/jquery.ztree.excheck.js new file mode 100644 index 0000000..6774489 --- /dev/null +++ b/static/zTree3/js/jquery.ztree.excheck.js @@ -0,0 +1,628 @@ +/* + * 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($){ + //default consts of excheck + var _consts = { + 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" + } + }, + //default setting of excheck + _setting = { + check: { + enable: false, + autoCheckTrigger: false, + chkStyle: _consts.checkbox.STYLE, + nocheckInherit: false, + chkDisabledInherit: false, + radioType: _consts.radio.TYPE_LEVEL, + chkboxType: { + "Y": "ps", + "N": "ps" + } + }, + data: { + key: { + checked: "checked" + } + }, + callback: { + beforeCheck:null, + onCheck:null + } + }, + //default root of excheck + _initRoot = function (setting) { + var r = data.getRoot(setting); + r.radioCheckedList = []; + }, + //default cache of excheck + _initCache = function(treeId) {}, + //default bind event of excheck + _bindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.bind(c.CHECK, function (event, srcEvent, treeId, node) { + event.srcEvent = srcEvent; + tools.apply(setting.callback.onCheck, [event, treeId, node]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.unbind(c.CHECK); + }, + //default event proxy of excheck + _eventProxy = function(e) { + var target = e.target, + setting = data.getSetting(e.data.treeId), + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null; + + if (tools.eqs(e.type, "mouseover")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoverCheck"; + } + } else if (tools.eqs(e.type, "mouseout")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoutCheck"; + } + } else if (tools.eqs(e.type, "click")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "checkNode"; + } + } + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "checkNode" : + nodeEventCallback = _handler.onCheckNode; + break; + case "mouseoverCheck" : + nodeEventCallback = _handler.onMouseoverCheck; + break; + case "mouseoutCheck" : + nodeEventCallback = _handler.onMouseoutCheck; + break; + } + } + var proxyResult = { + stop: nodeEventType === "checkNode", + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of excheck + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var checkedKey = setting.data.key.checked; + if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true"); + n[checkedKey] = !!n[checkedKey]; + n.checkedOld = n[checkedKey]; + if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true"); + n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck); + if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true"); + n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled); + if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true"); + n.halfCheck = !!n.halfCheck; + n.check_Child_State = -1; + n.check_Focus = false; + n.getCheckStatus = function() {return data.getCheckStatus(setting, n);}; + + if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) { + var r = data.getRoot(setting); + r.radioCheckedList.push(n); + } + }, + //add dom for check + _beforeA = function(setting, node, html) { + var checkedKey = setting.data.key.checked; + if (setting.check.enable) { + data.makeChkFlag(setting, node); + html.push(""); + } + }, + //update zTreeObj, add method of check + _zTreeTools = function(setting, zTreeTools) { + zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) { + var checkedKey = this.setting.data.key.checked; + if (node.chkDisabled === true) return; + if (checked !== true && checked !== false) { + checked = !node[checkedKey]; + } + callbackFlag = !!callbackFlag; + + if (node[checkedKey] === checked && !checkTypeFlag) { + return; + } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) { + return; + } + if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) { + node[checkedKey] = checked; + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]); + } + } + } + + zTreeTools.checkAllNodes = function(checked) { + view.repairAllChk(this.setting, !!checked); + } + + zTreeTools.getCheckedNodes = function(checked) { + var childKey = this.setting.data.key.children; + checked = (checked !== false); + return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked); + } + + zTreeTools.getChangeCheckedNodes = function() { + var childKey = this.setting.data.key.children; + return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]); + } + + zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) { + disabled = !!disabled; + inheritParent = !!inheritParent; + inheritChildren = !!inheritChildren; + view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren); + view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent); + } + + var _updateNode = zTreeTools.updateNode; + zTreeTools.updateNode = function(node, checkTypeFlag) { + if (_updateNode) _updateNode.apply(zTreeTools, arguments); + if (!node || !this.setting.check.enable) return; + var nObj = $$(node, this.setting); + if (nObj.get(0) && tools.uCanDo(this.setting)) { + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + } + } + }, + //method of operate data + _data = { + getRadioCheckedList: function(setting) { + var checkedList = data.getRoot(setting).radioCheckedList; + for (var i=0, j=checkedList.length; i -1 && node.check_Child_State < 2) : (node.check_Child_State > 0))) + }; + return r; + }, + getTreeCheckedNodes: function(setting, nodes, checked, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL); + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) { + results.push(nodes[i]); + if(onlyOne) { + break; + } + } + data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results); + if(onlyOne && results.length > 0) { + break; + } + } + return results; + }, + getTreeChangeCheckedNodes: function(setting, nodes, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked; + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) { + results.push(nodes[i]); + } + data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results); + } + return results; + }, + makeChkFlag: function(setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + chkFlag = -1; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var cNode = node[childKey][i]; + var tmp = -1; + if (setting.check.chkStyle == consts.radio.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 2; + } else if (cNode[checkedKey]) { + tmp = 2; + } else { + tmp = cNode.check_Child_State > 0 ? 2:0; + } + if (tmp == 2) { + chkFlag = 2; break; + } else if (tmp == 0){ + chkFlag = 0; + } + } else if (setting.check.chkStyle == consts.checkbox.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 1; + } else if (cNode[checkedKey] ) { + tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1; + } else { + tmp = (cNode.check_Child_State > 0) ? 1 : 0; + } + if (tmp === 1) { + chkFlag = 1; break; + } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) { + chkFlag = 1; break; + } else if (chkFlag === 2 && tmp > -1 && tmp < 2) { + chkFlag = 1; break; + } else if (tmp > -1) { + chkFlag = tmp; + } + } + } + } + node.check_Child_State = chkFlag; + } + }, + //method of event proxy + _event = { + + }, + //method of event handler + _handler = { + onCheckNode: function (event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkedKey = setting.data.key.checked; + if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true; + node[checkedKey] = !node[checkedKey]; + view.checkNodeRelation(setting, node); + var checkObj = $$(node, consts.id.CHECK, setting); + view.setChkClass(setting, checkObj, node); + view.repairParentChkClassWithSelf(setting, node); + setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]); + return true; + }, + onMouseoverCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = true; + view.setChkClass(setting, checkObj, node); + return true; + }, + onMouseoutCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = false; + view.setChkClass(setting, checkObj, node); + return true; + } + }, + //method of tools for zTree + _tools = { + + }, + //method of operate ztree dom + _view = { + checkNodeRelation: function(setting, node) { + var pNode, i, l, + childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + r = consts.radio; + if (setting.check.chkStyle == r.STYLE) { + var checkedList = data.getRadioCheckedList(setting); + if (node[checkedKey]) { + if (setting.check.radioType == r.TYPE_ALL) { + for (i = checkedList.length-1; i >= 0; i--) { + pNode = checkedList[i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + checkedList.splice(i, 1); + + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + if (pNode.parentTId != node.parentTId) { + view.repairParentChkClassWithSelf(setting, pNode); + } + } + } + checkedList.push(node); + } else { + var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (i = 0, l = parentNode[childKey].length; i < l; i++) { + pNode = parentNode[childKey][i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + } + } + } + } else if (setting.check.radioType == r.TYPE_ALL) { + for (i = 0, l = checkedList.length; i < l; i++) { + if (node == checkedList[i]) { + checkedList.splice(i, 1); + break; + } + } + } + + } else { + if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, false); + } + if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, false); + } + } + }, + makeChkClass: function(setting, node) { + var checkedKey = setting.data.key.checked, + c = consts.checkbox, r = consts.radio, + fullStyle = ""; + if (node.chkDisabled === true) { + fullStyle = c.DISABLED; + } else if (node.halfCheck) { + fullStyle = c.PART; + } else if (setting.check.chkStyle == r.STYLE) { + fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART; + } else { + fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART); + } + var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle; + chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName; + return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName; + }, + repairAllChk: function(setting, checked) { + if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) { + var checkedKey = setting.data.key.checked, + childKey = setting.data.key.children, + root = data.getRoot(setting); + for (var i = 0, l = root[childKey].length; i 0) { + view.repairParentChkClass(setting, node[childKey][0]); + } else { + view.repairParentChkClass(setting, node); + } + }, + repairSonChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + var childKey = setting.data.key.children; + if (node.chkDisabled != chkDisabled) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + if (node[childKey] && inherit) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var sNode = node[childKey][i]; + view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit); + } + } + }, + repairParentChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + if (node.chkDisabled != chkDisabled && inherit) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit); + }, + setChkClass: function(setting, obj, node) { + if (!obj) return; + if (node.nocheck === true) { + obj.hide(); + } else { + obj.show(); + } + obj.attr('class', view.makeChkClass(setting, node)); + }, + setParentNodeCheckBox: function(setting, node, value, srcNode) { + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + data.makeChkFlag(setting, node); + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + if (node.parentTId) { + var pSign = true; + if (!value) { + var pNodes = node.getParentNode()[childKey]; + for (var i = 0, l = pNodes.length; i < l; i++) { + if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey]) + || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) { + pSign = false; + break; + } + } + } + if (pSign) { + view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode); + } + } + }, + setSonNodeCheckBox: function(setting, node, value, srcNode) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + + var hasDisable = false; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var sNode = node[childKey][i]; + view.setSonNodeCheckBox(setting, sNode, value, srcNode); + if (sNode.chkDisabled === true) hasDisable = true; + } + } + + if (node != data.getRoot(setting) && node.chkDisabled !== true) { + if (hasDisable && node.nocheck !== true) { + data.makeChkFlag(setting, node); + } + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1; + } else { + node.check_Child_State = -1; + } + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + + } + }, + + _z = { + tools: _tools, + view: _view, + event: _event, + data: _data + }; + $.extend(true, $.fn.zTree.consts, _consts); + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.exSetting(_setting); + data.addInitBind(_bindEvent); + data.addInitUnBind(_unbindEvent); + data.addInitCache(_initCache); + data.addInitNode(_initNode); + data.addInitProxy(_eventProxy, true); + data.addInitRoot(_initRoot); + data.addBeforeA(_beforeA); + data.addZTreeTools(_zTreeTools); + + var _createNodes = view.createNodes; + view.createNodes = function(setting, level, nodes, parentNode, index) { + if (_createNodes) _createNodes.apply(view, arguments); + if (!nodes) return; + view.repairParentChkClassWithSelf(setting, parentNode); + } + var _removeNode = view.removeNode; + view.removeNode = function(setting, node) { + var parentNode = node.getParentNode(); + if (_removeNode) _removeNode.apply(view, arguments); + if (!node || !parentNode) return; + view.repairChkClass(setting, parentNode); + view.repairParentChkClass(setting, parentNode); + } + + var _appendNodes = view.appendNodes; + view.appendNodes = function(setting, level, nodes, parentNode, index, initFlag, openFlag) { + var html = ""; + if (_appendNodes) { + html = _appendNodes.apply(view, arguments); + } + if (parentNode) { + data.makeChkFlag(setting, parentNode); + } + return html; + } +})(jQuery); \ No newline at end of file diff --git a/static/zTree3/js/jquery.ztree.excheck.min.js b/static/zTree3/js/jquery.ztree.excheck.min.js new file mode 100644 index 0000000..957940a --- /dev/null +++ b/static/zTree3/js/jquery.ztree.excheck.min.js @@ -0,0 +1,34 @@ +/* + * 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-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;i0?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;i0){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;k0?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-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;f0)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;i0?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(""))});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); diff --git a/static/zTree3/js/jquery.ztree.exedit.js b/static/zTree3/js/jquery.ztree.exedit.js new file mode 100644 index 0000000..dce847e --- /dev/null +++ b/static/zTree3/js/jquery.ztree.exedit.js @@ -0,0 +1,1192 @@ +/* + * 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($){ + //default consts of exedit + var _consts = { + 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" + } + }, + //default setting of exedit + _setting = { + edit: { + enable: false, + editNameSelectAll: false, + showRemoveBtn: true, + showRenameBtn: true, + removeTitle: "remove", + renameTitle: "rename", + drag: { + autoExpandTrigger: false, + isCopy: true, + isMove: true, + prev: true, + next: true, + inner: true, + 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 + } + }, + //default root of exedit + _initRoot = function (setting) { + var r = data.getRoot(setting), rs = data.getRoots(); + r.curEditNode = null; + r.curEditInput = null; + r.curHoverNode = null; + r.dragFlag = 0; + r.dragNodeShowBefore = []; + r.dragMaskList = new Array(); + rs.showHoverDom = true; + }, + //default cache of exedit + _initCache = function(treeId) {}, + //default bind event of exedit + _bindEvent = function(setting) { + var o = setting.treeObj; + var c = consts.event; + o.bind(c.RENAME, function (event, treeId, treeNode, isCancel) { + tools.apply(setting.callback.onRename, [event, treeId, treeNode, isCancel]); + }); + + o.bind(c.DRAG, function (event, srcEvent, treeId, treeNodes) { + tools.apply(setting.callback.onDrag, [srcEvent, treeId, treeNodes]); + }); + + o.bind(c.DRAGMOVE,function(event, srcEvent, treeId, treeNodes){ + tools.apply(setting.callback.onDragMove,[srcEvent, treeId, treeNodes]); + }); + + o.bind(c.DROP, function (event, srcEvent, treeId, treeNodes, targetNode, moveType, isCopy) { + tools.apply(setting.callback.onDrop, [srcEvent, treeId, treeNodes, targetNode, moveType, isCopy]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj; + var c = consts.event; + o.unbind(c.RENAME); + o.unbind(c.DRAG); + o.unbind(c.DRAGMOVE); + o.unbind(c.DROP); + }, + //default event proxy of exedit + _eventProxy = function(e) { + var target = e.target, + setting = data.getSetting(e.data.treeId), + relatedTarget = e.relatedTarget, + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null, + tmp = null; + + if (tools.eqs(e.type, "mouseover")) { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "hoverOverNode"; + } + } else if (tools.eqs(e.type, "mouseout")) { + tmp = tools.getMDom(setting, relatedTarget, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (!tmp) { + tId = "remove"; + nodeEventType = "hoverOutNode"; + } + } else if (tools.eqs(e.type, "mousedown")) { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "mousedownNode"; + } + } + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "mousedownNode" : + nodeEventCallback = _handler.onMousedownNode; + break; + case "hoverOverNode" : + nodeEventCallback = _handler.onHoverOverNode; + break; + case "hoverOutNode" : + nodeEventCallback = _handler.onHoverOutNode; + break; + } + } + var proxyResult = { + stop: false, + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of exedit + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + n.isHover = false; + n.editNameFlag = false; + }, + //update zTreeObj, add method of edit + _zTreeTools = function(setting, zTreeTools) { + zTreeTools.cancelEditName = function(newName) { + var root = data.getRoot(this.setting); + if (!root.curEditNode) return; + view.cancelCurEditNode(this.setting, newName?newName:null, true); + } + zTreeTools.copyNode = function(targetNode, node, moveType, isSilent) { + if (!node) return null; + if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) return null; + var _this = this, + newNode = tools.clone(node); + if (!targetNode) { + targetNode = null; + moveType = consts.move.TYPE_INNER; + } + if (moveType == consts.move.TYPE_INNER) { + function copyCallback() { + view.addNodes(_this.setting, targetNode, -1, [newNode], isSilent); + } + + if (tools.canAsync(this.setting, targetNode)) { + view.asyncNode(this.setting, targetNode, isSilent, copyCallback); + } else { + copyCallback(); + } + } else { + view.addNodes(this.setting, targetNode.parentNode, -1, [newNode], isSilent); + view.moveNode(this.setting, targetNode, newNode, moveType, false, isSilent); + } + return newNode; + } + zTreeTools.editName = function(node) { + if (!node || !node.tId || node !== data.getNodeCache(this.setting, node.tId)) return; + if (node.parentTId) view.expandCollapseParentNode(this.setting, node.getParentNode(), true); + view.editNode(this.setting, node) + } + zTreeTools.moveNode = function(targetNode, node, moveType, isSilent) { + if (!node) return node; + if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) { + return null; + } else if (targetNode && ((node.parentTId == targetNode.tId && moveType == consts.move.TYPE_INNER) || $$(node, this.setting).find("#" + targetNode.tId).length > 0)) { + return null; + } else if (!targetNode) { + targetNode = null; + } + var _this = this; + function moveCallback() { + view.moveNode(_this.setting, targetNode, node, moveType, false, isSilent); + } + if (tools.canAsync(this.setting, targetNode) && moveType === consts.move.TYPE_INNER) { + view.asyncNode(this.setting, targetNode, isSilent, moveCallback); + } else { + moveCallback(); + } + return node; + } + zTreeTools.setEditable = function(editable) { + this.setting.edit.enable = editable; + return this.refresh(); + } + }, + //method of operate data + _data = { + setSonNodeLevel: function(setting, parentNode, node) { + if (!node) return; + var childKey = setting.data.key.children; + node.level = (parentNode)? parentNode.level + 1 : 0; + if (!node[childKey]) return; + for (var i = 0, l = node[childKey].length; i < l; i++) { + if (node[childKey][i]) data.setSonNodeLevel(setting, node, node[childKey][i]); + } + } + }, + //method of event proxy + _event = { + + }, + //method of event handler + _handler = { + onHoverOverNode: function(event, node) { + var setting = data.getSetting(event.data.treeId), + root = data.getRoot(setting); + if (root.curHoverNode != node) { + _handler.onHoverOutNode(event); + } + root.curHoverNode = node; + view.addHoverDom(setting, node); + }, + onHoverOutNode: function(event, node) { + var setting = data.getSetting(event.data.treeId), + root = data.getRoot(setting); + if (root.curHoverNode && !data.isSelectedNode(setting, root.curHoverNode)) { + view.removeTreeDom(setting, root.curHoverNode); + root.curHoverNode = null; + } + }, + onMousedownNode: function(eventMouseDown, _node) { + var i,l, + setting = data.getSetting(eventMouseDown.data.treeId), + root = data.getRoot(setting), roots = data.getRoots(); + //right click can't drag & drop + if (eventMouseDown.button == 2 || !setting.edit.enable || (!setting.edit.drag.isCopy && !setting.edit.drag.isMove)) return true; + + //input of edit node name can't drag & drop + var target = eventMouseDown.target, + _nodes = data.getRoot(setting).curSelectedList, + nodes = []; + if (!data.isSelectedNode(setting, _node)) { + nodes = [_node]; + } else { + for (i=0, l=_nodes.length; i1) { + var pNodes = nodes[0].parentTId ? nodes[0].getParentNode()[childKey] : data.getNodes(setting); + tmpNodes = []; + for (i=0, l=pNodes.length; i -1 && (lastIndex+1) !== i) { + isOrder = false; + } + tmpNodes.push(pNodes[i]); + lastIndex = i; + } + if (nodes.length === tmpNodes.length) { + nodes = tmpNodes; + break; + } + } + } + if (isOrder) { + preNode = nodes[0].getPreNode(); + nextNode = nodes[nodes.length-1].getNextNode(); + } + + //set node in selected + curNode = $$("
                          ", setting); + for (i=0, l=nodes.length; i0); + view.removeTreeDom(setting, tmpNode); + + if (i > setting.edit.drag.maxShowNodeNum-1) { + continue; + } + + tmpDom = $$("
                        • ", setting); + tmpDom.append($$(tmpNode, consts.id.A, setting).clone()); + tmpDom.css("padding", "0"); + tmpDom.children("#" + tmpNode.tId + consts.id.A).removeClass(consts.node.CURSELECTED); + curNode.append(tmpDom); + if (i == setting.edit.drag.maxShowNodeNum-1) { + tmpDom = $$("
                        • ...
                        • ", setting); + curNode.append(tmpDom); + } + } + curNode.attr("id", nodes[0].tId + consts.id.UL + "_tmp"); + curNode.addClass(setting.treeObj.attr("class")); + curNode.appendTo(body); + + tmpArrow = $$("", setting); + tmpArrow.attr("id", "zTreeMove_arrow_tmp"); + tmpArrow.appendTo(body); + + setting.treeObj.trigger(consts.event.DRAG, [event, setting.treeId, nodes]); + } + + if (root.dragFlag == 1) { + if (tmpTarget && tmpArrow.attr("id") == event.target.id && tmpTargetNodeId && (event.clientX + doc.scrollLeft()+2) > ($("#" + tmpTargetNodeId + consts.id.A, tmpTarget).offset().left)) { + var xT = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget); + event.target = (xT.length > 0) ? xT.get(0) : event.target; + } else if (tmpTarget) { + tmpTarget.removeClass(consts.node.TMPTARGET_TREE); + if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV) + .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER); + } + tmpTarget = null; + tmpTargetNodeId = null; + + //judge drag & drop in multi ztree + isOtherTree = false; + targetSetting = setting; + var settings = data.getSettings(); + for (var s in settings) { + if (settings[s].treeId && settings[s].edit.enable && settings[s].treeId != setting.treeId + && (event.target.id == settings[s].treeId || $(event.target).parents("#" + settings[s].treeId).length>0)) { + isOtherTree = true; + targetSetting = settings[s]; + } + } + + var docScrollTop = doc.scrollTop(), + docScrollLeft = doc.scrollLeft(), + treeOffset = targetSetting.treeObj.offset(), + scrollHeight = targetSetting.treeObj.get(0).scrollHeight, + scrollWidth = targetSetting.treeObj.get(0).scrollWidth, + dTop = (event.clientY + docScrollTop - treeOffset.top), + dBottom = (targetSetting.treeObj.height() + treeOffset.top - event.clientY - docScrollTop), + dLeft = (event.clientX + docScrollLeft - treeOffset.left), + dRight = (targetSetting.treeObj.width() + treeOffset.left - event.clientX - docScrollLeft), + isTop = (dTop < setting.edit.drag.borderMax && dTop > setting.edit.drag.borderMin), + isBottom = (dBottom < setting.edit.drag.borderMax && dBottom > setting.edit.drag.borderMin), + isLeft = (dLeft < setting.edit.drag.borderMax && dLeft > setting.edit.drag.borderMin), + isRight = (dRight < setting.edit.drag.borderMax && dRight > setting.edit.drag.borderMin), + isTreeInner = dTop > setting.edit.drag.borderMin && dBottom > setting.edit.drag.borderMin && dLeft > setting.edit.drag.borderMin && dRight > setting.edit.drag.borderMin, + isTreeTop = (isTop && targetSetting.treeObj.scrollTop() <= 0), + isTreeBottom = (isBottom && (targetSetting.treeObj.scrollTop() + targetSetting.treeObj.height()+10) >= scrollHeight), + isTreeLeft = (isLeft && targetSetting.treeObj.scrollLeft() <= 0), + isTreeRight = (isRight && (targetSetting.treeObj.scrollLeft() + targetSetting.treeObj.width()+10) >= scrollWidth); + + if (event.target && tools.isChildOrSelf(event.target, targetSetting.treeId)) { + //get node
                        • dom + var targetObj = event.target; + while (targetObj && targetObj.tagName && !tools.eqs(targetObj.tagName, "li") && targetObj.id != targetSetting.treeId) { + targetObj = targetObj.parentNode; + } + + var canMove = true; + //don't move to self or children of self + for (i=0, l=nodes.length; i 0) { + canMove = false; + break; + } + } + if (canMove && event.target && tools.isChildOrSelf(event.target, targetObj.id + consts.id.A)) { + tmpTarget = $(targetObj); + tmpTargetNodeId = targetObj.id; + } + } + + //the mouse must be in zTree + tmpNode = nodes[0]; + if (isTreeInner && tools.isChildOrSelf(event.target, targetSetting.treeId)) { + //judge mouse move in root of ztree + if (!tmpTarget && (event.target.id == targetSetting.treeId || isTreeTop || isTreeBottom || isTreeLeft || isTreeRight) && (isOtherTree || (!isOtherTree && tmpNode.parentTId))) { + tmpTarget = targetSetting.treeObj; + } + //auto scroll top + if (isTop) { + targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10); + } else if (isBottom) { + targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10); + } + if (isLeft) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10); + } else if (isRight) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10); + } + //auto scroll left + if (tmpTarget && tmpTarget != targetSetting.treeObj && tmpTarget.offset().left < targetSetting.treeObj.offset().left) { + targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+ tmpTarget.offset().left - targetSetting.treeObj.offset().left); + } + } + + curNode.css({ + "top": (event.clientY + docScrollTop + 3) + "px", + "left": (event.clientX + docScrollLeft + 3) + "px" + }); + + var dX = 0; + var dY = 0; + if (tmpTarget && tmpTarget.attr("id")!=targetSetting.treeId) { + var tmpTargetNode = tmpTargetNodeId == null ? null: data.getNodeCache(targetSetting, tmpTargetNodeId), + isCopy = ((event.ctrlKey || event.metaKey) && setting.edit.drag.isMove && setting.edit.drag.isCopy) || (!setting.edit.drag.isMove && setting.edit.drag.isCopy), + isPrev = !!(preNode && tmpTargetNodeId === preNode.tId), + isNext = !!(nextNode && tmpTargetNodeId === nextNode.tId), + isInner = (tmpNode.parentTId && tmpNode.parentTId == tmpTargetNodeId), + canPrev = (isCopy || !isNext) && tools.apply(targetSetting.edit.drag.prev, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.prev), + canNext = (isCopy || !isPrev) && tools.apply(targetSetting.edit.drag.next, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.next), + canInner = (isCopy || !isInner) && !(targetSetting.data.keep.leaf && !tmpTargetNode.isParent) && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, tmpTargetNode], !!targetSetting.edit.drag.inner); + + function clearMove() { + tmpTarget = null; + tmpTargetNodeId = ""; + moveType = consts.move.TYPE_INNER; + tmpArrow.css({ + "display":"none" + }); + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null + } + } + if (!canPrev && !canNext && !canInner) { + clearMove(); + } else { + var tmpTargetA = $("#" + tmpTargetNodeId + consts.id.A, tmpTarget), + tmpNextA = tmpTargetNode.isLastNode ? null : $("#" + tmpTargetNode.getNextNode().tId + consts.id.A, tmpTarget.next()), + tmpTop = tmpTargetA.offset().top, + tmpLeft = tmpTargetA.offset().left, + prevPercent = canPrev ? (canInner ? 0.25 : (canNext ? 0.5 : 1) ) : -1, + nextPercent = canNext ? (canInner ? 0.75 : (canPrev ? 0.5 : 0) ) : -1, + dY_percent = (event.clientY + docScrollTop - tmpTop)/tmpTargetA.height(); + + if ((prevPercent==1 || dY_percent<=prevPercent && dY_percent>=-.2) && canPrev) { + dX = 1 - tmpArrow.width(); + dY = tmpTop - tmpArrow.height()/2; + moveType = consts.move.TYPE_PREV; + } else if ((nextPercent==0 || dY_percent>=nextPercent && dY_percent<=1.2) && canNext) { + dX = 1 - tmpArrow.width(); + dY = (tmpNextA == null || (tmpTargetNode.isParent && tmpTargetNode.open)) ? (tmpTop + tmpTargetA.height() - tmpArrow.height()/2) : (tmpNextA.offset().top - tmpArrow.height()/2); + moveType = consts.move.TYPE_NEXT; + } else if (canInner) { + dX = 5 - tmpArrow.width(); + dY = tmpTop; + moveType = consts.move.TYPE_INNER; + } else { + clearMove(); + } + + if (tmpTarget) { + tmpArrow.css({ + "display":"block", + "top": dY + "px", + "left": (tmpLeft + dX) + "px" + }); + tmpTargetA.addClass(consts.node.TMPTARGET_NODE + "_" + moveType); + + if (preTmpTargetNodeId != tmpTargetNodeId || preTmpMoveType != moveType) { + startTime = (new Date()).getTime(); + } + if (tmpTargetNode && tmpTargetNode.isParent && moveType == consts.move.TYPE_INNER) { + var startTimer = true; + if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId !== tmpTargetNode.tId) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } else if (window.zTreeMoveTimer && window.zTreeMoveTargetNodeTId === tmpTargetNode.tId) { + startTimer = false; + } + if (startTimer) { + window.zTreeMoveTimer = setTimeout(function() { + if (moveType != consts.move.TYPE_INNER) return; + if (tmpTargetNode && tmpTargetNode.isParent && !tmpTargetNode.open && (new Date()).getTime() - startTime > targetSetting.edit.drag.autoOpenTime + && tools.apply(targetSetting.callback.beforeDragOpen, [targetSetting.treeId, tmpTargetNode], true)) { + view.switchNode(targetSetting, tmpTargetNode); + if (targetSetting.edit.drag.autoExpandTrigger) { + targetSetting.treeObj.trigger(consts.event.EXPAND, [targetSetting.treeId, tmpTargetNode]); + } + } + }, targetSetting.edit.drag.autoOpenTime+50); + window.zTreeMoveTargetNodeTId = tmpTargetNode.tId; + } + } + } + } + } else { + moveType = consts.move.TYPE_INNER; + if (tmpTarget && tools.apply(targetSetting.edit.drag.inner, [targetSetting.treeId, nodes, null], !!targetSetting.edit.drag.inner)) { + tmpTarget.addClass(consts.node.TMPTARGET_TREE); + } else { + tmpTarget = null; + } + tmpArrow.css({ + "display":"none" + }); + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } + } + preTmpTargetNodeId = tmpTargetNodeId; + preTmpMoveType = moveType; + + setting.treeObj.trigger(consts.event.DRAGMOVE, [event, setting.treeId, nodes]); + } + return false; + } + + doc.bind("mouseup", _docMouseUp); + function _docMouseUp(event) { + if (window.zTreeMoveTimer) { + clearTimeout(window.zTreeMoveTimer); + window.zTreeMoveTargetNodeTId = null; + } + preTmpTargetNodeId = null; + preTmpMoveType = null; + doc.unbind("mousemove", _docMouseMove); + doc.unbind("mouseup", _docMouseUp); + doc.unbind("selectstart", _docSelect); + body.css("cursor", "auto"); + if (tmpTarget) { + tmpTarget.removeClass(consts.node.TMPTARGET_TREE); + if (tmpTargetNodeId) $("#" + tmpTargetNodeId + consts.id.A, tmpTarget).removeClass(consts.node.TMPTARGET_NODE + "_" + consts.move.TYPE_PREV) + .removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE + "_" + _consts.move.TYPE_INNER); + } + tools.showIfameMask(setting, false); + + roots.showHoverDom = true; + if (root.dragFlag == 0) return; + root.dragFlag = 0; + + var i, l, tmpNode; + for (i=0, l=nodes.length; i 0) { + root.dragMaskList[0].remove(); + root.dragMaskList.shift(); + } + if (showSign) { + //show mask + var iframeList = $$("iframe", setting); + for (var i = 0, l = iframeList.length; i < l; i++) { + var obj = iframeList.get(i), + r = tools.getAbs(obj), + dragMask = $$("
                          ", setting); + dragMask.appendTo($$("body", setting)); + root.dragMaskList.push(dragMask); + } + } + } + }, + //method of operate ztree dom + _view = { + addEditBtn: function(setting, node) { + if (node.editNameFlag || $$(node, consts.id.EDIT, setting).length > 0) { + return; + } + if (!tools.apply(setting.edit.showRenameBtn, [setting.treeId, node], setting.edit.showRenameBtn)) { + return; + } + var aObj = $$(node, consts.id.A, setting), + editStr = ""; + aObj.append(editStr); + + $$(node, consts.id.EDIT, setting).bind('click', + function() { + if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeEditName, [setting.treeId, node], true) == false) return false; + view.editNode(setting, node); + return false; + } + ).show(); + }, + addRemoveBtn: function(setting, node) { + if (node.editNameFlag || $$(node, consts.id.REMOVE, setting).length > 0) { + return; + } + if (!tools.apply(setting.edit.showRemoveBtn, [setting.treeId, node], setting.edit.showRemoveBtn)) { + return; + } + var aObj = $$(node, consts.id.A, setting), + removeStr = ""; + aObj.append(removeStr); + + $$(node, consts.id.REMOVE, setting).bind('click', + function() { + if (!tools.uCanDo(setting) || tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return false; + view.removeNode(setting, node); + setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]); + return false; + } + ).bind('mousedown', + function(eventMouseDown) { + return true; + } + ).show(); + }, + addHoverDom: function(setting, node) { + if (data.getRoots().showHoverDom) { + node.isHover = true; + if (setting.edit.enable) { + view.addEditBtn(setting, node); + view.addRemoveBtn(setting, node); + } + tools.apply(setting.view.addHoverDom, [setting.treeId, node]); + } + }, + cancelCurEditNode: function (setting, forceName, isCancel) { + var root = data.getRoot(setting), + nameKey = setting.data.key.name, + node = root.curEditNode; + + if (node) { + var inputObj = root.curEditInput, + newName = forceName ? forceName:(isCancel ? node[nameKey]: inputObj.val()); + if (tools.apply(setting.callback.beforeRename, [setting.treeId, node, newName, isCancel], true) === false) { + return false; + } + node[nameKey] = newName; + var aObj = $$(node, consts.id.A, setting); + aObj.removeClass(consts.node.CURSELECTED_EDIT); + inputObj.unbind(); + view.setNodeName(setting, node); + node.editNameFlag = false; + root.curEditNode = null; + root.curEditInput = null; + view.selectNode(setting, node, false); + setting.treeObj.trigger(consts.event.RENAME, [setting.treeId, node, isCancel]); + } + root.noSelection = true; + return true; + }, + editNode: function(setting, node) { + var root = data.getRoot(setting); + view.editNodeBlur = false; + if (data.isSelectedNode(setting, node) && root.curEditNode == node && node.editNameFlag) { + setTimeout(function() {tools.inputFocus(root.curEditInput);}, 0); + return; + } + var nameKey = setting.data.key.name; + node.editNameFlag = true; + view.removeTreeDom(setting, node); + view.cancelCurEditNode(setting); + view.selectNode(setting, node, false); + $$(node, consts.id.SPAN, setting).html(""); + var inputObj = $$(node, consts.id.INPUT, setting); + inputObj.attr("value", node[nameKey]); + if (setting.edit.editNameSelectAll) { + tools.inputSelect(inputObj); + } else { + tools.inputFocus(inputObj); + } + + inputObj.bind('blur', function(event) { + if (!view.editNodeBlur) { + view.cancelCurEditNode(setting); + } + }).bind('keydown', function(event) { + if (event.keyCode=="13") { + view.editNodeBlur = true; + view.cancelCurEditNode(setting); + } else if (event.keyCode=="27") { + view.cancelCurEditNode(setting, null, true); + } + }).bind('click', function(event) { + return false; + }).bind('dblclick', function(event) { + return false; + }); + + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED_EDIT); + root.curEditInput = inputObj; + root.noSelection = false; + root.curEditNode = node; + }, + moveNode: function(setting, targetNode, node, moveType, animateFlag, isSilent) { + var root = data.getRoot(setting), + childKey = setting.data.key.children; + if (targetNode == node) return; + if (setting.data.keep.leaf && targetNode && !targetNode.isParent && moveType == consts.move.TYPE_INNER) return; + var oldParentNode = (node.parentTId ? node.getParentNode(): root), + targetNodeIsRoot = (targetNode === null || targetNode == root); + if (targetNodeIsRoot && targetNode === null) targetNode = root; + if (targetNodeIsRoot) moveType = consts.move.TYPE_INNER; + var targetParentNode = (targetNode.parentTId ? targetNode.getParentNode() : root); + + if (moveType != consts.move.TYPE_PREV && moveType != consts.move.TYPE_NEXT) { + moveType = consts.move.TYPE_INNER; + } + + if (moveType == consts.move.TYPE_INNER) { + if (targetNodeIsRoot) { + //parentTId of root node is null + node.parentTId = null; + } else { + if (!targetNode.isParent) { + targetNode.isParent = true; + targetNode.open = !!targetNode.open; + view.setNodeLineIcos(setting, targetNode); + } + node.parentTId = targetNode.tId; + } + } + + //move node Dom + var targetObj, target_ulObj; + if (targetNodeIsRoot) { + targetObj = setting.treeObj; + target_ulObj = targetObj; + } else { + if (!isSilent && moveType == consts.move.TYPE_INNER) { + view.expandCollapseNode(setting, targetNode, true, false); + } else if (!isSilent) { + view.expandCollapseNode(setting, targetNode.getParentNode(), true, false); + } + targetObj = $$(targetNode, setting); + target_ulObj = $$(targetNode, consts.id.UL, setting); + if (!!targetObj.get(0) && !target_ulObj.get(0)) { + var ulstr = []; + view.makeUlHtml(setting, targetNode, ulstr, ''); + targetObj.append(ulstr.join('')); + } + target_ulObj = $$(targetNode, consts.id.UL, setting); + } + var nodeDom = $$(node, setting); + if (!nodeDom.get(0)) { + nodeDom = view.appendNodes(setting, node.level, [node], null, -1, false, true).join(''); + } else if (!targetObj.get(0)) { + nodeDom.remove(); + } + if (target_ulObj.get(0) && moveType == consts.move.TYPE_INNER) { + target_ulObj.append(nodeDom); + } else if (targetObj.get(0) && moveType == consts.move.TYPE_PREV) { + targetObj.before(nodeDom); + } else if (targetObj.get(0) && moveType == consts.move.TYPE_NEXT) { + targetObj.after(nodeDom); + } + + //repair the data after move + var i,l, + tmpSrcIndex = -1, + tmpTargetIndex = 0, + oldNeighbor = null, + newNeighbor = null, + oldLevel = node.level; + if (node.isFirstNode) { + tmpSrcIndex = 0; + if (oldParentNode[childKey].length > 1 ) { + oldNeighbor = oldParentNode[childKey][1]; + oldNeighbor.isFirstNode = true; + } + } else if (node.isLastNode) { + tmpSrcIndex = oldParentNode[childKey].length -1; + oldNeighbor = oldParentNode[childKey][tmpSrcIndex - 1]; + oldNeighbor.isLastNode = true; + } else { + for (i = 0, l = oldParentNode[childKey].length; i < l; i++) { + if (oldParentNode[childKey][i].tId == node.tId) { + tmpSrcIndex = i; + break; + } + } + } + if (tmpSrcIndex >= 0) { + oldParentNode[childKey].splice(tmpSrcIndex, 1); + } + if (moveType != consts.move.TYPE_INNER) { + for (i = 0, l = targetParentNode[childKey].length; i < l; i++) { + if (targetParentNode[childKey][i].tId == targetNode.tId) tmpTargetIndex = i; + } + } + if (moveType == consts.move.TYPE_INNER) { + if (!targetNode[childKey]) targetNode[childKey] = new Array(); + if (targetNode[childKey].length > 0) { + newNeighbor = targetNode[childKey][targetNode[childKey].length - 1]; + newNeighbor.isLastNode = false; + } + targetNode[childKey].splice(targetNode[childKey].length, 0, node); + node.isLastNode = true; + node.isFirstNode = (targetNode[childKey].length == 1); + } else if (targetNode.isFirstNode && moveType == consts.move.TYPE_PREV) { + targetParentNode[childKey].splice(tmpTargetIndex, 0, node); + newNeighbor = targetNode; + newNeighbor.isFirstNode = false; + node.parentTId = targetNode.parentTId; + node.isFirstNode = true; + node.isLastNode = false; + + } else if (targetNode.isLastNode && moveType == consts.move.TYPE_NEXT) { + targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node); + newNeighbor = targetNode; + newNeighbor.isLastNode = false; + node.parentTId = targetNode.parentTId; + node.isFirstNode = false; + node.isLastNode = true; + + } else { + if (moveType == consts.move.TYPE_PREV) { + targetParentNode[childKey].splice(tmpTargetIndex, 0, node); + } else { + targetParentNode[childKey].splice(tmpTargetIndex + 1, 0, node); + } + node.parentTId = targetNode.parentTId; + node.isFirstNode = false; + node.isLastNode = false; + } + data.fixPIdKeyValue(setting, node); + data.setSonNodeLevel(setting, node.getParentNode(), node); + + //repair node what been moved + view.setNodeLineIcos(setting, node); + view.repairNodeLevelClass(setting, node, oldLevel) + + //repair node's old parentNode dom + if (!setting.data.keep.parent && oldParentNode[childKey].length < 1) { + //old parentNode has no child nodes + oldParentNode.isParent = false; + oldParentNode.open = false; + var tmp_ulObj = $$(oldParentNode, consts.id.UL, setting), + tmp_switchObj = $$(oldParentNode, consts.id.SWITCH, setting), + tmp_icoObj = $$(oldParentNode, consts.id.ICON, setting); + view.replaceSwitchClass(oldParentNode, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(oldParentNode, tmp_icoObj, consts.folder.DOCU); + tmp_ulObj.css("display", "none"); + + } else if (oldNeighbor) { + //old neigbor node + view.setNodeLineIcos(setting, oldNeighbor); + } + + //new neigbor node + if (newNeighbor) { + view.setNodeLineIcos(setting, newNeighbor); + } + + //repair checkbox / radio + if (!!setting.check && setting.check.enable && view.repairChkClass) { + view.repairChkClass(setting, oldParentNode); + view.repairParentChkClassWithSelf(setting, oldParentNode); + if (oldParentNode != node.parent) + view.repairParentChkClassWithSelf(setting, node); + } + + //expand parents after move + if (!isSilent) { + view.expandCollapseParentNode(setting, node.getParentNode(), true, animateFlag); + } + }, + removeEditBtn: function(setting, node) { + $$(node, consts.id.EDIT, setting).unbind().remove(); + }, + removeRemoveBtn: function(setting, node) { + $$(node, consts.id.REMOVE, setting).unbind().remove(); + }, + removeTreeDom: function(setting, node) { + node.isHover = false; + view.removeEditBtn(setting, node); + view.removeRemoveBtn(setting, node); + tools.apply(setting.view.removeHoverDom, [setting.treeId, node]); + }, + repairNodeLevelClass: function(setting, node, oldLevel) { + if (oldLevel === node.level) return; + var liObj = $$(node, setting), + aObj = $$(node, consts.id.A, setting), + ulObj = $$(node, consts.id.UL, setting), + oldClass = consts.className.LEVEL + oldLevel, + newClass = consts.className.LEVEL + node.level; + liObj.removeClass(oldClass); + liObj.addClass(newClass); + aObj.removeClass(oldClass); + aObj.addClass(newClass); + ulObj.removeClass(oldClass); + ulObj.addClass(newClass); + }, + selectNodes : function(setting, nodes) { + for (var i=0, l=nodes.length; i0); + } + } + }, + + _z = { + tools: _tools, + view: _view, + event: _event, + data: _data + }; + $.extend(true, $.fn.zTree.consts, _consts); + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.exSetting(_setting); + data.addInitBind(_bindEvent); + data.addInitUnBind(_unbindEvent); + data.addInitCache(_initCache); + data.addInitNode(_initNode); + data.addInitProxy(_eventProxy); + data.addInitRoot(_initRoot); + data.addZTreeTools(_zTreeTools); + + var _cancelPreSelectedNode = view.cancelPreSelectedNode; + view.cancelPreSelectedNode = function (setting, node) { + var list = data.getRoot(setting).curSelectedList; + for (var i=0, j=list.length; i1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a-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("
                            ", +e);for(a=0,c=l.length;a0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("
                          • ",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("
                          • ...
                          • ",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("", +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=ce.edit.drag.borderMin;var j=pe.edit.drag.borderMin,F=qe.edit.drag.borderMin,x=He.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;a0){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=-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;a0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f",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="";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="";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("");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=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p0)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;c0)}},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;a0)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"); + }, + showNode: function(setting, node, options) { + node.isHidden = false; + data.initShowForExCheck(setting, node); + $$(node, setting).show(); + }, + showNodes: function(setting, nodes, options) { + if (!nodes || nodes.length == 0) { + return; + } + var pList = {}, i, j; + for (i=0, j=nodes.length; i 0 && !parentNode[childKey][0].isHidden) { + parentNode[childKey][0].isFirstNode = true; + } else if (childLength > 0) { + view.setFirstNodeForHide(setting, parentNode[childKey]); + } + }, + setLastNode: function(setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if (childLength > 0 && !parentNode[childKey][0].isHidden) { + parentNode[childKey][childLength - 1].isLastNode = true; + } else if (childLength > 0) { + view.setLastNodeForHide(setting, parentNode[childKey]); + } + }, + setFirstNodeForHide: function(setting, nodes) { + var n,i,j; + for (i=0, j=nodes.length; i=0; i--) { + n = nodes[i]; + if (n.isLastNode) { + break; + } + if (!n.isHidden && !n.isLastNode) { + n.isLastNode = true; + view.setNodeLineIcos(setting, n); + break; + } else { + n = null; + } + } + return n; + }, + setLastNodeForShow: function(setting, nodes) { + var n,i,j, last, old; + for (i=nodes.length-1; i>=0; i--) { + n = nodes[i]; + if (!last && !n.isHidden && n.isLastNode) { + last = n; + break; + } else if (!last && !n.isHidden && !n.isLastNode) { + n.isLastNode = true; + last = n; + view.setNodeLineIcos(setting, n); + } else if (last && n.isLastNode) { + n.isLastNode = false; + old = n; + view.setNodeLineIcos(setting, n); + break; + } else { + n = null; + } + } + return {"new":last, "old":old}; + } + }, + + _z = { + view: _view, + data: _data + }; + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.addInitNode(_initNode); + data.addBeforeA(_beforeA); + data.addZTreeTools(_zTreeTools); + +// Override method in core + var _dInitNode = data.initNode; + data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) { + var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting), + children = tmpPNode[setting.data.key.children]; + data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children); + data.tmpHideLastNode = view.setLastNodeForHide(setting, children); + if (openFlag) { + view.setNodeLineIcos(setting, data.tmpHideFirstNode); + view.setNodeLineIcos(setting, data.tmpHideLastNode); + } + isFirstNode = (data.tmpHideFirstNode === node); + isLastNode = (data.tmpHideLastNode === node); + if (_dInitNode) _dInitNode.apply(data, arguments); + if (openFlag && isLastNode) { + view.clearOldLastNode(setting, node, openFlag); + } + }; + + var _makeChkFlag = data.makeChkFlag; + if (!!_makeChkFlag) { + data.makeChkFlag = function(setting, node) { + if (!!node && !!node.isHidden) { + return; + } + _makeChkFlag.apply(data, arguments); + } + } + + var _getTreeCheckedNodes = data.getTreeCheckedNodes; + if (!!_getTreeCheckedNodes) { + data.getTreeCheckedNodes = function(setting, nodes, checked, results) { + if (!!nodes && nodes.length > 0) { + var p = nodes[0].getParentNode(); + if (!!p && !!p.isHidden) { + return []; + } + } + return _getTreeCheckedNodes.apply(data, arguments); + } + } + + var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes; + if (!!_getTreeChangeCheckedNodes) { + data.getTreeChangeCheckedNodes = function(setting, nodes, results) { + if (!!nodes && nodes.length > 0) { + var p = nodes[0].getParentNode(); + if (!!p && !!p.isHidden) { + return []; + } + } + return _getTreeChangeCheckedNodes.apply(data, arguments); + } + } + + var _expandCollapseSonNode = view.expandCollapseSonNode; + if (!!_expandCollapseSonNode) { + view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) { + if (!!node && !!node.isHidden) { + return; + } + _expandCollapseSonNode.apply(view, arguments); + } + } + + var _setSonNodeCheckBox = view.setSonNodeCheckBox; + if (!!_setSonNodeCheckBox) { + view.setSonNodeCheckBox = function(setting, node, value, srcNode) { + if (!!node && !!node.isHidden) { + return; + } + _setSonNodeCheckBox.apply(view, arguments); + } + } + + var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf; + if (!!_repairParentChkClassWithSelf) { + view.repairParentChkClassWithSelf = function(setting, node) { + if (!!node && !!node.isHidden) { + return; + } + _repairParentChkClassWithSelf.apply(view, arguments); + } + } +})(jQuery); \ No newline at end of file diff --git a/static/zTree3/js/jquery.ztree.exhide.min.js b/static/zTree3/js/jquery.ztree.exhide.min.js new file mode 100644 index 0000000..08ff81e --- /dev/null +++ b/static/zTree3/js/jquery.ztree.exhide.min.js @@ -0,0 +1,22 @@ +/* + * JQuery zTree exHideNodes 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(i){i.extend(!0,i.fn.zTree._z,{view:{clearOldFirstNode:function(c,a){for(var b=a.getNextNode();b;){if(b.isFirstNode){b.isFirstNode=!1;d.setNodeLineIcos(c,b);break}if(b.isLastNode)break;b=b.getNextNode()}},clearOldLastNode:function(c,a,b){for(a=a.getPreNode();a;){if(a.isLastNode){a.isLastNode=!1;b&&d.setNodeLineIcos(c,a);break}if(a.isFirstNode)break;a=a.getPreNode()}},makeDOMNodeMainBefore:function(c,a,b){c.push("
                          • ")},showNode:function(c,a){a.isHidden=!1;f.initShowForExCheck(c,a);j(a,c).show()},showNodes:function(c,a,b){if(a&&a.length!=0){var e={},g,k;for(g=0,k=a.length;g0&&!a[b][0].isHidden? +a[b][0].isFirstNode=!0:e>0&&d.setFirstNodeForHide(c,a[b])},setLastNode:function(c,a){var b=c.data.key.children,e=a[b].length;e>0&&!a[b][0].isHidden?a[b][e-1].isLastNode=!0:e>0&&d.setLastNodeForHide(c,a[b])},setFirstNodeForHide:function(c,a){var b,e,g;for(e=0,g=a.length;e=0;e--){b=a[e];if(b.isLastNode)break;if(!b.isHidden&&!b.isLastNode){b.isLastNode=!0;d.setNodeLineIcos(c,b);break}else b=null}return b},setLastNodeForShow:function(c,a){var b,e,g,f;for(e=a.length-1;e>=0;e--)if(b=a[e],!g&&!b.isHidden&& +b.isLastNode){g=b;break}else if(!g&&!b.isHidden&&!b.isLastNode)b.isLastNode=!0,g=b,d.setNodeLineIcos(c,b);else if(g&&b.isLastNode){b.isLastNode=!1;f=b;d.setNodeLineIcos(c,b);break}return{"new":g,old:f}}},data:{initHideForExCheck:function(c,a){if(a.isHidden&&c.check&&c.check.enable){if(typeof a._nocheck=="undefined")a._nocheck=!!a.nocheck,a.nocheck=!0;a.check_Child_State=-1;d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}},initShowForExCheck:function(c,a){if(!a.isHidden&&c.check&& +c.check.enable){if(typeof a._nocheck!="undefined")a.nocheck=a._nocheck,delete a._nocheck;if(d.setChkClass){var b=j(a,l.id.CHECK,c);d.setChkClass(c,b,a)}d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}}}});var i=i.fn.zTree,m=i._z.tools,l=i.consts,d=i._z.view,f=i._z.data,j=m.$;f.addInitNode(function(c,a,b){if(typeof b.isHidden=="string")b.isHidden=m.eqs(b.isHidden,"true");b.isHidden=!!b.isHidden;f.initHideForExCheck(c,b)});f.addBeforeA(function(){});f.addZTreeTools(function(c,a){a.showNodes= +function(a,b){d.showNodes(c,a,b)};a.showNode=function(a,b){a&&d.showNodes(c,[a],b)};a.hideNodes=function(a,b){d.hideNodes(c,a,b)};a.hideNode=function(a,b){a&&d.hideNodes(c,[a],b)};var b=a.checkNode;if(b)a.checkNode=function(c,d,f,h){(!c||!c.isHidden)&&b.apply(a,arguments)}});var n=f.initNode;f.initNode=function(c,a,b,e,g,i,h){var j=(e?e:f.getRoot(c))[c.data.key.children];f.tmpHideFirstNode=d.setFirstNodeForHide(c,j);f.tmpHideLastNode=d.setLastNodeForHide(c,j);h&&(d.setNodeLineIcos(c,f.tmpHideFirstNode), +d.setNodeLineIcos(c,f.tmpHideLastNode));g=f.tmpHideFirstNode===b;i=f.tmpHideLastNode===b;n&&n.apply(f,arguments);h&&i&&d.clearOldLastNode(c,b,h)};var o=f.makeChkFlag;if(o)f.makeChkFlag=function(c,a){(!a||!a.isHidden)&&o.apply(f,arguments)};var p=f.getTreeCheckedNodes;if(p)f.getTreeCheckedNodes=function(c,a,b,e){if(a&&a.length>0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return p.apply(f,arguments)};var q=f.getTreeChangeCheckedNodes;if(q)f.getTreeChangeCheckedNodes=function(c,a,b){if(a&& +a.length>0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return q.apply(f,arguments)};var r=d.expandCollapseSonNode;if(r)d.expandCollapseSonNode=function(c,a,b,e,f){(!a||!a.isHidden)&&r.apply(d,arguments)};var s=d.setSonNodeCheckBox;if(s)d.setSonNodeCheckBox=function(c,a,b,e){(!a||!a.isHidden)&&s.apply(d,arguments)};var t=d.repairParentChkClassWithSelf;if(t)d.repairParentChkClassWithSelf=function(c,a){(!a||!a.isHidden)&&t.apply(d,arguments)}})(jQuery); diff --git a/static/zTree3/js/ztree.3.5.26.zip b/static/zTree3/js/ztree.3.5.26.zip new file mode 100644 index 0000000..b2a4507 Binary files /dev/null and b/static/zTree3/js/ztree.3.5.26.zip differ diff --git a/static/zTree3/log v3.x.txt b/static/zTree3/log v3.x.txt new file mode 100644 index 0000000..d43f6b3 --- /dev/null +++ b/static/zTree3/log v3.x.txt @@ -0,0 +1,271 @@ +=ZTree v3.x (JQuery Tree插件) 更新日志= + +为了更好的优化及扩展zTree, 因此决定升级为v3.x,并且对之前的v2.x不兼容,会有很多结构上的修改,对此深感无奈与抱歉,请大家谅解。 + + +具体修改内容可参考: + + * [http://www.treejs.cn/v3/api.php zTree v3.x API 文档] + + * [http://www.treejs.cn/v3/demo.php#_101 zTree v3.x Demo 演示] + + * [http://www.treejs.cn/v3/faq.php#_101 zTree v3.x 常见问题] + + + +*2017.01.20* v3.5.28 + * [修改] scrollIntoViewIfNeeded 方法对 IE8 的兼容 + +*2016.12.27* v3.5.27 + * [修改] addNodes 方法设置 index 参数后,导致 treeNode.isLastNode 错误 + +*2016.11.03* v3.5.26 + * [修改] 使用 scrollIntoViewIfNeeded 替代 scrollIntoView,兼容各种浏览器 + +*2016.09.27* v3.5.25 + * [修改] ajax 异步加载支持 contentType = 'application/json' + +*2016.06.06* v3.5.24 + * [修改] selectNode 方法中 某些情况下,isSilent 参数无效 + * [修改] 数据中 id = 'length'时, 导致 transformTozTreeFormat() 方法异常 + +*2016.04.08* v3.5.23 + * [修改] expandCollapseNode 方法被 gulp 压缩后,在 IE8 上会导致溢出 + +*2016.04.06* v3.5.23 + * [修改] 替换 arguments.callee 避免 'use strict' 严格模式下报错 + +*2016.04.01* v3.5.23 + * [修改] selectNode 方法 增加 isSilent 参数,可以禁止 选中节点时,自动滚动到视图 + +*2016.03.01* v3.5.22 + * [修改] metro Demo 的样式错误 + * [修改] 增加 的 padding 后, 导致 setting.edit.drag.inner 无效 + +*2016.02.17* v3.5.21 + * [修改] zTree js 文件名 (为了便于发布到 https://cdnjs.com/) + +*2016.01.20* v3.5.20 + * [修改] checkAllNodes() 方法不处理 (chkDisabled = true) 的父节点的子节点的 bug + +*2015.12.04* v3.5.19.3 + * [修改] 为避免定位节点时抢焦点, 使用 scrollIntoView 方法替换之前的 focus 方法(对于IE6等旧浏览器仍然使用 focus方法) + +*2015.11.15* v3.5.19.2 + * [增加] 给节点名称的 span 标签增加 class,便于用户设置 css + +*2015.10.26* v3.5.19.1 + * [修改] addNodes 新方法 导致 拖拽节点时报错 + * [增加] treeNode.getIndex 方法,可以快速获取 节点在 子节点中的位置 + * [增加] treeNode.getPath 方法,可以快速获取 节点的所有父节点 + +*2015.10.22* v3.5.19 + * [修改] addNodes 方法支持直接添加新节点到任意位置 addNodes(parentNode, index, newNodes, isSilent) + * [修改] selectstart 事件未解绑导致的内存泄漏 + +*2015.08.26* v3.5.18 + * [修改] onSelected/onUnSelected 回调参数,由 (event, treeId, node) 修改为 (treeId, node);另外 删除 已选择的节点时,也会触发 onUnSelected 回调 + * [增加] Allow nodes to specify their own icon using an 'icon' property of the 'setting.data.key' + * [增加] metro 风格 demo + * [增加] awesome 风格 demo + * [增加] 回调 onSelected / onUnSelected + +*2015.02.15* v3.5.17 + * [修改] excheck 扩展中 removeClass 与 jQueryUI 1.9 冲突的问题,目前放弃 removeClass 方法 + * [修改] 优化 exhide 扩展包初始化效率,避免数据多时 ie8 假死的 bug(感谢:https://github.com/sarxos) + * [修改] 若干 Demo & API 的小错误 + * [修改] 异步加载 低版本 IE 缓存严重的问题 + * [修改] 在 onRename 回调中使用 updateNode 方法无效的问题 + +*2014.03.09* v3.5.16 + * [增加] onDragMove 回调,便于控制 zTree 节点与其他 DOM 的拖拽操作。(感谢 yumi301) + * [增加] 针对 Mac 系统 Cmd 键的支持, Cmd 键 + 左键 也可以多选节点 + + * [修改] 使用 destory 方法销毁树以后,依然可以从 getZTreeObj 方法中获取到 zTree 对象的 bug。 + * [修改] onCheck 回调的 event,恢复为 zTree 自身的 event 事件,同时利用 srcEvent 传递原始 event 对象。(感谢 yumi301) + * [修改] 拖拽多个节点时,超出 maxShowNodeNum 设置个数的节点会失去 被选择状态的 bug + * [修改] excheck & exedit 扩展包的 zTree 方法中 setting 数据错误导致 checkNode、updateNode 等方法操作 radio 失效的 bug + * [修改] 不加载 exedit 扩展包时,使用 removeNode 方法无法触发 beforeRemove 和 onRemove 回调的 bug + +*2013.10.19* v3.5.15 + * [增加] setting.view.txtSelectedEnable 属性,满足部分项目中客户对于可以选择节点文本信息的强烈欲望。 + + * [修改] exhide 扩展包导致操作子节点后 isLastNode 属性异常 的bug + * [修改] 使用 cancelEditName 方法时,beforeRename & onRename 的 isCancel 始终为 false 的bug + * [修改] 编辑状态, beforeRename 回调 return false 时,提示信息导致 input 失去焦点后, 当树再次得到焦点时,让 input 自动获取焦点 + * [修改] 判断拖拽到节点的 标签中自定义的无 id 组件判断错误的bug + * [修改] async_edit.html demo 中 添加按钮 显示的 bug + * [修改] 当没有开启异步加载模式下,对于没有子节点的父节点,即使设置 open=true 在初始化时也不会设置为展开状态的bug (对于异步加载模式下依然会强行设置为折叠状态) + +*2013.06.28* v3.5.14 + * [修改] 拖拽节点时 iframe 遮罩异常的bug + * [修改] 清空子节点后重新添加子节点无法显示的bug + +*2013.06.02* v3.5.13 + + * [增加] beforeRename & onRename 增加 isCancel 参数,可以监控用户 ESC 取消编辑的事件 + + * [修改] 初始化时 radioType="all", 父节点未展开 且 子节点有被勾选,点击其他 radio 时,不会取消勾选该子节点的bug + * [修改] 多棵树拖拽时,拖拽无效后会导致目标书已选择的节点清空的 bug。 + * [修改] 多棵树拖拽时,会触发 addHoverDom 的bug。 + * [修改] 多棵树拖拽时,由于 beforeDrog 或 prev / inner / next 返回 false 后未触发原始节点的 addHoverDom 的bug + * [修改] 异步加载时,对于未加载子节点的父节点使用 expandNode 方法时, sonSign 设置为 true后,导致异步加载的节点无法正常显示的bug + * [修改] 一次性加载全部数据,如果父节点 A 未展开,但下一级的父节点 A1 设置了 open=true 的时候,使用 expandAll 方法导致 A1 的下一级父节点出现重复的 bug + * [修改] 增加对 iframe 的支持,可以只在主页面加载 zTree 的 js,在 iframe 内创建树 [https://github.com/zTree/zTree_v3/issues/7 Issue Info] + * [修改] 引入 exhide 扩展包 导致页面上同时加载多棵树时,根节点 的 连接线图标出现异常 的 bug [http://tieba.baidu.com/p/2277416574] + * [修改] excheck & exedit 扩展包中事件代理获取节点 tId 的方法,保证适当修改 DOM 结构也能得到 tId + +*2013.03.11* v3.5.12 + * [修改] 由于 jquery 1.9 中移除 event.srcElement 导致的 js 报错的bug。 + * [修改] 在异步加载模式下,使用 moveNode 方法,且 moveType != "inner" 时,也会导致 targetNode 自动加载子节点的 bug + * [修改] 对已经显示的节点(nochecked=true)使用 showNodes 或 showNode 方法后,导致勾选框出现的bug。 + * [修改] 对已经隐藏的节点(nochecked=false)使用 hideNodes 或 hideNode 方法后,导致勾选框消失的bug。 + * [修改] getNodesByParamFuzzy 支持 大小写模糊。 + * [修改] className 结构,提取 _consts.className.BUTTON / LEVEL / ICO_LOADING / SWITCH,便于快速修改 css 冲突。 + 例如:与 WordPress 产生冲突后,直接修改 core 中的 "button" 和 "level" 即可。 Issue: https://github.com/zTree/zTree_v3/issues/2 + +*2013.01.28* v3.5.02 + * [增加] setting.check.chkDisabledInherit 属性,用于设置 chkDisabled 在初始化时子节点是否可以继承父节点的 chkDisabled 属性 + * [删除] 内部 noSel 方法,使用 selectstart事件 和 "-moz-user-select"样式 处理禁止 节点文字被选择的功能 + * [修改] 不兼容 jQuery 1.9 的bug + * [修改] onDrop 的触发规则,保证异步加载模式下,可以在延迟加载结束后触发,避免 onDrop 中被拖拽的节点是已经更新后的数据。 + * [修改] setChkDisabled 方法,增加 inheritParent, inheritChildren 参数设置是否让父子节点继承 disabled + * [修改] 异步加载时 拼接参数的方法,由 string 修改为 json 对象 + * [修正] 1-2-3 3级节点时,如果 2级节点 全部设置为 nocheck 或 chkDisabled后,勾选3级节点时,1级节点的半勾选状态错误的 bug + * [修改] Demo: checkbox_nocheck.html & checkbox_chkDisabled.html; + * [修改] Demo: edit_super.html,增加 showRenameBtn & showRemoveBtn 的演示 + * [修改] Demo: asyncForAll, 将 post 修改为 get;为了避免由于 IE10 的 bug 造成的客户端 以及 服务端崩溃 + IE10 ajax Post 无法提交参数的bug (http://bugs.jquery.com/ticket/12790) + +*2012.12.21* v3.5.01 + * [优化] clone 方法 + * [修正] 对于初始化无 children 属性的父节点进行 reAsyncChildNodes 操作时出错的 bug + * [修正] beforeRename 回调中使用 cancelEditName 方法后,再 return false 导致无法重新进行编辑的 bug + * [修正] exedit 扩展包让 setting.data.key.url 失效的 bug + * [修正] setting.check.autoCheckTrigger 设置为 true 时,onCheck 回调缺少 event 参数的 bug + * [修正] singlepath.html Demo 中的 bug + +*2012.11.20* v3.5 + * [优化] 原先的 clone 方法 (特别感谢:愚人码头) + * [修改] 隐藏父节点后,使用 expandAll 方法导致 父节点展开的 bug + * [修改] 使用 jQuery v1.7 以上时,设置 zTree 容器 ul 隐藏(visibility: hidden;)后, 调用 selectNode 导致 IE 浏览器报错 Can't move focus 的 bug + * [修改] 正在异步加载时,执行 destory 或 init 方法后,异步加载的节点影响新树的 bug + * [修改] 方法 reAsyncChildNodes 在 refresh 的时候未清空内部 cache 导致内存泄露 的 bug + * [修改] 批量节点拖拽到其他父节点内(inner)时,导致顺序反转 的 bug + * [修改] 对于 使用 html格式的 节点无法触发 双击事件 的 bug + * [修改] onCheck 回调中的 event ,保证与触发事件中的 event 一致 + * [修改] 异步加载时,在 onNodeCreated 中执行 selectNode 后,导致节点折叠的 bug + * [修改] API 中 dataFilter 的参数名称 childNodes -> responseData + * [修改] API 中 iconSkin 的 举例内容 + * [修改] API 中 chkDisabled 的说明 + * [修改] Demo 中 index.html 内的 loadReady 重复绑定问题 + +*2012.09.03* v3.4 + * [增加] Demo —— OutLook 样式的左侧菜单 + * [增加] 清空 zTree 的方法 $.fn.zTree.destory(treeId) & zTree.destory() + + * [修改] core核心文件内 _eventProxy 方法中获取 tId 的方法,提高 DOM 的灵活性 + * [修改] 初始化时 多层父节点的 checkbox 半选状态计算错误的 bug + * [修改] 同时选中父、子节点后,利用 getSelectedNodes 获取选中节点并利用 removeNode 删除时报错的 bug + * [修改] treeNode.chkDisabled / nocheck 属性,支持字符串格式的 "false"/"true" + * [修改] 异步加载模式下无法利用 server 返回 xml 并且 在 dataFilter 中继续处理的 bug + * [修改] title 只允许设置为 string 类型值的问题。 修正后允许设置为 number 类型的值 + * [修改] zId 计数规则 & Cache 保存,减少 IE9 的 bug 造成的内存泄漏 + * [修改] API 页面搜索功能导致 IE 崩溃的 bug + +*2012.07.16* v3.3 + * [增加] 扩展库 exhide -- 节点隐藏功能 + + * [修改] getNodesByFilter 方法,添加 invokeParam 自定义参数 + * [修改] 拖拽中测试代码未删除,导致出现黄颜色的 iframe 遮罩层的 bug + * [修改] 延迟加载方法 对于使用 expandAll 进行全部展开时,导致 onNodeCreated 回调 和 addDiyDom 方法触发过早的 bug + * [修改] 使用 moveNode 移动尚未生成 DOM 的节点时,视图会出现异常的 bug + * [修改] 删除节点后,相关节点的 isFirstNode 属性未重置的 bug + * [修改] getPreNode(),getNextNode() 方法在对于特殊情况时计算错误的 bug + * [修改] 设置 title 之后,如果重新将 title 内容设置为空后,会导致无法更新 title 的 bug + * [修改] 针对 setting.check.chkStyle=="radio" && setting.check.radioType=="all" 的情况时,getTreeCheckedNodes方法优化,找到一个结果就 break + * [修改] zTreeObj.getCheckedNodes(false) 在 radioType = "all" 时计算错误的 bug + * [修改] 完善 API 中 beforeDrop / onDrop 的关于 treeId 的说明 + +*2012.05.13* v3.2 + * [增加] setting.data.key.url 允许修改 treeNode.url 属性 + * [增加] getNodesByFilter(filter, isSingle) 方法 + * [增加] "与其他 DOM 拖拽互动" 的 Demo (http://www.treejs.cn/v3/demo.php#_511) + * [增加] "异步加载模式下全部展开" 的 Demo (http://www.treejs.cn/v3/demo.php#_512) + + * [修改] 代码结构,将 addNodes、removeNode、removeChildNodes 方法 和 beforeRemove、onRemove 回调 转移到 core 内 + * [修改] IE7的环境下无子节点的父节点反复展开出现多余空行的 bug + * [修改] 异步加载时,如果出现网络异常等,会导致 图标显示错误的 bug + * [修改] dataFilter中 return null 导致异常 的 bug + * [修改] removeChildNodes 方法清空子节点后,无法正常添加节点的 bug + * [修改] moveNode 后节点中的自定义元素的事件丢失的 bug + * [修改] moveNode 方法中设置 isSilent = true 时,如果移动到已展开的 父节点后,出现异常的 bug + * [修改] onClick/onDrag/onDrop 回调中 event 不是原始 event 的 bug + * [修改] onDrop 回调中 当拖拽无效时,无法获得 treeNodes 的 bug + * [修改] onDrop 无法判断拖拽是 移动还是复制的问题 + * [修改] 未开启异步加载模式时,拖拽节点到子节点为空的父节点内时 出现异常 的 bug + * [修改] 拖拽过程中,反复在 父节点图标上划动时,会出现停顿的 bug + (需要css 结构—— button -> span.button) + + * [修改] 拖拽操作时箭头 与 targetNode 背景之间的细节现实问题,便于用户拖拽时更容易区分 prev、next 和 inner 操作 + * [修改] 拖拽操作时IE6/7 下 在 节点 右侧 10px 内会导致 targetNode = root 的 bug + * [修改] 编辑模式下 默认的编辑按钮、删除按钮点击后,如果相应的 before 回调 return false 时会触发 onClick 回调的 bug + +*2012.02.14* v3.1 + * [增加] ajax 的参数 setting.async.contentType ,让提交参数适用于 json 数据提交 (主要适用于 .Net 的开发)。 + * [增加] setting.edit.editNameSelectAll, 用于设定编辑节点名称时初次显示 input 后 text 内容为全选 + * [修改] 异步加载 规则,不再仅仅依靠父节点的子节点数来判定,增加内部属性 zAsync,保证默认状态下父节点及时无子节点也只能异步加载一次,除非使用 reAsyncChildNodes 方法强行控制异步加载。 + * [修改] 放大浏览器后导致 界面出现多余连接线的bug (需要更新:icon 图标和 css ) + * [修改] 在编辑状态,如果节点名超过编辑框宽度,左右键在框内不起作用的bug(IE 6 7 8 出现) + CSS 中 filter:alpha(opacity=80) 造成的,应该是 ie 的 bug,需要更新 css 文件 + * [修改] title 设置后,如果属性不存在,则默认为 title 为空,便于数据容错和用户灵活使用 + * [修改] editName 方法如果针对尚未展开的 父节点,会导致该父节点自动展开的 bug + * [修改] title 中存在标签时导致 title 显示异常的bug(例如:蓝色字22%"'``) + +*2012.01.10* v3.0 + * [增加] setting.check.autoCheckTrigger 默认值 false,可以设置联动选中时是否触发事件回调函数 + * [增加] setting.callback.beforeEditName 回调函数,以保证用户可以捕获点击编辑按钮的事件 + * [增加] treeNode.chkDisabled 属性,显示 checkbox 但是用户无法修改 checkbox 状态,并且该 checkbox 会影响父节点的 checkbox 的半选状态 + * [增加] setting.check.nocheckInherit 属性,用户设置子节点继承 nocheck 属性,用于批量初始化节点,不适用于已经显示的节点 + * [增加] setting.edit.drag.autoExpandTrigger 默认值 false,可以设置自动展开、折叠操作时是否触发事件回调函数 + * [增加] setting.view.nameIsHTML 默认值 false,允许用户对 name 设置 DOM 对象 + * [增加] treeNode.click 属性的说明文档 + * [增加] treeObj.setChkDisabled 方法用于设置 checkbox / radio disabled 状态 + * [增加] treeNode.halfCheck 属性,用于强制设定节点的半选状态 + + * [修改] 异步加载 & 编辑功能 共存时,拖拽节点 或 增加节点 导致 ie 上报错的 bug (apply 方法引起) + * [修改] zTreeStyle 样式冲突 + * [修改] setting.data.key.title 默认值设置为 "",初始化时自动赋值为 setting.data.key.name 这样可避免希望 title 与 name 一致的用户反复设置参数 + * [修改] 点击叶子节点的连接线会触发 expand 事件的 bug + * [修改] IE 下 点击叶子节点连线会出现虚线框的 bug + * [修改] updateNode 导致 checkbox 半选状态错误的 bug + * [修改] checkNode 方法实现 toggle 操作, 取消 expandAll 方法的 toggle 操作 + * [修改] zTree 内鼠标移动会抢页面上 input 内的焦点的 bug + * [修改] beforeRename / onRename 的触发方式——即使名称内容未改变也会触发,便于用户配合 beforeEditName 捕获编辑状态的结束,赋予用户更多调整规则的权利 + * [修改] 与 easyUI 共存时无法拖拽的bug + * [修改] beforeRename 在 Firefox 下如果利用 alert,会触发两次的 bug + * [修改] checkNode/expandNode/removeNode 方法,默认不触发回调函数,恢复 v2.6 的默认状态,同时增加 callbackFlag 参数,设置为 true 时,可以触发回调函数 + * [修改] IE9下“根据参数查找节点”的Demo 报错:行14 重新声明常量属性(Demo 自身的问题,定义了history变量) + * [修改] 初始化 zTree 时 onNodeCreated 事件回调函数中无法 用 getZTreeObj 获取 zTree 对象的 bug + * [修改] setting.edit.drag.prev / next / inner 参数,增加被拖拽的节点集合 + * [修改] 异步加载模式下,otherParam 使用Array数组会出错的 bug。例如: ["id", "1", "name", "test"] + * [修改] FireFox 下多棵树拖拽异常的 bug + * [修改] exedit 中调用 excheck库的方法时没有进行容错处理,导致如果只加入 exedit 而没有 excheck的时候,会出现 js 错误 + * [修改] 显示 checkbox 的 zTree 在编辑模式下,移动节点不会更新父节点半选状态的 bug + * [修改] treeNode.childs --> children; treeObject.removeChilds --> removeChildNodes; setting.data.key.childs --> children(英文不好惹的祸!抱歉了!) + * [修改] onRemove 回调中得到的 treeNode 还可以查找 preNode、nextNode 的bug。 修正后,getPreNode 和 getNextNode 都返回 null; 为了便于查找父节点,getParentNode 仍保留 + * [修改] 简单数据模式下,如果 id 与 pId 的值相同会导致该节点无法正常加载的 bug + * [修改] 移动或删除中间节点会导致最后一个节点连接线图标变小的 bug + +*2011.09.05* v3.0 beta + * [修改] zTree 的 js 代码架构全面修改,并且拆分 + * [修改] zTree 的 css 样式全面修改,对浏览器可以更好地兼容,同时解决了以前1个像素差的问题 + * [优化] 采用延迟加载技术,一次性加载大数据量的节点性能飞速提升 + * [增加] 支持多节点同时选中、拖拽 + * [增加] checkNode、checkAllNodes 等多种方法 + * [增加] IE6 自动取消动画展开、折叠的功能 + * [修正] 异步加载 & 编辑模式 能够更完美的共存 + * [修正] setting 配置更加合理,并且增加了若干项配置参数 + * [修正] treeNode 节点数据的属性更加合理,并且增加了一些方法 + * [修正] 拖拽操作更加灵活方便,更容易制定自己的规则 + * [修正] 其他若干修改,详细对比请参考 url:[http://www.treejs.cn/v3/faq.php#_101 zTree v3.0 常见问题] diff --git a/static/zTree3/package.json b/static/zTree3/package.json new file mode 100644 index 0000000..f710a06 --- /dev/null +++ b/static/zTree3/package.json @@ -0,0 +1,22 @@ +{ + "name": "zTree_v3", + "description": "zTree is a multi-functional 'tree plug-ins.' based on jQuery. The main advantages of zTree includes excellent performance, flexible configuration, and the combination of multiple functions.", + "version": "3.5.27", + "homepage": "http://www.treejs.cn/v3/main.php", + "author": "zTree (https://github.com/zTree)", + "repository": "zTree/zTree", + "license": "MIT", + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "keywords": [ + "tree", + "jquery", + "plug-in", + "plugin", + "ztree", + "html", + "node" + ] +} diff --git a/static/zTree3/zTree.v3.jquery.json b/static/zTree3/zTree.v3.jquery.json new file mode 100644 index 0000000..b39665c --- /dev/null +++ b/static/zTree3/zTree.v3.jquery.json @@ -0,0 +1,35 @@ +{ + "name": "zTree.v3", + "title": "zTree.v3", + "description": "jquery tree plugin", + "keywords": [ + "tree", + "ui" + ], + "version": "3.5.28", + "author": { + "name": "Zhang QiGang", + "email":"hunter.z@263.net", + "url": "https://github.com/zTree/zTree_v3" + }, + "maintainers": [ + { + "name": "Zhang QiGang", + "email":"hunter.z@263.net", + "url": "http://www.ztree.me/" + } + ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.ztree.me/v3/main.php#_license" + } + ], + "bugs": "https://github.com/zTree/zTree_v3/issues", + "homepage": "http://www.ztree.me/", + "demo": "http://www.ztree.me/v3/demo.php", + "docs": "http://www.ztree.me/v3/api.php", + "dependencies": { + "jquery": ">=1.4.4" + } +} diff --git a/views/admin/add.html b/views/admin/add.html new file mode 100644 index 0000000..5d1c13c --- /dev/null +++ b/views/admin/add.html @@ -0,0 +1,108 @@ +
                            +
                            +
                            + 说明:新建管理员默认密码为:george518 +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            *英文,数字或_,6位以上
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + {{range $k, $v := .role}} + + {{end}} +
                            +
                            *
                            +
                            + + + +
                            +
                            + + +
                            +
                            + +
                            + \ No newline at end of file diff --git a/views/admin/edit.html b/views/admin/edit.html new file mode 100644 index 0000000..d8d848f --- /dev/null +++ b/views/admin/edit.html @@ -0,0 +1,116 @@ +
                            +
                            +
                            + +
                            + +
                            +
                            *登录不允许修改
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + +
                            +
                            *
                            +
                            + +
                            + +
                            + + +
                            +
                            默认密码:george518
                            +
                            + {{if ne .admin.id 1}} +
                            + +
                            + {{range $k, $v := .role}} + + {{end}} +
                            +
                            *
                            +
                            + {{end}} + + + + + + +
                            +
                            + + +
                            +
                            + +
                            + \ No newline at end of file diff --git a/views/admin/list.html b/views/admin/list.html new file mode 100644 index 0000000..57df5f3 --- /dev/null +++ b/views/admin/list.html @@ -0,0 +1,118 @@ +
                            +
                            + +
                            +
                            +
                            +
                            + +
                            + +
                            + + +
                            +
                            + +
                          • +
                            + + + + \ No newline at end of file diff --git a/views/auth/list.html b/views/auth/list.html new file mode 100644 index 0000000..64bc1bc --- /dev/null +++ b/views/auth/list.html @@ -0,0 +1,383 @@ + + + + + +
                            +
                            +
                            + 说明:新增权限,请直接填写相关数据保存即可;修改和删除,请点击左侧权限树选择要修改的权限节点 +
                            +
                            + +
                            +
                              +
                            +
                            +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + + +
                            +
                            + +
                            +
                            + + +
                            +
                            + + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + + +
                            +
                            是否左侧导航栏显示
                            +
                            + + + +
                            +
                            + + + 删除 + +
                            +
                            +
                            +
                            +
                            +
                            + + + + + + + + \ No newline at end of file diff --git a/views/ban/add.html b/views/ban/add.html new file mode 100644 index 0000000..11111fd --- /dev/null +++ b/views/ban/add.html @@ -0,0 +1,57 @@ + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            +
                            + + +
                            +
                            +
                            +
                            + \ No newline at end of file diff --git a/views/ban/edit.html b/views/ban/edit.html new file mode 100644 index 0000000..d642df4 --- /dev/null +++ b/views/ban/edit.html @@ -0,0 +1,57 @@ + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            +
                            + + +
                            +
                            +
                            +
                            + \ No newline at end of file diff --git a/views/ban/list.html b/views/ban/list.html new file mode 100644 index 0000000..51d39eb --- /dev/null +++ b/views/ban/list.html @@ -0,0 +1,128 @@ +
                            +
                            +
                            + 新增 +
                            +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            + +
                            +
                            + + +
                            + + +
                            + \ No newline at end of file diff --git a/views/group/add.html b/views/group/add.html index 1899873..c2c189a 100644 --- a/views/group/add.html +++ b/views/group/add.html @@ -1,67 +1,62 @@ - -
                            -
                            - -
                            - +
                            +
                            +
                            + 说明:新建任务分组 +
                            +
                            +
                            +
                            + +
                            +
                            - +
                            *
                            +
                            + +
                            + +
                            - -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            -
                            - - -
                            -
                            - +
                            + +
                            +
                            + + +
                            +
                            + +
                            \ No newline at end of file diff --git a/views/group/edit.html b/views/group/edit.html index 8800e60..6265d71 100644 --- a/views/group/edit.html +++ b/views/group/edit.html @@ -1,67 +1,62 @@ - -
                            -
                            - -
                            - - + +
                            \ No newline at end of file diff --git a/views/group/list.html b/views/group/list.html index 59f551e..88d5365 100644 --- a/views/group/list.html +++ b/views/group/list.html @@ -1,113 +1,105 @@ - -
                            -
                            - -
                            - +
                            +
                            +
                            + 新增
                            -
                            -
                            - -
                            - + +
                            + +
                            \ No newline at end of file diff --git a/views/home/start.html b/views/home/start.html new file mode 100644 index 0000000..0a084dc --- /dev/null +++ b/views/home/start.html @@ -0,0 +1,173 @@ +
                            + +
                            +
                            +
                            +
                            +
                            +
                            +
                            +
                            + +
                            + 最近执行成功 + {{.okJob}} +
                            +
                            +
                            +
                            +
                            + +
                            + 最近执行失败 + {{.failJob}} +
                            +
                            +
                            +
                            +
                            + +
                            + 即将执行的任务 + {{.startJob}} +
                            +
                            +
                            +
                            +
                            + +
                            + 定时任务总数量 + {{.totalJob}} +
                            +
                            +
                            +
                            +
                            +
                            +
                            +
                            +
                            +
                            最近执行的任务
                            +
                            + + + + + + + + + + + + + + + + + + {{range $k, $v := .recentLogs}} + + + + + + + {{else}} + + + + {{end}} + +
                            序号任务名称开始时间执行结果
                            {{$k}} + {{$v.task_name}} # {{$v.id}} + {{$v.start_time}}{{if eq $v.status 0}} + 正常 + {{else if eq $v.status -1}} + 异常 + {{else}} + 超时 + {{end}}
                            暂无信息
                            +
                            +
                            +
                            +
                            +
                            +
                            即将执行的任务
                            +
                            + + + + + + + + + + + + + + {{range $k, $v := .jobs}} + + + + + {{else}} + + + + {{end}} + +
                            任务名称执行时间
                            {{$v.task_name}}-{{$v.task_group}} # {{$v.task_id}}{{$v.next_time}}
                            暂无信息
                            +
                            +
                            +
                            + +
                            +
                            +
                            \ No newline at end of file diff --git a/views/login/login.html b/views/login/login.html new file mode 100644 index 0000000..b934dad --- /dev/null +++ b/views/login/login.html @@ -0,0 +1,70 @@ + + + + + + + + {{.siteName}} 登录 + + + + + + + + + + + + + + + + diff --git a/views/public/layout.html b/views/public/layout.html index 8b7959a..db63d02 100644 --- a/views/public/layout.html +++ b/views/public/layout.html @@ -1,349 +1,46 @@ - - - - - - 定时任务管理后台 - + + + + + + {{.siteName}} + {{if .zTree}} + + + {{end}} + + + + + + + + + +{{.LayoutContent}} -
                            -
                            - + - //服务器时间 - Date.prototype.Format = function (fmt) { - var o = { - "M+": this.getMonth() + 1, - "d+": this.getDate(), - "h+": this.getHours(), - "m+": this.getMinutes(), - "s+": this.getSeconds(), - "q+": Math.floor((this.getMonth() + 3) / 3), - "S": this.getMilliseconds() - }; - if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); - for (var k in o) - if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); - return fmt; - } - - $(function () { - $('.subnavbar').find ('li').each (function (i) { - var mod = i % 3; - if (mod === 2) { - $(this).addClass ('subnavbar-open-right'); - } - }); - initTime = new Date().getTime(); - $.getJSON("/gettime", function(out) { - setTime(initTime, out.time); - }); - }); - - function setTime(initTime,serverTime) { - ellapsedTime = new Date().getTime()-initTime; - $('#server-time').html('当前服务器时间: '+new Date(serverTime+ellapsedTime).Format("yyyy-MM-dd hh:mm:ss")+''); - setTimeout('setTime('+initTime+','+serverTime+');',500); - } - - - - - + + \ No newline at end of file diff --git a/views/public/main.html b/views/public/main.html new file mode 100644 index 0000000..94c7b91 --- /dev/null +++ b/views/public/main.html @@ -0,0 +1,196 @@ + + + + + + {{.siteName}} + + + + + +
                            +
                            + + +
                              + +
                            + +
                            + +
                            +
                            +
                            + + +
                            +
                            + +
                            + +
                            +
                              +
                            • 系统首页
                            • + +
                            +
                            +
                            + +
                            + +
                            +
                            +
                            + + +
                            + + + + \ No newline at end of file diff --git a/views/role/add.html b/views/role/add.html new file mode 100644 index 0000000..d2fb83a --- /dev/null +++ b/views/role/add.html @@ -0,0 +1,234 @@ + + + + + +
                            +
                            +
                            + 说明:新增角色 +
                            +
                            + +
                            +
                            +
                            +
                            + +
                            +
                              +
                            +
                            +
                            +
                            +
                            + +
                            + + {{range $k, $v := .serverGroup}} + + {{end}} + +
                            +
                            +
                            + +
                            + +
                            + {{range $k, $v := .taskGroup}} + + {{end}} + + +
                            +
                            +
                            + + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            + +
                            +
                            + + +
                            +
                            +
                            +
                            +
                            + +
                            + + + + + \ No newline at end of file diff --git a/views/role/edit.html b/views/role/edit.html new file mode 100644 index 0000000..c345a3d --- /dev/null +++ b/views/role/edit.html @@ -0,0 +1,250 @@ + + + + + +
                            +
                            +
                            + 修改角色以及角色权限 +
                            +
                            + + +
                            +
                            +
                            +
                            + +
                            +
                              +
                            +
                            +
                            +
                            + +
                            + +
                            + + {{range $k, $v := .serverGroup}} + + {{end}} + +
                            +
                            +
                            + + +
                            + +
                            + {{range $k, $v := .taskGroup}} + + {{end}} + + +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            + + + +
                            +
                            + + +
                            +
                            +
                            +
                            +
                            +
                            + + + + + \ No newline at end of file diff --git a/views/role/list.html b/views/role/list.html new file mode 100644 index 0000000..3c0b90d --- /dev/null +++ b/views/role/list.html @@ -0,0 +1,95 @@ +
                            +
                            +
                            + 新增 +
                            +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            + +
                            +
                            + + +
                            + + +
                            + \ No newline at end of file diff --git a/views/server/add.html b/views/server/add.html index 1f4f6aa..19f48ea 100644 --- a/views/server/add.html +++ b/views/server/add.html @@ -1,158 +1,174 @@ - -
                            -
                            - -
                            - -
                            - +
                            +
                            +
                            + 说明:提交之前请先测试服务器资源是否可以连通 +
                            +
                            - - -
                            - -
                            - -
                            - +
                            + +
                            +
                            -
                            - +
                            +
                            +
                            + +
                            +
                            +
                            -
                            - -
                            - -
                            -
                            - -
                            -
                            -
                            - -
                            - -
                            -
                            - +
                            + +
                            +
                            +
                            -
                            - -
                            - +
                            + +
                            +
                            -
                            +
                            +
                            + + +
                            + +
                            + +
                            +
                            -
                            - -
                            - - - -
                            -
                            - +
                            + +
                            + +
                            +
                            -
                            - -
                            - -
                            -
                            - +
                            + +
                            +
                            +
                            -
                            - -
                            - -
                            -
                            + -
                            - -
                            - -
                            -
                            - 公钥和私钥地址请在本地服务器生成,命令:ssh-keygen -t rsa -f pp_rsa + -
                            - -
                            - +
                            + +
                            +
                            -
                            +
                            + +
                            + +
                            + + + +
                            - - - -
                            - - -
                            +
                            - \ No newline at end of file diff --git a/views/server/copy.html b/views/server/copy.html new file mode 100644 index 0000000..2ed124a --- /dev/null +++ b/views/server/copy.html @@ -0,0 +1,171 @@ +
                            +{{/*
                            */}} +{{/*
                            */}} +{{/*说明:创建新的服务器资源*/}} +{{/*
                            */}} +{{/*
                            */}} +
                            + +
                            + +
                            + +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + + +
                            + +
                            + + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            说明
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + + + +
                            +
                            +
                            +
                            + \ No newline at end of file diff --git a/views/server/edit.html b/views/server/edit.html index 496f32c..8be0a73 100644 --- a/views/server/edit.html +++ b/views/server/edit.html @@ -1,160 +1,172 @@ - -
                            -
                            - -
                            - -
                            - -
                            - - - -
                            -
                            -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - - -
                            - -
                            - - - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - -
                            - -
                            - -
                            -
                            - -
                            -
                            - - - -
                            - -
                            -
                            +
                            +
                            +
                            +说明:创建新的服务器资源之前,请先测试服务器是否可以连通 +
                            +
                            +
                            + +
                            + +
                            +
                            +
                            +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + + + +
                            + +
                            + +
                            +
                            +
                            + + +
                            + +
                            + + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            +
                            说明
                            +
                            + +
                            + +
                            + +
                            +
                            +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + +
                            + + + + +
                            +
                            +
                            +
                            \ No newline at end of file diff --git a/views/server/list.html b/views/server/list.html index eb13f27..947c734 100644 --- a/views/server/list.html +++ b/views/server/list.html @@ -1,121 +1,106 @@ - -
                            -
                            - -
                            - +
                            +
                            +
                            + 新增
                            -
                            -
                            - -
                            -